HBASE-15505 ReplicationPeerConfig should be builder-style (Gabor Liptak)
This commit is contained in:
parent
a93a8878fe
commit
7e399883f6
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue