use of org.apache.druid.segment.loading.LocalFileTimestampVersionFinder in project druid by druid-io.
the class NamespacedExtractorModuleTest method setUp.
@Before
public void setUp() throws Exception {
final Map<Class<? extends ExtractionNamespace>, CacheGenerator<?>> factoryMap = ImmutableMap.of(UriExtractionNamespace.class, new UriCacheGenerator(ImmutableMap.of("file", new LocalFileTimestampVersionFinder())), JdbcExtractionNamespace.class, new JdbcCacheGenerator());
lifecycle = new Lifecycle();
lifecycle.start();
NoopServiceEmitter noopServiceEmitter = new NoopServiceEmitter();
scheduler = new CacheScheduler(noopServiceEmitter, factoryMap, new OnHeapNamespaceExtractionCacheManager(lifecycle, noopServiceEmitter, new NamespaceExtractionConfig()));
}
use of org.apache.druid.segment.loading.LocalFileTimestampVersionFinder in project druid by druid-io.
the class NamespacedExtractorModuleTest method testNewTask.
@Test
public void testNewTask() throws Exception {
final File tmpFile = temporaryFolder.newFile();
try (Writer out = Files.newWriter(tmpFile, StandardCharsets.UTF_8)) {
out.write(MAPPER.writeValueAsString(ImmutableMap.of("foo", "bar")));
}
final UriCacheGenerator factory = new UriCacheGenerator(ImmutableMap.of("file", new LocalFileTimestampVersionFinder()));
final UriExtractionNamespace namespace = new UriExtractionNamespace(tmpFile.toURI(), null, null, new UriExtractionNamespace.ObjectMapperFlatDataParser(UriExtractionNamespaceTest.registerTypes(new DefaultObjectMapper())), new Period(0), null, null);
CacheScheduler.VersionedCache versionedCache = factory.generateCache(namespace, null, null, scheduler);
Assert.assertNotNull(versionedCache);
Map<String, String> map = versionedCache.getCache();
Assert.assertEquals("bar", map.get("foo"));
Assert.assertEquals(null, map.get("baz"));
}
Aggregations