You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ra...@apache.org on 2013/03/21 19:06:55 UTC

svn commit: r1459429 - in /airavata/trunk/modules/gfac-core: ./ src/main/java/org/apache/airavata/gfac/provider/impl/ src/main/java/org/apache/airavata/gfac/provider/utils/ src/test/java/org/apache/airavata/core/gfac/services/impl/

Author: raminder
Date: Thu Mar 21 18:06:55 2013
New Revision: 1459429

URL: http://svn.apache.org/r1459429
Log: (empty)

Added:
    airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3Test.java   (with props)
Modified:
    airavata/trunk/modules/gfac-core/pom.xml
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ApplicationProcessor.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLGenerator.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLUtils.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceProcessor.java
    airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java
    airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTest.java
    airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTest.java
    airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java

Modified: airavata/trunk/modules/gfac-core/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/pom.xml?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/pom.xml (original)
+++ airavata/trunk/modules/gfac-core/pom.xml Thu Mar 21 18:06:55 2013
@@ -1,209 +1,211 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!--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. -->
+<!--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. -->
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <groupId>org.apache.airavata</groupId>
-        <artifactId>airavata</artifactId>
-        <version>0.7-SNAPSHOT</version>
-        <relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>airavata-gfac-core</artifactId>
-    <name>Airavata GFac Core</name>
-    <description>The core GFAC functionality independent from any webservice implementation.</description>
-    <url>http://airavata.apache.org/</url>
-
-    <dependencies>
-        <dependency>
-            <groupId>cog-jglobus</groupId>
-            <artifactId>cog-jglobus</artifactId>
-            <version>1.8.0_bc</version>
-        </dependency>
-        <dependency>
-            <groupId>cog-globus</groupId>
-            <artifactId>puretls</artifactId>
-            <type>jar</type>
-            <version>1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>cog-globus</groupId>
-            <artifactId>cryptix32</artifactId>
-            <version>1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.bouncycastle</groupId>
-            <artifactId>bcprov-jdk16</artifactId>
-            <version>1.46</version>
-        </dependency>
-        <dependency>
-            <groupId>cog-globus</groupId>
-            <artifactId>cryptix-asn1</artifactId>
-            <version>1.0</version>
-        </dependency>
-        <!-- dependency>
-            <groupId>commons-configuration</groupId>
-            <artifactId>commons-configuration</artifactId>
-            <version>1.6</version>
-        </dependency>
- 		-->
-        <!-- Logging -->
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <!-- GFAC schemas -->
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-client-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-workflow-execution-context</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <!-- Workflow Tracking -->
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-workflow-tracking</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <!-- SSH -->
-        <dependency>
-            <groupId>net.schmizz</groupId>
-            <artifactId>sshj</artifactId>
-            <version>0.8.0</version>
-        </dependency>
-
-        <!-- Amazon -->
-        <dependency>
-            <groupId>com.amazonaws</groupId>
-            <artifactId>aws-java-sdk</artifactId>
-            <version>1.3.20</version>
-        </dependency>
-
-        <!-- Test -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>j2ssh</groupId>
-            <artifactId>j2ssh-core</artifactId>
-            <version>0.2.9</version>
-            <type>jar</type>
-        </dependency>
-        <dependency>
-            <groupId>j2ssh</groupId>
-            <artifactId>j2ssh-common</artifactId>
-            <version>0.2.9</version>
-            <type>jar</type>
-        </dependency>
-        <!-- Unicore dependencies -->
-        <dependency>
-            <groupId>eu.unicore</groupId>
-            <artifactId>ogsabes-client</artifactId>
-            <version>1.6.0-SNAPSHOT</version>
-        </dependency>
-         <!-- Hadoop provider related dependencies -->
-        <dependency>
-            <groupId>org.apache.hadoop</groupId>
-            <artifactId>hadoop-core</artifactId>
-            <version>1.0.3</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.hadoop</groupId>
-            <artifactId>hadoop-client</artifactId>
-            <version>1.0.3</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.whirr</groupId>
-            <artifactId>whirr-core</artifactId>
-            <version>0.7.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.whirr</groupId>
-            <artifactId>whirr-hadoop</artifactId>
-            <version>0.7.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-all</artifactId>
-            <version>1.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <version>1.8.5</version>
-        </dependency>
-        <dependency>
-            <groupId>com.jcraft</groupId>
-            <artifactId>jsch</artifactId>
-            <version>0.1.44-1</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-configuration</groupId>
-            <artifactId>commons-configuration</artifactId>
-            <version>1.7</version>
-        </dependency>
-        <dependency>
-            <groupId>net.sf.jopt-simple</groupId>
-            <artifactId>jopt-simple</artifactId>
-            <version>3.2</version>
-        </dependency>
-        <dependency>
-            <groupId>net.sf.wsag4j.types</groupId>
-            <artifactId>wsag4j-jsdl-types</artifactId>
-            <version>2.0.0</version>
-        </dependency>
-        <!-- Guava -->
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>12.0</version>
-        </dependency>
-    </dependencies>
-
-     <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-        <!--skip>true</skip-->
-          <excludes>
-            <exclude>**/services/**</exclude>
-          </excludes>
-          <forkMode>always</forkMode>
-          <useSystemClassloader>true</useSystemClassloader>
-          <failIfNoTests>false</failIfNoTests>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<parent>
+		<groupId>org.apache.airavata</groupId>
+		<artifactId>airavata</artifactId>
+		<version>0.7-SNAPSHOT</version>
+		<relativePath>../../pom.xml</relativePath>
+	</parent>
+
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>airavata-gfac-core</artifactId>
+	<name>Airavata GFac Core</name>
+	<description>The core GFAC functionality independent from any webservice implementation.</description>
+	<url>http://airavata.apache.org/</url>
+
+	<dependencies>
+		<dependency>
+			<groupId>cog-jglobus</groupId>
+			<artifactId>cog-jglobus</artifactId>
+			<version>1.8.0_bc</version>
+		</dependency>
+		<dependency>
+			<groupId>cog-globus</groupId>
+			<artifactId>puretls</artifactId>
+			<type>jar</type>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>cog-globus</groupId>
+			<artifactId>cryptix32</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<!-- <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk16</artifactId> 
+			<version>1.46</version> </dependency> -->
+		<dependency>
+			<groupId>cog-globus</groupId>
+			<artifactId>cryptix-asn1</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-configuration</groupId>
+			<artifactId>commons-configuration</artifactId>
+			<version>1.6</version>
+		</dependency>
+
+		<!-- Logging -->
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+		</dependency>
+
+		<!-- GFAC schemas -->
+		<dependency>
+			<groupId>org.apache.airavata</groupId>
+			<artifactId>airavata-client-api</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.airavata</groupId>
+			<artifactId>airavata-workflow-execution-context</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+		<!-- Workflow Tracking -->
+		<dependency>
+			<groupId>org.apache.airavata</groupId>
+			<artifactId>airavata-workflow-tracking</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+		<!-- SSH -->
+		<dependency>
+			<groupId>net.schmizz</groupId>
+			<artifactId>sshj</artifactId>
+			<version>0.8.0</version>
+		</dependency>
+
+		<!-- Amazon -->
+		<dependency>
+			<groupId>com.amazonaws</groupId>
+			<artifactId>aws-java-sdk</artifactId>
+			<version>1.3.20</version>
+		</dependency>
+
+		<!-- Test -->
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>jcl-over-slf4j</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>j2ssh</groupId>
+			<artifactId>j2ssh-core</artifactId>
+			<version>0.2.9</version>
+			<type>jar</type>
+		</dependency>
+		<dependency>
+			<groupId>j2ssh</groupId>
+			<artifactId>j2ssh-common</artifactId>
+			<version>0.2.9</version>
+			<type>jar</type>
+		</dependency>
+
+		<!-- Unicore dependencies -->
+		<dependency>
+			<groupId>eu.unicore</groupId>
+			<artifactId>ogsabes-client</artifactId>
+			<version>1.6.0</version>
+		</dependency>
+
+		<!-- Hadoop provider related dependencies -->
+		<dependency>
+			<groupId>org.apache.hadoop</groupId>
+			<artifactId>hadoop-core</artifactId>
+			<version>1.0.3</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.hadoop</groupId>
+			<artifactId>hadoop-client</artifactId>
+			<version>1.0.3</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.whirr</groupId>
+			<artifactId>whirr-core</artifactId>
+			<version>0.7.1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.whirr</groupId>
+			<artifactId>whirr-hadoop</artifactId>
+			<version>0.7.1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.hamcrest</groupId>
+			<artifactId>hamcrest-all</artifactId>
+			<version>1.1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.mockito</groupId>
+			<artifactId>mockito-all</artifactId>
+			<version>1.8.5</version>
+		</dependency>
+		<dependency>
+			<groupId>com.jcraft</groupId>
+			<artifactId>jsch</artifactId>
+			<version>0.1.44-1</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-configuration</groupId>
+			<artifactId>commons-configuration</artifactId>
+			<version>1.7</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.jopt-simple</groupId>
+			<artifactId>jopt-simple</artifactId>
+			<version>3.2</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.wsag4j.types</groupId>
+			<artifactId>wsag4j-jsdl-types</artifactId>
+			<version>2.0.0</version>
+		</dependency>
+		<!-- Guava -->
+		<dependency>
+			<groupId>com.google.guava</groupId>
+			<artifactId>guava</artifactId>
+			<version>12.0</version>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<!--skip>true</skip -->
+					<excludes>
+						<exclude>**/services/**</exclude>
+					</excludes>
+					<forkMode>always</forkMode>
+					<useSystemClassloader>true</useSystemClassloader>
+					<failIfNoTests>false</failIfNoTests>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
 
 </project>
\ No newline at end of file

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java Thu Mar 21 18:06:55 2013
@@ -46,7 +46,7 @@ import org.ggf.schemas.bes.x2006.x08.bes
 import org.ggf.schemas.bes.x2006.x08.besFactory.CreateActivityResponseDocument;
 import org.ggf.schemas.bes.x2006.x08.besFactory.GetActivityStatusesDocument;
 import org.ggf.schemas.bes.x2006.x08.besFactory.GetActivityStatusesResponseDocument;
-import org.globus.gsi.GlobusCredential;
+import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3.x2005.x08.addressing.EndpointReferenceType;
@@ -67,14 +67,14 @@ public class BESProvider implements GFac
     private DefaultClientConfiguration secProperties;
 
     private String jobId;
-
-
-
+    
+    
+        
     @Override
 	public void initialize(JobExecutionContext jobExecutionContext)
-			throws GFacProviderException,GFacException {
-
-    	log.info("Initializing GFAC's <<< UNICORE Provider >>>");
+			throws GFacProviderException, GFacException {
+		
+    	log.info("Initializing UNICORE Provider");
     	initSecurityProperties(jobExecutionContext);
     	log.debug("initialized security properties");
 
@@ -84,7 +84,7 @@ public class BESProvider implements GFac
 	public void execute(JobExecutionContext jobExecutionContext)
 			throws GFacProviderException {
 		UnicoreHostType host = (UnicoreHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
-
+        
         String factoryUrl = host.getUnicoreHostAddressArray()[0];
 
         EndpointReferenceType eprt = EndpointReferenceType.Factory.newInstance();
@@ -92,14 +92,14 @@ public class BESProvider implements GFac
 
         CreateActivityDocument cad = CreateActivityDocument.Factory
                 .newInstance();
-
+        
         try {
 			cad.addNewCreateActivity().addNewActivityDocument()
 			        .setJobDefinition(JSDLGenerator.buildJSDLInstance(jobExecutionContext).getJobDefinition());
 		} catch (Exception e1) {
 			throw new GFacProviderException("Cannot generate JSDL instance from the JobExecutionContext.",e1);
 		}
-
+        
         FactoryClient factory = null;
         try {
             factory = new FactoryClient(eprt, secProperties);
@@ -108,36 +108,35 @@ public class BESProvider implements GFac
         }
         CreateActivityResponseDocument response = null;
         try {
-            log.info("========================================");
             log.info(String.format("Activity Submitting to %s ... \n", factoryUrl));
             response = factory.createActivity(cad);
             log.info(String.format("Activity Submitted to %s \n", factoryUrl));
         } catch (Exception e) {
         	e.printStackTrace();
             throw new GFacProviderException("Cannot create activity.", e);
-        }
+        } 
         EndpointReferenceType activityEpr = response
                 .getCreateActivityResponse().getActivityIdentifier();
-
+        
         log.debug("Activity EPR: "+activityEpr);
-
+        
         log.info("Activity: "+activityEpr.getAddress().getStringValue()+  " Submitted.");
-
+        
         //factory.waitWhileActivityIsDone(activityEpr, 1000);
         jobId = WSUtilities.extractResourceID(activityEpr);
         if (jobId == null) {
             jobId = new Long(Calendar.getInstance().getTimeInMillis())
                     .toString();
         }
-
+        
         log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), factory.getActivityStatus(activityEpr)
                 .toString()));
-
-
+        
+        
         //TODO publish the status messages to the message bus
         while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED) &&
                 (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED)){
-
+        	
             ActivityStatusType activityStatus = null;
     		try {
     			activityStatus = getStatus(factory, activityEpr);
@@ -145,7 +144,7 @@ public class BESProvider implements GFac
     		} catch (UnknownActivityIdentifierFault e) {
     			throw new GFacProviderException(e.getMessage(), e.getCause());
     		}
-
+	
             try {
                 Thread.sleep(2000);
             } catch (InterruptedException e) {
@@ -153,21 +152,21 @@ public class BESProvider implements GFac
             }
             continue;
         }
-
+        
         ActivityStatusType activityStatus = null;
 		try {
 			activityStatus = getStatus(factory, activityEpr);
 		} catch (UnknownActivityIdentifierFault e) {
 			throw new GFacProviderException(e.getMessage(), e.getCause());
 		}
-
+        
         log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), activityStatus.getState().toString()));
-
+        
 		if ((activityStatus.getState() == ActivityStateEnumeration.FAILED)) {
 				log.info(activityStatus.getFault().getFaultcode().getLocalPart()
 						+ "\n" + activityStatus.getFault().getFaultstring());
 				log.info("EXITCODE: "+activityStatus.getExitCode());
-		}
+		} 
 	}
 
 	@Override
@@ -175,59 +174,66 @@ public class BESProvider implements GFac
 			throws GFacProviderException {
 		secProperties = null;
 	}
-
-
-	protected void initSecurityProperties(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException{
-
+	
+	
+	protected void initSecurityProperties(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException{
+		
 		if (secProperties != null) return;
+		
 
+		
 		GSISecurityContext gssContext = (GSISecurityContext)jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT);
-		GlobusCredential credentials = gssContext.getGlobusCredential();
+//		GlobusCredential credentials = gssContext.getGlobusCredential();
+		
+		GlobusGSSCredentialImpl gss = (GlobusGSSCredentialImpl) gssContext.getGssCredentails();
+		
 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
+		
 		BufferedOutputStream bufos = new BufferedOutputStream(bos);
-
+		
 		ByteArrayInputStream bis = null;
 		BufferedInputStream bufis = null;
 		try{
-			credentials.save(bufos);
+			gss.getGlobusCredential().save(bufos);
 			bufos.flush();
-
+			
+			
+			
 			//TODO: to be supported by airavata gsscredential class
 			List<String> trustedCert = new ArrayList<String>();
 			trustedCert.add(gssContext.getTrustedCertLoc()+"/*.0");
 			trustedCert.add(gssContext.getTrustedCertLoc()+"/*.pem");
-
+			
 			char[] c = null;
-
+			
 			DirectoryCertChainValidator dcValidator = new DirectoryCertChainValidator(trustedCert, Encoding.PEM, -1, 60000, null);
 			bis = new ByteArrayInputStream(bos.toByteArray());
 			bufis = new BufferedInputStream(bis);
 			PEMCredential pem = new PEMCredential(bufis, c);
-
+			
 			secProperties = new DefaultClientConfiguration(dcValidator, pem);
 			secProperties.doSSLAuthn();
-
+			
 			String[] outHandlers = secProperties.getOutHandlerClassNames();
-
-			Set<String> outHandlerLst = null;
-
+			
+			Set<String> outHandlerLst = null; 
+			
 	        if(outHandlers == null) {
 	        	outHandlerLst = new HashSet<String>();
 	        }
 	        else  {
 	        	outHandlerLst = new HashSet<String>(Arrays.asList(outHandlers));
 	        }
-
+	        
 	        outHandlerLst.add("de.fzj.unicore.uas.security.ProxyCertOutHandler");
-
+	        
 	        secProperties.setOutHandlerClassNames(outHandlerLst.toArray(new String[outHandlerLst.size()]));
-
-
+	        
+	        
 		}
 		catch (Exception e) {
-			throw new GFacProviderException(e.getMessage(), e);
-		}
+			throw new GFacProviderException(e.getMessage(), e); 
+		} 
 		finally{
 			try {
 				if(bos!=null)bos.close();
@@ -239,33 +245,33 @@ public class BESProvider implements GFac
 			}
 		}
 	}
-
+	
 	protected ActivityStatusType getStatus(FactoryClient fc, EndpointReferenceType activityEpr) throws UnknownActivityIdentifierFault{
-
+		
     	GetActivityStatusesDocument stats = GetActivityStatusesDocument.Factory.newInstance();
-
+    	
     	stats.addNewGetActivityStatuses().setActivityIdentifierArray(new EndpointReferenceType[] {activityEpr});
-
+    	
 		GetActivityStatusesResponseDocument resDoc = fc.getActivityStatuses(stats);
-
+		
 		ActivityStatusType activityStatus = resDoc
 				.getGetActivityStatusesResponse()
 				.getResponseArray()[0].getActivityStatus();
 		return activityStatus;
 	}
-
-
+	
+	
 	protected String formatStatusMessage(String activityUrl, String status){
 		return String.format("Activity %s is %s.\n", activityUrl, status);
 	}
-
+	
 	protected String subStatusAsString(ActivityStatusType statusType) {
-
-
+		
+		
 		StringBuffer sb = new StringBuffer();
-
+		
 		sb.append(statusType.getState().toString());
-
+		
 		XmlCursor acursor = statusType.newCursor();
 		if (acursor.toFirstChild()) {
 			do {
@@ -277,10 +283,9 @@ public class BESProvider implements GFac
 			acursor.dispose();
 			return sb.toString();
 		} else {
-			acursor.dispose();
+			acursor.dispose();                               
 			return sb.toString();
 		}
-
+		
 	}
-
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ApplicationProcessor.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ApplicationProcessor.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ApplicationProcessor.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ApplicationProcessor.java Thu Mar 21 18:06:55 2013
@@ -1,5 +1,27 @@
+/*
+ *
+ * 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.
+ *
+*/
 package org.apache.airavata.gfac.provider.utils;
 
