Search in sources :

Example 6 with Property

use of org.apache.accumulo.core.conf.Property 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 7 with Property

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

the class NamespaceConfigurationTest method testGet_SkipParentIfAccumuloNS.

@Test
public void testGet_SkipParentIfAccumuloNS() {
    c = new NamespaceConfiguration(Namespace.ID.ACCUMULO, instance, parent);
    c.setZooCacheFactory(zcf);
    Property p = Property.INSTANCE_SECRET;
    expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + Namespace.ID.ACCUMULO + Constants.ZNAMESPACE_CONF + "/" + p.getKey())).andReturn(null);
    replay(zc);
    assertNull(c.get(Property.INSTANCE_SECRET));
}
Also used : Property(org.apache.accumulo.core.conf.Property) Test(org.junit.Test)

Example 8 with Property

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

the class NamespaceConfigurationTest method testInvalidateCache.

@Test
public void testInvalidateCache() {
    // need to do a get so the accessor is created
    Property p = Property.INSTANCE_SECRET;
    expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + NSID + Constants.ZNAMESPACE_CONF + "/" + p.getKey())).andReturn("sekrit".getBytes(UTF_8));
    zc.clear();
    replay(zc);
    c.get(Property.INSTANCE_SECRET);
    c.invalidateCache();
    verify(zc);
}
Also used : Property(org.apache.accumulo.core.conf.Property) Test(org.junit.Test)

Example 9 with Property

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

the class TableConfigurationTest method testInvalidateCache.

@Test
public void testInvalidateCache() {
    // need to do a get so the accessor is created
    Property p = Property.INSTANCE_SECRET;
    expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF + "/" + p.getKey())).andReturn("sekrit".getBytes(UTF_8));
    zc.clear();
    replay(zc);
    c.get(Property.INSTANCE_SECRET);
    c.invalidateCache();
    verify(zc);
}
Also used : Property(org.apache.accumulo.core.conf.Property) Test(org.junit.Test)

Example 10 with Property

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

the class TableConfigurationTest method testGet_InZK.

@Test
public void testGet_InZK() {
    Property p = Property.INSTANCE_SECRET;
    expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZTABLES + "/" + TID + Constants.ZTABLE_CONF + "/" + p.getKey())).andReturn("sekrit".getBytes(UTF_8));
    replay(zc);
    assertEquals("sekrit", c.get(Property.INSTANCE_SECRET));
}
Also used : Property(org.apache.accumulo.core.conf.Property) Test(org.junit.Test)

Aggregations

Property (org.apache.accumulo.core.conf.Property)40 Test (org.junit.Test)19 HashMap (java.util.HashMap)11 AccumuloConfiguration (org.apache.accumulo.core.conf.AccumuloConfiguration)11 File (java.io.File)8 Path (org.apache.hadoop.fs.Path)7 IOException (java.io.IOException)6 Map (java.util.Map)6 Predicate (java.util.function.Predicate)5 ConfigurationCopy (org.apache.accumulo.core.conf.ConfigurationCopy)5 VolumeManager (org.apache.accumulo.server.fs.VolumeManager)5 AccumuloException (org.apache.accumulo.core.client.AccumuloException)4 DefaultConfiguration (org.apache.accumulo.core.conf.DefaultConfiguration)4 TableConfiguration (org.apache.accumulo.server.conf.TableConfiguration)4 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)3 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)3 AccumuloServerContext (org.apache.accumulo.server.AccumuloServerContext)3 NamespaceConfiguration (org.apache.accumulo.server.conf.NamespaceConfiguration)3 TServerInstance (org.apache.accumulo.server.master.state.TServerInstance)3 ArrayList (java.util.ArrayList)2