Author: samindaw
Date: Tue Oct  1 00:43:27 2013
New Revision: 1527833

URL: http://svn.apache.org/r1527833
Log:
https://issues.apache.org/jira/browse/AIRAVATA-915

Added:
    
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/OsUtils.java
    airavata/trunk/modules/integration-tests/src/test/resources/comma_data.bat
Modified:
    
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
    
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/ForEachCaseIT.java

Modified: 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java?rev=1527833&r1=1527832&r2=1527833&view=diff
==============================================================================
--- 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
 (original)
+++ 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
 Tue Oct  1 00:43:27 2013
@@ -276,7 +276,7 @@ public class BaseCaseIT {
 
         // Deployment descriptor
         ApplicationDescription applicationDeploymentDescription = 
descriptorBuilder
-                .buildApplicationDeploymentDescription("EchoApplication", 
"/bin/echo", "/tmp");
+                .buildApplicationDeploymentDescription("EchoApplication", 
OsUtils.getEchoExecutable(), OsUtils.getTempFolderPath());
 
         log("Adding deployment description ...");
         
airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription,
 hostDescription,
@@ -348,7 +348,7 @@ public class BaseCaseIT {
 
         // Deployment descriptor
         ApplicationDescription applicationDeploymentDescription = 
descriptorBuilder
-                .buildApplicationDeploymentDescription("EchoApplication", 
"/bin/echo", "/tmp");
+                .buildApplicationDeploymentDescription("EchoApplication", 
OsUtils.getEchoExecutable(), OsUtils.getTempFolderPath());
 
         log("Adding deployment description ...");
         try {

Modified: 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/ForEachCaseIT.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/ForEachCaseIT.java?rev=1527833&r1=1527832&r2=1527833&view=diff
==============================================================================
--- 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/ForEachCaseIT.java
 (original)
+++ 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/ForEachCaseIT.java
 Tue Oct  1 00:43:27 2013
@@ -284,12 +284,18 @@ public class ForEachCaseIT {
                 serviceDescription2.getType().getName()));
 
         // Deployment descriptor
-        File executable = getFile("src/test/resources/comma_data.sh");
-        Runtime.getRuntime().exec("chmod +x "+executable.getAbsolutePath());
+        File executable;
+        if(OsUtils.isWindows()) {
+               executable = getFile("src/test/resources/comma_data.bat");
+        } else {
+               executable = getFile("src/test/resources/comma_data.sh");
+               Runtime.getRuntime().exec("chmod +x 
"+executable.getAbsolutePath());
+        }
+        
                ApplicationDescription applicationDeploymentDescription = 
descriptorBuilder
-                .buildApplicationDeploymentDescription("comma_app_localhost", 
executable.getAbsolutePath(), "/tmp");
+                .buildApplicationDeploymentDescription("comma_app_localhost", 
executable.getAbsolutePath(), OsUtils.getTempFolderPath());
                ApplicationDescription applicationDeploymentDescription2 = 
descriptorBuilder
-                .buildApplicationDeploymentDescription("echo_app_localhost", 
"/bin/echo", "/tmp");
+                .buildApplicationDeploymentDescription("echo_app_localhost", 
OsUtils.getEchoExecutable(), OsUtils.getTempFolderPath());
 
         log("Adding deployment description ...");
         
airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription,
 hostDescription,

Added: 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/OsUtils.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/OsUtils.java?rev=1527833&view=auto
==============================================================================
--- 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/OsUtils.java
 (added)
+++ 
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/OsUtils.java
 Tue Oct  1 00:43:27 2013
@@ -0,0 +1,30 @@
+package org.apache.airavata.integration;
+
+import java.io.File;
+import java.io.IOException;
+
+public final class OsUtils
+{
+   private static String OS = null;
+   public static String getOsName()
+   {
+      if(OS == null) { OS = System.getProperty("os.name"); }
+      return OS;
+   }
+   public static boolean isWindows()
+   {
+      return getOsName().startsWith("Windows");
+   }
+   
+   public static String getEchoExecutable() {
+          if(isWindows())
+                  return "echo";
+           else 
+               return "/bin/echo";
+   }
+   
+   public static String getTempFolderPath() throws IOException {
+          return File.createTempFile("tmp",null).getParent();
+   }
+
+}
\ No newline at end of file

Added: 
airavata/trunk/modules/integration-tests/src/test/resources/comma_data.bat
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/integration-tests/src/test/resources/comma_data.bat?rev=1527833&view=auto
==============================================================================
--- airavata/trunk/modules/integration-tests/src/test/resources/comma_data.bat 
(added)
+++ airavata/trunk/modules/integration-tests/src/test/resources/comma_data.bat 
Tue Oct  1 00:43:27 2013
@@ -0,0 +1,10 @@
+@ECHO off & setlocal enabledelayedexpansion
+SET first=1
+FOR %%A IN (%*) DO (
+       IF !first! EQU 1 (
+               ECHO %%A
+               SET first=0
+       ) ELSE (
+               ECHO ,%%A
+       )
+)
\ No newline at end of file


Reply via email to