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);
}
Aggregations