use of co.cask.cdap.logging.appender.LoggingTester in project cdap by caskdata.
the class TestFileLogging method testGetLogPrev.
@Test
public void testGetLogPrev() throws Exception {
LoggingContext loggingContext = new FlowletLoggingContext("TFL_NS_1", "APP_1", "FLOW_1", "", "RUN1", "INSTANCE1");
FileLogReader logReader = injector.getInstance(FileLogReader.class);
LoggingTester tester = new LoggingTester();
tester.testGetPrev(logReader, loggingContext);
}
use of co.cask.cdap.logging.appender.LoggingTester in project cdap by caskdata.
the class TestFileLogging method testGetLogNext.
@Test
public void testGetLogNext() throws Exception {
LoggingContext loggingContext = new FlowletLoggingContext("TFL_NS_1", "APP_1", "FLOW_1", "", "RUN1", "INSTANCE1");
FileLogReader logReader = injector.getInstance(FileLogReader.class);
LoggingTester tester = new LoggingTester();
tester.testGetNext(logReader, loggingContext);
}
use of co.cask.cdap.logging.appender.LoggingTester in project cdap by caskdata.
the class TestFileLogging method setUpContext.
@BeforeClass
public static void setUpContext() throws Exception {
Configuration hConf = HBaseConfiguration.create();
final CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TMP_FOLDER.newFolder().getAbsolutePath());
cConf.setInt(LoggingConfiguration.LOG_MAX_FILE_SIZE_BYTES, 20 * 1024);
String logBaseDir = cConf.get(LoggingConfiguration.LOG_BASE_DIR) + "/" + TestFileLogging.class.getSimpleName();
cConf.set(LoggingConfiguration.LOG_BASE_DIR, logBaseDir);
injector = Guice.createInjector(new ConfigModule(cConf, hConf), new NonCustomLocationUnitTestModule().getModule(), new TransactionModules().getInMemoryModules(), new LoggingModules().getInMemoryModules(), new DataSetsModules().getInMemoryModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
}
});
txManager = injector.getInstance(TransactionManager.class);
txManager.startAndWait();
LogAppender appender = injector.getInstance(LocalLogAppender.class);
new LogAppenderInitializer(appender).initialize("TestFileLogging");
Logger logger = LoggerFactory.getLogger("TestFileLogging");
LoggingTester loggingTester = new LoggingTester();
loggingTester.generateLogs(logger, new FlowletLoggingContext("TFL_NS_1", "APP_1", "FLOW_1", "FLOWLET_1", "RUN1", "INSTANCE1"));
appender.stop();
}
use of co.cask.cdap.logging.appender.LoggingTester in project cdap by caskdata.
the class TestKafkaLogging method testGetPrev.
@Test
public void testGetPrev() throws Exception {
LoggingContext loggingContext = new FlowletLoggingContext("TKL_NS_1", "APP_1", "FLOW_1", "", "RUN1", "INSTANCE1");
KafkaLogReader logReader = KAFKA_TESTER.getInjector().getInstance(KafkaLogReader.class);
LoggingTester tester = new LoggingTester();
tester.testGetPrev(logReader, loggingContext);
}
use of co.cask.cdap.logging.appender.LoggingTester in project cdap by caskdata.
the class TestKafkaLogging method init.
@BeforeClass
public static void init() throws Exception {
txManager = KAFKA_TESTER.getInjector().getInstance(TransactionManager.class);
txManager.startAndWait();
KafkaLogAppender appender = KAFKA_TESTER.getInjector().getInstance(KafkaLogAppender.class);
new LogAppenderInitializer(appender).initialize("TestKafkaLogging");
Logger logger = LoggerFactory.getLogger("TestKafkaLogging");
LoggingTester loggingTester = new LoggingTester();
loggingTester.generateLogs(logger, new FlowletLoggingContext("TKL_NS_1", "APP_1", "FLOW_1", "FLOWLET_1", "RUN1", "INSTANCE1"));
appender.stop();
}
Aggregations