You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by pa...@apache.org on 2012/04/23 01:07:31 UTC
svn commit: r1328989 - in
/incubator/airavata/trunk/modules/gfac-core/src/test:
java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImplTest.java
resources/echo.bat
Author: patanachai
Date: Sun Apr 22 23:07:31 2012
New Revision: 1328989
URL: http://svn.apache.org/viewvc?rev=1328989&view=rev
Log:
AIRAVATA-371 using "echo.bat" for testing when compile on windows
Added:
incubator/airavata/trunk/modules/gfac-core/src/test/resources/echo.bat
Modified:
incubator/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImplTest.java
Modified: incubator/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImplTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImplTest.java?rev=1328989&r1=1328988&r2=1328989&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImplTest.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImplTest.java Sun Apr 22 23:07:31 2012
@@ -23,6 +23,8 @@ package org.apache.airavata.core.gfac.se
import static org.junit.Assert.fail;
+import java.io.File;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -42,6 +44,8 @@ import org.apache.airavata.schemas.gfac.
import org.apache.airavata.schemas.gfac.InputParameterType;
import org.apache.airavata.schemas.gfac.OutputParameterType;
import org.apache.airavata.schemas.gfac.StringParameterType;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.SystemUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -73,13 +77,32 @@ public class PropertiesBasedServiceImplT
ApplicationName name = ApplicationName.Factory.newInstance();
name.setStringValue("EchoLocal");
app.setApplicationName(name);
- app.setExecutableLocation("/bin/echo");
- app.setScratchWorkingDirectory("/tmp");
- app.setStaticWorkingDirectory("/tmp");
- app.setInputDataDirectory("/tmp/input");
- app.setOutputDataDirectory("/tmp/output");
- app.setStandardOutput("/tmp/echo.stdout");
- app.setStandardError("/tmp/echo.stdout");
+
+ /*
+ * Use bat file if it is compiled on Windows
+ */
+ if(SystemUtils.IS_OS_WINDOWS){
+ URL url = this.getClass().getClassLoader().getResource("echo.bat");
+ app.setExecutableLocation(url.getFile());
+ }else{
+ //for unix and Mac
+ app.setExecutableLocation("/bin/echo");
+ }
+
+ /*
+ * Default tmp location
+ */
+ String tempDir = System.getProperty("java.io.tmpdir");
+ if(tempDir == null){
+ tempDir = "/tmp";
+ }
+
+ app.setScratchWorkingDirectory(tempDir);
+ app.setStaticWorkingDirectory(tempDir);
+ app.setInputDataDirectory(tempDir + File.separator + "input");
+ app.setOutputDataDirectory(tempDir + File.separator + "output");
+ app.setStandardOutput(tempDir + File.separator + "echo.stdout");
+ app.setStandardError(tempDir + File.separator + "echo.stdout");
/*
* Service
Added: incubator/airavata/trunk/modules/gfac-core/src/test/resources/echo.bat
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/test/resources/echo.bat?rev=1328989&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/test/resources/echo.bat (added)
+++ incubator/airavata/trunk/modules/gfac-core/src/test/resources/echo.bat Sun Apr 22 23:07:31 2012
@@ -0,0 +1,22 @@
+::
+::
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements. See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership. The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License. You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied. See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+::
+::
+@echo off
+echo %1^=%2
\ No newline at end of file