Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 53CCC19573 for ; Mon, 11 Apr 2016 16:10:28 +0000 (UTC) Received: (qmail 80166 invoked by uid 500); 11 Apr 2016 16:10:27 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 79975 invoked by uid 500); 11 Apr 2016 16:10:27 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 79048 invoked by uid 99); 11 Apr 2016 16:10:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Apr 2016 16:10:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 61454E78B2; Mon, 11 Apr 2016 16:10:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: syuanjiang@apache.org To: commits@hbase.apache.org Date: Mon, 11 Apr 2016 16:10:33 -0000 Message-Id: <906d6c7f746b44de9ac3ccbe97f57760@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [08/24] hbase git commit: HBASE-15505 ReplicationPeerConfig should be builder-style (Gabor Liptak) HBASE-15505 ReplicationPeerConfig should be builder-style (Gabor Liptak) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7e399883 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7e399883 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7e399883 Branch: refs/heads/hbase-12439 Commit: 7e399883f62fd37e5215ce3a456a917e690c921c Parents: a93a887 Author: Enis Soztutar Authored: Tue Apr 5 11:44:05 2016 -0700 Committer: Enis Soztutar Committed: Tue Apr 5 11:44:05 2016 -0700 ---------------------------------------------------------------------- .../client/UnmodifyableHTableDescriptor.java | 14 +++--- .../replication/ReplicationPeerConfig.java | 4 +- .../TestUnmodifyableHTableDescriptor.java | 47 ++++++++++++++++++++ .../hadoop/hbase/quotas/TestQuotaFilter.java | 47 ++++++++++++++++++++ .../replication/TestReplicationPeerConfig.java | 47 ++++++++++++++++++++ 5 files changed, 151 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/7e399883/hbase-client/src/main/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java index 7331983..59a1bd5 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java @@ -68,12 +68,12 @@ public class UnmodifyableHTableDescriptor extends HTableDescriptor { * @param family HColumnDescriptor of familyto add. */ @Override - public HTableDescriptor addFamily(final HColumnDescriptor family) { + public UnmodifyableHTableDescriptor addFamily(final HColumnDescriptor family) { throw new UnsupportedOperationException("HTableDescriptor is read-only"); } @Override - public HTableDescriptor modifyFamily(HColumnDescriptor family) { + public UnmodifyableHTableDescriptor modifyFamily(HColumnDescriptor family) { throw new UnsupportedOperationException("HTableDescriptor is read-only"); } @@ -91,7 +91,7 @@ public class UnmodifyableHTableDescriptor extends HTableDescriptor { * @see org.apache.hadoop.hbase.HTableDescriptor#setReadOnly(boolean) */ @Override - public HTableDescriptor setReadOnly(boolean readOnly) { + public UnmodifyableHTableDescriptor setReadOnly(boolean readOnly) { throw new UnsupportedOperationException("HTableDescriptor is read-only"); } @@ -99,7 +99,7 @@ public class UnmodifyableHTableDescriptor extends HTableDescriptor { * @see org.apache.hadoop.hbase.HTableDescriptor#setValue(byte[], byte[]) */ @Override - public HTableDescriptor setValue(byte[] key, byte[] value) { + public UnmodifyableHTableDescriptor setValue(byte[] key, byte[] value) { throw new UnsupportedOperationException("HTableDescriptor is read-only"); } @@ -107,7 +107,7 @@ public class UnmodifyableHTableDescriptor extends HTableDescriptor { * @see org.apache.hadoop.hbase.HTableDescriptor#setValue(java.lang.String, java.lang.String) */ @Override - public HTableDescriptor setValue(String key, String value) { + public UnmodifyableHTableDescriptor setValue(String key, String value) { throw new UnsupportedOperationException("HTableDescriptor is read-only"); } @@ -115,7 +115,7 @@ public class UnmodifyableHTableDescriptor extends HTableDescriptor { * @see org.apache.hadoop.hbase.HTableDescriptor#setMaxFileSize(long) */ @Override - public HTableDescriptor setMaxFileSize(long maxFileSize) { + public UnmodifyableHTableDescriptor setMaxFileSize(long maxFileSize) { throw new UnsupportedOperationException("HTableDescriptor is read-only"); } @@ -123,7 +123,7 @@ public class UnmodifyableHTableDescriptor extends HTableDescriptor { * @see org.apache.hadoop.hbase.HTableDescriptor#setMemStoreFlushSize(long) */ @Override - public HTableDescriptor setMemStoreFlushSize(long memstoreFlushSize) { + public UnmodifyableHTableDescriptor setMemStoreFlushSize(long memstoreFlushSize) { throw new UnsupportedOperationException("HTableDescriptor is read-only"); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/7e399883/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeerConfig.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeerConfig.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeerConfig.java index 8d05fa0..7799de6 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeerConfig.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeerConfig.java @@ -87,8 +87,10 @@ public class ReplicationPeerConfig { return (Map>) tableCFsMap; } - public void setTableCFsMap(Map> tableCFsMap) { + public ReplicationPeerConfig setTableCFsMap(Map> tableCFsMap) { this.tableCFsMap = tableCFsMap; + return this; } @Override http://git-wip-us.apache.org/repos/asf/hbase/blob/7e399883/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestUnmodifyableHTableDescriptor.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestUnmodifyableHTableDescriptor.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestUnmodifyableHTableDescriptor.java new file mode 100644 index 0000000..dca0c1f --- /dev/null +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestUnmodifyableHTableDescriptor.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hbase.client; + +import org.apache.hadoop.hbase.testclassification.ClientTests; +import org.apache.hadoop.hbase.testclassification.SmallTests; +import org.apache.hadoop.hbase.util.BuilderStyleTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category({ClientTests.class, SmallTests.class}) +public class TestUnmodifyableHTableDescriptor { + + @Test + public void testClassMethodsAreBuilderStyle() { + /* UnmodifyableHTableDescriptor should have a builder style setup where setXXX/addXXX methods + * can be chainable together: + * . For example: + * UnmodifyableHTableDescriptor d + * = new UnmodifyableHTableDescriptor() + * .setFoo(foo) + * .setBar(bar) + * .setBuz(buz) + * + * This test ensures that all methods starting with "set" returns the declaring object + */ + + BuilderStyleTest.assertClassesAreBuilderStyle(UnmodifyableHTableDescriptor.class); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hbase/blob/7e399883/hbase-client/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaFilter.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaFilter.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaFilter.java new file mode 100644 index 0000000..565695c --- /dev/null +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaFilter.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hbase.quotas; + +import org.apache.hadoop.hbase.testclassification.ClientTests; +import org.apache.hadoop.hbase.testclassification.SmallTests; +import org.apache.hadoop.hbase.util.BuilderStyleTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category({ClientTests.class, SmallTests.class}) +public class TestQuotaFilter { + + @Test + public void testClassMethodsAreBuilderStyle() { + /* ReplicationPeerConfig should have a builder style setup where setXXX/addXXX methods + * can be chainable together: + * . For example: + * QuotaFilter qf + * = new QuotaFilter() + * .setFoo(foo) + * .setBar(bar) + * .setBuz(buz) + * + * This test ensures that all methods starting with "set" returns the declaring object + */ + + BuilderStyleTest.assertClassesAreBuilderStyle(QuotaFilter.class); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hbase/blob/7e399883/hbase-client/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationPeerConfig.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationPeerConfig.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationPeerConfig.java new file mode 100644 index 0000000..a0b8a32 --- /dev/null +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationPeerConfig.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hbase.replication; + +import org.apache.hadoop.hbase.testclassification.ClientTests; +import org.apache.hadoop.hbase.testclassification.SmallTests; +import org.apache.hadoop.hbase.util.BuilderStyleTest; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category({ClientTests.class, SmallTests.class}) +public class TestReplicationPeerConfig { + + @Test + public void testClassMethodsAreBuilderStyle() { + /* ReplicationPeerConfig should have a builder style setup where setXXX/addXXX methods + * can be chainable together: + * . For example: + * ReplicationPeerConfig htd + * = new ReplicationPeerConfig() + * .setFoo(foo) + * .setBar(bar) + * .setBuz(buz) + * + * This test ensures that all methods starting with "set" returns the declaring object + */ + + BuilderStyleTest.assertClassesAreBuilderStyle(ReplicationPeerConfig.class); + } + +}