+import java.io.File;
+
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.schemas.gfac.ExtendedKeyValueType;
 import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
@@ -9,14 +31,10 @@ import org.ggf.schemas.jsdl.x2005.x11.js
 import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionType;
 import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.EnvironmentType;
 import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.FileNameType;
-import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.LimitsType;
 import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.NumberOfProcessesType;
 import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.ProcessesPerHostType;
 import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.ThreadsPerProcessType;
 
-import java.io.File;
-import java.math.BigInteger;
-
 
 public class ApplicationProcessor {
 	
@@ -28,24 +46,6 @@ public class ApplicationProcessor {
 		
 		createGenericApplication(value, appDepType);
 		
-		if (appDepType.getMaxWallTime() > 0) {
-			
-			if(!isParallelJob(appDepType)) {
-				LimitsType limitType = LimitsType.Factory.newInstance();
-				BigInteger bi = BigInteger.valueOf(appDepType.getMaxWallTime());
-				limitType.setBigIntegerValue(bi);
-				JSDLUtils.getOrCreatePOSIXApplication(value).setWallTimeLimit(limitType);
-			}
-			
-			else {
-				LimitsType limitType = LimitsType.Factory.newInstance();
-				Integer i = appDepType.getMaxWallTime();
-				limitType.setStringValue(i.toString());
-//				JSDLUtils.getOrCreateSPMDApplication(value).setWallTimeLimit(limitType);
-			}
-		}
-
-
 		if (appDepType.getApplicationEnvironmentArray().length > 0) {
 			createApplicationEnvironment(value,
 					appDepType.getApplicationEnvironmentArray(), appDepType);

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLGenerator.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLGenerator.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLGenerator.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLGenerator.java Thu Mar 21 18:06:55 2013
@@ -31,7 +31,6 @@ import org.slf4j.LoggerFactory;
 /**
  * 
  * Utility class generates a JSDL instance from JobExecutionContext instance
- * @author shahbaz memon
  * 
  * */
 

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLUtils.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLUtils.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/JSDLUtils.java Thu Mar 21 18:06:55 2013
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.
+ *
+*/
 package org.apache.airavata.gfac.provider.utils;
 
 
@@ -33,8 +53,6 @@ import org.ogf.schemas.jsdl.x2007.x02.js
 
 /**
  * 
- * @author shahbaz memon, bastian demuth
- *
  */
 public class JSDLUtils
 {

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceProcessor.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceProcessor.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceProcessor.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceProcessor.java Thu Mar 21 18:06:55 2013
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.
+ *
+*/
 package org.apache.airavata.gfac.provider.utils;
 
 import org.apache.airavata.gfac.context.JobExecutionContext;
@@ -38,7 +58,15 @@ public class ResourceProcessor {
 			rangeType.setExact(appDepType.getNodeCount());
 			JSDLUtils.setTotalResourceCountRequirements(value, rangeType);
 		}
-
+		
+		if(appDepType.getMaxWallTime() > 0) {
+			RangeValueType cpuTime = new RangeValueType();
+			cpuTime.setLowerBound(Double.NaN);
+			cpuTime.setUpperBound(Double.NaN);
+			long wallTime = appDepType.getMaxWallTime() * 60;
+			cpuTime.setExact(wallTime);
+			JSDLUtils.setIndividualCPUTimeRequirements(value, cpuTime);
+		}
 	}
 	
 	

Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java Thu Mar 21 18:06:55 2013
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.
+ *
+*/
 package org.apache.airavata.core.gfac.services.impl;
 
 import java.io.File;
@@ -19,104 +39,100 @@ import org.apache.log4j.PropertyConfigur
 
 public abstract class AbstractBESTest {
 
-        protected JobExecutionContext jobExecutionContext;
+	protected JobExecutionContext jobExecutionContext;
 
-//       public static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory" };
-
-
-        public static final String[] hostArray = new String[] { "https://deisa-unic.fz-juelich.de:9111/FZJ_JUROPA/services/BESFactory?res=default_bes_factory" };
-
-
-
-        //directory where data will be copy into and copied out to unicore resources
-
-
-
-//      public static final String gridftpAddress = "gsiftp://gridftp1.ls4.tacc.utexas.edu:2811";
-//      public static final String scratchDir = "/scratch/02055/msmemon/airavata";
-
-
-//      public static final String gridftpAddress = "gsiftp://gridftp.psc.xsede.org:2811";
-//      public static final String scratchDir = "/brashear/msmemon/airavata/";
-
-
-        public static final String gridftpAddress = "gsiftp://osg-xsede.grid.iu.edu:2811/";
-        public static final String scratchDir = "/home/msmemon/airavata/";
-
-
-
-
-        protected String remoteTempDir = null;
-
-
-
-        protected void initTest() throws Exception {
-                PropertyConfigurator.configure("src/test/resources/logging.properties");
-
-                /*
-                 * Default tmp location
-                 */
-                String date = (new Date()).toString();
-                date = date.replaceAll(" ", "_");
-                date = date.replaceAll(":", "_");
-
-
-                remoteTempDir = scratchDir + File.separator + "BESJOB" + "_" + date + "_"
-                                + UUID.randomUUID();
-                jobExecutionContext = new JobExecutionContext(getGFACConfig(), getServiceDesc("BES-APP-Service").getType().getName());
-                GSISecurityContext context = new GSISecurityContext();
-        		context.setMyproxyLifetime(3600);
-        		context.setMyproxyServer("myproxy.teragrid.org");
-        		context.setMyproxyUserName("*****");
-        		context.setMyproxyPasswd("*****");
-        		context.setTrustedCertLoc("./certificates");
-        		jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, context);
-                jobExecutionContext.setApplicationContext(getApplicationContext());
-                jobExecutionContext.setInMessageContext(getInMessageContext());
-                jobExecutionContext.setOutMessageContext(getOutMessageContext());
-
-        }
-
-        protected abstract void submitJob() throws Exception;
-
-        protected GFacConfiguration getGFACConfig() throws Exception{
-        URL resource = this.getClass().getClassLoader().getResource("gfac-config.xml");
-        System.out.println(resource.getFile());
-        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
-        return gFacConfiguration;
-        }
-
-        protected ApplicationContext getApplicationContext() {
-                ApplicationContext applicationContext = new ApplicationContext();
-                applicationContext.setHostDescription(getHostDesc());
-                return applicationContext;
-        }
-
-        protected HostDescription getHostDesc() {
-                HostDescription host = new HostDescription(UnicoreHostType.type);
-                host.getType().setHostAddress("zam1161v01.zam.kfa-juelich.de");
-                host.getType().setHostName("DEMO-INTEROP-SITE");
-                ((UnicoreHostType) host.getType()).setUnicoreHostAddressArray(hostArray);
-                ((UnicoreHostType) host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
-                return host;
-        }
-
-
-        protected abstract ApplicationDescription getApplicationDesc(JobTypeType jobType);
-
-
-        protected ServiceDescription getServiceDesc(String serviceName) {
-                ServiceDescription serv = new ServiceDescription();
-                serv.getType().setName(serviceName);
-                return serv;
-        }
-
-
-        protected abstract MessageContext getInMessageContext();
-
-
-
-        protected abstract MessageContext getOutMessageContext();
+	public static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory" };
 
+	// public static final String[] hostArray = new String[] {
+	// "https://deisa-unic.fz-juelich.de:9111/FZJ_JUROPA/services/BESFactory?res=default_bes_factory"
+	// };
+
+	// directory where data will be copy into and copied out to unicore
+	// resources
+
+	// public static final String gridftpAddress =
+	// "gsiftp://gridftp1.ls4.tacc.utexas.edu:2811";
+	// public static final String scratchDir = "/scratch/01129/tg804076/";
+
+	// public static final String gridftpAddress =
+	// "gsiftp://gridftp.psc.xsede.org:2811";
+	// public static final String scratchDir = "/brashear/msmemon/airavata/";
+
+	public static final String gridftpAddress = "gsiftp://osg-xsede.grid.iu.edu:2811/";
+	public static final String scratchDir = "/home/ramifnu/airavata/";
+
+	protected String remoteTempDir = null;
+
+	protected void initTest() throws Exception {
+		PropertyConfigurator.configure("src/test/resources/logging.properties");
+		/*
+		 * Default tmp location
+		 */
+		String date = (new Date()).toString();
+		date = date.replaceAll(" ", "_");
+		date = date.replaceAll(":", "_");
+
+		remoteTempDir = scratchDir + File.separator + "BESJOB" + "_" + date
+				+ "_" + UUID.randomUUID();
+		jobExecutionContext = new JobExecutionContext(getGFACConfig(),
+				getServiceDesc("BES-APP-Service").getType().getName());
+		jobExecutionContext.setApplicationContext(getApplicationContext());
+		jobExecutionContext.setInMessageContext(getInMessageContext());
+		jobExecutionContext.setOutMessageContext(getOutMessageContext());
+		jobExecutionContext.addSecurityContext(
+				GSISecurityContext.GSI_SECURITY_CONTEXT, getSecurityContext());
+
+	}
+
+	protected abstract void submitJob() throws Exception;
+
+	protected GFacConfiguration getGFACConfig() throws Exception {
+		URL resource = this.getClass().getClassLoader()
+				.getResource("gfac-config.xml");
+		System.out.println(resource.getFile());
+		return GFacConfiguration.create(new File(resource.getPath()), null,
+				null);
+	}
+
+	protected ApplicationContext getApplicationContext() {
+		ApplicationContext applicationContext = new ApplicationContext();
+		applicationContext.setHostDescription(getHostDesc());
+		return applicationContext;
+	}
+
+	protected HostDescription getHostDesc() {
+		HostDescription host = new HostDescription(UnicoreHostType.type);
+		host.getType().setHostAddress("zam1161v01.zam.kfa-juelich.de");
+		host.getType().setHostName("DEMO-INTEROP-SITE");
+		((UnicoreHostType) host.getType())
+				.setUnicoreHostAddressArray(hostArray);
+		((UnicoreHostType) host.getType())
+				.setGridFTPEndPointArray(new String[] { gridftpAddress });
+		return host;
+	}
+
+	protected abstract ApplicationDescription getApplicationDesc(
+			JobTypeType jobType);
+
+	protected ServiceDescription getServiceDesc(String serviceName) {
+		ServiceDescription serv = new ServiceDescription();
+		serv.getType().setName(serviceName);
+		return serv;
+	}
+
+	protected abstract MessageContext getInMessageContext();
+
+	protected abstract MessageContext getOutMessageContext();
+
+	private GSISecurityContext getSecurityContext() {
+		GSISecurityContext context = new GSISecurityContext();
+		context.setMyproxyLifetime(3600);
+		context.setMyproxyServer("myproxy.teragrid.org");
+		context.setMyproxyUserName("******");
+		context.setMyproxyPasswd("*******");
+		// Add Unicore certificate to this folder
+		context.setTrustedCertLoc("/Users/raminder/.globus/certificates");
+		return context;
+	}
 
 }

Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTest.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTest.java Thu Mar 21 18:06:55 2013
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.
+ *
+*/
 package org.apache.airavata.core.gfac.services.impl;
 
 import java.io.File;
@@ -12,8 +32,6 @@ import org.apache.airavata.schemas.gfac.
 import org.apache.airavata.schemas.gfac.ExtendedKeyValueType;
 import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
 import org.apache.airavata.schemas.gfac.JobTypeType;
-import org.apache.airavata.schemas.gfac.ProjectAccountType;
-import org.apache.airavata.schemas.gfac.QueueType;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -38,8 +56,6 @@ public class BESParallelJobTest extends 
 	}
 	
 	
-	
-
 	protected ApplicationDescription getApplicationDesc(JobTypeType jobType) {
 		ApplicationDescription appDesc = new ApplicationDescription(
 				HpcApplicationDeploymentType.type);
@@ -49,11 +65,11 @@ public class BESParallelJobTest extends 
 				.newInstance();
 		name.setStringValue("MPIRemote");
 		appDepType.setApplicationName(name);
-		ProjectAccountType projectAccountType = appDepType.addNewProjectAccount();
-		projectAccountType.setProjectAccountNumber("TG-AST110064");
+//		ProjectAccountType projectAccountType = appDepType.addNewProjectAccount();
+//		projectAccountType.setProjectAccountNumber("TG-AST110064");
 
-		QueueType queueType = appDepType.addNewQueue();
-		queueType.setQueueName("development");
+//		QueueType queueType = appDepType.addNewQueue();
+//		queueType.setQueueName("development");
 
 		// TODO: also handle parallel jobs
 		if((jobType.enumValue() == JobTypeType.SERIAL) || (jobType.enumValue() == JobTypeType.SINGLE)) {
@@ -74,11 +90,15 @@ public class BESParallelJobTest extends 
 		 */
 		appDepType.setExecutableLocation("/home/bes/mpiexamples/a.out");
 		
+//		appDepType.setExecutableLocation("/lustre/jhome11/zam/m.memon/mpiexamples");
+		
+		
+		
 		ExtendedKeyValueType extKV = appDepType.addNewKeyValuePairs();
 		// using jsdl spmd standard
 		extKV.setName("NumberOfProcesses");
 		// this will be transformed into mpiexec -n 4
-		extKV.setStringValue("4"); 
+		extKV.setStringValue("1"); 
 		
 		/*
 		 * Default tmp location

Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTest.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTest.java Thu Mar 21 18:06:55 2013
@@ -1,114 +1,100 @@
 package org.apache.airavata.core.gfac.services.impl;
 
+/*
+*
+* 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.
+*
+*/
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Random;
 import java.util.UUID;
 
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.gfac.GFacAPI;
-import org.apache.airavata.gfac.GFacConfiguration;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.ApplicationContext;
-import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.context.security.GSISecurityContext;
 import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
 import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
 import org.apache.airavata.schemas.gfac.InputParameterType;
 import org.apache.airavata.schemas.gfac.JobTypeType;
 import org.apache.airavata.schemas.gfac.OutputParameterType;
 import org.apache.airavata.schemas.gfac.ProjectAccountType;
-import org.apache.airavata.schemas.gfac.QueueType;
 import org.apache.airavata.schemas.gfac.StringParameterType;
 import org.apache.airavata.schemas.gfac.URIParameterType;
-import org.apache.airavata.schemas.gfac.UnicoreHostType;
-import org.apache.log4j.PropertyConfigurator;
+import org.apache.commons.io.FileUtils;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-public class BESProviderTest {
-	private JobExecutionContext jobExecutionContext;
-
-	private static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory" };
-	private static final String gridftpAddress = "gsiftp://gridftp1.ls4.tacc.utexas.edu:2811";
-
-	//directory where data will be copy into and copied out to unicore resources
-
-	// private static final String scratchDir = "/brashear/msmemon/airavata";
-	//FIXME: to move all the configurations to property files.
-	private static final String scratchDir = "/scratch/01437/ogce/test/";
-
-	private String remoteTempDir = null;
-
+public class BESProviderTest extends AbstractBESTest{
+	
+	private String tmpFilePath;
+	
 	@Before
 	public void initJobContext() throws Exception {
-		PropertyConfigurator.configure("src/test/resources/logging.properties");
-
-		/*
-		 * Default tmp location
-		 */
-		String date = (new Date()).toString();
-		date = date.replaceAll(" ", "_");
-		date = date.replaceAll(":", "_");
-
-
-		remoteTempDir = scratchDir + File.separator + "SimpleEcho" + "_" + date + "_"
-				+ UUID.randomUUID();
-
-		jobExecutionContext = new JobExecutionContext(getGFACConfig(), getServiceDesc().getType().getName());
-
-		// set security context
-		jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, getSecurityContext());
-		jobExecutionContext.setApplicationContext(getApplicationContext());
-		jobExecutionContext.setInMessageContext(getInMessageContext());
-		jobExecutionContext.setOutMessageContext(getOutMessageContext());
+		initTest();
 	}
 
 	@Test
-	public void testBESProvider() throws GFacException {
+	public void submitJob() throws GFacException {
+		JobTypeType jobType = JobTypeType.Factory.newInstance();
+		jobType.set(JobTypeType.SERIAL);
+		ApplicationContext appContext = getApplicationContext();
+		appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
+		jobExecutionContext.setApplicationContext(appContext);
+		
 		GFacAPI gFacAPI = new GFacAPI();
 		gFacAPI.submitJob(jobExecutionContext);
 	}
-
-	private GFacConfiguration getGFACConfig() throws Exception{
-        URL resource = BESProviderTest.class.getClassLoader().getResource("gfac-config.xml");
-        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
-    	return gFacConfiguration;
-	}
-
-	private ApplicationContext getApplicationContext() {
-		ApplicationContext applicationContext = new ApplicationContext();
-		applicationContext.setHostDescription(getHostDesc());
-		applicationContext
-				.setApplicationDeploymentDescription(getApplicationDesc());
-		applicationContext.setServiceDescription(getServiceDesc());
-		return applicationContext;
-	}
-
-	private ApplicationDescription getApplicationDesc() {
+	
+	
+	protected ApplicationDescription getApplicationDesc(JobTypeType jobType) {
 		ApplicationDescription appDesc = new ApplicationDescription(
 				HpcApplicationDeploymentType.type);
 		HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc
 				.getType();
 		ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
 				.newInstance();
-		name.setStringValue("Simple Cat");
+		name.setStringValue("CatRemote");
 		app.setApplicationName(name);
 		ProjectAccountType projectAccountType = app.addNewProjectAccount();
 		projectAccountType.setProjectAccountNumber("TG-AST110064");
 
-		QueueType queueType = app.addNewQueue();
-		queueType.setQueueName("development");
-
 		app.setCpuCount(1);
 		// TODO: also handle parallel jobs
-		app.setJobType(JobTypeType.SERIAL);
+		if((jobType.enumValue() == JobTypeType.SERIAL) || (jobType.enumValue() == JobTypeType.SINGLE)) {
+			app.setJobType(JobTypeType.SERIAL);
+		}
+		else if (jobType.enumValue() == JobTypeType.MPI) {
+			app.setJobType(JobTypeType.MPI);
+		}
+		else {
+			app.setJobType(JobTypeType.OPEN_MP);
+		}
+		
 		app.setNodeCount(1);
 		app.setProcessorsPerNode(1);
 
@@ -116,35 +102,34 @@ public class BESProviderTest {
 		 * Use bat file if it is compiled on Windows
 		 */
 		app.setExecutableLocation("/bin/cat");
+		
 
+		/*
+		 * Default tmp location
+		 */
+		String date = (new Date()).toString();
+		date = date.replaceAll(" ", "_");
+		date = date.replaceAll(":", "_");
 
-		System.out.println(remoteTempDir);
-
+		String remoteTempDir = scratchDir + File.separator + "SimpleCat" + "_" + date + "_"
+				+ UUID.randomUUID();
 
+		System.out.println(remoteTempDir);
+		
+		// no need of these parameters, as unicore manages by itself
 		app.setScratchWorkingDirectory(remoteTempDir);
 		app.setStaticWorkingDirectory(remoteTempDir);
-
-
-		// this is required
 		app.setInputDataDirectory(remoteTempDir + File.separator + "inputData");
 		app.setOutputDataDirectory(remoteTempDir + File.separator + "outputData");
-
-		app.setStandardOutput(app.getOutputDataDirectory()+ File.separator + "stdout");
-		app.setStandardError(app.getOutputDataDirectory()+ File.separator + "stderr");
+		
+		app.setStandardOutput(app.getOutputDataDirectory()+"/jsdl_stdout");
+		
+		app.setStandardError(app.getOutputDataDirectory()+"/jsdl_stderr");
 
 		return appDesc;
 	}
 
-	private HostDescription getHostDesc() {
-		HostDescription host = new HostDescription(UnicoreHostType.type);
-		host.getType().setHostAddress("zam1161v01.zam.kfa-juelich.de");
-		host.getType().setHostName("DEMO-INTEROP-SITE");
-		((UnicoreHostType) host.getType()).setUnicoreHostAddressArray(hostArray);
-		((UnicoreHostType) host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
-		return host;
-	}
-
-	private ServiceDescription getServiceDesc() {
+	protected ServiceDescription getServiceDesc() {
 		ServiceDescription serv = new ServiceDescription();
 		serv.getType().setName("SimpleCat");
 
@@ -169,56 +154,58 @@ public class BESProviderTest {
 		return serv;
 	}
 
-	private MessageContext getInMessageContext() {
+	protected MessageContext getInMessageContext() {
+		
+		File tmpFile = new File("target"+File.separator+"tmp-"+new Random().nextInt(5));
+		try {
+			FileUtils.touch(tmpFile);
+			FileUtils.writeStringToFile(tmpFile, "tmp contents", "UTF-8");
+			tmpFilePath = tmpFile.getAbsolutePath();
+		} catch (Exception e) {
+			assertTrue(false);
+		}
+		
 		MessageContext inMessage = new MessageContext();
-
+        
 		ActualParameter copy_input = new ActualParameter();
         copy_input.getType().changeType(URIParameterType.type);
-        ((URIParameterType)copy_input.getType()).setValue("file:///tmp/rave_db.h2.db ");
+        ((URIParameterType)copy_input.getType()).setValue("file:///"+tmpFile.getAbsolutePath());
         inMessage.addParameter("f1", copy_input);
-
+		
     	ActualParameter f2 = new ActualParameter();
         f2.getType().changeType(URIParameterType.type);
         ((URIParameterType)f2.getType()).setValue("http://unicore-dev.zam.kfa-juelich.de/maven/cog-globus/cog-jglobus/1.4/cog-jglobus-1.4.jar");
         inMessage.addParameter("f2", f2);
-
-    	ActualParameter f3 = new ActualParameter();
-        f3.getType().changeType(URIParameterType.type);
-        ((URIParameterType)f3.getType()).setValue(gridftpAddress+"/"+scratchDir+"/README");
-        inMessage.addParameter("f3", f3);
-
+        
+        
         ActualParameter a1 = new ActualParameter();
         a1.getType().changeType(StringParameterType.type);
-        ((StringParameterType)a1.getType()).setValue("tmpstrace");
+        ((StringParameterType)a1.getType()).setValue(tmpFile.getName());
         inMessage.addParameter("arg1", a1);
 
         return inMessage;
 	}
-	private GSISecurityContext getSecurityContext(){
-	    GSISecurityContext context = new GSISecurityContext();
-        context.setMyproxyLifetime(3600);
-        context.setMyproxyServer("myproxy.teragrid.org");
-        context.setMyproxyUserName("*****");
-        context.setMyproxyPasswd("*****");
-        context.setTrustedCertLoc("./certificates");
-        return context;
-	}
-
-	private MessageContext getOutMessageContext() {
 
+	protected MessageContext getOutMessageContext() {
+		
 		MessageContext outMessage = new MessageContext();
 		ActualParameter a1 = new ActualParameter();
 		a1.getType().changeType(StringParameterType.type);
-		((StringParameterType)a1.getType()).setValue("README");
+		((StringParameterType)a1.getType()).setValue(new File(tmpFilePath).getName());
 		outMessage.addParameter("echo_output", a1);
-
+		
 		ActualParameter o1 = new ActualParameter();
 		o1.getType().changeType(URIParameterType.type);
 		// this may be any gridftp / ftp directory
 		((URIParameterType)o1.getType()).setValue(gridftpAddress+"/"+remoteTempDir + "/" + "outputData"+"/"+"cog-jglobus-1.4.jar");
 		outMessage.addParameter("o1", o1);
-
+		
 		return outMessage;
 	}
-
+	
+	@After
+	public void cleanData(){
+		FileUtils.deleteQuietly(new File(tmpFilePath));
+	}
+	
 }

Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java?rev=1459429&r1=1459428&r2=1459429&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java Thu Mar 21 18:06:55 2013
@@ -1,6 +1,7 @@
 package org.apache.airavata.core.gfac.services.impl;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
@@ -38,60 +39,77 @@ import org.junit.Test;
 
 public class JSDLGeneratorTest {
 
+	public static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory" };
+	public static final String gridftpAddress = "gsiftp://gridftp.blacklight.psc.teragrid.org:2811";
+	public static final String hostAddress = "zam1161v01.zam.kfa-juelich.de";
+	public static final String hostName = "DEMO-INTEROP-SITE";
+	public static final String scratchDir = "/scratch/msmemon/airavata";
+	
+	protected JobExecutionContext jobExecutionContext;
 
-	private static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory" };
-	private static final String gridftpAddress = "gsiftp://gridftp.blacklight.psc.teragrid.org:2811";
-	private static final String hostAddress = "zam1161v01.zam.kfa-juelich.de";
-	private static final String hostName = "DEMO-INTEROP-SITE";
-	private static final String scratchDir = "/scratch/msmemon/airavata";
+	
+	@Test
+	public void testSerialJSDL() throws Exception{
 
-	private JobExecutionContext jobExecutionContext;
+		JobTypeType jobType = JobTypeType.Factory.newInstance();
+		jobType.set(JobTypeType.SERIAL);
+		ApplicationContext appContext = getApplicationContext();
+		appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
+		jobExecutionContext.setApplicationContext(appContext);
 
-	@Test
-	public void testJSDLUtils() throws Exception{
 		JobDefinitionDocument jobDefDoc = JSDLGenerator.buildJSDLInstance(jobExecutionContext);
-
+		
 		assertTrue (jobDefDoc.getJobDefinition().getJobDescription().getApplication().toString().contains("/bin/cat"));
 		assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getDataStagingArray().length > 2);
-
+		
 		assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getJobIdentification().getJobProjectArray().length > 0);
-
+		
+		assertFalse(JSDLUtils.getPOSIXApplication(jobDefDoc.getJobDefinition())==null);
+		
 		assertEquals("jsdl_stdout", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getOutput().getStringValue().toString());
-
-		System.out.println(jobDefDoc);
-
+		
 	}
-
-	@Before
-	public void initJobContext() throws Exception {
-		PropertyConfigurator.configure("src/test/resources/logging.properties");
-		jobExecutionContext = new JobExecutionContext(getGFACConfig(), getServiceDesc().getType().getName());
-		//Add security context
-		jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, getSecurityContext());
-		jobExecutionContext.setApplicationContext(getApplicationContext());
-		jobExecutionContext.setInMessageContext(getInMessageContext());
-		jobExecutionContext.setOutMessageContext(getOutMessageContext());
+	
+	@Test
+	public void testMPIJSDL() throws Exception{
+		
+		JobTypeType jobType = JobTypeType.Factory.newInstance();
+		jobType.set(JobTypeType.MPI);
+		ApplicationContext appContext = getApplicationContext();
+		appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
+		jobExecutionContext.setApplicationContext(appContext);
+		
+		JobDefinitionDocument jobDefDoc = JSDLGenerator.buildJSDLInstance(jobExecutionContext);
+		
+		assertTrue (jobDefDoc.getJobDefinition().getJobDescription().getApplication().toString().contains("/bin/cat"));
+		assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getDataStagingArray().length > 2);
+		
+		assertTrue(jobDefDoc.getJobDefinition().getJobDescription().getJobIdentification().getJobProjectArray().length > 0);
+		
+		assertEquals("jsdl_stdout", JSDLUtils.getOrCreateSPMDApplication(jobDefDoc.getJobDefinition()).getOutput().getStringValue().toString());
+		
+		assertFalse(JSDLUtils.getSPMDApplication(jobDefDoc.getJobDefinition())==null);
+		
+		
 	}
 
-	private GFacConfiguration getGFACConfig() throws Exception{
+	protected GFacConfiguration getGFACConfig() throws Exception{
         URL resource = BESProviderTest.class.getClassLoader().getResource("gfac-config.xml");
         System.out.println(resource.getFile());
         GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
 		return gFacConfiguration;
 	}
-
-
-	private ApplicationContext getApplicationContext() {
+	
+	
+	protected ApplicationContext getApplicationContext() {
 		ApplicationContext applicationContext = new ApplicationContext();
 		applicationContext.setHostDescription(getHostDesc());
-		applicationContext
-				.setApplicationDeploymentDescription(getApplicationDesc());
-
+		
 		applicationContext.setServiceDescription(getServiceDesc());
 		return applicationContext;
 	}
 
-	private ApplicationDescription getApplicationDesc() {
+	protected ApplicationDescription getApplicationDesc(JobTypeType jobType) {
 		ApplicationDescription appDesc = new ApplicationDescription(
 				HpcApplicationDeploymentType.type);
 		HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc
@@ -108,7 +126,16 @@ public class JSDLGeneratorTest {
 
 		app.setCpuCount(1);
 		// TODO: also handle parallel jobs
-		app.setJobType(JobTypeType.SERIAL);
+		if((jobType.enumValue() == JobTypeType.SERIAL) || (jobType.enumValue() == JobTypeType.SINGLE)) {
+			app.setJobType(JobTypeType.SERIAL);
+		}
+		else if (jobType.enumValue() == JobTypeType.MPI) {
+			app.setJobType(JobTypeType.MPI);
+		}
+		else {
+			app.setJobType(JobTypeType.OPEN_MP);
+		}
+		
 		app.setNodeCount(1);
 		app.setProcessorsPerNode(1);
 
@@ -128,21 +155,21 @@ public class JSDLGeneratorTest {
 				+ UUID.randomUUID();
 
 		System.out.println(remoteTempDir);
-
+		
 		// no need of these parameters, as unicore manages by itself
 		app.setScratchWorkingDirectory(remoteTempDir);
 		app.setStaticWorkingDirectory(remoteTempDir);
 		app.setInputDataDirectory(remoteTempDir + File.separator + "inputData");
 		app.setOutputDataDirectory(remoteTempDir + File.separator + "outputData");
-
+		
 		app.setStandardOutput(app.getOutputDataDirectory()+"/jsdl_stdout");
-
+		
 		app.setStandardError(app.getOutputDataDirectory()+"/jsdl_stderr");
 
 		return appDesc;
 	}
 
-	private HostDescription getHostDesc() {
+	protected HostDescription getHostDesc() {
 		HostDescription host = new HostDescription(UnicoreHostType.type);
 		host.getType().setHostAddress(hostAddress);
 		host.getType().setHostName(hostName);
@@ -151,7 +178,7 @@ public class JSDLGeneratorTest {
 		return host;
 	}
 
-	private ServiceDescription getServiceDesc() {
+	protected ServiceDescription getServiceDesc() {
 		ServiceDescription serv = new ServiceDescription();
 		serv.getType().setName("SimpleCat");
 
@@ -173,24 +200,24 @@ public class JSDLGeneratorTest {
 
 		serv.getType().setInputParametersArray(inputParamList);
 		serv.getType().setOutputParametersArray(outputParamList);
-
-
+		
+		
 		return serv;
 	}
 
-	private MessageContext getInMessageContext() {
+	protected MessageContext getInMessageContext() {
 		MessageContext inMessage = new MessageContext();
-
+		
         ActualParameter i1 = new ActualParameter();
         i1.getType().changeType(URIParameterType.type);
         ((URIParameterType)i1.getType()).setValue("file:///tmp/ifile1");
         inMessage.addParameter("i1", i1);
-
+        
         ActualParameter i2 = new ActualParameter();
         i2.getType().changeType(URIParameterType.type);
         ((URIParameterType)i2.getType()).setValue("file:///tmp/ifile2");
         inMessage.addParameter("i2", i2);
-
+        
         ActualParameter i3 = new ActualParameter();
         i2.getType().changeType(URIParameterType.type);
         ((URIParameterType)i2.getType()).setValue("///tmp/ifile2");
@@ -200,24 +227,24 @@ public class JSDLGeneratorTest {
         simpleArg.getType().changeType(StringParameterType.type);
         ((StringParameterType)simpleArg.getType()).setValue("argument1");
         inMessage.addParameter("a1", simpleArg);
-
+        
         ActualParameter nameValueArg = new ActualParameter();
         nameValueArg.getType().changeType(StringParameterType.type);
         ((StringParameterType)nameValueArg.getType()).setValue("name1=value1");
         inMessage.addParameter("nameValueArg", nameValueArg);
-
+        
 		ActualParameter echo_input = new ActualParameter();
 		((StringParameterType) echo_input.getType())
 				.setValue("echo_output=hello");
 		inMessage.addParameter("echo_input", echo_input);
-
+        
 		return inMessage;
 	}
 
-	private MessageContext getOutMessageContext() {
+	protected MessageContext getOutMessageContext() {
 		MessageContext om1 = new MessageContext();
-
-		// TODO: Aint the output parameters are only the name of the files staged out to the gridftp endpoint?
+		
+		// TODO: Aint the output parameters are only the name of the files staged out to the gridftp endpoint? 
 		ActualParameter o1 = new ActualParameter();
 		((StringParameterType) o1.getType())
 		.setValue("tempfile");
@@ -225,23 +252,34 @@ public class JSDLGeneratorTest {
 
 		ActualParameter o2 = new ActualParameter();
 		o2.getType().changeType(URIParameterType.type);
-
+		
 		((URIParameterType)o2.getType()).setValue("http://path/to/upload");
 		om1.addParameter("o2", o2);
 
-
-
+		
+		
 		return om1;
 	}
-
-	private GSISecurityContext getSecurityContext(){
-	    GSISecurityContext context = new GSISecurityContext();
+	private GSISecurityContext getSecurityContext() {
+		GSISecurityContext context = new GSISecurityContext();
         context.setMyproxyLifetime(3600);
         context.setMyproxyServer("myproxy.teragrid.org");
-        context.setMyproxyUserName("*****");
-        context.setMyproxyPasswd("*****");
-        context.setTrustedCertLoc("./certificates");
-        return context;
+        context.setMyproxyUserName("******");
+        context.setMyproxyPasswd("*********");
+        context.setTrustedCertLoc("**********");
+		return context;
 	}
 
+	@Before
+	public void initJobContext() throws Exception {
+		PropertyConfigurator.configure("src/test/resources/logging.properties");
+		jobExecutionContext = new JobExecutionContext(getGFACConfig(), getServiceDesc().getType().getName());
+		jobExecutionContext.setApplicationContext(getApplicationContext());
+		jobExecutionContext.setInMessageContext(getInMessageContext());
+		jobExecutionContext.setOutMessageContext(getOutMessageContext());
+	    jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, getSecurityContext());
+          
+	}
+	
+	
 }

Added: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3Test.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3Test.java?rev=1459429&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3Test.java (added)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3Test.java Thu Mar 21 18:06:55 2013
@@ -0,0 +1,152 @@
+/*
+ *
+ * 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.
+ *
+*/
+package org.apache.airavata.core.gfac.services.impl;
+
+import java.io.File;
+import java.util.Date;
+import java.util.UUID;
+
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.gfac.GFacAPI;
+import org.apache.airavata.gfac.context.ApplicationContext;
+import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.ExtendedKeyValueType;
+import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
+import org.apache.airavata.schemas.gfac.JobTypeType;
+import org.apache.airavata.schemas.gfac.StringParameterType;
+import org.apache.airavata.schemas.gfac.URIParameterType;
+import org.junit.Before;
+import org.junit.Test;
+
+public class US3Test extends AbstractBESTest{
+	
+	
+	@Before
+	public void initJobContext() throws Exception {
+		initTest();
+	}
+
+	@Test
+	public void submitJob() throws Exception {
+		JobTypeType jobType = JobTypeType.Factory.newInstance();
+		jobType.set(JobTypeType.MPI);
+		ApplicationContext appContext = getApplicationContext();
+		appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
+		jobExecutionContext.setApplicationContext(appContext);
+		GFacAPI gFacAPI = new GFacAPI();
+		gFacAPI.submitJob(jobExecutionContext);
+	}
+	
+	
+	protected ApplicationDescription getApplicationDesc(JobTypeType jobType) {
+		ApplicationDescription appDesc = new ApplicationDescription(
+				HpcApplicationDeploymentType.type);
+		HpcApplicationDeploymentType appDepType = (HpcApplicationDeploymentType) appDesc
+				.getType();
+		ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
+				.newInstance();
+		name.setStringValue("US3-Job");
+		appDepType.setApplicationName(name);
+
+//		ProjectAccountType projectAccountType = appDepType.addNewProjectAccount();
+//		projectAccountType.setProjectAccountNumber("TG-AST110064");
+
+//		QueueType queueType = appDepType.addNewQueue();
+//		queueType.setQueueName("development");
+
+		// TODO: also handle parallel jobs
+		if((jobType.enumValue() == JobTypeType.SERIAL) || (jobType.enumValue() == JobTypeType.SINGLE)) {
+			appDepType.setJobType(JobTypeType.SERIAL);
+		}
+		else if (jobType.enumValue() == JobTypeType.MPI) {
+			appDepType.setJobType(JobTypeType.MPI);
+		}
+		else {
+			appDepType.setJobType(JobTypeType.OPEN_MP);
+		}
+		
+		appDepType.setNodeCount(4);
+		appDepType.setProcessorsPerNode(8);
+		
+		appDepType.setMaxWallTime(15);
+		
+		appDepType.setExecutableLocation("us_mpi_analysis");
+		
+		ExtendedKeyValueType extKV = appDepType.addNewKeyValuePairs();
+		// using jsdl spmd standard
+		extKV.setName("NumberOfProcesses");
+		// this will be transformed into mpiexec -n 4
+		extKV.setStringValue("32"); 
+		
+		/*
+		 * Default tmp location
+		 */
+		String date = (new Date()).toString();
+		date = date.replaceAll(" ", "_");
+		date = date.replaceAll(":", "_");
+
+		String remoteTempDir = scratchDir + File.separator + "US3" + "_" + date + "_"
+				+ UUID.randomUUID();
+
+		System.out.println(remoteTempDir);
+		
+		// no need of these parameters, as unicore manages by itself
+		appDepType.setScratchWorkingDirectory(remoteTempDir);
+		appDepType.setStaticWorkingDirectory(remoteTempDir);
+		appDepType.setInputDataDirectory(remoteTempDir + File.separator + "inputData");
+		appDepType.setOutputDataDirectory(remoteTempDir + File.separator + "outputData");
+		
+		appDepType.setStandardOutput(appDepType.getOutputDataDirectory()+"/stdout");
+		
+		appDepType.setStandardError(appDepType.getOutputDataDirectory()+"/stderr");
+
+		return appDesc;
+	}
+	protected MessageContext getInMessageContext() {
+		MessageContext inMessage = new MessageContext();
+		
+	    ActualParameter a1 = new ActualParameter();
+	    a1.getType().changeType(StringParameterType.type);
+	    ((StringParameterType)a1.getType()).setValue("hpcinput-uslims3.uthscsa.edu-uslims3_cauma3-01594.tar");
+	    inMessage.addParameter("arg1", a1);
+	        
+        ActualParameter i1 = new ActualParameter();
+        i1.getType().changeType(URIParameterType.type);
+        ((URIParameterType)i1.getType()).setValue("file:///"+System.getProperty("user.home")+"/juelich-us3/hpcinput-uslims3.uthscsa.edu-uslims3_cauma3-01594.tar");
+        inMessage.addParameter("i1", i1);
+
+        return inMessage;
+	}
+
+	protected MessageContext getOutMessageContext() {
+		MessageContext outMessage = new MessageContext();
+		
+		ActualParameter a1 = new ActualParameter();
+		a1.getType().changeType(StringParameterType.type);
+		((StringParameterType)a1.getType()).setValue("output/analysis-results.tar");
+		outMessage.addParameter("o1", a1);
+
+		return outMessage;
+	}
+
+}

Propchange: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain