use of io.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespacedExtractorModuleTest method setUp.
@Before
public void setUp() throws Exception {
final Map<Class<? extends ExtractionNamespace>, ExtractionNamespaceCacheFactory<?>> factoryMap = ImmutableMap.<Class<? extends ExtractionNamespace>, ExtractionNamespaceCacheFactory<?>>of(URIExtractionNamespace.class, new URIExtractionNamespaceCacheFactory(ImmutableMap.<String, SearchableVersionedDataFinder>of("file", new LocalFileTimestampVersionFinder())), JDBCExtractionNamespace.class, new JDBCExtractionNamespaceCacheFactory());
lifecycle = new Lifecycle();
lifecycle.start();
NoopServiceEmitter noopServiceEmitter = new NoopServiceEmitter();
scheduler = new CacheScheduler(noopServiceEmitter, factoryMap, new OnHeapNamespaceExtractionCacheManager(lifecycle, noopServiceEmitter));
}
use of io.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testStartFailsToSchedule.
@Test
public void testStartFailsToSchedule() {
final ExtractionNamespace extractionNamespace = new ExtractionNamespace() {
@Override
public long getPollMs() {
return 0;
}
};
try {
EasyMock.expect(scheduler.scheduleAndWait(EasyMock.eq(extractionNamespace), EasyMock.eq(60000L))).andReturn(null).once();
} catch (InterruptedException e) {
throw new AssertionError(e);
}
mockReplay();
final NamespaceLookupExtractorFactory namespaceLookupExtractorFactory = new NamespaceLookupExtractorFactory(extractionNamespace, scheduler);
Assert.assertFalse(namespaceLookupExtractorFactory.start());
// true because it never fully started
Assert.assertTrue(namespaceLookupExtractorFactory.close());
mockVerify();
}
use of io.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testSimpleStartRacyGetDuringDelete.
@Test
public void testSimpleStartRacyGetDuringDelete() {
final ExtractionNamespace extractionNamespace = new ExtractionNamespace() {
@Override
public long getPollMs() {
return 0;
}
};
expectScheduleAndWaitOnce(extractionNamespace);
expectEntryGetCacheStateOnce(CacheScheduler.NoCache.ENTRY_CLOSED);
mockReplay();
final NamespaceLookupExtractorFactory namespaceLookupExtractorFactory = new NamespaceLookupExtractorFactory(extractionNamespace, scheduler);
Assert.assertTrue(namespaceLookupExtractorFactory.start());
try {
namespaceLookupExtractorFactory.get();
Assert.fail("Should have thrown ISE");
} catch (ISE ise) {
// NOOP
}
mockVerify();
}
use of io.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testSimpleStartStart.
@Test
public void testSimpleStartStart() {
final ExtractionNamespace extractionNamespace = new ExtractionNamespace() {
@Override
public long getPollMs() {
return 0;
}
};
expectScheduleAndWaitOnce(extractionNamespace);
mockReplay();
final NamespaceLookupExtractorFactory namespaceLookupExtractorFactory = new NamespaceLookupExtractorFactory(extractionNamespace, scheduler);
Assert.assertTrue(namespaceLookupExtractorFactory.start());
Assert.assertTrue(namespaceLookupExtractorFactory.start());
mockVerify();
}
use of io.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testSimpleStartStopStop.
@Test
public void testSimpleStartStopStop() {
final ExtractionNamespace extractionNamespace = new ExtractionNamespace() {
@Override
public long getPollMs() {
return 0;
}
};
expectScheduleAndWaitOnce(extractionNamespace);
expectEntryCloseOnce();
mockReplay();
final NamespaceLookupExtractorFactory namespaceLookupExtractorFactory = new NamespaceLookupExtractorFactory(extractionNamespace, scheduler);
Assert.assertTrue(namespaceLookupExtractorFactory.start());
Assert.assertTrue(namespaceLookupExtractorFactory.close());
Assert.assertTrue(namespaceLookupExtractorFactory.close());
mockVerify();
}
Aggregations