use of com.axway.ats.environment.database.DatabaseEnvironmentUnit in project ats-framework by Axway.
the class MockDbEnvironmentUnit method testChangingDbPort.
@Test
public void testChangingDbPort() throws ConfigurationException, ComponentAlreadyDefinedException {
Properties properties = new Properties();
properties.put(EnvironmentConfigurator.DB_CONFIGURATION_INDEX, 0);
properties.put(EnvironmentConfigurator.DB_PORT, 1234);
EnvironmentConfigurator environmentConfigurator = new EnvironmentConfigurator(COMPONENT_NAME, Arrays.asList(properties));
environmentConfigurator.apply();
DatabaseEnvironmentUnit dbEnvUnit = (DatabaseEnvironmentUnit) testComponent.getEnvironments().get(0).getEnvironmentUnits().get(0);
assertEquals(1234, dbEnvUnit.getDbConnection().getCustomProperties().get(DbKeys.PORT_KEY));
}
use of com.axway.ats.environment.database.DatabaseEnvironmentUnit in project ats-framework by Axway.
the class MockDbEnvironmentUnit method testChangingDbPassword.
@Test
public void testChangingDbPassword() throws ConfigurationException, ComponentAlreadyDefinedException {
Properties properties = new Properties();
properties.put(EnvironmentConfigurator.DB_CONFIGURATION_INDEX, 0);
properties.put(EnvironmentConfigurator.DB_USER_PASSWORD, "new_test_password");
EnvironmentConfigurator environmentConfigurator = new EnvironmentConfigurator(COMPONENT_NAME, Arrays.asList(properties));
environmentConfigurator.apply();
DatabaseEnvironmentUnit dbEnvUnit = (DatabaseEnvironmentUnit) testComponent.getEnvironments().get(0).getEnvironmentUnits().get(0);
assertEquals("new_test_password", dbEnvUnit.getDbConnection().getPassword());
}
use of com.axway.ats.environment.database.DatabaseEnvironmentUnit in project ats-framework by Axway.
the class MockDbEnvironmentUnit method testChangingDbName.
@Test
public void testChangingDbName() throws ConfigurationException, ComponentAlreadyDefinedException {
Properties properties = new Properties();
properties.put(EnvironmentConfigurator.DB_CONFIGURATION_INDEX, 0);
properties.put(EnvironmentConfigurator.DB_NAME, "new_test_dbName");
EnvironmentConfigurator environmentConfigurator = new EnvironmentConfigurator(COMPONENT_NAME, Arrays.asList(properties));
environmentConfigurator.apply();
DatabaseEnvironmentUnit dbEnvUnit = (DatabaseEnvironmentUnit) testComponent.getEnvironments().get(0).getEnvironmentUnits().get(0);
assertEquals("new_test_dbName", dbEnvUnit.getDbConnection().getDb());
}
use of com.axway.ats.environment.database.DatabaseEnvironmentUnit in project ats-framework by Axway.
the class Test_ConfigurationParser method checkDbEnvironmentUnit_OracleSID.
@Test
public void checkDbEnvironmentUnit_OracleSID() throws Exception {
InputStream descriptorFileStream = Test_ConfigurationParser.class.getResourceAsStream("descriptor_oracle.xml");
ConfigurationParser configParser = new ConfigurationParser();
configParser.parse(descriptorFileStream, jarFileAbsolutePath);
assertEquals(DatabaseEnvironmentUnit.class, configParser.getEnvironments().get(0).getEnvironmentUnits().get(0).getClass());
DatabaseEnvironmentUnit dbUnit = (DatabaseEnvironmentUnit) configParser.getEnvironments().get(0).getEnvironmentUnits().get(0);
Map<String, Object> customDbConnectionProperties = dbUnit.getDbConnection().getCustomProperties();
// check SID
assertEquals("some_sid", customDbConnectionProperties.get(OracleKeys.SID_KEY));
// check that the URL is right (using the SID correctly)
assertEquals("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=some_sid)))", dbUnit.getDbConnection().getURL());
}
Aggregations