use of com.axway.ats.common.system.OperatingSystemType in project ats-framework by Axway.
the class Test_ConfigurationParser method testBackupDirectory_NoBackupName_forWindows.
@Test
public void testBackupDirectory_NoBackupName_forWindows() throws Exception {
OperatingSystemType currentOs = OperatingSystemType.getCurrentOsType();
simulateOS(OperatingSystemType.WINDOWS);
try {
InputStream _descriptorFileStream = Test_ConfigurationParser.class.getClassLoader().getResourceAsStream("test_descriptors/test_agent_descriptor_windows_backup_folder.xml");
ConfigurationParser configParser = new ConfigurationParser();
configParser.parse(_descriptorFileStream, jarFileAbsolutePath);
String backupFileName = getBackupDirName((DirectoryEnvironmentUnit) configParser.getEnvironments().get(0).getEnvironmentUnits().get(2));
if (currentOs.isWindows()) {
assertEquals(IoUtils.normalizeDirPath("C:/agent_backup_dir/original dir2/"), backupFileName);
} else {
// due to file canonicalization path is interpreted as relative and gets like this:
// /home/user/workspace/.../C:/agent_backup_dir/original dir2/
backupFileName.endsWith(IoUtils.normalizeDirPath("C:/agent_backup_dir/original dir2/"));
}
} finally {
simulateOS(currentOs);
}
}
use of com.axway.ats.common.system.OperatingSystemType in project ats-framework by Axway.
the class Test_ConfigurationParser method testBackupFolder_forUnix.
@Test
public void testBackupFolder_forUnix() throws Exception {
OperatingSystemType currentOs = OperatingSystemType.getCurrentOsType();
simulateOS(OperatingSystemType.LINUX);
try {
InputStream _descriptorFileStream = Test_ConfigurationParser.class.getClassLoader().getResourceAsStream("test_descriptors/test_agent_descriptor_unix_backup_folder.xml");
ConfigurationParser configParser = new ConfigurationParser();
configParser.parse(_descriptorFileStream, jarFileAbsolutePath);
assertEquals(1, configParser.getEnvironments().get(0).getEnvironmentUnits().size());
String backupFileName = getBackupFileName((FileEnvironmentUnit) configParser.getEnvironments().get(0).getEnvironmentUnits().get(0));
assertEquals(IoUtils.normalizeFilePath("/var/backup/agent_backup/backup_test.txt"), backupFileName);
} finally {
simulateOS(currentOs);
}
}
Aggregations