Search in sources :

Example 6 with ActiveDbAppender

use of com.axway.ats.log.appenders.ActiveDbAppender in project ats-framework by Axway.

the class Test_RemoteLoggingConfigurator method testApplyPositive.

@Test
public void testApplyPositive() {
    ActiveDbAppender appender = new ActiveDbAppender();
    appender.setHost("test");
    appender.setDatabase("test");
    appender.setUser("test");
    appender.setPassword("test");
    Logger log = Logger.getLogger(loggerName);
    log.addAppender(appender);
    //construct the configurator - an appender is present
    RemoteLoggingConfigurator remoteLoggingConfig = new RemoteLoggingConfigurator("127.0.0.1");
    //remove the appender, so the configurator will need to apply it
    log.removeAppender(appender);
    // check if needs to be applied - this sets the internal flags
    // so the next "apply" method will work as expected
    assertTrue(remoteLoggingConfig.needsApplying());
    //apply the appender
    remoteLoggingConfig.apply();
    assertTrue(log.getAllAppenders().hasMoreElements());
}
Also used : ActiveDbAppender(com.axway.ats.log.appenders.ActiveDbAppender) Logger(org.apache.log4j.Logger) Test(org.junit.Test)

Example 7 with ActiveDbAppender

use of com.axway.ats.log.appenders.ActiveDbAppender in project ats-framework by Axway.

the class Test_RemoteLoggingConfigurator method testRevertPositive.

@Test
public void testRevertPositive() {
    ActiveDbAppender appender = new ActiveDbAppender();
    appender.setHost("test");
    appender.setDatabase("test");
    appender.setUser("test");
    appender.setPassword("test");
    Logger log = Logger.getLogger(loggerName);
    log.addAppender(appender);
    //construct the configurator - an appender is present
    RemoteLoggingConfigurator remoteLoggingConfig = new RemoteLoggingConfigurator("127.0.0.1");
    //remove the appender, so the configurator will need to apply it
    log.removeAppender(appender);
    //apply the appender
    remoteLoggingConfig.apply();
    remoteLoggingConfig.revert();
    assertFalse(log.getAllAppenders().hasMoreElements());
}
Also used : ActiveDbAppender(com.axway.ats.log.appenders.ActiveDbAppender) Logger(org.apache.log4j.Logger) Test(org.junit.Test)

Example 8 with ActiveDbAppender

use of com.axway.ats.log.appenders.ActiveDbAppender in project ats-framework by Axway.

the class Test_RemoteLoggingConfigurator method testNeedsApplyWithAppenderExpectTrue.

@Test
public void testNeedsApplyWithAppenderExpectTrue() {
    ActiveDbAppender appender = new ActiveDbAppender();
    appender.setHost("test");
    appender.setDatabase("test");
    appender.setUser("test");
    appender.setPassword("test");
    Logger log = Logger.getRootLogger();
    log.addAppender(appender);
    //construct the configurator - an appender is present
    RemoteLoggingConfigurator remoteLoggingConfig = new RemoteLoggingConfigurator("127.0.0.1");
    //remove the appender, so the configurator will need to apply it
    log.removeAppender(appender);
    assertTrue(remoteLoggingConfig.needsApplying());
}
Also used : ActiveDbAppender(com.axway.ats.log.appenders.ActiveDbAppender) Logger(org.apache.log4j.Logger) Test(org.junit.Test)

Example 9 with ActiveDbAppender

use of com.axway.ats.log.appenders.ActiveDbAppender in project ats-framework by Axway.

the class Test_RemoteLoggingConfigurator method testRevertPositiveRootLogger.

@Test
public void testRevertPositiveRootLogger() {
    ActiveDbAppender appender = new ActiveDbAppender();
    appender.setHost("test");
    appender.setDatabase("test");
    appender.setUser("test");
    appender.setPassword("test");
    Logger log = Logger.getRootLogger();
    log.addAppender(appender);
    //construct the configurator - an appender is present
    RemoteLoggingConfigurator remoteLoggingConfig = new RemoteLoggingConfigurator("127.0.0.1");
    //remove the appender, so the configurator will need to apply it
    log.removeAppender(appender);
    //apply the appender
    remoteLoggingConfig.apply();
    remoteLoggingConfig.revert();
    assertFalse(log.getAllAppenders().hasMoreElements());
}
Also used : ActiveDbAppender(com.axway.ats.log.appenders.ActiveDbAppender) Logger(org.apache.log4j.Logger) Test(org.junit.Test)

Example 10 with ActiveDbAppender

use of com.axway.ats.log.appenders.ActiveDbAppender in project ats-framework by Axway.

the class Test_RemoteLoggingConfigurator method testApplyPositiveRootLogger.

@Test
public void testApplyPositiveRootLogger() {
    ActiveDbAppender appender = new ActiveDbAppender();
    appender.setHost("test");
    appender.setDatabase("test");
    appender.setUser("test");
    appender.setPassword("test");
    Logger log = Logger.getRootLogger();
    log.addAppender(appender);
    //construct the configurator - an appender is present
    RemoteLoggingConfigurator remoteLoggingConfig = new RemoteLoggingConfigurator("127.0.0.1");
    //remove the appender, so the configurator will need to apply it
    log.removeAppender(appender);
    // check if needs to be applied - this sets the internal flags
    // so the next "apply" method will work as expected
    assertTrue(remoteLoggingConfig.needsApplying());
    //apply the appender
    remoteLoggingConfig.apply();
    assertTrue(log.getAllAppenders().hasMoreElements());
}
Also used : ActiveDbAppender(com.axway.ats.log.appenders.ActiveDbAppender) Logger(org.apache.log4j.Logger) Test(org.junit.Test)

Aggregations

ActiveDbAppender (com.axway.ats.log.appenders.ActiveDbAppender)10 Logger (org.apache.log4j.Logger)5 Test (org.junit.Test)5 PassiveDbAppender (com.axway.ats.log.appenders.PassiveDbAppender)2 GetCurrentTestCaseEvent (com.axway.ats.log.autodb.events.GetCurrentTestCaseEvent)2 Appender (org.apache.log4j.Appender)2 PublicAtsApi (com.axway.ats.common.PublicAtsApi)1 DbConnection (com.axway.ats.core.dbaccess.DbConnection)1 DbConnSQLServer (com.axway.ats.core.dbaccess.mssql.DbConnSQLServer)1 Suite (com.axway.ats.log.autodb.entities.Suite)1 DatabaseAccessException (com.axway.ats.log.autodb.exceptions.DatabaseAccessException)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ConnectException (java.net.ConnectException)1 URL (java.net.URL)1 HttpEntity (org.apache.http.HttpEntity)1 ClientProtocolException (org.apache.http.client.ClientProtocolException)1 HttpPost (org.apache.http.client.methods.HttpPost)1 MultipartEntityBuilder (org.apache.http.entity.mime.MultipartEntityBuilder)1