Search in sources :

Example 21 with TestBox

use of com.axway.ats.harness.config.TestBox in project ats-framework by Axway.

the class Test_TestBox method testDbNameEmpty.

@Test(expected = NullOrEmptyConfigurationPropertyException.class)
public void testDbNameEmpty() throws NullOrEmptyConfigurationPropertyException {
    TestBox testBox = new TestBox();
    testBox.setDbName(ONLY_SPACE_STR);
}
Also used : TestBox(com.axway.ats.harness.config.TestBox) BaseTest(com.axway.ats.harness.BaseTest) Test(org.junit.Test)

Example 22 with TestBox

use of com.axway.ats.harness.config.TestBox in project ats-framework by Axway.

the class DatabaseBackupRestoreTests method init.

@BeforeMethod
public void init() {
    serverBox = new TestBox();
    serverBox.setHost(configuration.getDatabaseHost());
    serverBox.setDbType(configuration.getDatabaseType());
    serverBox.setDbName(configuration.getBackupDatabaseName());
    serverBox.setDbUser(configuration.getDatabaseUser());
    serverBox.setDbPass(configuration.getDatabasePassword());
    serverBox.setDbPort(String.valueOf(configuration.getDbPort()));
    // establish DB connection
    dbOperations = new DatabaseOperations(serverBox);
    dbConn = new DbConnPostgreSQL(configuration.getDatabaseHost(), port, configuration.getBackupDatabaseName(), configuration.getDatabaseUser(), configuration.getDatabasePassword(), null);
    // establish tables which to be inspected
    dbTables = new ArrayList<>();
    dbTables.add(new DbTable(TABLE));
}
Also used : TestBox(com.axway.ats.harness.config.TestBox) DatabaseOperations(com.axway.ats.action.dbaccess.DatabaseOperations) DbConnPostgreSQL(com.axway.ats.core.dbaccess.postgresql.DbConnPostgreSQL) DbTable(com.axway.ats.environment.database.model.DbTable)

Example 23 with TestBox

use of com.axway.ats.harness.config.TestBox in project ats-framework by Axway.

the class DatabaseVerificationTests method beforeMethod.

/**
 * Prior to each test we make sure we have the table we worked with
 * is in same state
 */
@BeforeMethod
public void beforeMethod() {
    // initialize all connection parameters
    dbServerBox = new TestBox();
    dbServerBox.setHost(configuration.getDatabaseHost());
    dbServerBox.setDbType(configuration.getDatabaseType());
    dbServerBox.setDbName(configuration.getDatabaseName());
    dbServerBox.setDbUser(configuration.getDatabaseUser());
    dbServerBox.setDbPass(configuration.getDatabasePassword());
    dbServerBox.setDbPort(String.valueOf(configuration.getDbPort()));
    // initialize this helper class
    dbOperations = new DatabaseOperations(dbServerBox);
    // cleanup the table we use and fill it with the needed data
    dbOperations.delete(TABLE, "1=1");
    dbOperations.insertValues(TABLE, new String[] { "id", "firstName", "lastName", "age" }, new String[] { "1", "Chuck", "Norris", "70" });
    dbOperations.insertValues(TABLE, new String[] { "id", "firstName", "lastName", "age" }, new String[] { "2", "Jackie", "Chan", "64" });
    // Initialize the class we will use in our tests
    dbVerification = new DbVerification(dbServerBox, TABLE);
}
Also used : TestBox(com.axway.ats.harness.config.TestBox) DatabaseOperations(com.axway.ats.action.dbaccess.DatabaseOperations) DbVerification(com.axway.ats.rbv.clients.DbVerification) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 24 with TestBox

use of com.axway.ats.harness.config.TestBox in project ats-framework by Axway.

the class DatabaseOperationTests method beforeMethod.

/**
 * Prior to each test we make sure we have the table we worked with
 * is in same state
 */
@BeforeMethod
public void beforeMethod() {
    // Here we define all connection parameters
    TestBox serverBox = new TestBox();
    serverBox.setHost(configuration.getDatabaseHost());
    serverBox.setDbType(configuration.getDatabaseType());
    serverBox.setDbName(configuration.getDatabaseName());
    serverBox.setDbUser(configuration.getDatabaseUser());
    serverBox.setDbPass(configuration.getDatabasePassword());
    serverBox.setDbPort(String.valueOf(configuration.getDbPort()));
    // establish DB connection
    dbOperations = new DatabaseOperations(serverBox);
    // cleanup the table we use and fill it with the needed data
    dbOperations.delete(TABLE, "1=1");
    dbOperations.insertValues(TABLE, new String[] { "id", "firstName", "lastName", "age" }, new String[] { "1", "Chuck", "Norris", "70" });
    dbOperations.insertValues(TABLE, new String[] { "id", "firstName", "lastName", "age" }, new String[] { "2", "Jackie", "Chan", "64" });
}
Also used : TestBox(com.axway.ats.harness.config.TestBox) DatabaseOperations(com.axway.ats.action.dbaccess.DatabaseOperations) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

TestBox (com.axway.ats.harness.config.TestBox)24 BaseTest (com.axway.ats.harness.BaseTest)21 Test (org.junit.Test)21 CommonConfigurator (com.axway.ats.harness.config.CommonConfigurator)4 DatabaseOperations (com.axway.ats.action.dbaccess.DatabaseOperations)3 BeforeMethod (org.testng.annotations.BeforeMethod)2 DbConnPostgreSQL (com.axway.ats.core.dbaccess.postgresql.DbConnPostgreSQL)1 DbTable (com.axway.ats.environment.database.model.DbTable)1 DbVerification (com.axway.ats.rbv.clients.DbVerification)1 AssertionFailedError (junit.framework.AssertionFailedError)1