use of co.cask.cdap.file.dropzone.config.ObserverConfiguration in project cdap-ingest by caskdata.
the class FileDropZoneIT method loadConfig.
private ObserverConfiguration loadConfig(File file) throws ConfigurationLoadingException {
ConfigurationLoader loader = new ConfigurationLoaderImpl();
Configuration configuration = loader.load(file);
List<ObserverConfiguration> observerConfig = new FileDropZoneConfigurationImpl(configuration.getProperties()).getObserverConfiguration();
return observerConfig.get(0);
}
use of co.cask.cdap.file.dropzone.config.ObserverConfiguration in project cdap-ingest by caskdata.
the class FileDropZoneIT method deleteTestDir.
private void deleteTestDir() throws Exception {
File configFile = getConfigFile();
ObserverConfiguration observerConfiguration = loadConfig(configFile);
File workDir = observerConfiguration.getPipeConf().getSourceConfiguration().getWorkDir();
FileUtils.deleteDirectory(workDir);
File daemonDir = observerConfiguration.getPipeConf().getDaemonDir();
FileUtils.deleteDirectory(daemonDir);
}
use of co.cask.cdap.file.dropzone.config.ObserverConfiguration in project cdap-ingest by caskdata.
the class FileDropZoneIT method fileDropZoneBasicIT.
@Test
public void fileDropZoneBasicIT() throws Exception {
final File configurationFile = getConfigFile();
PollingServiceManager pollingServiceManager = new PollingServiceManager(configurationFile);
pollingServiceManager.initManager();
Field monitor = pollingServiceManager.getClass().getDeclaredField("monitor");
monitor.setAccessible(true);
PollingService myMonitor = (PollingService) monitor.get(pollingServiceManager);
ObserverConfiguration observerConf = loadConfig(configurationFile);
PollingListener myPollingListener = new PollingListenerImpl(myMonitor, observerConf);
FileTailerMetricsProcessor metricsProcessor = getMetricsProcessor(observerConf);
Field metricsProcessorField = myPollingListener.getClass().getDeclaredField("metricsProcessor");
metricsProcessorField.setAccessible(true);
metricsProcessorField.set(myPollingListener, metricsProcessor);
myMonitor.registerDirMonitor(observerConf.getPipeConf().getSourceConfiguration().getWorkDir(), myPollingListener);
createFile(observerConf.getPipeConf().getSourceConfiguration().getWorkDir().getAbsolutePath());
long start = System.currentTimeMillis();
pollingServiceManager.startMonitor();
Thread.sleep(SLEEP_TIME);
pollingServiceManager.stopMonitor();
checkDeliveredEvents(start, System.currentTimeMillis());
Assert.assertEquals(read.get(), ingest.get());
}
Aggregations