You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2014/04/10 22:27:56 UTC
git commit: fixing gfac-core tests
Repository: airavata
Updated Branches:
refs/heads/master 8b2781919 -> a8d53cdaa
fixing gfac-core tests
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/a8d53cda
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/a8d53cda
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/a8d53cda
Branch: refs/heads/master
Commit: a8d53cdaaefbb9ed72c03e3dcd217619d5bebc40
Parents: 8b27819
Author: lahiru <la...@apache.org>
Authored: Thu Apr 10 16:27:46 2014 -0400
Committer: lahiru <la...@apache.org>
Committed: Thu Apr 10 16:27:46 2014 -0400
----------------------------------------------------------------------
modules/gfac/gfac-core/pom.xml | 1 +
.../gfac/context/JobExecutionContext.java | 4 +
.../context/security/SSHSecurityContext.java | 4 +-
.../org/apache/airavata/gfac/cpi/GFacImpl.java | 6 +-
.../gfac/provider/impl/GSISSHProvider.java | 4 +-
.../apache/airavata/gfac/utils/GFacUtils.java | 12 +-
.../impl/AbstractBESTestWithMyProxyAuth.java | 252 ++++-----
.../impl/BESParallelJobTestWithMyProxyAuth.java | 200 +++----
.../impl/BESProviderTestWithMyProxyAuth.java | 322 ++++++------
.../services/impl/BigRed2TestWithSSHAuth.java | 87 +++-
.../impl/GSISSHProviderTestWithMyProxyAuth.java | 17 +-
.../impl/JSDLGeneratorTestWithMyProxyAuth.java | 518 +++++++++----------
.../services/impl/US3TestWithMyProxyAuth.java | 224 ++++----
.../GSISecurityContextTestWithMyProxyAuth.java | 2 +-
.../impl/DefaultSSHApiTestWithMyProxyAuth.java | 23 +-
15 files changed, 872 insertions(+), 804 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/pom.xml b/modules/gfac/gfac-core/pom.xml
index 1f125f1..68b2120 100644
--- a/modules/gfac/gfac-core/pom.xml
+++ b/modules/gfac/gfac-core/pom.xml
@@ -157,6 +157,7 @@
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-server-configuration</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
index 43708c7..1f99057 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
@@ -246,6 +246,10 @@ public class JobExecutionContext extends AbstractContext{
return registry;
}
+ public Map<String, SecurityContext> getAllSecurityContexts(){
+ return securityContext;
+ }
+
public void setRegistry(Registry registry) {
this.registry = registry;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/SSHSecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/SSHSecurityContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/SSHSecurityContext.java
index 70e2710..2d71b7d 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/SSHSecurityContext.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/SSHSecurityContext.java
@@ -45,7 +45,7 @@ public class SSHSecurityContext implements SecurityContext {
private SSHClient sshClient;
private Session session;
- Cluster pbsCluster;
+ private Cluster pbsCluster;
public String getUsername() {
return username;
@@ -115,6 +115,6 @@ public class SSHSecurityContext implements SecurityContext {
}
public Cluster getPbsCluster() {
- return pbsCluster;
+ return this.pbsCluster;
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
index c78c164..6c80009 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
@@ -185,7 +185,11 @@ public class GFacImpl implements GFac {
jobExecutionContext.setProperty(Constants.PROP_TOPIC, experimentID);
jobExecutionContext.setExperimentID(experimentID);
- addSecurityContext(hostDescription, configurationProperties, jobExecutionContext);
+ // only in test cases we set the security context outside the gfacimpl, otherwise we setit here
+ // but in future we might set multiple security contexts
+ if(jobExecutionContext.getAllSecurityContexts().size()==0){
+ addSecurityContext(hostDescription, configurationProperties, jobExecutionContext);
+ }
return jobExecutionContext;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
index c20447c..8eaf5d2 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
@@ -106,14 +106,14 @@ public class GSISSHProvider extends AbstractProvider implements GFacProvider{
}
} catch (SSHApiException e) {
- String error = "Error submitting the job to host " + host.getHostAddress() + e.getMessage();
+ String error = "Error submitting the job to host " + host.getHostAddress() + " message: " + e.getMessage();
log.error(error);
jobDetails.setJobID("none");
GFacUtils.saveJobStatus(jobDetails,JobState.FAILED,taskID);
GFacUtils.saveErrorDetails(error, CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR, taskID);
throw new GFacProviderException(error, e);
} catch (Exception e) {
- String error = "Error submitting the job to host " + host.getHostAddress() + e.getMessage();
+ String error = "Error submitting the job to host " + host.getHostAddress() + " message: " + e.getMessage();
log.error(error);
jobDetails.setJobID("none");
GFacUtils.saveJobStatus(jobDetails,JobState.FAILED,taskID);
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
index b4210b5..49ca569 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
@@ -741,11 +741,15 @@ public class GFacUtils {
jobDescriptor.setProcessesPerNode(applicationDeploymentType.getProcessorsPerNode());
jobDescriptor.setMaxWallTime(String.valueOf(applicationDeploymentType.getMaxWallTime()));
jobDescriptor.setJobSubmitter(applicationDeploymentType.getJobSubmitterCommand());
- if (applicationDeploymentType.getProjectAccount().getProjectAccountNumber() != null) {
- jobDescriptor.setAcountString(applicationDeploymentType.getProjectAccount().getProjectAccountNumber());
+ if (applicationDeploymentType.getProjectAccount() != null) {
+ if (applicationDeploymentType.getProjectAccount().getProjectAccountNumber() != null) {
+ jobDescriptor.setAcountString(applicationDeploymentType.getProjectAccount().getProjectAccountNumber());
+ }
}
- if (applicationDeploymentType.getQueue().getQueueName() != null) {
- jobDescriptor.setQueueName(applicationDeploymentType.getQueue().getQueueName());
+ if (applicationDeploymentType.getQueue() != null) {
+ if (applicationDeploymentType.getQueue().getQueueName() != null) {
+ jobDescriptor.setQueueName(applicationDeploymentType.getQueue().getQueueName());
+ }
}
jobDescriptor.setOwner(((PBSCluster) cluster).getServerInfo().getUserName());
TaskDetails taskData = jobExecutionContext.getTaskData();
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTestWithMyProxyAuth.java
index 689ae86..6f0b23c 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTestWithMyProxyAuth.java
@@ -39,131 +39,131 @@ import org.apache.airavata.schemas.gfac.UnicoreHostType;
import org.apache.airavata.schemas.wec.ContextHeaderDocument.ContextHeader;
import org.apache.log4j.PropertyConfigurator;
-public abstract class AbstractBESTestWithMyProxyAuth extends GFacBaseTestWithMyProxyAuth {
-
- protected static String tmpFilePath = "target"+File.separator+"data";
- protected JobExecutionContext jobExecutionContext;
- private String userName = "";
-
-// 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"
- };
-
-
+//public abstract class AbstractBESTestWithMyProxyAuth extends GFacBaseTestWithMyProxyAuth {
+//
+// protected static String tmpFilePath = "target"+File.separator+"data";
+// protected JobExecutionContext jobExecutionContext;
+// private String userName = "";
+//
+//// 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://daemon.alamo.futuregrid.org:8082/ALAMO/services/BESFactory?res=default_bes_factory"
+// "https://deisa-unic.fz-juelich.de:9111/FZJ_JUROPA/services/BESFactory?res=default_bes_factory"
// };
-
-// public static final String[] hostArray = new String[] {
-// "https://daemon.india.futuregrid.org:8081/INDIA/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/ogce/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 void submitJob() throws Exception {
-// ContextHeader contextHeader = ContextHeader.Factory.newInstance();
-// buildOutputLocation(contextHeader);
-//
-// buildUserName(contextHeader, userName);
-// jobExecutionContext.setContextHeader(contextHeader);
- }
-
- protected GFacConfiguration getGFACConfig() throws Exception {
- URL resource = this.getClass().getClassLoader()
- .getResource(org.apache.airavata.common.utils.Constants.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())
- .setUnicoreBESEndPointArray(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();
-
-
- protected void buildOutputLocation(ContextHeader currentContextHeader) {
- File tmpDir = new File(tmpFilePath+File.separator+"output-"+new Random().nextInt(1000));
-
- if(!tmpDir.exists()) {
- tmpDir.mkdirs();
- }
- currentContextHeader.addNewWorkflowOutputDataHandling().addNewApplicationOutputDataHandling().setOutputDataDirectory(tmpDir.getAbsolutePath());
-
- }
-
-
- protected void buildUserName(ContextHeader currentContextHeader, String userName) {
- if("".equals(userName) || userName == null) return;
-
- currentContextHeader.setUserIdentifier(userName);
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
-}
+//
+//
+//// public static final String[] hostArray = new String[] {
+//// "https://daemon.alamo.futuregrid.org:8082/ALAMO/services/BESFactory?res=default_bes_factory"
+//// };
+//
+//// public static final String[] hostArray = new String[] {
+//// "https://daemon.india.futuregrid.org:8081/INDIA/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/ogce/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 void submitJob() throws Exception {
+//// ContextHeader contextHeader = ContextHeader.Factory.newInstance();
+//// buildOutputLocation(contextHeader);
+////
+//// buildUserName(contextHeader, userName);
+//// jobExecutionContext.setContextHeader(contextHeader);
+// }
+//
+// protected GFacConfiguration getGFACConfig() throws Exception {
+// URL resource = this.getClass().getClassLoader()
+// .getResource(org.apache.airavata.common.utils.Constants.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())
+// .setUnicoreBESEndPointArray(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();
+//
+//
+// protected void buildOutputLocation(ContextHeader currentContextHeader) {
+// File tmpDir = new File(tmpFilePath+File.separator+"output-"+new Random().nextInt(1000));
+//
+// if(!tmpDir.exists()) {
+// tmpDir.mkdirs();
+// }
+// currentContextHeader.addNewWorkflowOutputDataHandling().addNewApplicationOutputDataHandling().setOutputDataDirectory(tmpDir.getAbsolutePath());
+//
+// }
+//
+//
+// protected void buildUserName(ContextHeader currentContextHeader, String userName) {
+// if("".equals(userName) || userName == null) return;
+//
+// currentContextHeader.setUserIdentifier(userName);
+// }
+//
+// public void setUserName(String userName) {
+// this.userName = userName;
+// }
+
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTestWithMyProxyAuth.java
index 0775271..67134cd 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESParallelJobTestWithMyProxyAuth.java
@@ -35,107 +35,107 @@ import org.apache.airavata.schemas.gfac.JobTypeType;
import org.junit.Before;
import org.junit.Test;
-public class BESParallelJobTestWithMyProxyAuth extends AbstractBESTestWithMyProxyAuth {
+//public class BESParallelJobTestWithMyProxyAuth extends AbstractBESTestWithMyProxyAuth {
-
- @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);
- GFacImpl gFacAPI = new GFacImpl();
- 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("MPIRemote");
- 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(1);
- appDepType.setProcessorsPerNode(1);
-
- /*
- * Use bat file if it is compiled on Windows
- */
- 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("1");
-
- /*
- * Default tmp location
- */
- String date = (new Date()).toString();
- date = date.replaceAll(" ", "_");
- date = date.replaceAll(":", "_");
-
- String remoteTempDir = scratchDir + File.separator + "SimpleEcho" + "_" + 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()+"/jsdl_stdout");
-
- appDepType.setStandardError(appDepType.getOutputDataDirectory()+"/jsdl_stderr");
-
- return appDesc;
- }
- protected MessageContext getInMessageContext() {
- MessageContext inMessage = new MessageContext();
- return inMessage;
- }
-
-
-
- protected MessageContext getOutMessageContext() {
- MessageContext outMessage = new MessageContext();
- return outMessage;
- }
+//
+// @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);
+// GFacImpl gFacAPI = new GFacImpl();
+// 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("MPIRemote");
+// 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(1);
+// appDepType.setProcessorsPerNode(1);
+//
+// /*
+// * Use bat file if it is compiled on Windows
+// */
+// 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("1");
+//
+// /*
+// * Default tmp location
+// */
+// String date = (new Date()).toString();
+// date = date.replaceAll(" ", "_");
+// date = date.replaceAll(":", "_");
+//
+// String remoteTempDir = scratchDir + File.separator + "SimpleEcho" + "_" + 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()+"/jsdl_stdout");
+//
+// appDepType.setStandardError(appDepType.getOutputDataDirectory()+"/jsdl_stderr");
+//
+// return appDesc;
+// }
+// protected MessageContext getInMessageContext() {
+// MessageContext inMessage = new MessageContext();
+// return inMessage;
+// }
+//
+//
+//
+// protected MessageContext getOutMessageContext() {
+// MessageContext outMessage = new MessageContext();
+// return outMessage;
+// }
-}
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTestWithMyProxyAuth.java
index aebdf4c..f947e12 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BESProviderTestWithMyProxyAuth.java
@@ -48,164 +48,164 @@ import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
-public class BESProviderTestWithMyProxyAuth extends AbstractBESTestWithMyProxyAuth {
-
- private String tmpFilePath;
-
- @Before
- public void initJobContext() throws Exception {
- initTest();
- }
-
- @Test
- public void submitJob() throws GFacException {
- JobTypeType jobType = JobTypeType.Factory.newInstance();
- jobType.set(JobTypeType.SERIAL);
- ApplicationContext appContext = getApplicationContext();
- appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
- jobExecutionContext.setApplicationContext(appContext);
-
- GFacImpl gFacAPI = new GFacImpl();
- gFacAPI.submitJob(jobExecutionContext);
- }
-
-
- 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("CatRemote");
- app.setApplicationName(name);
- ProjectAccountType projectAccountType = app.addNewProjectAccount();
- projectAccountType.setProjectAccountNumber("TG-AST110064");
-
- app.setCpuCount(1);
- // TODO: also handle parallel jobs
- 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);
-
- /*
- * 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(":", "_");
-
- 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);
- 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;
- }
-
- protected ServiceDescription getServiceDesc() {
- ServiceDescription serv = new ServiceDescription();
- serv.getType().setName("SimpleCat");
-
- List<InputParameterType> inputList = new ArrayList<InputParameterType>();
- InputParameterType input = InputParameterType.Factory.newInstance();
- input.setParameterName("copy_input");
- input.setParameterType(URIParameterType.Factory.newInstance());
- inputList.add(input);
- InputParameterType[] inputParamList = inputList
- .toArray(new InputParameterType[inputList.size()]);
-
- List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
- OutputParameterType output = OutputParameterType.Factory.newInstance();
- output.setParameterName("echo_output");
- output.setParameterType(StringParameterType.Factory.newInstance());
- outputList.add(output);
- OutputParameterType[] outputParamList = outputList
- .toArray(new OutputParameterType[outputList.size()]);
-
- serv.getType().setInputParametersArray(inputParamList);
- serv.getType().setOutputParametersArray(outputParamList);
- return serv;
- }
-
- 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:///"+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 a1 = new ActualParameter();
- a1.getType().changeType(StringParameterType.type);
- ((StringParameterType)a1.getType()).setValue(tmpFile.getName());
- inMessage.addParameter("arg1", a1);
-
- return inMessage;
- }
-
- protected MessageContext getOutMessageContext() {
-
- MessageContext outMessage = new MessageContext();
- ActualParameter a1 = new ActualParameter();
- a1.getType().changeType(StringParameterType.type);
- ((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));
- }
-
-}
+//
+//public class BESProviderTestWithMyProxyAuth extends AbstractBESTestWithMyProxyAuth {
+//
+// private String tmpFilePath;
+//
+// @Before
+// public void initJobContext() throws Exception {
+// initTest();
+// }
+//
+// @Test
+// public void submitJob() throws GFacException {
+// JobTypeType jobType = JobTypeType.Factory.newInstance();
+// jobType.set(JobTypeType.SERIAL);
+// ApplicationContext appContext = getApplicationContext();
+// appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType));
+// jobExecutionContext.setApplicationContext(appContext);
+//
+// GFacImpl gFacAPI = new GFacImpl();
+// gFacAPI.submitJob(jobExecutionContext);
+// }
+//
+//
+// 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("CatRemote");
+// app.setApplicationName(name);
+// ProjectAccountType projectAccountType = app.addNewProjectAccount();
+// projectAccountType.setProjectAccountNumber("TG-AST110064");
+//
+// app.setCpuCount(1);
+// // TODO: also handle parallel jobs
+// 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);
+//
+// /*
+// * 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(":", "_");
+//
+// 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);
+// 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;
+// }
+//
+// protected ServiceDescription getServiceDesc() {
+// ServiceDescription serv = new ServiceDescription();
+// serv.getType().setName("SimpleCat");
+//
+// List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+// InputParameterType input = InputParameterType.Factory.newInstance();
+// input.setParameterName("copy_input");
+// input.setParameterType(URIParameterType.Factory.newInstance());
+// inputList.add(input);
+// InputParameterType[] inputParamList = inputList
+// .toArray(new InputParameterType[inputList.size()]);
+//
+// List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+// OutputParameterType output = OutputParameterType.Factory.newInstance();
+// output.setParameterName("echo_output");
+// output.setParameterType(StringParameterType.Factory.newInstance());
+// outputList.add(output);
+// OutputParameterType[] outputParamList = outputList
+// .toArray(new OutputParameterType[outputList.size()]);
+//
+// serv.getType().setInputParametersArray(inputParamList);
+// serv.getType().setOutputParametersArray(outputParamList);
+// return serv;
+// }
+//
+// 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:///"+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 a1 = new ActualParameter();
+// a1.getType().changeType(StringParameterType.type);
+// ((StringParameterType)a1.getType()).setValue(tmpFile.getName());
+// inMessage.addParameter("arg1", a1);
+//
+// return inMessage;
+// }
+//
+// protected MessageContext getOutMessageContext() {
+//
+// MessageContext outMessage = new MessageContext();
+// ActualParameter a1 = new ActualParameter();
+// a1.getType().changeType(StringParameterType.type);
+// ((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));
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
index 78d3b27..2fc1038 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
@@ -39,10 +39,14 @@ import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
import org.apache.airavata.gsi.ssh.api.job.JobManagerConfiguration;
import org.apache.airavata.gsi.ssh.impl.PBSCluster;
import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
import org.apache.airavata.schemas.gfac.*;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
import java.io.File;
import java.net.URL;
@@ -54,20 +58,39 @@ import java.util.UUID;
public class BigRed2TestWithSSHAuth {
private JobExecutionContext jobExecutionContext;
- private static final String hostAddress = "bigred2";
- private static final String hostName = "bigred2.uits.iu.edu";
- private static String userName = "lginnali";
- private static String password = "";
+ private String userName;
+ private String password;
+ private String passPhrase;
+ private String hostName;
+ private String workingDirectory;
+ private String privateKeyPath;
+ private String publicKeyPath;
- @Before
+ @BeforeClass
public void setUp() throws Exception {
- if(System.getProperty("bigred2.password") == null || System.getProperty("bigred2.username") == null){
- System.out.println("set the bigred2 password/username in maven command : mvn clean install -Dbigred2.username=xxx -Dbigred2.password=yyy");
- throw new Exception("Wrong inputs given");
+ System.out.println("Test case name " + this.getClass().getName());
+// System.setProperty("ssh.host","bigred2.uits.iu.edu"); //default ssh host
+// System.setProperty("ssh.user", "lginnali");
+// System.setProperty("ssh.private.key.path", "/Users/lahirugunathilake/.ssh/id_dsa");
+// System.setProperty("ssh.public.key.path", "/Users/lahirugunathilake/.ssh/id_dsa.pub");
+// System.setProperty("ssh.working.directory", "/tmp");
+
+ this.hostName = System.getProperty("ssh.host");
+ this.userName = System.getProperty("ssh.user");
+ this.password = System.getProperty("ssh.password");
+ this.privateKeyPath = System.getProperty("ssh.private.key.path");
+ this.publicKeyPath = System.getProperty("ssh.public.key.path");
+ this.passPhrase = System.getProperty("ssh.private.key.passphrase");
+ this.workingDirectory = System.getProperty("ssh.working.directory");
+
+
+ if (this.userName == null
+ || (this.password==null && (this.publicKeyPath == null || this.privateKeyPath == null)) || this.workingDirectory == null) {
+ System.out.println("########### In order to test you have to either username password or private,public keys");
+ System.out.println("Use -Dssh.user=xxx -Dssh.password=yyy -Dssh.private.key.passphrase=zzz " +
+ "-Dssh.private.key.path -Dssh.public.key.path -Dssh.working.directory ");
}
- userName = System.getProperty("bigred2.username");
- password = System.getProperty("bigred2.password");
URL resource = GramProviderTestWithMyProxyAuth.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
assert resource != null;
System.out.println(resource.getFile());
@@ -86,7 +109,7 @@ public class BigRed2TestWithSSHAuth {
* Host
*/
HostDescription host = new HostDescription(SSHHostType.type);
- host.getType().setHostAddress(hostAddress);
+ host.getType().setHostAddress(hostName);
host.getType().setHostName(hostName);
((SSHHostType)host.getType()).setHpcResource(true);
/*
@@ -111,7 +134,7 @@ public class BigRed2TestWithSSHAuth {
/*
* Default tmp location
*/
- String tempDir = "~/";
+ String tempDir = "/tmp";
String date = (new Date()).toString();
date = date.replaceAll(" ", "_");
date = date.replaceAll(":", "_");
@@ -179,29 +202,43 @@ public class BigRed2TestWithSSHAuth {
ActualParameter echo_out = new ActualParameter();
// ((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
outMessage.addParameter("echo_output", echo_out);
-
- jobExecutionContext.setOutMessageContext( outMessage);
+ jobExecutionContext.setRegistry(RegistryFactory.getLoggingRegistry());
+ jobExecutionContext.setTaskData(new TaskDetails("11323"));
+ jobExecutionContext.setOutMessageContext(outMessage);
}
+
private SecurityContext getSecurityContext(HpcApplicationDeploymentType app) {
- AuthenticationInfo authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
+ try {
+
+ AuthenticationInfo authenticationInfo = null;
+ if (password != null) {
+ authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
+ } else {
+ authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
+ this.passPhrase);
+ }
// Server info
ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
Cluster pbsCluster = null;
- try {
+ SSHSecurityContext sshSecurityContext = null;
+
JobManagerConfiguration pbsJobManager = CommonUtils.getPBSJobManager(app.getInstalledParentPath());
- pbsCluster = new PBSCluster(serverInfo, authenticationInfo,pbsJobManager);
+ pbsCluster = new PBSCluster(serverInfo, authenticationInfo, pbsJobManager);
+
+
+ sshSecurityContext = new SSHSecurityContext();
+ sshSecurityContext.setPbsCluster(pbsCluster);
+ sshSecurityContext.setUsername(userName);
+ sshSecurityContext.setKeyPass(passPhrase);
+ sshSecurityContext.setPrivateKeyLoc(privateKeyPath);
+ return sshSecurityContext;
} catch (SSHApiException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
-
-
- SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
- sshSecurityContext.setPbsCluster(pbsCluster);
- sshSecurityContext.setUsername(userName);
- return sshSecurityContext;
+ return null;
}
@Test
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
index acb6bd5..fbf93dd 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
@@ -43,8 +43,9 @@ import org.apache.airavata.gsi.ssh.util.CommonUtils;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
import org.apache.airavata.schemas.gfac.*;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
import java.io.File;
import java.net.URL;
@@ -64,13 +65,13 @@ public class GSISSHProviderTestWithMyProxyAuth {
private String workingDirectory;
private String certificateLocation = "/Users/lahirugunathilake/Downloads/certificates";
- @Before
+ @BeforeClass
public void setUp() throws Exception {
- System.setProperty("myproxy.user", "ogce");
- System.setProperty("myproxy.password", "");
- System.setProperty("basedir", "/Users/lahirugunathilake/Downloads");
- System.setProperty("gsi.working.directory", "/home/ogce");
- System.setProperty("gsi.certificate.path", "/Users/lahirugunathilake/Downloads/certificates");
+// System.setProperty("myproxy.user", "ogce");
+// System.setProperty("myproxy.password", "");
+// System.setProperty("basedir", "/Users/lahirugunathilake/Downloads");
+// System.setProperty("gsi.working.directory", "/home/ogce");
+// System.setProperty("gsi.certificate.path", "/Users/lahirugunathilake/Downloads/certificates");
certificateLocation = System.getProperty("gsi.certificate.path");
myProxyUserName = System.getProperty("myproxy.user");
myProxyPassword = System.getProperty("myproxy.password");
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTestWithMyProxyAuth.java
index 528b083..3351b32 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTestWithMyProxyAuth.java
@@ -57,262 +57,262 @@ import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionDocument;
import org.junit.Before;
import org.junit.Test;
-public class JSDLGeneratorTestWithMyProxyAuth {
-
- 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;
-
-
- @Test
- public void testSerialJSDLWithStdout() throws Exception{
-
- JobTypeType jobType = JobTypeType.Factory.newInstance();
- jobType.set(JobTypeType.SERIAL);
- ApplicationContext appContext = getApplicationContext();
- appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType, true));
- 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);
-
- assertFalse(JSDLUtils.getPOSIXApplication(jobDefDoc.getJobDefinition())==null);
-
- assertEquals("jsdl_stdout", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getOutput().getStringValue().toString());
-
- }
-
- @Test
- public void testSerialJSDLWithoutStdout() throws Exception{
-
- JobTypeType jobType = JobTypeType.Factory.newInstance();
- jobType.set(JobTypeType.SERIAL);
- ApplicationContext appContext = getApplicationContext();
- appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType, false));
- 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);
-
- assertFalse(JSDLUtils.getPOSIXApplication(jobDefDoc.getJobDefinition())==null);
-
- assertEquals("stdout", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getOutput().getStringValue().toString());
- assertEquals("stderr", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getError().getStringValue().toString());
-
- }
-
-
- @Test
- public void testMPIJSDL() throws Exception{
-
- JobTypeType jobType = JobTypeType.Factory.newInstance();
- jobType.set(JobTypeType.MPI);
- ApplicationContext appContext = getApplicationContext();
- appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType, true));
- 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);
-
-
- }
-
- protected GFacConfiguration getGFACConfig() throws Exception{
- URL resource = BESProviderTestWithMyProxyAuth.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.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());
-
- applicationContext.setServiceDescription(getServiceDesc());
- return applicationContext;
- }
-
- protected ApplicationDescription getApplicationDesc(JobTypeType jobType, boolean setOuput) {
- ApplicationDescription appDesc = new ApplicationDescription(
- HpcApplicationDeploymentType.type);
- HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc
- .getType();
- ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
- .newInstance();
- name.setStringValue("EchoLocal");
- 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
- 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);
-
- /*
- * 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(":", "_");
-
- String remoteTempDir = scratchDir + File.separator + "SimpleEcho" + "_" + date + "_"
- + 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");
-
- if(setOuput) {
- app.setStandardOutput(app.getOutputDataDirectory()+"/jsdl_stdout");
- app.setStandardError(app.getOutputDataDirectory()+"/jsdl_stderr");
- }
- return appDesc;
- }
-
- protected HostDescription getHostDesc() {
- HostDescription host = new HostDescription(UnicoreHostType.type);
- host.getType().setHostAddress(hostAddress);
- host.getType().setHostName(hostName);
- ((UnicoreHostType) host.getType()).setUnicoreBESEndPointArray(hostArray);
- ((UnicoreHostType) host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
- return host;
- }
-
- protected ServiceDescription getServiceDesc() {
- ServiceDescription serv = new ServiceDescription();
- serv.getType().setName("SimpleCat");
-
- List<InputParameterType> inputList = new ArrayList<InputParameterType>();
- InputParameterType input = InputParameterType.Factory.newInstance();
- input.setParameterName("echo_input");
- input.setParameterType(StringParameterType.Factory.newInstance());
- inputList.add(input);
- InputParameterType[] inputParamList = inputList
- .toArray(new InputParameterType[inputList.size()]);
-
- List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
- OutputParameterType output = OutputParameterType.Factory.newInstance();
- output.setParameterName("echo_output");
- output.setParameterType(StringParameterType.Factory.newInstance());
- outputList.add(output);
- OutputParameterType[] outputParamList = outputList
- .toArray(new OutputParameterType[outputList.size()]);
-
- serv.getType().setInputParametersArray(inputParamList);
- serv.getType().setOutputParametersArray(outputParamList);
-
-
- return serv;
- }
-
- 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");
- inMessage.addParameter("i3", i2);
-
- ActualParameter simpleArg = new ActualParameter();
- 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;
- }
-
- 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?
- ActualParameter o1 = new ActualParameter();
- ((StringParameterType) o1.getType())
- .setValue("tempfile");
- om1.addParameter("o1", o1);
-
- ActualParameter o2 = new ActualParameter();
- o2.getType().changeType(URIParameterType.type);
-
- ((URIParameterType)o2.getType()).setValue("http://path/to/upload");
- om1.addParameter("o2", o2);
-
-
-
- return om1;
- }
-
- @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());
- }
-
-
-}
+//public class JSDLGeneratorTestWithMyProxyAuth {
+//
+// 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;
+//
+//
+// @Test
+// public void testSerialJSDLWithStdout() throws Exception{
+//
+// JobTypeType jobType = JobTypeType.Factory.newInstance();
+// jobType.set(JobTypeType.SERIAL);
+// ApplicationContext appContext = getApplicationContext();
+// appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType, true));
+// 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);
+//
+// assertFalse(JSDLUtils.getPOSIXApplication(jobDefDoc.getJobDefinition())==null);
+//
+// assertEquals("jsdl_stdout", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getOutput().getStringValue().toString());
+//
+// }
+//
+// @Test
+// public void testSerialJSDLWithoutStdout() throws Exception{
+//
+// JobTypeType jobType = JobTypeType.Factory.newInstance();
+// jobType.set(JobTypeType.SERIAL);
+// ApplicationContext appContext = getApplicationContext();
+// appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType, false));
+// 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);
+//
+// assertFalse(JSDLUtils.getPOSIXApplication(jobDefDoc.getJobDefinition())==null);
+//
+// assertEquals("stdout", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getOutput().getStringValue().toString());
+// assertEquals("stderr", JSDLUtils.getOrCreatePOSIXApplication(jobDefDoc.getJobDefinition()).getError().getStringValue().toString());
+//
+// }
+//
+//
+// @Test
+// public void testMPIJSDL() throws Exception{
+//
+// JobTypeType jobType = JobTypeType.Factory.newInstance();
+// jobType.set(JobTypeType.MPI);
+// ApplicationContext appContext = getApplicationContext();
+// appContext.setApplicationDeploymentDescription(getApplicationDesc(jobType, true));
+// 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);
+//
+//
+// }
+//
+// protected GFacConfiguration getGFACConfig() throws Exception{
+// URL resource = BESProviderTestWithMyProxyAuth.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.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());
+//
+// applicationContext.setServiceDescription(getServiceDesc());
+// return applicationContext;
+// }
+//
+// protected ApplicationDescription getApplicationDesc(JobTypeType jobType, boolean setOuput) {
+// ApplicationDescription appDesc = new ApplicationDescription(
+// HpcApplicationDeploymentType.type);
+// HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc
+// .getType();
+// ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
+// .newInstance();
+// name.setStringValue("EchoLocal");
+// 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
+// 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);
+//
+// /*
+// * 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(":", "_");
+//
+// String remoteTempDir = scratchDir + File.separator + "SimpleEcho" + "_" + date + "_"
+// + 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");
+//
+// if(setOuput) {
+// app.setStandardOutput(app.getOutputDataDirectory()+"/jsdl_stdout");
+// app.setStandardError(app.getOutputDataDirectory()+"/jsdl_stderr");
+// }
+// return appDesc;
+// }
+//
+// protected HostDescription getHostDesc() {
+// HostDescription host = new HostDescription(UnicoreHostType.type);
+// host.getType().setHostAddress(hostAddress);
+// host.getType().setHostName(hostName);
+// ((UnicoreHostType) host.getType()).setUnicoreBESEndPointArray(hostArray);
+// ((UnicoreHostType) host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
+// return host;
+// }
+//
+// protected ServiceDescription getServiceDesc() {
+// ServiceDescription serv = new ServiceDescription();
+// serv.getType().setName("SimpleCat");
+//
+// List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+// InputParameterType input = InputParameterType.Factory.newInstance();
+// input.setParameterName("echo_input");
+// input.setParameterType(StringParameterType.Factory.newInstance());
+// inputList.add(input);
+// InputParameterType[] inputParamList = inputList
+// .toArray(new InputParameterType[inputList.size()]);
+//
+// List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+// OutputParameterType output = OutputParameterType.Factory.newInstance();
+// output.setParameterName("echo_output");
+// output.setParameterType(StringParameterType.Factory.newInstance());
+// outputList.add(output);
+// OutputParameterType[] outputParamList = outputList
+// .toArray(new OutputParameterType[outputList.size()]);
+//
+// serv.getType().setInputParametersArray(inputParamList);
+// serv.getType().setOutputParametersArray(outputParamList);
+//
+//
+// return serv;
+// }
+//
+// 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");
+// inMessage.addParameter("i3", i2);
+//
+// ActualParameter simpleArg = new ActualParameter();
+// 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;
+// }
+//
+// 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?
+// ActualParameter o1 = new ActualParameter();
+// ((StringParameterType) o1.getType())
+// .setValue("tempfile");
+// om1.addParameter("o1", o1);
+//
+// ActualParameter o2 = new ActualParameter();
+// o2.getType().changeType(URIParameterType.type);
+//
+// ((URIParameterType)o2.getType()).setValue("http://path/to/upload");
+// om1.addParameter("o2", o2);
+//
+//
+//
+// return om1;
+// }
+//
+// @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());
+// }
+//
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3TestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3TestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3TestWithMyProxyAuth.java
index 434a09d..43f655d 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3TestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3TestWithMyProxyAuth.java
@@ -37,116 +37,116 @@ import org.apache.airavata.schemas.gfac.StringParameterType;
import org.apache.airavata.schemas.gfac.URIParameterType;
import org.junit.Before;
import org.junit.Test;
+//
+//public class US3TestWithMyProxyAuth extends AbstractBESTestWithMyProxyAuth {
+//
+//
+// @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);
+// GFacImpl gFacAPI = new GFacImpl();
+// 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;
+// }
-public class US3TestWithMyProxyAuth extends AbstractBESTestWithMyProxyAuth {
-
-
- @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);
- GFacImpl gFacAPI = new GFacImpl();
- 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;
- }
-
-}
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTestWithMyProxyAuth.java
index b9a5863..9789756 100644
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTestWithMyProxyAuth.java
@@ -55,7 +55,7 @@ public class GSISecurityContextTestWithMyProxyAuth extends DatabaseTestCases {
AiravataUtils.setExecutionAsServer();
System.setProperty("myproxy.user", "ogce");
- System.setProperty("myproxy.password", "0Gce3098");
+ System.setProperty("myproxy.password", "");
userName = System.getProperty("myproxy.user");
password = System.getProperty("myproxy.password");
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8d53cda/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
index f2617c0..ae3f4d4 100644
--- a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
+++ b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
@@ -221,12 +221,29 @@ public class DefaultSSHApiTestWithMyProxyAuth {
= new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
7512, 17280000, certificateLocation);
ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
- SSHUtils SSHUtils = new SSHUtils(serverInfo, authenticationInfo, this.certificateLocation, new ConfigReader());
- SSHUtils.scpTo("/tmp", lFilePath);
+ PBSCluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, null);
+ pbsCluster.scpTo("/tmp", lFilePath);
Thread.sleep(1000);
- SSHUtils.scpFrom(File.separator + "tmp" + File.separator + "test", lFilePath);
+ pbsCluster.scpFrom(File.separator + "tmp" + File.separator + "test", lFilePath);
boolean delete = test.delete();
org.junit.Assert.assertTrue(delete);
}
+ @Test
+ public void testlistDirectory() throws Exception {
+ // Create authentication
+ File test = new File("test");
+ if (!test.exists()) {
+ test.createNewFile();
+ }
+ lFilePath = test.getAbsolutePath();
+ System.out.println(lFilePath);
+ GSIAuthenticationInfo authenticationInfo
+ = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+ 7512, 17280000, certificateLocation);
+ ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+ PBSCluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, null);
+ List<String> strings = pbsCluster.listDirectory("/tmp");
+ org.junit.Assert.assertNotNull(strings);
+ }
}