Search in sources :

Example 16 with EnvironmentUnit

use of com.axway.ats.environment.EnvironmentUnit in project ats-framework by Axway.

the class Test_DirectoryEnvironmentUnit method restore_originalDirectoryIsFile.

@Test(expected = EnvironmentCleanupException.class)
public void restore_originalDirectoryIsFile() throws EnvironmentCleanupException, IOException {
    EnvironmentUnit dirEnvUnit = new DirectoryEnvironmentUnit(restoreDirPath, backupDirPath, backupDirName);
    new File(restoreDirPath).createNewFile();
    dirEnvUnit.restore();
//        Assert.assertTrue( dirEnvUnit.restore() );
//
//        FileEnvironmentUnit fileEnvUnit = new FileEnvironmentUnit( IoUtils.getFilePath( originalFileName ),
//                                                                   backupFileName );
//        assertTrue( fileEnvUnit.restore() );
}
Also used : EnvironmentUnit(com.axway.ats.environment.EnvironmentUnit) File(java.io.File) BaseTest(com.axway.ats.environment.BaseTest) Test(org.junit.Test)

Example 17 with EnvironmentUnit

use of com.axway.ats.environment.EnvironmentUnit in project ats-framework by Axway.

the class Test_FileEnvironmentUnit method testBackupFolder_ifNotExist.

@Test
public void testBackupFolder_ifNotExist() throws EnvironmentCleanupException {
    String backupFileNameInDeepDir = backupFolder + "agent_test_backup/test_folder/other_folder/backup_file.txt";
    EnvironmentUnit fileEnvUnit = new FileEnvironmentUnit(originalFileName, backupFolder + "agent_test_backup/test_folder/other_folder/", "backup_file.txt");
    fileEnvUnit.backup();
    //verify if the backup file exists on the right place
    File backupFile = new File(backupFileNameInDeepDir);
    Assert.assertTrue(backupFile.exists());
}
Also used : EnvironmentUnit(com.axway.ats.environment.EnvironmentUnit) File(java.io.File) BaseTest(com.axway.ats.environment.BaseTest) Test(org.junit.Test)

Example 18 with EnvironmentUnit

use of com.axway.ats.environment.EnvironmentUnit in project ats-framework by Axway.

the class MockDbEnvironmentUnit method getTestComponent.

private Component getTestComponent() {
    Component testComponent = new Component(COMPONENT_NAME);
    Map<String, Object> customProperties = new HashMap<String, Object>();
    customProperties.put(DbKeys.PORT_KEY, 3306);
    List<EnvironmentUnit> environmentUnits = new ArrayList<EnvironmentUnit>();
    environmentUnits.add(new MockDbEnvironmentUnit(new DbConnMySQL("host_1", "db_1", "user_1", "password_1", customProperties)));
    testComponent.setEnvironments(Arrays.asList(new ComponentEnvironment(COMPONENT_NAME, null, environmentUnits, "backupFolder")));
    return testComponent;
}
Also used : ComponentEnvironment(com.axway.ats.agent.core.ComponentEnvironment) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DbConnMySQL(com.axway.ats.core.dbaccess.mysql.DbConnMySQL) EnvironmentUnit(com.axway.ats.environment.EnvironmentUnit) DatabaseEnvironmentUnit(com.axway.ats.environment.database.DatabaseEnvironmentUnit) Component(com.axway.ats.agent.core.Component)

Aggregations

EnvironmentUnit (com.axway.ats.environment.EnvironmentUnit)18 Test (org.junit.Test)11 DatabaseEnvironmentUnit (com.axway.ats.environment.database.DatabaseEnvironmentUnit)10 BaseTest (com.axway.ats.environment.BaseTest)8 DirectoryEnvironmentUnit (com.axway.ats.environment.file.DirectoryEnvironmentUnit)8 FileEnvironmentUnit (com.axway.ats.environment.file.FileEnvironmentUnit)8 File (java.io.File)8 AgentException (com.axway.ats.agent.core.exceptions.AgentException)3 EnvironmentCleanupException (com.axway.ats.environment.EnvironmentCleanupException)3 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 Ignore (org.junit.Ignore)3 ComponentEnvironment (com.axway.ats.agent.core.ComponentEnvironment)2 Component (com.axway.ats.agent.core.Component)1 ComponentRepository (com.axway.ats.agent.core.ComponentRepository)1 NoSuchComponentException (com.axway.ats.agent.core.exceptions.NoSuchComponentException)1 DbConnection (com.axway.ats.core.dbaccess.DbConnection)1 DbConnMySQL (com.axway.ats.core.dbaccess.mysql.DbConnMySQL)1 SystemProcessAction (com.axway.ats.environment.process.SystemProcessAction)1 Date (java.util.Date)1