airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [1/2] new files
Date Fri, 04 Apr 2014 13:27:26 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 9ab16b97e -> f2a7fc3e7


http://git-wip-us.apache.org/repos/asf/airavata/blob/f2a7fc3e/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTestWithMyProxyAuth.java
new file mode 100644
index 0000000..4e739df
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTestWithMyProxyAuth.java
@@ -0,0 +1,306 @@
+/*
+ *
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+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.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.gfac.handler.GFacHandlerConfig;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.DataType;
+import org.apache.airavata.schemas.gfac.GlobusHostType;
+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.ParameterType;
+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.junit.Before;
+import org.junit.Test;
+
+public class ParamChemTestWithMyProxyAuth extends GFacBaseTestWithMyProxyAuth {
+    private JobExecutionContext jobExecutionContext;
+
+    @Before
+    public void setUp() throws Exception {
+
+        GFacConfiguration gFacConfiguration = new GFacConfiguration(null);
+        GSISecurityContext context = getSecurityContext();
+
+        //have to set InFlwo Handlers and outFlowHandlers
+        gFacConfiguration.setInHandlers(Arrays.asList(new GFacHandlerConfig[]{new GFacHandlerConfig(null,"org.apache.airavata.gfac.handler.GramDirectorySetupHandler"), new GFacHandlerConfig(null,"org.apache.airavata.gfac.handler.GridFTPInputHandler")}));
+        gFacConfiguration.setOutHandlers(Arrays.asList(new GFacHandlerConfig[] {new GFacHandlerConfig(null,"org.apache.airavata.gfac.handler.GridFTPOutputHandler")}));
+        /*
+        * Host
+        */
+        String serviceName = "Prepare_Model_Reference_Data";
+        HostDescription host = new HostDescription(GlobusHostType.type);
+        host.getType().setHostName("trestles");
+        host.getType().setHostAddress("trestles.sdsc.edu");
+        ((GlobusHostType) host.getType()).addGridFTPEndPoint("gsiftp://trestles-dm.sdsc.edu:2811");
+        ((GlobusHostType) host.getType()).addGlobusGateKeeperEndPoint("trestles-login2.sdsc.edu:2119/jobmanager-pbstest2");
+
+        /*
+        * App
+        */
+        ApplicationDescription appDesc =
+                new ApplicationDescription(HpcApplicationDeploymentType.type);
+        ApplicationDeploymentDescriptionType applicationDeploymentDescriptionType
+                = appDesc.getType();
+        applicationDeploymentDescriptionType.addNewApplicationName().setStringValue(serviceName);
+        String tempDir = "/oasis/projects/nsf/uic151/gridchem/airavata-workdirs";
+        String date = (new Date()).toString();
+        date = date.replaceAll(" ", "_");
+        date = date.replaceAll(":", "_");
+
+        tempDir = tempDir + File.separator
+                + serviceName + "_" + date + "_" + UUID.randomUUID();
+        applicationDeploymentDescriptionType.setExecutableLocation("/home/gridchem/workflow_script/sys_exec/scripts/step1/step1_model_refdata_prep.sh");
+        applicationDeploymentDescriptionType.setScratchWorkingDirectory(tempDir);
+        applicationDeploymentDescriptionType.setStaticWorkingDirectory(tempDir);
+        applicationDeploymentDescriptionType.setInputDataDirectory(tempDir + File.separator + "inputData");
+        applicationDeploymentDescriptionType.setOutputDataDirectory(tempDir + File.separator + "outputData");
+        applicationDeploymentDescriptionType.setStandardOutput(tempDir + File.separator + applicationDeploymentDescriptionType.getApplicationName().getStringValue() + ".stdout");
+        applicationDeploymentDescriptionType.setStandardError(tempDir + File.separator + applicationDeploymentDescriptionType.getApplicationName().getStringValue() + ".stderr");
+
+        ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("uic151");
+
+        QueueType queueType = ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).addNewQueue();
+        queueType.setQueueName("shared");
+
+        ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).setJobType(JobTypeType.SERIAL);
+        ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).setMaxWallTime(30);
+        ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).setMaxMemory(2000);
+        ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).setCpuCount(1);
+        ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).setNodeCount(1);
+        ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).setProcessorsPerNode(1);
+
+
+        /*
+        * Service
+        */
+        ServiceDescription serv = new ServiceDescription();
+        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
+
+        serv.getType().setName(serviceName);
+        serv.getType().setDescription(serviceName);
+
+        //Creating input parameters
+        InputParameterType parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("molecule_id");
+        ParameterType parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+        inputParameters.add(parameter);
+
+        parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("geom_mol2");
+        parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.URI);
+        parameterType.setName("URI");
+        inputParameters.add(parameter);
+
+        parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("toppar_main_tgz");
+        parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.URI);
+        parameterType.setName("URI");
+        inputParameters.add(parameter);
+
+        parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("toppar_usr_tgz");
+        parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.URI);
+        parameterType.setName("URI");
+        inputParameters.add(parameter);
+
+        parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("toppar_mol_str");
+        parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.URI);
+        parameterType.setName("URI");
+        inputParameters.add(parameter);
+
+        parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("molecule_dir_in_tgz");
+        parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.URI);
+        parameterType.setName("URI");
+        inputParameters.add(parameter);
+
+        parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("GC_UserName");
+        parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+        inputParameters.add(parameter);
+
+        parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("GC_ProjectName");
+        parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+        inputParameters.add(parameter);
+
+        parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("GC_WorkflowName");
+        parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+        inputParameters.add(parameter);
+
+        //Creating output parameters
+        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
+        outputParameter.setParameterName("opt_freq_input_gjf");
+        ParameterType outputParaType = outputParameter.addNewParameterType();
+        outputParaType.setType(DataType.URI);
+        outputParaType.setName("URI");
+        outputParameters.add(outputParameter);
+
+        outputParameter = OutputParameterType.Factory.newInstance();
+        outputParameter.setParameterName("charmm_miminized_crd");
+        outputParaType = outputParameter.addNewParameterType();
+        outputParaType.setType(DataType.URI);
+        outputParaType.setName("URI");
+        outputParameters.add(outputParameter);
+
+        outputParameter = OutputParameterType.Factory.newInstance();
+        outputParameter.setParameterName("step1_log");
+        outputParaType = outputParameter.addNewParameterType();
+        outputParaType.setType(DataType.URI);
+        outputParaType.setName("URI");
+        outputParameters.add(outputParameter);
+
+        outputParameter = OutputParameterType.Factory.newInstance();
+        outputParameter.setParameterName("molecule_dir_out_tgz");
+        outputParaType = outputParameter.addNewParameterType();
+        outputParaType.setType(DataType.URI);
+        outputParaType.setName("URI");
+        outputParameters.add(outputParameter);
+
+        outputParameter = OutputParameterType.Factory.newInstance();
+        outputParameter.setParameterName("gcvars");
+        outputParaType = outputParameter.addNewParameterType();
+        outputParaType.setType(DataType.URI);
+        outputParaType.setName("URI");
+        outputParameters.add(outputParameter);
+
+        //Setting input and output parameters to serviceDescriptor
+        serv.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
+        serv.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));
+
+        jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
+        jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, context);
+        ApplicationContext applicationContext = new ApplicationContext();
+        applicationContext.setHostDescription(host);
+        applicationContext.setApplicationDeploymentDescription(appDesc);
+        jobExecutionContext.setApplicationContext(applicationContext);
+        applicationContext.setServiceDescription(serv);
+
+        MessageContext inMessage = new MessageContext();
+
+        ActualParameter echo_input = new ActualParameter();
+        ((StringParameterType) echo_input.getType()).setValue("ai");
+        inMessage.addParameter("molecule_id", echo_input);
+
+        ActualParameter geom_mol2 = new ActualParameter(URIParameterType.type);
+        ((URIParameterType) geom_mol2.getType()).setValue("http://ccg-mw1.ncsa.uiuc.edu/cgenff/leoshen/cgenff_project/ai/ai.mol2");
+        inMessage.addParameter("geom_mol2", geom_mol2);
+
+        ActualParameter toppar_main_tgz = new ActualParameter(URIParameterType.type);
+        ((URIParameterType) toppar_main_tgz.getType()).setValue("/home/gridchem/workflow_script/toppar/cgenff/releases/2b7/main.tgz");
+        inMessage.addParameter("toppar_main_tgz", toppar_main_tgz);
+
+        ActualParameter toppar_usr_tgz = new ActualParameter(URIParameterType.type);
+        ((URIParameterType) toppar_usr_tgz.getType()).setValue("gsiftp://trestles.sdsc.edu");
+        inMessage.addParameter("toppar_usr_tgz", toppar_usr_tgz);
+
+        ActualParameter toppar_mol_str = new ActualParameter(URIParameterType.type);
+        ((URIParameterType) toppar_mol_str.getType()).setValue("http://ccg-mw1.ncsa.uiuc.edu/cgenff/leoshen/cgenff_project/ai/toppar/ai.str");
+        inMessage.addParameter("toppar_mol_str", toppar_mol_str);
+
+        ActualParameter molecule_dir_in_tgz = new ActualParameter(URIParameterType.type);
+        ((URIParameterType) molecule_dir_in_tgz.getType()).setValue("");
+        inMessage.addParameter("molecule_dir_in_tgz", molecule_dir_in_tgz);
+
+        ActualParameter GC_UserName = new ActualParameter();
+        ((StringParameterType) GC_UserName.getType()).setValue("leoshen");
+        inMessage.addParameter("GC_UserName", GC_UserName);
+
+        ActualParameter GC_ProjectName = new ActualParameter();
+        ((StringParameterType) GC_ProjectName.getType()).setValue("leoshen");
+        inMessage.addParameter("GC_ProjectName", GC_ProjectName);
+
+        ActualParameter GC_WorkflowName = new ActualParameter();
+        ((StringParameterType) GC_WorkflowName.getType()).setValue("ai__1339258840");
+        inMessage.addParameter("GC_WorkflowName", GC_WorkflowName);
+
+        jobExecutionContext.setInMessageContext(inMessage);
+
+        MessageContext outMessage = new MessageContext();
+
+        ActualParameter opt_freq_input_gjf = new ActualParameter(URIParameterType.type);
+        outMessage.addParameter("opt_freq_input_gjf", opt_freq_input_gjf);
+
+        ActualParameter charmm_miminized_crd = new ActualParameter(URIParameterType.type);
+        outMessage.addParameter("charmm_miminized_crd", charmm_miminized_crd);
+
+        ActualParameter step1_log = new ActualParameter(URIParameterType.type);
+        outMessage.addParameter("step1_log", step1_log);
+
+        ActualParameter molecule_dir_out_tgz = new ActualParameter(URIParameterType.type);
+        outMessage.addParameter("molecule_dir_out_tgz", molecule_dir_out_tgz);
+
+        ActualParameter gcvars = new ActualParameter(URIParameterType.type);
+        outMessage.addParameter("gcvars", gcvars);
+
+        jobExecutionContext.setOutMessageContext(outMessage);
+
+    }
+
+    @Test
+    public void testGramProvider() throws GFacException {
+//        GFacImpl gFacAPI = new GFacImpl();
+//        gFacAPI.submitJob(jobExecutionContext);
+//        MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
+//        Assert.assertFalse(outMessageContext.getParameters().isEmpty());
+//        Assert.assertEquals(MappingFactory.toString((ActualParameter) outMessageContext.getParameter("echo_output")), "hello");
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/f2a7fc3e/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
new file mode 100644
index 0000000..cd5611c
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
@@ -0,0 +1,172 @@
+/*
+ *
+ * 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.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+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.MappingFactory;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+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.SSHSecurityContext;
+import org.apache.airavata.gfac.cpi.GFacImpl;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
+import org.apache.airavata.schemas.gfac.SSHHostType;
+import org.apache.airavata.schemas.gfac.StringParameterType;
+import org.apache.commons.lang.SystemUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SSHProviderTestWithSSHAuth {
+	private JobExecutionContext jobExecutionContext;
+    @Before
+    public void setUp() throws Exception {
+
+    	URL resource = GramProviderTestWithMyProxyAuth.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
+        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
+//        gFacConfiguration.s
+        //have to set InFlwo Handlers and outFlowHandlers
+        ApplicationContext applicationContext = new ApplicationContext();
+        HostDescription host = new HostDescription(SSHHostType.type);
+        host.getType().setHostName("bigred");
+        host.getType().setHostAddress("bigred2.uits.iu.edu");
+        applicationContext.setHostDescription(host);
+        /*
+           * App
+           */
+        ApplicationDescription appDesc = new ApplicationDescription();
+        ApplicationDeploymentDescriptionType app = appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue("EchoSSH");
+        app.setApplicationName(name);
+
+        /*
+           * Use bat file if it is compiled on Windows
+           */
+        if (SystemUtils.IS_OS_WINDOWS) {
+            URL url = this.getClass().getClassLoader().getResource("echo.bat");
+            app.setExecutableLocation(url.getFile());
+        } else {
+            //for unix and Mac
+            app.setExecutableLocation("/bin/echo");
+        }
+
+        /*
+         * Job location
+        */
+        String tempDir = "/tmp";
+        String date = (new Date()).toString();
+        date = date.replaceAll(" ", "_");
+        date = date.replaceAll(":", "_");
+
+        tempDir = tempDir + File.separator
+                + "EchoSSH" + "_" + date + "_" + UUID.randomUUID();
+
+        app.setScratchWorkingDirectory(tempDir);
+        app.setStaticWorkingDirectory(tempDir);
+        app.setInputDataDirectory(tempDir + File.separator + "input");
+        app.setOutputDataDirectory(tempDir + File.separator + "output");
+        app.setStandardOutput(tempDir + File.separator + "echo.stdout");
+        app.setStandardError(tempDir + File.separator + "echo.stderr");
+
+        applicationContext.setApplicationDeploymentDescription(appDesc);
+
+        /*
+           * Service
+           */
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName("EchoSSH");
+
+        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);
+
+        jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
+        jobExecutionContext.setApplicationContext(applicationContext);
+
+        // Add security context
+        jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, getSecurityContext());
+        /*
+        * Host
+        */
+        applicationContext.setServiceDescription(serv);
+
+        MessageContext inMessage = new MessageContext();
+        ActualParameter echo_input = new ActualParameter();
+		((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
+        inMessage.addParameter("echo_input", echo_input);
+
+        jobExecutionContext.setInMessageContext(inMessage);
+
+        MessageContext outMessage = new MessageContext();
+        ActualParameter echo_out = new ActualParameter();
+//		((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
+        outMessage.addParameter("echo_output", echo_out);
+
+        jobExecutionContext.setOutMessageContext(outMessage);
+
+    }
+
+	private SSHSecurityContext getSecurityContext() {
+		SSHSecurityContext context = new SSHSecurityContext();
+        context.setUsername("lginnali");
+        context.setPrivateKeyLoc("~/.ssh/id_dsa");
+        context.setKeyPass("i want to be free");
+		return context;
+	}
+
+    @Test
+    public void testLocalProvider() throws GFacException {
+        GFacImpl gFacAPI = new GFacImpl();
+        gFacAPI.submitJob(jobExecutionContext);
+        MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
+        Assert.assertEquals(MappingFactory.toString((ActualParameter)outMessageContext.getParameter("echo_output")), "hello");
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/f2a7fc3e/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
new file mode 100644
index 0000000..434a09d
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/US3TestWithMyProxyAuth.java
@@ -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.context.ApplicationContext;
+import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.cpi.GFacImpl;
+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 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/f2a7fc3e/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
new file mode 100644
index 0000000..f3f866c
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTestWithMyProxyAuth.java
@@ -0,0 +1,174 @@
+/*
+ *
+ * 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.context.security;
+
+import junit.framework.Assert;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.DatabaseTestCases;
+import org.apache.airavata.common.utils.DerbyUtil;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.credential.store.store.CredentialReaderFactory;
+import org.apache.airavata.gfac.RequestData;
+import org.apache.log4j.Logger;
+import org.ietf.jgss.GSSCredential;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.io.File;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 7/12/13
+ * Time: 12:58 PM
+ */
+
+public class GSISecurityContextTestWithMyProxyAuth extends DatabaseTestCases {
+
+    private static String userName;
+    private static String password;
+
+    private static final Logger log = Logger.getLogger(GSISecurityContextTestWithMyProxyAuth.class);
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        AiravataUtils.setExecutionAsServer();
+
+        userName = System.getProperty("myproxy.user");
+        password = System.getProperty("myproxy.password");
+
+        if (userName == null || password == null || userName.trim().equals("") || password.trim().equals("")) {
+            log.error("===== Please set myproxy.user and myproxy.password system properties. =======");
+            Assert.fail("Please set myproxy.user and myproxy.password system properties.");
+        }
+
+        log.info("Using my proxy user name - " + userName);
+
+        setUpDatabase();
+
+    }
+
+    public static void setUpDatabase() throws Exception {
+        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
+
+        waitTillServerStarts();
+
+        /*
+         * String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n" + "        GATEWAY_NAME VARCHAR(256) NOT NULL,\n" +
+         * "        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n" + "        CREDENTIAL BLOB NOT NULL,\n" +
+         * "        PRIVATE_KEY BLOB NOT NULL,\n" + "        NOT_BEFORE VARCHAR(256) NOT NULL,\n" +
+         * "        NOT_AFTER VARCHAR(256) NOT NULL,\n" + "        LIFETIME INTEGER NOT NULL,\n" +
+         * "        REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,\n" +
+         * "        REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',\n" +
+         * "        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)\n" + ")";
+         */
+
+        String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n"
+                + "        GATEWAY_ID VARCHAR(256) NOT NULL,\n"
+                + "        TOKEN_ID VARCHAR(256) NOT NULL,\n"
+                + // Actual token used to identify the credential
+                "        CREDENTIAL BLOB NOT NULL,\n" + "        PORTAL_USER_ID VARCHAR(256) NOT NULL,\n"
+                + "        TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n"
+                + "        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" + ")";
+
+        String dropTable = "drop table CREDENTIALS";
+
+        try {
+            executeSQL(dropTable);
+        } catch (Exception e) {
+        }
+
+        executeSQL(createTable);
+
+    }
+
+    @AfterClass
+    public static void shutDownDatabase() throws Exception {
+        DerbyUtil.stopDerbyServer();
+    }
+
+    @Test
+    public void testGetTrustedCertificatePath() throws Exception {
+
+        File f = new File(GSISecurityContext.getTrustedCertificatePath());
+        Assert.assertTrue(f.exists());
+    }
+
+    private GSSCredential getGSSCredentials() throws Exception {
+
+        GSISecurityContext gsiSecurityContext = getGSISecurityContext();
+
+        return gsiSecurityContext.getGssCredentials();
+    }
+
+    private GSISecurityContext getGSISecurityContext() throws Exception {
+
+        RequestData requestData = new RequestData();
+
+        requestData.setMyProxyUserName(userName);
+        requestData.setMyProxyPassword(password);
+
+        CredentialReader credentialReader = CredentialReaderFactory.createCredentialStoreReader(getDbUtil());
+
+        return new GSISecurityContext(credentialReader, requestData);
+    }
+
+    @Test
+    public void testGetGssCredentials() throws Exception {
+
+        Assert.assertNotNull(getGSSCredentials());
+    }
+
+    @Test
+    public void testRenewCredentials() throws Exception {
+        GSISecurityContext gsiSecurityContext = getGSISecurityContext();
+        Assert.assertNotNull(gsiSecurityContext.renewCredentials());
+
+    }
+
+    @Test
+    public void testGetCredentialsFromStore() throws Exception {
+        GSISecurityContext gsiSecurityContext = getGSISecurityContext();
+        Assert.assertNotNull(gsiSecurityContext.getCredentialsFromStore());
+
+    }
+
+    @Test
+    public void testGetDefaultCredentials() throws Exception {
+        GSISecurityContext gsiSecurityContext = getGSISecurityContext();
+        Assert.assertNotNull(gsiSecurityContext.getDefaultCredentials());
+
+    }
+
+    @Test
+    public void testGetProxyCredentials() throws Exception {
+        GSISecurityContext gsiSecurityContext = getGSISecurityContext();
+        Assert.assertNotNull(gsiSecurityContext.getProxyCredentials());
+
+    }
+
+    @Test
+    public void testRenewCredentialsAsATrustedHost() throws Exception {
+        GSISecurityContext gsiSecurityContext = getGSISecurityContext();
+        Assert.assertNotNull(gsiSecurityContext.renewCredentialsAsATrustedHost());
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/f2a7fc3e/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/provider/impl/GramProviderTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/provider/impl/GramProviderTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/provider/impl/GramProviderTestWithMyProxyAuth.java
new file mode 100644
index 0000000..0d73e57
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/provider/impl/GramProviderTestWithMyProxyAuth.java
@@ -0,0 +1,61 @@
+/*
+ *
+ * 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.impl;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 7/12/13
+ * Time: 11:17 AM
+ */
+
+public class GramProviderTestWithMyProxyAuth {
+    @BeforeMethod
+    public void setUp() throws Exception {
+
+    }
+
+    @AfterMethod
+    public void tearDown() throws Exception {
+
+    }
+
+    @Test
+    public void testExecute() throws Exception {
+
+        GramProvider gramProvider = new GramProvider();
+
+        System.out.println(gramProvider.getGramErrorString(1));
+
+        System.out.println("======================================================================================");
+        System.out.println("Executing test .......................................................................");
+
+    }
+
+    @Test
+    public void testCancelJob() throws Exception {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/f2a7fc3e/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/config/SCPFromTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/config/SCPFromTestWithMyProxyAuth.java b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/config/SCPFromTestWithMyProxyAuth.java
new file mode 100644
index 0000000..8d0674a
--- /dev/null
+++ b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/config/SCPFromTestWithMyProxyAuth.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * 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.gsi.ssh.config;
+
+import java.io.File;
+
+import org.apache.airavata.gsi.ssh.api.ServerInfo;
+import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.util.SSHUtils;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class SCPFromTestWithMyProxyAuth {
+    private String myProxyUserName;
+    private String myProxyPassword;
+    private String certificateLocation;
+    private String lFilePath;
+    private String rFilePath;
+
+    @BeforeTest
+    public void setUp() throws Exception {
+//        System.setProperty("myproxy.user", "ogce");
+//        System.setProperty("myproxy.password", "");
+//        System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
+        myProxyUserName = System.getProperty("myproxy.user");
+        myProxyPassword = System.getProperty("myproxy.password");
+        String pomDirectory = System.getProperty("basedir");
+
+        File pomFileDirectory = new File(pomDirectory);
+
+        System.out.println("POM directory ----------------- " + pomFileDirectory.getAbsolutePath());
+
+        certificateLocation = pomFileDirectory.getAbsolutePath() + "/certificates";
+
+
+        lFilePath = pomDirectory + File.separator + "pom.xml";
+        rFilePath = "/tmp/";
+    }
+
+
+    @Test
+    public void testExecuteCommand() throws Exception {
+         // Create authentication
+        GSIAuthenticationInfo authenticationInfo
+                = 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(rFilePath, lFilePath);
+        Thread.sleep(1000);
+        SSHUtils.scpFrom(File.separator + "tmp" + File.separator + "pom.xml", System.getProperty("basedir"));
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/f2a7fc3e/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/config/SCPToTestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/config/SCPToTestWithSSHAuth.java b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/config/SCPToTestWithSSHAuth.java
new file mode 100644
index 0000000..198fcd9
--- /dev/null
+++ b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/config/SCPToTestWithSSHAuth.java
@@ -0,0 +1,75 @@
+/*
+ *
+ * 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.gsi.ssh.config;
+
+import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.util.SSHUtils;
+import org.apache.airavata.gsi.ssh.api.ServerInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.io.File;
+
+public class SCPToTestWithSSHAuth {
+    private String myProxyUserName;
+    private String myProxyPassword;
+    private String certificateLocation;
+    private String lFilePath;
+    private String rFilePath;
+
+    @BeforeTest
+    public void setUp() throws Exception {
+//        System.setProperty("myproxy.user", "ogce");
+//        System.setProperty("myproxy.password", "");
+//        System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
+        myProxyUserName = System.getProperty("myproxy.user");
+        myProxyPassword = System.getProperty("myproxy.password");
+
+        String pomDirectory = System.getProperty("basedir");
+
+        File pomFileDirectory = new File(pomDirectory);
+
+        System.out.println("POM directory ----------------- " + pomFileDirectory.getAbsolutePath());
+
+        certificateLocation = pomFileDirectory.getAbsolutePath() + "/certificates";
+
+        if (myProxyUserName == null || myProxyPassword == null) {
+            System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
+                    "E.g :- mvn clean install -Dmyproxy.user=xxx -Dmyproxy.password=xxx <<<<<<<");
+            throw new Exception("Need my proxy user name password to run tests.");
+        }
+        lFilePath = pomDirectory + File.separator + "pom.xml";
+        rFilePath = "/tmp";
+    }
+
+
+    @Test
+    public void testExecuteCommand() throws Exception {
+         // Create authentication
+        GSIAuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000,certificateLocation);
+        ServerInfo serverInfo = new ServerInfo("ogce" ,"trestles.sdsc.edu");
+        SSHUtils scpTo = new SSHUtils(serverInfo,authenticationInfo,this.certificateLocation,new ConfigReader());
+        scpTo.scpTo(rFilePath, lFilePath);
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/f2a7fc3e/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
new file mode 100644
index 0000000..030f868
--- /dev/null
+++ b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
@@ -0,0 +1,433 @@
+/*
+ *
+ * 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.gsi.ssh.impl;
+
+import junit.framework.Assert;
+import org.apache.airavata.gsi.ssh.api.*;
+import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
+import org.apache.airavata.gsi.ssh.config.ConfigReader;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class DefaultSSHApiTestWithMyProxyAuth {
+    private static final Logger log = LoggerFactory.getLogger(PBSCluster.class);
+    private String myProxyUserName;
+    private String myProxyPassword;
+    private String certificateLocation;
+    private String pbsFilePath;
+    private String workingDirectory;
+    private String slurmWorkingDirectory;
+    private String jobID;
+
+    @BeforeTest
+    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");
+        myProxyUserName = System.getProperty("myproxy.user");
+        myProxyPassword = System.getProperty("myproxy.password");
+        workingDirectory = System.getProperty("gsi.working.directory");
+        slurmWorkingDirectory = "/home1/01437/ogce";
+        String pomDirectory = System.getProperty("basedir");
+
+        File pomFileDirectory = new File(pomDirectory);
+
+        System.out.println("POM directory ----------------- " + pomFileDirectory.getAbsolutePath());
+
+        certificateLocation = pomFileDirectory.getAbsolutePath() + "/certificates";
+
+
+        if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) {
+            System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
+                    "E.g :- mvn clean install -Dmyproxy.user=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<");
+            throw new Exception("Need my proxy user name password to run tests.");
+        }
+    }
+
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testExecuteCommand() throws Exception {
+        // Create authentication
+        GSIAuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000, certificateLocation);
+
+        // Create command
+        CommandInfo commandInfo = new RawCommandInfo("/bin/ls");
+
+        // Server info
+        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+
+        // Output
+        CommandOutput commandOutput = new SystemCommandOutput();
+
+        // Execute command
+        CommandExecutor.executeCommand(commandInfo, serverInfo, authenticationInfo, commandOutput, new ConfigReader());
+    }
+
+
+    @Test
+    public void testPBSAsync() throws Exception {
+        // Create authentication
+        GSIAuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000, certificateLocation);
+
+        // Server info
+        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+
+
+        Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/"));
+
+
+        // Execute command
+        System.out.println("Target PBS file path: " + workingDirectory);
+        // constructing the job object
+        JobDescriptor jobDescriptor = new JobDescriptor();
+        jobDescriptor.setWorkingDirectory(workingDirectory);
+        jobDescriptor.setShellName("/bin/bash");
+        jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
+        jobDescriptor.setExecutablePath("/bin/echo");
+        jobDescriptor.setAllEnvExport(true);
+        jobDescriptor.setMailOptions("n");
+        jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
+        jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
+        jobDescriptor.setNodes(1);
+        jobDescriptor.setProcessesPerNode(1);
+        jobDescriptor.setQueueName("normal");
+        jobDescriptor.setMaxWallTime("60");
+        jobDescriptor.setAcountString("sds128");
+        List<String> inputs = new ArrayList<String>();
+        inputs.add("Hello World");
+        jobDescriptor.setInputValues(inputs);
+        //finished construction of job object
+        System.out.println(jobDescriptor.toXML());
+        jobID = pbsCluster.submitBatchJob(jobDescriptor);
+        System.out.println("JobID returned : " + jobID);
+
+//        Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo);
+        Thread.sleep(1000);
+        JobDescriptor jobById = pbsCluster.getJobDescriptorById(jobID);
+
+        //printing job data got from previous call
+        AssertJUnit.assertEquals(jobById.getJobId(), jobID);
+        System.out.println(jobById.getAcountString());
+        System.out.println(jobById.getAllEnvExport());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getExecutablePath());
+        System.out.println(jobById.getEllapsedTime());
+        System.out.println(jobById.getQueueName());
+        System.out.println(jobById.getExecuteNode());
+        System.out.println(jobById.getJobName());
+        System.out.println(jobById.getCTime());
+        System.out.println(jobById.getSTime());
+        System.out.println(jobById.getMTime());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getOwner());
+        System.out.println(jobById.getQTime());
+        System.out.println(jobById.getUsedCPUTime());
+        System.out.println(jobById.getUsedMemory());
+        System.out.println(jobById.getVariableList());
+    }
+
+    @Test
+    public void testSLURMAsync() throws Exception {
+        // Create authentication
+        GSIAuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000, certificateLocation);
+
+        // Server info
+        ServerInfo serverInfo = new ServerInfo("ogce", "stampede.tacc.xsede.org");
+        serverInfo.setPort(2222);
+
+        Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getSLURMJobManager("/usr/bin/"));
+
+
+        // Execute command
+        System.out.println("Target SLURM file path: " + slurmWorkingDirectory);
+        // constructing the job object
+        JobDescriptor jobDescriptor = new JobDescriptor();
+        jobDescriptor.setWorkingDirectory(slurmWorkingDirectory);
+        jobDescriptor.setShellName("/bin/sh");
+        jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
+        jobDescriptor.setExecutablePath("/bin/echo");
+        jobDescriptor.setAllEnvExport(true);
+        jobDescriptor.setMailOptions("n");
+        jobDescriptor.setStandardOutFile("" + File.separator + "application.out");
+        jobDescriptor.setStandardErrorFile("/home1/01437/ogce" + File.separator + "application.err");
+        jobDescriptor.setNodes(1);
+        jobDescriptor.setProcessesPerNode(1);
+        jobDescriptor.setQueueName("normal");
+        jobDescriptor.setMaxWallTime("60");
+        jobDescriptor.setAcountString("TG-STA110014S");
+        jobDescriptor.setJobSubmitter("sbatch");
+        List<String> inputs = new ArrayList<String>();
+        inputs.add("Hello World");
+        jobDescriptor.setInputValues(inputs);
+        //finished construction of job object
+        System.out.println(jobDescriptor.toXML());
+        jobID = pbsCluster.submitBatchJob(jobDescriptor);
+        System.out.println("JobID returned : " + jobID);
+
+//        Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo);
+//    Thread.sleep(1000);
+
+        JobDescriptor jobById = pbsCluster.getJobDescriptorById(jobID);
+
+        //printing job data got from previous call
+        AssertJUnit.assertEquals(jobById.getJobId(), jobID);
+        System.out.println(jobById.getAcountString());
+        System.out.println(jobById.getAllEnvExport());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getExecutablePath());
+        System.out.println(jobById.getEllapsedTime());
+        System.out.println(jobById.getQueueName());
+        System.out.println(jobById.getExecuteNode());
+        System.out.println(jobById.getJobName());
+        System.out.println(jobById.getCTime());
+        System.out.println(jobById.getSTime());
+        System.out.println(jobById.getMTime());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getOwner());
+        System.out.println(jobById.getQTime());
+        System.out.println(jobById.getUsedCPUTime());
+        System.out.println(jobById.getUsedMemory());
+        System.out.println(jobById.getVariableList());
+    }
+
+
+    @Test
+    public void testGetCluster() throws Exception {
+//        GSIAuthenticationInfo authenticationInfo
+//                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+//                7512, 17280000);
+//        // Server info
+//        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+//        // Get the API
+//        SSHApi sshApi = SSHApiFactory.createSSHApi(this.certificateLocation);
+//        Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo);
+//        System.out.println(cluster.getNodes()[0].getName());
+//        System.out.println(cluster.getNodes()[0].getNp());
+//        System.out.println(cluster.getNodes()[0].getState());
+//        System.out.println(cluster.getNodes()[0].getCores()[0].getId());
+//        System.out.println(cluster.getNodes()[0].getName());
+
+    }
+
+
+    @Test
+    public void testsubmitAsyncJobWithFailure() throws Exception {
+        // Create authentication
+        GSIAuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000, certificateLocation);
+
+        // Server info
+        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+
+        Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/"));
+
+        // Execute command
+        System.out.println("Target PBS file path: " + workingDirectory);
+        System.out.println("Local PBS File path: " + pbsFilePath);
+        String workingDirectory = File.separator + "home" + File.separator + "ogce" + File.separator + "gsissh";
+        JobDescriptor jobDescriptor = new JobDescriptor();
+        jobDescriptor.setWorkingDirectory(workingDirectory);
+        jobDescriptor.setShellName("/bin/bash");
+        jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
+        jobDescriptor.setExecutablePath("/bin/sleep");
+        jobDescriptor.setAllEnvExport(true);
+        jobDescriptor.setMailOptions("n");
+        jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
+        jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
+        jobDescriptor.setNodes(1);
+        jobDescriptor.setProcessesPerNode(100);
+        jobDescriptor.setQueueName("normal");
+        jobDescriptor.setMaxWallTime("60");
+        jobDescriptor.setAcountString("sds128");
+        List<String> inputs = new ArrayList<String>();
+        inputs.add("Hello World");
+        jobDescriptor.setInputValues(inputs);
+        System.out.println(jobDescriptor.toXML());
+        try {
+            String jobID = pbsCluster.submitBatchJob(jobDescriptor);
+            System.out.println("JobID returned : " + jobID);
+        } catch (SSHApiException e) {
+            System.out.println(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSubmitAsyncJobWithListener() throws Exception {
+        // Create authentication
+        GSIAuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000, certificateLocation);
+
+        // Server info
+        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+
+
+        Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/"));
+
+
+        // Execute command
+        System.out.println("Target PBS file path: " + workingDirectory);
+        System.out.println("Local PBS File path: " + pbsFilePath);
+        String workingDirectory = File.separator + "home" + File.separator + "ogce" + File.separator + "gsissh";
+        JobDescriptor jobDescriptor = new JobDescriptor();
+        jobDescriptor.setWorkingDirectory(workingDirectory);
+        jobDescriptor.setShellName("/bin/bash");
+        jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
+        jobDescriptor.setExecutablePath("/bin/sleep");
+        jobDescriptor.setAllEnvExport(true);
+        jobDescriptor.setMailOptions("n");
+        jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
+        jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
+        jobDescriptor.setNodes(1);
+        jobDescriptor.setProcessesPerNode(1);
+//        jobDescriptor.setMaxWallTime("1:00:00");
+        jobDescriptor.setQueueName("normal");
+        jobDescriptor.setAcountString("sds128");
+        List<String> inputs = new ArrayList<String>();
+        inputs.add("1000");
+        jobDescriptor.setInputValues(inputs);
+        System.out.println(jobDescriptor.toXML());
+        DefaultJobSubmissionListener listener = new DefaultJobSubmissionListener();
+        String jobID = pbsCluster.submitBatchJob(jobDescriptor);
+        try {
+//            // Wait 5 seconds to start the first poll, this is hard coded, user doesn't have
+//            // to configure this.
+//            Thread.sleep(5000);
+//        } catch (InterruptedException e) {
+//            log.error("Error during job status monitoring");
+//            throw new SSHApiException("Error during job status monitoring", e);
+//        }
+//        // Get the job status first
+//        try {
+////
+////            Thread t = new Thread() {
+////                @Override
+////                public void run() {
+////                    try {
+            // p
+            JobStatus jobStatus = pbsCluster.getJobStatus(jobID);
+            while (true) {
+                while (!jobStatus.equals(JobStatus.C.toString())) {
+                    if (!jobStatus.equals(listener.getJobStatus().toString())) {
+                        listener.setJobStatus(jobStatus);
+                        listener.statusChanged(jobStatus);
+                    }
+                    Thread.sleep(60000);
+
+                    jobStatus = pbsCluster.getJobStatus(jobID);
+                }
+                //Set the job status to Complete
+                listener.setJobStatus(JobStatus.C);
+                listener.statusChanged(jobStatus);
+                break;
+            }
+//                    } catch (InterruptedException e) {
+//                        log.error("Error listening to the submitted job", e);
+//                    } catch (SSHApiException e) {
+//                        log.error("Error listening to the submitted job", e);
+//                    }
+//                }
+//            };
+            //  This thread runs until the program termination, so that use can provide
+//            // any action in onChange method of the listener, without worrying for waiting in the caller thread.
+            //t.setDaemon(true);
+//            t.start();
+        } catch (Exception e) {
+            log.error("Error during job status monitoring");
+            throw new SSHApiException("Error during job status monitoring", e);
+        }
+        while (!listener.isJobDone()) {
+            Thread.sleep(10000);
+        }
+    }
+
+    @Test
+    public void testJobCancel() throws Exception {
+        // Create authentication
+        GSIAuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000, certificateLocation);
+
+        // Server info
+        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+
+
+        Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/"));
+
+
+        // Execute command
+        System.out.println("Target PBS file path: " + workingDirectory);
+        System.out.println("Local PBS File path: " + pbsFilePath);
+        String workingDirectory = File.separator + "home" + File.separator + "ogce" + File.separator + "gsissh";
+        JobDescriptor jobDescriptor = new JobDescriptor();
+        jobDescriptor.setWorkingDirectory(workingDirectory);
+        jobDescriptor.setShellName("/bin/bash");
+        jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
+        jobDescriptor.setExecutablePath("/bin/sleep");
+        jobDescriptor.setAllEnvExport(true);
+        jobDescriptor.setMailOptions("n");
+        jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
+        jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
+        jobDescriptor.setNodes(1);
+        jobDescriptor.setProcessesPerNode(1);
+        jobDescriptor.setMaxWallTime("60");
+        jobDescriptor.setQueueName("normal");
+        jobDescriptor.setAcountString("sds128");
+        List<String> inputs = new ArrayList<String>();
+        inputs.add("1000");
+        jobDescriptor.setInputValues(inputs);
+        System.out.println(jobDescriptor.toXML());
+        String jobID = pbsCluster.submitBatchJob(jobDescriptor);
+        System.out.println("Job submitted to successfully : " + jobID);
+        JobDescriptor jobById = pbsCluster.getJobDescriptorById(jobID);
+        if (!CommonUtils.isJobFinished(jobById)) {
+            JobDescriptor job = pbsCluster.cancelJob(jobID);
+            if (CommonUtils.isJobFinished(job)) {
+                Assert.assertTrue(true);
+            } else {
+                Assert.assertTrue(true);
+            }
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/f2a7fc3e/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java
new file mode 100644
index 0000000..576d4ee
--- /dev/null
+++ b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java
@@ -0,0 +1,220 @@
+/*
+ *
+ * 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.gsi.ssh.impl;
+
+import org.apache.airavata.gsi.ssh.api.*;
+import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
+import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
+import org.apache.airavata.gsi.ssh.config.ConfigReader;
+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.testng.AssertJUnit;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+public class VanilaTestWithSSHAuth {
+
+    private String userName;
+    private String password;
+    private String passPhrase;
+    private String hostName;
+    private String workingDirectory;
+    private String privateKeyPath;
+    private String publicKeyPath;
+
+    @BeforeTest
+    public void setUp() throws Exception {
+        this.hostName = "bigred2.uits.iu.edu";
+
+//        this.userName = System.setProperty("my.ssh.user", "lginnali");
+//        this.password = System.setProperty("my.ssh.password", "");
+//        this.workingDirectory = System.setProperty("working.directory", "/N/u/lginnali/BigRed2/myjob");
+//        System.setProperty("basedir","/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
+        this.userName = System.getProperty("my.ssh.user");
+        this.password = System.getProperty("my.ssh.password");
+        this.privateKeyPath = System.getProperty("my.private.key.path");
+        this.publicKeyPath = System.getProperty("my.public.key.path");
+        this.passPhrase = System.getProperty("my.ssh.user.pass.phrase");
+        this.workingDirectory = System.getProperty("ssh.working.directory");
+
+        System.out.println();
+
+
+        if (this.userName == null || (this.userName != null && this.password == 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 -Dmy.ssh.user=xxx -Dmy.ssh.user.password=yyy -Dmy.ssh.user.pass.phrase=zzz " +
+                    "-Dmy.private.key.path -Dmy.public.key.path -Dssh.working.directory ");
+        }
+    }
+
+
+    @Test
+    public void testSimpleCommand1() throws Exception {
+
+        System.out.println("Starting vanila SSH test ....");
+        AuthenticationInfo authenticationInfo = null;
+        if (password != null) {
+            authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
+        } else {
+            new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
+                    this.passPhrase);
+        }
+
+        // Create command
+        CommandInfo commandInfo = new RawCommandInfo("/opt/torque/torque-4.2.3.1/bin/qstat");
+
+        // Server info
+        ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
+
+        // Output
+        CommandOutput commandOutput = new SystemCommandOutput();
+
+        // Execute command
+        CommandExecutor.executeCommand(commandInfo, serverInfo, authenticationInfo, commandOutput, new ConfigReader());
+
+
+    }
+
+
+    @Test
+    public void testSimplePBSJob() throws Exception {
+
+        AuthenticationInfo authenticationInfo = null;
+        if (password != null) {
+            authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
+        } else {
+            new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
+                    this.passPhrase);
+        }
+        // Server info
+        ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
+        Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/torque-4.2.3.1/bin/"));
+
+        String date = new Date().toString();
+        date = date.replaceAll(" ", "_");
+        date = date.replaceAll(":", "_");
+
+        String pomFile = System.getProperty("basedir") + File.separator + "pom.xml";
+
+        workingDirectory = workingDirectory + File.separator
+                + date + "_" + UUID.randomUUID();
+        pbsCluster.makeDirectory(workingDirectory);
+        Thread.sleep(1000);
+        pbsCluster.makeDirectory(workingDirectory + File.separator + "inputs");
+        Thread.sleep(1000);
+        pbsCluster.makeDirectory(workingDirectory + File.separator + "outputs");
+
+
+        // doing file transfer to the remote resource
+        String remoteLocation = workingDirectory + File.separator + "inputs";
+        pbsCluster.scpTo(remoteLocation, pomFile);
+
+        int i = pomFile.lastIndexOf(File.separator);
+        String fileName = pomFile.substring(i + 1);
+        // constructing the job object
+        JobDescriptor jobDescriptor = new JobDescriptor();
+        jobDescriptor.setWorkingDirectory(workingDirectory);
+        jobDescriptor.setShellName("/bin/bash");
+        jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
+        jobDescriptor.setExecutablePath("/bin/echo");
+        jobDescriptor.setAllEnvExport(true);
+        jobDescriptor.setMailOptions("n");
+        jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
+        jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
+        jobDescriptor.setNodes(1);
+        jobDescriptor.setProcessesPerNode(1);
+        jobDescriptor.setQueueName("normal");
+        jobDescriptor.setMaxWallTime("5");
+        jobDescriptor.setJobSubmitter("aprun -n 1");
+        List<String> inputs = new ArrayList<String>();
+        inputs.add(remoteLocation + File.separator + fileName);
+        jobDescriptor.setInputValues(inputs);
+        //finished construction of job object
+        System.out.println(jobDescriptor.toXML());
+        String jobID = pbsCluster.submitBatchJob(jobDescriptor);
+        System.out.println("JobID returned : " + jobID);
+
+//        Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo);
+        Thread.sleep(1000);
+        JobDescriptor jobById = pbsCluster.getJobDescriptorById(jobID);
+
+        //printing job data got from previous call
+        AssertJUnit.assertEquals(jobById.getJobId(), jobID);
+        System.out.println(jobById.getAcountString());
+        System.out.println(jobById.getAllEnvExport());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getExecutablePath());
+        System.out.println(jobById.getEllapsedTime());
+        System.out.println(jobById.getQueueName());
+        System.out.println(jobById.getExecuteNode());
+        System.out.println(jobById.getJobName());
+        System.out.println(jobById.getCTime());
+        System.out.println(jobById.getSTime());
+        System.out.println(jobById.getMTime());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getOwner());
+        System.out.println(jobById.getQTime());
+        System.out.println(jobById.getUsedCPUTime());
+        System.out.println(jobById.getUsedMemory());
+        System.out.println(jobById.getVariableList());
+    }
+
+    @Test
+    public void testSCPFrom() throws Exception {
+
+        AuthenticationInfo authenticationInfo = null;
+        if (password != null) {
+            authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
+        } else {
+            new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
+                    this.passPhrase);
+        }
+        // Server info
+        ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
+        Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/torque-4.2.3.1/bin/"));
+
+        String date = new Date().toString();
+        date = date.replaceAll(" ", "_");
+        date = date.replaceAll(":", "_");
+
+        String pomFile = System.getProperty("basedir") + File.separator + "pom.xml";
+
+        // Constructing theworking directory for demonstration and creating directories in the remote
+        // resource
+        workingDirectory = workingDirectory + File.separator
+                + date + "_" + UUID.randomUUID();
+        pbsCluster.makeDirectory(workingDirectory);
+        pbsCluster.scpTo(workingDirectory, pomFile);
+        Thread.sleep(1000);
+        pbsCluster.scpFrom(workingDirectory + File.separator + "pom.xml", System.getProperty("basedir"));
+    }
+
+
+}


Mime
View raw message