use of org.apache.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testSimpleStartRacyGetDuringDelete.
@Test
public void testSimpleStartRacyGetDuringDelete() throws Exception {
final ExtractionNamespace extractionNamespace = new ExtractionNamespace() {
@Override
public long getPollMs() {
return 0;
}
};
expectScheduleAndWaitOnce(extractionNamespace);
when(entry.getCacheState()).thenReturn(CacheScheduler.NoCache.ENTRY_CLOSED);
final NamespaceLookupExtractorFactory namespaceLookupExtractorFactory = new NamespaceLookupExtractorFactory(extractionNamespace, scheduler);
Assert.assertTrue(namespaceLookupExtractorFactory.start());
Assert.assertThrows(ISE.class, () -> namespaceLookupExtractorFactory.get());
verify(scheduler).scheduleAndWait(extractionNamespace, 60000L);
verify(entry).getCacheState();
verifyNoMoreInteractions(scheduler, entry, versionedCache);
}
use of org.apache.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testStartReturnsImmediately.
@Test
public void testStartReturnsImmediately() {
final ExtractionNamespace extractionNamespace = () -> 0;
when(scheduler.schedule(extractionNamespace)).thenReturn(entry);
final NamespaceLookupExtractorFactory namespaceLookupExtractorFactory = new NamespaceLookupExtractorFactory(extractionNamespace, 0, false, scheduler);
Assert.assertTrue(namespaceLookupExtractorFactory.start());
Assert.assertTrue(namespaceLookupExtractorFactory.close());
verify(scheduler).schedule(any());
verify(entry).close();
verifyNoMoreInteractions(scheduler, entry, versionedCache);
}
use of org.apache.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testReplaces.
@Test
public void testReplaces() {
final ExtractionNamespace en1 = mock(ExtractionNamespace.class), en2 = mock(ExtractionNamespace.class);
final NamespaceLookupExtractorFactory f1 = new NamespaceLookupExtractorFactory(en1, scheduler);
final NamespaceLookupExtractorFactory f2 = new NamespaceLookupExtractorFactory(en2, scheduler);
final NamespaceLookupExtractorFactory f1b = new NamespaceLookupExtractorFactory(en1, scheduler);
Assert.assertTrue(f1.replaces(f2));
Assert.assertTrue(f2.replaces(f1));
Assert.assertFalse(f1.replaces(f1b));
Assert.assertFalse(f1b.replaces(f1));
Assert.assertFalse(f1.replaces(f1));
Assert.assertTrue(f1.replaces(mock(LookupExtractorFactory.class)));
verifyNoInteractions(en1, en2);
}
use of org.apache.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testSimpleStartStopStop.
@Test
public void testSimpleStartStopStop() throws Exception {
final ExtractionNamespace extractionNamespace = () -> 0;
expectScheduleAndWaitOnce(extractionNamespace);
final NamespaceLookupExtractorFactory namespaceLookupExtractorFactory = new NamespaceLookupExtractorFactory(extractionNamespace, scheduler);
Assert.assertTrue(namespaceLookupExtractorFactory.start());
Assert.assertTrue(namespaceLookupExtractorFactory.close());
Assert.assertTrue(namespaceLookupExtractorFactory.close());
verify(entry).close();
verify(scheduler).scheduleAndWait(extractionNamespace, 60000L);
verifyNoMoreInteractions(scheduler, entry, versionedCache);
}
use of org.apache.druid.query.lookup.namespace.ExtractionNamespace in project druid by druid-io.
the class NamespaceLookupExtractorFactoryTest method testSimpleStartStop.
@Test
public void testSimpleStartStop() throws Exception {
final ExtractionNamespace extractionNamespace = () -> 0;
expectScheduleAndWaitOnce(extractionNamespace);
final NamespaceLookupExtractorFactory namespaceLookupExtractorFactory = new NamespaceLookupExtractorFactory(extractionNamespace, scheduler);
Assert.assertTrue(namespaceLookupExtractorFactory.start());
Assert.assertTrue(namespaceLookupExtractorFactory.close());
verify(scheduler).scheduleAndWait(extractionNamespace, 60000L);
verify(entry).close();
verifyNoMoreInteractions(scheduler, entry, versionedCache);
}
Aggregations