airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: Adding main classes - AIRAVATA-1652
Date Tue, 31 Mar 2015 20:37:36 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 7812dcaf0 -> 1f9ac846a


Adding main classes - AIRAVATA-1652


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/1f9ac846
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/1f9ac846
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/1f9ac846

Branch: refs/heads/master
Commit: 1f9ac846aa0c3bf3f3ec41b3c818780baf280207
Parents: 7812dca
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Tue Mar 31 16:37:28 2015 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Tue Mar 31 16:37:28 2015 -0400

----------------------------------------------------------------------
 .../test-suite/multi-tenanted-airavata/pom.xml  |   5 +
 .../multitenantedairavata/AiravataClient.java   |   4 +-
 .../ApplicationRegister.java                    |  16 +-
 .../ComputeResourceRegister.java                |   7 +-
 .../ExperimentExecution.java                    |   2 -
 .../FrameworkBootstrapping.java                 |  44 ++++
 .../multitenantedairavata/FrameworkSetup.java   |  73 ++++++
 .../multitenantedairavata/GatewayRegister.java  | 220 +++++++++++++++++++
 .../multitenantedairavata/LoadTester.java       |  50 +++++
 .../testsuite/multitenantedairavata/Setup.java  | 208 ------------------
 10 files changed, 405 insertions(+), 224 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/pom.xml
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/pom.xml b/modules/test-suite/multi-tenanted-airavata/pom.xml
index f974c59..9068996 100644
--- a/modules/test-suite/multi-tenanted-airavata/pom.xml
+++ b/modules/test-suite/multi-tenanted-airavata/pom.xml
@@ -74,6 +74,11 @@
             <artifactId>airavata-credential-store</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!--<dependency>-->
+            <!--<groupId>mysql</groupId>-->
+            <!--<artifactId>mysql-connector-java</artifactId>-->
+            <!--<version>5.1.35</version>-->
+        <!--</dependency>-->
         <dependency>
             <groupId>org.apache.derby</groupId>
             <artifactId>derbyclient</artifactId>

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
index b20cdc2..5126249 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/AiravataClient.java
@@ -45,7 +45,7 @@ public class AiravataClient {
         propertyReader = new PropertyReader();
     }
 
-    public Airavata.Client getAiravataClient(){
+    public Airavata.Client getAiravataClient() throws Exception{
         try {
             String airavataHost = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_HOST,
PropertyFileType.AIRAVATA_CLIENT);
             int airavataport = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_PORT,
PropertyFileType.AIRAVATA_CLIENT));
@@ -53,7 +53,7 @@ public class AiravataClient {
             return airavataClient;
         } catch (AiravataClientConnectException e) {
             logger.error("Error while creating airavata client instance", e);
+            throw new Exception("Error while creating airavata client instance", e);
         }
-        return null;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
index 8e71958..d73ccba 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ApplicationRegister.java
@@ -83,7 +83,7 @@ public class ApplicationRegister {
         addLAMMPSApplication();
     }
 
