Search in sources :

Example 16 with PipeConfiguration

use of co.cask.cdap.filetailer.config.PipeConfiguration in project cdap-ingest by caskdata.

the class FileTailerIT method loadConfig.

private PipeConfiguration loadConfig(File file) throws ConfigurationLoadingException {
    ConfigurationLoader loader = new ConfigurationLoaderImpl();
    Configuration configuration = loader.load(file);
    List<PipeConfiguration> pipeConfig = configuration.getPipeConfigurations();
    return pipeConfig.get(0);
}
Also used : PipeConfiguration(co.cask.cdap.filetailer.config.PipeConfiguration) Configuration(co.cask.cdap.filetailer.config.Configuration) PipeConfiguration(co.cask.cdap.filetailer.config.PipeConfiguration) ConfigurationLoaderImpl(co.cask.cdap.filetailer.config.ConfigurationLoaderImpl) ConfigurationLoader(co.cask.cdap.filetailer.config.ConfigurationLoader)

Example 17 with PipeConfiguration

use of co.cask.cdap.filetailer.config.PipeConfiguration in project cdap-ingest by caskdata.

the class FileTailerIT method fileTailerBasicIT.

@Test
public void fileTailerBasicIT() throws Exception {
    File configFile = getConfigFile();
    PipeConfiguration pipeConfig = loadConfig(configFile);
    String logFilePath = pipeConfig.getSourceConfiguration().getWorkDir().getAbsolutePath() + "/" + pipeConfig.getSourceConfiguration().getFileName();
    Logger logger = getTimeLogger(logFilePath);
    writeLogs(logger, ENTRY_NUMBER);
    PipeManager manager = new PipeManager(configFile);
    mockMetricsProcessor(manager);
    long startTime = System.currentTimeMillis();
    manager.startAsync();
    writeLogs(logger, ENTRY_NUMBER);
    Thread.sleep(SLEEP_TIME);
    logger.getAppender("File Tailer IT").stop();
    manager.stopAsync();
    Thread.sleep(SLEEP_TIME);
    Assert.assertEquals(read.get(), ingest.get());
    checkDeliveredEvents(ENTRY_NUMBER * 2, startTime);
}
Also used : PipeConfiguration(co.cask.cdap.filetailer.config.PipeConfiguration) Logger(ch.qos.logback.classic.Logger) File(java.io.File) Test(org.junit.Test)

Aggregations

PipeConfiguration (co.cask.cdap.filetailer.config.PipeConfiguration)17 File (java.io.File)8 FileTailerQueue (co.cask.cdap.filetailer.queue.FileTailerQueue)7 Test (org.junit.Test)7 Logger (ch.qos.logback.classic.Logger)6 FileTailerStateProcessor (co.cask.cdap.filetailer.state.FileTailerStateProcessor)5 FileTailerStateProcessorImpl (co.cask.cdap.filetailer.state.FileTailerStateProcessorImpl)5 ArrayList (java.util.ArrayList)5 FileTailerMetricsProcessor (co.cask.cdap.filetailer.metrics.FileTailerMetricsProcessor)4 StreamWriter (co.cask.cdap.client.StreamWriter)3 Configuration (co.cask.cdap.filetailer.config.Configuration)3 ConfigurationLoader (co.cask.cdap.filetailer.config.ConfigurationLoader)3 ConfigurationLoaderImpl (co.cask.cdap.filetailer.config.ConfigurationLoaderImpl)3 FileTailerSink (co.cask.cdap.filetailer.sink.FileTailerSink)3 LogTailer (co.cask.cdap.filetailer.tailer.LogTailer)3 Field (java.lang.reflect.Field)3 RandomStringUtils (org.apache.commons.lang.RandomStringUtils)3 StreamClient (co.cask.cdap.client.StreamClient)2 ServiceManager (com.google.common.util.concurrent.ServiceManager)2 Pipe (co.cask.cdap.filetailer.Pipe)1