Search in sources :

Example 6 with AccumuloConfiguration

use of org.apache.accumulo.core.conf.AccumuloConfiguration in project accumulo by apache.

the class MasterClientServiceHandler method updatePlugins.

private void updatePlugins(String property) {
    if (property.equals(Property.MASTER_TABLET_BALANCER.getKey())) {
        AccumuloConfiguration conf = master.getConfiguration();
        TabletBalancer balancer = Property.createInstanceFromPropertyName(conf, Property.MASTER_TABLET_BALANCER, TabletBalancer.class, new DefaultLoadBalancer());
        balancer.init(master);
        master.tabletBalancer = balancer;
        log.info("tablet balancer changed to {}", master.tabletBalancer.getClass().getName());
    }
}
Also used : TabletBalancer(org.apache.accumulo.server.master.balancer.TabletBalancer) DefaultLoadBalancer(org.apache.accumulo.server.master.balancer.DefaultLoadBalancer) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration)

Example 7 with AccumuloConfiguration

use of org.apache.accumulo.core.conf.AccumuloConfiguration in project accumulo by apache.

the class TCredentialsUpdatingInvocationHandlerTest method setup.

@Before
public void setup() {
    cc = new ConfigurationCopy();
    conf = new AccumuloConfiguration() {

        @Override
        public String get(Property property) {
            String value = cc.get(property);
            if (null == value) {
                return DEFAULT_CONFIG.get(property);
            }
            return value;
        }

        @Override
        public void getProperties(Map<String, String> props, Predicate<String> filter) {
            cc.getProperties(props, filter);
        }

        @Override
        public long getUpdateCount() {
            return cc.getUpdateCount();
        }
    };
    proxy = new TCredentialsUpdatingInvocationHandler<>(new Object(), conf);
}
Also used : ConfigurationCopy(org.apache.accumulo.core.conf.ConfigurationCopy) Property(org.apache.accumulo.core.conf.Property) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) Before(org.junit.Before)

Example 8 with AccumuloConfiguration

use of org.apache.accumulo.core.conf.AccumuloConfiguration in project accumulo by apache.

the class ZooCachePropertyAccessorTest method testGetProperties_Filter.

@Test
public void testGetProperties_Filter() {
    Map<String, String> props = new java.util.HashMap<>();
    AccumuloConfiguration parent = createMock(AccumuloConfiguration.class);
    @SuppressWarnings("unchecked") Predicate<String> filter = createMock(Predicate.class);
    parent.getProperties(props, filter);
    replay(parent);
    String child1 = "child1";
    List<String> children = new java.util.ArrayList<>();
    children.add(child1);
    expect(zc.getChildren(PATH)).andReturn(children);
    replay(zc);
    expect(filter.test(child1)).andReturn(false);
    replay(filter);
    a.getProperties(props, PATH, filter, parent, null);
    assertEquals(0, props.size());
}
Also used : AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) Test(org.junit.Test)

Example 9 with AccumuloConfiguration

use of org.apache.accumulo.core.conf.AccumuloConfiguration in project accumulo by apache.

the class ZooCachePropertyAccessorTest method testGetProperties.

@Test
public void testGetProperties() {
    Map<String, String> props = new java.util.HashMap<>();
    AccumuloConfiguration parent = createMock(AccumuloConfiguration.class);
    @SuppressWarnings("unchecked") Predicate<String> filter = createMock(Predicate.class);
    parent.getProperties(props, filter);
    replay(parent);
    String child1 = "child1";
    String child2 = "child2";
    List<String> children = new java.util.ArrayList<>();
    children.add(child1);
    children.add(child2);
    expect(zc.getChildren(PATH)).andReturn(children);
    expect(zc.get(PATH + "/" + child1)).andReturn(VALUE_BYTES);
    expect(zc.get(PATH + "/" + child2)).andReturn(null);
    replay(zc);
    expect(filter.test(child1)).andReturn(true);
    expect(filter.test(child2)).andReturn(true);
    replay(filter);
    a.getProperties(props, PATH, filter, parent, null);
    assertEquals(1, props.size());
    assertEquals(VALUE, props.get(child1));
    verify(parent);
}
Also used : AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) Test(org.junit.Test)

Example 10 with AccumuloConfiguration

use of org.apache.accumulo.core.conf.AccumuloConfiguration in project accumulo by apache.

the class ZooCachePropertyAccessorTest method testGet_Parent_Null.

@Test
public void testGet_Parent_Null() {
    AccumuloConfiguration parent = createMock(AccumuloConfiguration.class);
    expect(parent.get(PROP)).andReturn(null);
    replay(parent);
    expect(zc.get(FULL_PATH)).andReturn(null);
    replay(zc);
    assertNull(a.get(PROP, PATH, parent));
}
Also used : AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) Test(org.junit.Test)

Aggregations

AccumuloConfiguration (org.apache.accumulo.core.conf.AccumuloConfiguration)117 Test (org.junit.Test)44 Path (org.apache.hadoop.fs.Path)26 ConfigurationCopy (org.apache.accumulo.core.conf.ConfigurationCopy)25 IOException (java.io.IOException)23 Configuration (org.apache.hadoop.conf.Configuration)19 HashMap (java.util.HashMap)17 ClientConfiguration (org.apache.accumulo.core.client.ClientConfiguration)13 Key (org.apache.accumulo.core.data.Key)13 DefaultConfiguration (org.apache.accumulo.core.conf.DefaultConfiguration)12 Property (org.apache.accumulo.core.conf.Property)12 Value (org.apache.accumulo.core.data.Value)12 ByteArrayInputStream (java.io.ByteArrayInputStream)11 DataInputStream (java.io.DataInputStream)11 FileSystem (org.apache.hadoop.fs.FileSystem)11 ArrayList (java.util.ArrayList)10 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)9 Text (org.apache.hadoop.io.Text)9 ByteArrayOutputStream (java.io.ByteArrayOutputStream)8 AccumuloException (org.apache.accumulo.core.client.AccumuloException)8