changeset 189:2af53c61efc6

Canonizing thermostat etc path
author Zdenek Zambersky <zzambers@redhat.com>
date Tue, 14 Jul 2015 18:48:35 +0200
parents 2f4f704ba819
children 7ffc366993b5
files src/org/thermostat/qa2/framework/ThermostatQAConfig.java src/org/thermostat/qa2/framework/services/ThermostatFullStorage.java src/org/thermostat/qa2/framework/services/Tomcat.java src/org/thermostat/qa2/framework/utils/FileUtilities.java
diffstat 4 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/thermostat/qa2/framework/ThermostatQAConfig.java	Fri Jul 10 14:32:40 2015 +0200
+++ b/src/org/thermostat/qa2/framework/ThermostatQAConfig.java	Tue Jul 14 18:48:35 2015 +0200
@@ -31,7 +31,9 @@
 package org.thermostat.qa2.framework;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.PrintStream;
+import org.thermostat.qa2.framework.utils.FileUtilities;
 import org.thermostat.qa2.framework.utils.ThermostatUtilities;
 
 /**
@@ -160,8 +162,8 @@
         return getThermostatHome(target) + File.separator + "bin";
     }
 
-    public static String getThermostatEtcDir(String target) {
-        return getThermostatHome(target) + File.separator + "etc";
+    public static String getThermostatEtcDir(String target) throws IOException {
+        return FileUtilities.getCanonicalPath(getThermostatHome(target) + File.separator + "etc");
     }
 
     public static String getThermostatOutputTextsDir() {
--- a/src/org/thermostat/qa2/framework/services/ThermostatFullStorage.java	Fri Jul 10 14:32:40 2015 +0200
+++ b/src/org/thermostat/qa2/framework/services/ThermostatFullStorage.java	Tue Jul 14 18:48:35 2015 +0200
@@ -30,6 +30,7 @@
  */
 package org.thermostat.qa2.framework.services;
 
+import java.io.IOException;
 import org.thermostat.qa2.framework.utils.ThermostatUtilities;
 
 /**
@@ -42,11 +43,11 @@
     Tomcat tomcat;
     boolean web;
 
-    public ThermostatFullStorage() {
+    public ThermostatFullStorage() throws IOException {
         this("tested");
     }
 
-    public ThermostatFullStorage(String target) {
+    public ThermostatFullStorage(String target) throws IOException {
         storage = new ThermostatStorage(target);
         tomcat = new Tomcat(target);
     }
--- a/src/org/thermostat/qa2/framework/services/Tomcat.java	Fri Jul 10 14:32:40 2015 +0200
+++ b/src/org/thermostat/qa2/framework/services/Tomcat.java	Tue Jul 14 18:48:35 2015 +0200
@@ -31,6 +31,7 @@
 package org.thermostat.qa2.framework.services;
 
 import java.io.File;
+import java.io.IOException;
 import org.thermostat.qa2.framework.NativeProcess;
 import org.thermostat.qa2.framework.ThermostatQAConfig;
 
@@ -44,11 +45,11 @@
     String thermostatEtcDir;
     boolean packaged = false;
 
-    public Tomcat() {
+    public Tomcat() throws IOException {
         this("tested");
     }
 
-    public Tomcat(String targetThermostat) {
+    public Tomcat(String targetThermostat) throws IOException {
         this(ThermostatQAConfig.tomcatHome, ThermostatQAConfig.getThermostatEtcDir(targetThermostat));
         if (targetThermostat.equals("tested") && ThermostatQAConfig.thermostatPackaged) {
             packaged = true;
--- a/src/org/thermostat/qa2/framework/utils/FileUtilities.java	Fri Jul 10 14:32:40 2015 +0200
+++ b/src/org/thermostat/qa2/framework/utils/FileUtilities.java	Tue Jul 14 18:48:35 2015 +0200
@@ -63,6 +63,10 @@
         return name;
     }
 
+    public static String getCanonicalPath(String s) throws IOException {
+        return new File(s).getCanonicalPath();
+    }
+
     public static String getUniqueTempFile(String name) {
         return getUniqueFile(ThermostatQAConfig.backupDir + File.separator + name);
     }