hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject [33/52] [abbrv] hbase git commit: HBASE-15505 ReplicationPeerConfig should be builder-style (Gabor Liptak)
Date Fri, 08 Apr 2016 19:32:25 GMT
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-14850
Commit: 7e399883f62fd37e5215ce3a456a917e690c921c
Parents: a93a887
Author: Enis Soztutar <enis@apache.org>
Authored: Tue Apr 5 11:44:05 2016 -0700
Committer: Enis Soztutar <enis@apache.org>
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<TableName, List<String>>) tableCFsMap;
   }
 
-  public void setTableCFsMap(Map<TableName,? extends Collection<String>> tableCFsMap)
{
+  public ReplicationPeerConfig setTableCFsMap(Map<TableName,
+                                              ? extends Collection<String>> 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);
+  }
+
+}


Mime
View raw message