Search in sources :

Example 6 with Configuration

use of org.apache.accumulo.core.spi.common.ServiceEnvironment.Configuration in project accumulo by apache.

the class DefaultCompactionPlannerTest method testErrorExternalTypeNumThreads.

/**
 * Test external type executor with numThreads set throws error.
 */
@Test
public void testErrorExternalTypeNumThreads() {
    DefaultCompactionPlanner planner = new DefaultCompactionPlanner();
    Configuration conf = EasyMock.createMock(Configuration.class);
    EasyMock.expect(conf.isSet(EasyMock.anyString())).andReturn(false).anyTimes();
    ServiceEnvironment senv = EasyMock.createMock(ServiceEnvironment.class);
    EasyMock.expect(senv.getConfiguration()).andReturn(conf).anyTimes();
    EasyMock.replay(conf, senv);
    String executors = getExecutors("'type': 'internal','maxSize':'32M','numThreads':1", "'type': 'internal','maxSize':'128M','numThreads':2", "'type': 'external','maxSize':'512M','numThreads':3");
    var e = assertThrows(IllegalArgumentException.class, () -> planner.init(getInitParams(senv, executors)), "Failed to throw error");
    assertTrue(e.getMessage().contains("numThreads"), "Error message didn't contain numThreads");
}
Also used : ServiceEnvironment(org.apache.accumulo.core.spi.common.ServiceEnvironment) Configuration(org.apache.accumulo.core.spi.common.ServiceEnvironment.Configuration) Test(org.junit.jupiter.api.Test)

Example 7 with Configuration

use of org.apache.accumulo.core.spi.common.ServiceEnvironment.Configuration in project accumulo by apache.

the class ConfigurationImpl method getDerived.

@Override
public <T> Supplier<T> getDerived(Function<PluginEnvironment.Configuration, T> computeDerivedValue) {
    Configuration outerConfiguration = this;
    AccumuloConfiguration.Deriver<T> deriver = acfg.newDeriver(entries -> computeDerivedValue.apply(outerConfiguration));
    return deriver::derive;
}
Also used : Configuration(org.apache.accumulo.core.spi.common.ServiceEnvironment.Configuration) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration)

Aggregations

Configuration (org.apache.accumulo.core.spi.common.ServiceEnvironment.Configuration)7 ServiceEnvironment (org.apache.accumulo.core.spi.common.ServiceEnvironment)6 Test (org.junit.jupiter.api.Test)5 Map (java.util.Map)1 AccumuloConfiguration (org.apache.accumulo.core.conf.AccumuloConfiguration)1