-    public void addAmberApplication () throws Exception{
+    protected void addAmberApplication () throws Exception{
         for (Gateway gateway : allGateways){
             // add amber module
             String amberModuleId = airavata.registerApplicationModule(gateway.getGatewayId(),
@@ -185,7 +185,7 @@ public class ApplicationRegister {
     }
 
 
-    public void addEchoApplication() throws Exception{
+    protected void addEchoApplication() throws Exception{
         for (Gateway gateway : allGateways){
             // add echo module
             String echoModuleId = airavata.registerApplicationModule(gateway.getGatewayId(),
@@ -218,14 +218,14 @@ public class ApplicationRegister {
         }
     }
 
-    public void addLAMMPSApplication() throws Exception{
+    protected void addLAMMPSApplication() throws Exception{
         // add LAMPPS module
         // add LAMPSS interface
         // add LAMPSS deployment
     }
 
 
-    public static ApplicationDeploymentDescription createApplicationDeployment(String appModuleId,
+    protected ApplicationDeploymentDescription createApplicationDeployment(String appModuleId,
                                                                                String computeResourceId,
                                                                                String executablePath,
                                                                                ApplicationParallelismType
parallelism,
@@ -245,7 +245,7 @@ public class ApplicationRegister {
         return deployment;
     }
 
-    public static ApplicationModule createApplicationModule(String appModuleName,
+    protected ApplicationModule createApplicationModule(String appModuleName,
                                                             String appModuleVersion, String
appModuleDescription) {
         ApplicationModule module = new ApplicationModule();
         module.setAppModuleDescription(appModuleDescription);
@@ -254,7 +254,7 @@ public class ApplicationRegister {
         return module;
     }
 
-    public static InputDataObjectType createAppInput (String inputName,
+    protected InputDataObjectType createAppInput (String inputName,
                                                       String value,
                                                       DataType type,
                                                       String applicationArgument,
@@ -278,7 +278,7 @@ public class ApplicationRegister {
         return input;
     }
 
-    public static OutputDataObjectType createAppOutput(String inputName,
+    protected OutputDataObjectType createAppOutput(String inputName,
                                                        String value,
                                                        DataType type,
                                                        boolean isRequired,
@@ -292,7 +292,7 @@ public class ApplicationRegister {
         return outputDataObjectType;
     }
 
-    public static ApplicationInterfaceDescription createApplicationInterfaceDescription
+    protected ApplicationInterfaceDescription createApplicationInterfaceDescription
             (String applicationName, String applicationDescription, List<String> applicationModules,
              List<InputDataObjectType> applicationInputs, List<OutputDataObjectType>applicationOutputs)
{
         ApplicationInterfaceDescription applicationInterfaceDescription = new ApplicationInterfaceDescription();

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
index 9127fc9..db2965f 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ComputeResourceRegister.java
@@ -144,7 +144,7 @@ public class ComputeResourceRegister {
         return computeResourceId;
     }
 
-    public static ComputeResourceDescription createComputeResourceDescription(
+    public ComputeResourceDescription createComputeResourceDescription(
             String hostName, String hostDesc, List<String> hostAliases, List<String>
ipAddresses) {
         ComputeResourceDescription host = new ComputeResourceDescription();
         host.setHostName(hostName);
@@ -154,7 +154,7 @@ public class ComputeResourceRegister {
         return host;
     }
 
-    public static ResourceJobManager createResourceJobManager(
+    public ResourceJobManager createResourceJobManager(
             ResourceJobManagerType resourceJobManagerType, String pushMonitoringEndpoint,
String jobManagerBinPath,
             Map<JobManagerCommand, String> jobManagerCommands) {
         ResourceJobManager resourceJobManager = new ResourceJobManager();
@@ -197,8 +197,7 @@ public class ComputeResourceRegister {
         }
     }
 
-    public static ComputeResourcePreference
-    createComputeResourcePreference(String computeResourceId, String allocationProjectNumber,
+    public ComputeResourcePreference createComputeResourcePreference(String computeResourceId,
String allocationProjectNumber,
                                     boolean overridebyAiravata, String preferredBatchQueue,
                                     JobSubmissionProtocol preferredJobSubmissionProtocol,
                                     DataMovementProtocol preferredDataMovementProtocol,

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
index b6b5476..7a79735 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/ExperimentExecution.java
@@ -149,8 +149,6 @@ public class ExperimentExecution {
                 }
             });
         }
-
-
     }
 
     public void createAmberExperiment () throws Exception{

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkBootstrapping.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkBootstrapping.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkBootstrapping.java
new file mode 100644
index 0000000..22a1608
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkBootstrapping.java
@@ -0,0 +1,44 @@
+/*
+ *
+ * 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.testsuite.multitenantedairavata;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FrameworkBootstrapping {
+    private final static Logger logger = LoggerFactory.getLogger(FrameworkBootstrapping.class);
+
+    public static void main(String[] args) {
+        try {
+            FrameworkSetup setup = FrameworkSetup.getInstance();
+            setup.getGatewayRegister().createGateways();
+            logger.info("Gateways created...");
+            setup.getGatewayRegister().registerSSHKeys();
+            logger.info("Registered SSH keys to each gateway...");
+            setup.getApplicationRegister().addApplications();
+            logger.info("Applications registered for each each gateway...");
+        } catch (Exception e) {
+            logger.error("Error occured while set up", e);
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkSetup.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkSetup.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkSetup.java
new file mode 100644
index 0000000..d0666e4
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/FrameworkSetup.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.testsuite.multitenantedairavata;
+
+import org.apache.airavata.api.Airavata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FrameworkSetup {
+    private static FrameworkSetup instance = new FrameworkSetup();
+    private GatewayRegister gatewayRegister;
+    private ApplicationRegister applicationRegister;
+    private Airavata.Client airavata;
+    private final static Logger logger = LoggerFactory.getLogger(FrameworkSetup.class);
+
+    public static FrameworkSetup getInstance() {
+        return instance;
+    }
+
+    private FrameworkSetup() {
+        try {
+            AiravataClient airavataClient = AiravataClient.getInstance();
+            this.airavata = airavataClient.getAiravataClient();
+            gatewayRegister = new GatewayRegister(airavata);
+            applicationRegister = new ApplicationRegister(airavata);
+        } catch (Exception e) {
+            logger.error("Error while creating airavata client instance", e);
+        }
+    }
+
+    public GatewayRegister getGatewayRegister() {
+        return gatewayRegister;
+    }
+
+    public void setGatewayRegister(GatewayRegister gatewayRegister) {
+        this.gatewayRegister = gatewayRegister;
+    }
+
+    public ApplicationRegister getApplicationRegister() {
+        return applicationRegister;
+    }
+
+    public void setApplicationRegister(ApplicationRegister applicationRegister) {
+        this.applicationRegister = applicationRegister;
+    }
+
+    public Airavata.Client getAiravata() {
+        return airavata;
+    }
+
+    public void setAiravata(Airavata.Client airavata) {
+        this.airavata = airavata;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/GatewayRegister.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/GatewayRegister.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/GatewayRegister.java
new file mode 100644
index 0000000..f0fba59
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/GatewayRegister.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.testsuite.multitenantedairavata;
+
+
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
+import org.apache.airavata.credential.store.store.CredentialStoreException;
+import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
+import org.apache.airavata.credential.store.util.TokenGenerator;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.model.error.AiravataClientException;
+import org.apache.airavata.model.error.AiravataSystemException;
+import org.apache.airavata.model.error.InvalidRequestException;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyFileType;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyReader;
+import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GatewayRegister {
+    private final static Logger logger = LoggerFactory.getLogger(GatewayRegister.class);
+    private Airavata.Client airavata;
+    private PropertyReader propertyReader;
+    private int gatewayCount;
+    private Map<String, String> tokenMap;
+    private Map<String, String> projectMap;
+
+    public GatewayRegister(Airavata.Client client) throws Exception{
+        try {
+            this.airavata = client;
+            this.tokenMap = new HashMap<String, String>();
+            this.projectMap = new HashMap<String, String>();
+            propertyReader = new PropertyReader();
+        }catch (Exception e){
+            logger.error("Error while initializing setup step", e);
+            throw new Exception("Error while initializing setup step", e);
+        }
+
+    }
+
+    public void createGateways() throws Exception{
+        try {
+            // read gateway count from properties file
+            gatewayCount = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.NUMBER_OF_GATEWAYS,
PropertyFileType.TEST_FRAMEWORK));
+            String genericGatewayName = propertyReader.readProperty(TestFrameworkConstants.GatewayConstants.GENERIC_GATEWAY_NAME,
PropertyFileType.TEST_FRAMEWORK);
+            String genericGatewayDomain = propertyReader.readProperty(TestFrameworkConstants.GatewayConstants.GENERIC_GATEWAY_DOMAIN,
PropertyFileType.TEST_FRAMEWORK);
+            for (int i = 0; i < gatewayCount; i++){
+                Gateway gateway = new Gateway();
+                String gatewayId = genericGatewayName + (i + 1);
+                gateway.setGatewayId(gatewayId);
+                gateway.setGatewayName(gatewayId);
+                gateway.setDomain(gatewayId + genericGatewayDomain);
+                airavata.addGateway(gateway);
+                GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
+                gatewayResourceProfile.setGatewayID(gatewayId);
+                airavata.registerGatewayResourceProfile(gatewayResourceProfile);
+                // create a project per each gateway
+                createProject(gatewayId);
+            }
+        } catch (AiravataSystemException e) {
+            logger.error("Error while creating airavata client instance", e);
+            throw new Exception("Error while creating airavata client instance", e);
+        } catch (InvalidRequestException e) {
+            logger.error("Invalid request for airavata client instance", e);
+            throw new Exception("Invalid request for airavata client instance", e);
+        } catch (AiravataClientException e) {
+            logger.error("Error while creating airavata client instance", e);
+            throw new Exception("Error while creating airavata client instance", e);
+        } catch (TException e) {
+            logger.error("Error while communicating with airavata client ", e);
+            throw new Exception("Error while communicating with airavata client", e);
+        }
+    }
+
+    public void createProject (String gatewayId) throws Exception{
+        Project project = new Project();
+        project.setName("testProj_" + gatewayId);
+        project.setOwner("testUser_" + gatewayId);
+        String projectId = airavata.createProject(gatewayId, project);
+        projectMap.put(projectId, gatewayId);
+    }
+
+    public void registerSSHKeys () throws Exception{
+        try {
+            // credential store related functions are not in the current api, so need to
call credential store directly
+            AiravataUtils.setExecutionAsClient();
+            String jdbcURL = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_JBDC_URL,
PropertyFileType.AIRAVATA_CLIENT);
+            String jdbcDriver = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_JBDC_DRIVER,
PropertyFileType.AIRAVATA_CLIENT);
+            String userName = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_DB_USERNAME,
PropertyFileType.AIRAVATA_CLIENT);
+            String password = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_DB_PWD,
PropertyFileType.AIRAVATA_CLIENT);
+            String privateKeyPath = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PRIKEY_LOCATION,
PropertyFileType.TEST_FRAMEWORK);
+            String pubKeyPath = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PUBKEY_LOCATION,
PropertyFileType.TEST_FRAMEWORK);
+            String keyPassword = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PWD,
PropertyFileType.TEST_FRAMEWORK);
+            DBUtil dbUtil = new DBUtil(jdbcURL, userName, password, jdbcDriver);
+            SSHCredentialWriter writer = new SSHCredentialWriter(dbUtil);
+            List<Gateway> allGateways = airavata.getAllGateways();
+            for (Gateway gateway : allGateways){
+                SSHCredential sshCredential = new SSHCredential();
+                sshCredential.setGateway(gateway.getGatewayId());
+                String token = TokenGenerator.generateToken(gateway.getGatewayId(), null);
+                sshCredential.setToken(token);
+                sshCredential.setPortalUserName("testuser");
+                FileInputStream privateKeyStream = new FileInputStream(privateKeyPath);
+                File filePri = new File(privateKeyPath);
+                byte[] bFilePri = new byte[(int) filePri.length()];
+                privateKeyStream.read(bFilePri);
+                FileInputStream pubKeyStream = new FileInputStream(pubKeyPath);
+                File filePub = new File(pubKeyPath);
+                byte[] bFilePub = new byte[(int) filePub.length()];
+                pubKeyStream.read(bFilePub);
+                privateKeyStream.close();
+                pubKeyStream.close();
+                sshCredential.setPrivateKey(bFilePri);
+                sshCredential.setPublicKey(bFilePub);
+                sshCredential.setPassphrase(keyPassword);
+                writer.writeCredentials(sshCredential);
+                tokenMap.put(gateway.getGatewayId(), token);
+            }
+        } catch (ClassNotFoundException e) {
+            logger.error("Unable to find mysql driver", e);
+            throw new Exception("Unable to find mysql driver",e);
+        } catch (InstantiationException e) {
+            logger.error("Error while saving SSH credentials", e);
+            throw new Exception("Error while saving SSH credentials",e);
+        } catch (IllegalAccessException e) {
+            logger.error("Error while saving SSH credentials", e);
+            throw new Exception("Error while saving SSH credentials",e);
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-client properties", e);
+            throw new Exception("Unable to read airavata-client properties",e);
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while connecting with airavata client", e);
+            throw new Exception("Error occured while connecting with airavata client",e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while connecting with airavata client", e);
+            throw new Exception("Error occured while connecting with airavata client",e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while connecting with airavata client", e);
+            throw new Exception("Error occured while connecting with airavata client",e);
+        } catch (TException e) {
+            logger.error("Error occured while connecting with airavata client", e);
+            throw new Exception("Error occured while connecting with airavata client",e);
+        } catch (FileNotFoundException e) {
+            logger.error("Could not find keys specified in the path", e);
+            throw new Exception("Could not find keys specified in the path",e);
+        } catch (CredentialStoreException e) {
+            logger.error("Error while saving SSH credentials", e);
+            throw new Exception("Error while saving SSH credentials",e);
+        } catch (IOException e) {
+            logger.error("Error while saving SSH credentials", e);
+            throw new Exception("Error while saving SSH credentials",e);
+        }
+    }
+
+    public int getGatewayCount() {
+        return gatewayCount;
+    }
+
+    public void setGatewayCount(int gatewayCount) {
+        this.gatewayCount = gatewayCount;
+    }
+
+    public Map<String, String> getTokenMap() {
+        return tokenMap;
+    }
+
+    public void setTokenMap(Map<String, String> tokenMap) {
+        this.tokenMap = tokenMap;
+    }
+
+    public Map<String, String> getProjectMap() {
+        return projectMap;
+    }
+
+    public void setProjectMap(Map<String, String> projectMap) {
+        this.projectMap = projectMap;
+    }
+
+    public Airavata.Client getAiravata() {
+        return airavata;
+    }
+
+    public void setAiravata(Airavata.Client airavata) {
+        this.airavata = airavata;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/LoadTester.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/LoadTester.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/LoadTester.java
new file mode 100644
index 0000000..b27b429
--- /dev/null
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/LoadTester.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.testsuite.multitenantedairavata;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+public class LoadTester {
+    private final static Logger logger = LoggerFactory.getLogger(LoadTester.class);
+    public static void main(String[] args) {
+        try {
+            FrameworkSetup frameworkSetup = FrameworkSetup.getInstance();
+            Map<String, String> tokenMap = frameworkSetup.getGatewayRegister().getTokenMap();
+            Map<String, String> projectMap = frameworkSetup.getGatewayRegister().getProjectMap();
+            Map<String, String> appInterfaceMap = frameworkSetup.getApplicationRegister().getApplicationInterfaceListPerGateway();
+
+            ExperimentExecution experimentExecution = new ExperimentExecution(frameworkSetup.getAiravata(),tokenMap,
appInterfaceMap, projectMap);
+            experimentExecution.createAmberExperiment();
+            experimentExecution.createEchoExperiment();
+            experimentExecution.launchExperiments();
+            experimentExecution.monitorExperiments();
+        } catch (Exception e) {
+            logger.error("Error while submitting experiments", e);
+        }
+
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/1f9ac846/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
b/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
deleted file mode 100644
index 9b94d4e..0000000
--- a/modules/test-suite/multi-tenanted-airavata/src/main/java/org/apache/airavata/testsuite/multitenantedairavata/Setup.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *
- * 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.testsuite.multitenantedairavata;
-
-
-import org.apache.airavata.api.Airavata;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
-import org.apache.airavata.credential.store.util.TokenGenerator;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
-import org.apache.airavata.model.error.AiravataClientException;
-import org.apache.airavata.model.error.AiravataSystemException;
-import org.apache.airavata.model.error.InvalidRequestException;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyFileType;
-import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyReader;
-import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants;
-import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class Setup {
-    private final static Logger logger = LoggerFactory.getLogger(Setup.class);
-    private AiravataClient airavataClient;
-    private Airavata.Client airavata;
-    private PropertyReader propertyReader;
-    private int gatewayCount;
-    private Map<String, String> tokenMap;
-    private Map<String, String> projectMap;
-
-    public Setup() {
-        this.airavataClient = AiravataClient.getInstance();
-        this.airavata = airavataClient.getAiravataClient();
-        this.tokenMap = new HashMap<String, String>();
-        this.projectMap = new HashMap<String, String>();
-        propertyReader = new PropertyReader();
-    }
-
-    public void createGateways() throws Exception{
-        try {
-            // read gateway count from properties file
-            gatewayCount = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.NUMBER_OF_GATEWAYS,
PropertyFileType.TEST_FRAMEWORK));
-            String genericGatewayName = propertyReader.readProperty(TestFrameworkConstants.GatewayConstants.GENERIC_GATEWAY_NAME,
PropertyFileType.TEST_FRAMEWORK);
-            String genericGatewayDomain = propertyReader.readProperty(TestFrameworkConstants.GatewayConstants.GENERIC_GATEWAY_DOMAIN,
PropertyFileType.TEST_FRAMEWORK);
-            for (int i = 0; i < gatewayCount; i++){
-                Gateway gateway = new Gateway();
-                String gatewayId = genericGatewayName + (i + 1);
-                gateway.setGatewayId(gatewayId);
-                gateway.setGatewayName(gatewayId);
-                gateway.setDomain(gatewayId + genericGatewayDomain);
-                airavata.addGateway(gateway);
-                GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
-                gatewayResourceProfile.setGatewayID(gatewayId);
-                airavata.registerGatewayResourceProfile(gatewayResourceProfile);
-                // create a project per each gateway
-                createProject(gatewayId);
-            }
-        } catch (AiravataSystemException e) {
-            logger.error("Error while creating airavata client instance", e);
-            throw new Exception("Error while creating airavata client instance", e);
-        } catch (InvalidRequestException e) {
-            logger.error("Invalid request for airavata client instance", e);
-            throw new Exception("Invalid request for airavata client instance", e);
-        } catch (AiravataClientException e) {
-            logger.error("Error while creating airavata client instance", e);
-            throw new Exception("Error while creating airavata client instance", e);
-        } catch (TException e) {
-            logger.error("Error while communicating with airavata client ", e);
-            throw new Exception("Error while communicating with airavata client", e);
-        }
-    }
-
-    public void createProject (String gatewayId) throws Exception{
-        Project project = new Project();
-        project.setName("testProj_" + gatewayId);
-        project.setOwner("testUser_" + gatewayId);
-        String projectId = airavata.createProject(gatewayId, project);
-        projectMap.put(projectId, gatewayId);
-    }
-
-    public void registerSSHKeys () throws Exception{
-        try {
-            // credential store related functions are not in the current api, so need to
call credential store directly
-            AiravataUtils.setExecutionAsClient();
-            String jdbcURL = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_JBDC_URL,
PropertyFileType.AIRAVATA_CLIENT);
-            String jdbcDriver = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_JBDC_DRIVER,
PropertyFileType.AIRAVATA_CLIENT);
-            String userName = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_DB_USERNAME,
PropertyFileType.AIRAVATA_CLIENT);
-            String password = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.CS_DB_PWD,
PropertyFileType.AIRAVATA_CLIENT);
-            String privateKeyPath = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PRIKEY_LOCATION,
PropertyFileType.TEST_FRAMEWORK);
-            String pubKeyPath = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PUBKEY_LOCATION,
PropertyFileType.TEST_FRAMEWORK);
-            String keyPassword = propertyReader.readProperty(TestFrameworkConstants.FrameworkPropertiesConstants.SSH_PWD,
PropertyFileType.TEST_FRAMEWORK);
-            DBUtil dbUtil = new DBUtil(jdbcURL, userName, password, jdbcDriver);
-            SSHCredentialWriter writer = new SSHCredentialWriter(dbUtil);
-            List<Gateway> allGateways = airavata.getAllGateways();
-            for (Gateway gateway : allGateways){
-                SSHCredential sshCredential = new SSHCredential();
-                sshCredential.setGateway(gateway.getGatewayId());
-                String token = TokenGenerator.generateToken(gateway.getGatewayId(), null);
-                sshCredential.setToken(token);
-                sshCredential.setPortalUserName("testuser");
-                FileInputStream privateKeyStream = new FileInputStream(privateKeyPath);
-                File filePri = new File(privateKeyPath);
-                byte[] bFilePri = new byte[(int) filePri.length()];
-                privateKeyStream.read(bFilePri);
-                FileInputStream pubKeyStream = new FileInputStream(pubKeyPath);
-                File filePub = new File(pubKeyPath);
-                byte[] bFilePub = new byte[(int) filePub.length()];
-                pubKeyStream.read(bFilePub);
-                privateKeyStream.close();
-                pubKeyStream.close();
-                sshCredential.setPrivateKey(bFilePri);
-                sshCredential.setPublicKey(bFilePub);
-                sshCredential.setPassphrase(keyPassword);
-                writer.writeCredentials(sshCredential);
-                tokenMap.put(gateway.getGatewayId(), token);
-            }
-        } catch (ClassNotFoundException e) {
-            logger.error("Unable to find mysql driver", e);
-            throw new Exception("Unable to find mysql driver",e);
-        } catch (InstantiationException e) {
-            logger.error("Error while saving SSH credentials", e);
-            throw new Exception("Error while saving SSH credentials",e);
-        } catch (IllegalAccessException e) {
-            logger.error("Error while saving SSH credentials", e);
-            throw new Exception("Error while saving SSH credentials",e);
-        } catch (ApplicationSettingsException e) {
-            logger.error("Unable to read airavata-client properties", e);
-            throw new Exception("Unable to read airavata-client properties",e);
-        } catch (AiravataSystemException e) {
-            logger.error("Error occured while connecting with airavata client", e);
-            throw new Exception("Error occured while connecting with airavata client",e);
-        } catch (InvalidRequestException e) {
-            logger.error("Error occured while connecting with airavata client", e);
-            throw new Exception("Error occured while connecting with airavata client",e);
-        } catch (AiravataClientException e) {
-            logger.error("Error occured while connecting with airavata client", e);
-            throw new Exception("Error occured while connecting with airavata client",e);
-        } catch (TException e) {
-            logger.error("Error occured while connecting with airavata client", e);
-            throw new Exception("Error occured while connecting with airavata client",e);
-        } catch (FileNotFoundException e) {
-            logger.error("Could not find keys specified in the path", e);
-            throw new Exception("Could not find keys specified in the path",e);
-        } catch (CredentialStoreException e) {
-            logger.error("Error while saving SSH credentials", e);
-            throw new Exception("Error while saving SSH credentials",e);
-        } catch (IOException e) {
-            logger.error("Error while saving SSH credentials", e);
-            throw new Exception("Error while saving SSH credentials",e);
-        }
-    }
-
-    public int getGatewayCount() {
-        return gatewayCount;
-    }
-
-    public void setGatewayCount(int gatewayCount) {
-        this.gatewayCount = gatewayCount;
-    }
-
-    public Map<String, String> getTokenMap() {
-        return tokenMap;
-    }
-
-    public void setTokenMap(Map<String, String> tokenMap) {
-        this.tokenMap = tokenMap;
-    }
-
-    public Map<String, String> getProjectMap() {
-        return projectMap;
-    }
-
-    public void setProjectMap(Map<String, String> projectMap) {
-        this.projectMap = projectMap;
-    }
-}


Mime
View raw message