Search in sources :

Example 1 with Opts

use of org.apache.accumulo.gc.SimpleGarbageCollector.Opts in project accumulo by apache.

the class SimpleGarbageCollectorTest method setUp.

@Before
public void setUp() {
    volMgr = createMock(VolumeManager.class);
    instance = createMock(Instance.class);
    SiteConfiguration siteConfig = EasyMock.createMock(SiteConfiguration.class);
    expect(instance.getInstanceID()).andReturn("mock").anyTimes();
    expect(instance.getZooKeepers()).andReturn("localhost").anyTimes();
    expect(instance.getZooKeepersSessionTimeOut()).andReturn(30000).anyTimes();
    opts = new Opts();
    systemConfig = createSystemConfig();
    ServerConfigurationFactory factory = createMock(ServerConfigurationFactory.class);
    expect(factory.getSystemConfiguration()).andReturn(systemConfig).anyTimes();
    expect(factory.getSiteConfiguration()).andReturn(siteConfig).anyTimes();
    // Just make the SiteConfiguration delegate to our AccumuloConfiguration
    // Presently, we only need get(Property) and iterator().
    EasyMock.expect(siteConfig.get(EasyMock.anyObject(Property.class))).andAnswer(new IAnswer<String>() {

        @Override
        public String answer() {
            Object[] args = EasyMock.getCurrentArguments();
            return systemConfig.get((Property) args[0]);
        }
    }).anyTimes();
    EasyMock.expect(siteConfig.getBoolean(EasyMock.anyObject(Property.class))).andAnswer(new IAnswer<Boolean>() {

        @Override
        public Boolean answer() {
            Object[] args = EasyMock.getCurrentArguments();
            return systemConfig.getBoolean((Property) args[0]);
        }
    }).anyTimes();
    EasyMock.expect(siteConfig.iterator()).andAnswer(new IAnswer<Iterator<Entry<String, String>>>() {

        @Override
        public Iterator<Entry<String, String>> answer() {
            return systemConfig.iterator();
        }
    }).anyTimes();
    replay(instance, factory, siteConfig);
    credentials = SystemCredentials.get(instance);
    gc = new SimpleGarbageCollector(opts, instance, volMgr, factory);
}
Also used : VolumeManager(org.apache.accumulo.server.fs.VolumeManager) IAnswer(org.easymock.IAnswer) Entry(java.util.Map.Entry) Instance(org.apache.accumulo.core.client.Instance) Opts(org.apache.accumulo.gc.SimpleGarbageCollector.Opts) SiteConfiguration(org.apache.accumulo.core.conf.SiteConfiguration) ServerConfigurationFactory(org.apache.accumulo.server.conf.ServerConfigurationFactory) Before(org.junit.Before)

Aggregations

Entry (java.util.Map.Entry)1 Instance (org.apache.accumulo.core.client.Instance)1 SiteConfiguration (org.apache.accumulo.core.conf.SiteConfiguration)1 Opts (org.apache.accumulo.gc.SimpleGarbageCollector.Opts)1 ServerConfigurationFactory (org.apache.accumulo.server.conf.ServerConfigurationFactory)1 VolumeManager (org.apache.accumulo.server.fs.VolumeManager)1 IAnswer (org.easymock.IAnswer)1 Before (org.junit.Before)1