Repository: airavata Updated Branches: refs/heads/master 1302c309b -> 8b5b8869a
fixing test suite to match with new data model changes Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/8b5b8869 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/8b5b8869 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/8b5b8869 Branch: refs/heads/master Commit: 8b5b8869acd3ba18b69b0d934eea5a32219f778d Parents: 1302c30 Author: Chathuri Wimalasena <[email protected]> Authored: Fri Sep 18 15:15:32 2015 -0400 Committer: Chathuri Wimalasena <[email protected]> Committed: Fri Sep 18 15:15:32 2015 -0400 ---------------------------------------------------------------------- .../multitenantedairavata/AiravataClient.java | 4 +- .../ApplicationRegister.java | 45 ++--- .../ComputeResourceRegister.java | 35 ++-- .../ExperimentExecution.java | 172 ++++++++++--------- .../multitenantedairavata/GatewayRegister.java | 11 +- pom.xml | 2 +- 6 files changed, 142 insertions(+), 127 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/8b5b8869/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 5126249..8b4b48b 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 @@ -23,7 +23,7 @@ package org.apache.airavata.testsuite.multitenantedairavata; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.client.AiravataClientFactory; -import org.apache.airavata.model.error.AiravataClientConnectException; +import org.apache.airavata.model.error.AiravataClientException; import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyFileType; import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyReader; import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants; @@ -51,7 +51,7 @@ public class AiravataClient { int airavataport = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_PORT, PropertyFileType.AIRAVATA_CLIENT)); airavataClient = AiravataClientFactory.createAiravataClient(airavataHost, airavataport); return airavataClient; - } catch (AiravataClientConnectException e) { + } catch (AiravataClientException e) { logger.error("Error while creating airavata client instance", e); throw new Exception("Error while creating airavata client instance", e); } http://git-wip-us.apache.org/repos/asf/airavata/blob/8b5b8869/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 6959fff..c02daa5 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 @@ -26,9 +26,10 @@ import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentD import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType; import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription; -import org.apache.airavata.model.appcatalog.appinterface.DataType; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; +import org.apache.airavata.model.application.io.DataType; +import org.apache.airavata.model.application.io.InputDataObjectType; +import org.apache.airavata.model.application.io.OutputDataObjectType; +import org.apache.airavata.model.security.AuthzToken; import org.apache.airavata.model.workspace.Gateway; import org.apache.airavata.testsuite.multitenantedairavata.utils.FrameworkUtils; import org.apache.airavata.testsuite.multitenantedairavata.utils.TestFrameworkConstants; @@ -52,6 +53,7 @@ public class ApplicationRegister { private String gordenResourceId; private String alamoResourceId; private List<String> gatewaysToAvoid; + private AuthzToken authzToken; public ApplicationRegister(Airavata.Client airavata, TestFrameworkProps props) throws Exception { @@ -61,11 +63,12 @@ public class ApplicationRegister { applicationDeployementListPerGateway = new HashMap<String, String>(); FrameworkUtils frameworkUtils = FrameworkUtils.getInstance(); gatewaysToAvoid = frameworkUtils.getGatewayListToAvoid(props.getSkippedGateways()); + authzToken = new AuthzToken("emptyToken"); } public List<Gateway> getAllGateways(Airavata.Client client) throws Exception{ try { - return client.getAllGateways(); + return client.getAllGateways(authzToken); }catch (Exception e){ logger.error("Error while getting all the gateways", e); throw new Exception("Error while getting all the gateways", e); @@ -73,7 +76,7 @@ public class ApplicationRegister { } public void addApplications () throws Exception{ - Map<String, String> allComputeResourceNames = airavata.getAllComputeResourceNames(); + Map<String, String> allComputeResourceNames = airavata.getAllComputeResourceNames(authzToken); System.out.println("All compute resources :" + allComputeResourceNames.size()); for (String resourceId : allComputeResourceNames.keySet()){ String resourceName = allComputeResourceNames.get(resourceId); @@ -106,7 +109,7 @@ public class ApplicationRegister { } if (isgatewayValid) { // add amber module - String amberModuleId = airavata.registerApplicationModule(gateway.getGatewayId(), + String amberModuleId = airavata.registerApplicationModule(authzToken, gateway.getGatewayId(), createApplicationModule(TestFrameworkConstants.AppcatalogConstants.AMBER_APP_NAME, "12.0", TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION)); System.out.println("Amber Module Id " + amberModuleId); @@ -120,9 +123,9 @@ public class ApplicationRegister { ApplicationDeploymentDescription amberStampedeDeployment = createApplicationDeployment(amberModuleId, stampedeResourceId, "/opt/apps/intel13/mvapich2_1_9/amber/12.0/bin/sander.MPI -O", ApplicationParallelismType.MPI, TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION, moduleLoadCMDs, null, null); - String amberStampedeAppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(), amberStampedeDeployment); + String amberStampedeAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), amberStampedeDeployment); - String amberTrestlesAppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(), + String amberTrestlesAppDeployId = airavata.registerApplicationDeployment(authzToken,gateway.getGatewayId(), createApplicationDeployment(amberModuleId, trestlesResourceId, "/opt/amber/bin/sander.MPI -O", ApplicationParallelismType.MPI, TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION, moduleLoadCMDs, null, null)); @@ -130,7 +133,7 @@ public class ApplicationRegister { List<String> amberModuleLoadCMDsBr2 = new ArrayList<String>(); amberModuleLoadCMDsBr2.add("module load amber/gnu/mpi/12"); amberModuleLoadCMDsBr2.add("module swap PrgEnv-cray PrgEnv-gnu"); - String amberBr2AppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(), + String amberBr2AppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), createApplicationDeployment(amberModuleId, br2ResourceId, "/N/soft/cle4/amber/gnu/mpi/12/amber12/bin/sander.MPI -O", ApplicationParallelismType.MPI, TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION, amberModuleLoadCMDsBr2, null, null)); @@ -155,7 +158,7 @@ public class ApplicationRegister { } if (isgatewayValid) { // add amber module - String ultrascanModuleId = airavata.registerApplicationModule(gateway.getGatewayId(), + String ultrascanModuleId = airavata.registerApplicationModule(authzToken, gateway.getGatewayId(), createApplicationModule(TestFrameworkConstants.AppcatalogConstants.ULTRASCAN, "1.0", TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION)); System.out.println("Ultrascan module Id " + ultrascanModuleId); @@ -167,14 +170,14 @@ public class ApplicationRegister { ApplicationDeploymentDescription ultrascanStampedeDeployment = createApplicationDeployment(ultrascanModuleId, stampedeResourceId, "/home1/01623/us3/bin/us_mpi_analysis", ApplicationParallelismType.MPI, TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, null, null, null); - String ultrascanStampedeAppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(), ultrascanStampedeDeployment); + String ultrascanStampedeAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), ultrascanStampedeDeployment); - String ultrascanTrestlesAppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(), + String ultrascanTrestlesAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), createApplicationDeployment(ultrascanModuleId, trestlesResourceId, "/home/us3/trestles/bin/us_mpi_analysis", ApplicationParallelismType.MPI, TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, null, null, null)); - String ultrascanGordenAppDepId = airavata.registerApplicationDeployment(gateway.getGatewayId(), + String ultrascanGordenAppDepId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), createApplicationDeployment(ultrascanModuleId,gordenResourceId, "/home/us3/gordon/bin/us_mpi_analysis", ApplicationParallelismType.MPI, TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, null, null, null)); @@ -184,7 +187,7 @@ public class ApplicationRegister { alamoModules.add("module load openmpi/intel/1.8.4"); alamoModules.add("module load qt4/4.8.6"); alamoModules.add("module load ultrascan3/3.3"); - String ultrascanAlamoAppId = airavata.registerApplicationDeployment(gateway.getGatewayId(), + String ultrascanAlamoAppId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), createApplicationDeployment(ultrascanModuleId,alamoResourceId, "/home/us3/bin/us_mpi_analysis", ApplicationParallelismType.OPENMP, TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, alamoModules, null, null)); @@ -223,7 +226,7 @@ public class ApplicationRegister { applicationOutputs.add(output2); applicationOutputs.add(output3); - String ultrascanAppId = airavata.registerApplicationInterface(gateway.getGatewayId(), + String ultrascanAppId = airavata.registerApplicationInterface(authzToken, gateway.getGatewayId(), createApplicationInterfaceDescription(TestFrameworkConstants.AppcatalogConstants.ULTRASCAN, TestFrameworkConstants.AppcatalogConstants.ULTRASCAN_DESCRIPTION, appModules, applicationInputs, applicationOutputs)); System.out.println("Ultrascan Application Interface Id " + ultrascanAppId); @@ -262,7 +265,7 @@ public class ApplicationRegister { applicationOutputs.add(output5); applicationOutputs.add(output6); - String amberInterfaceId = airavata.registerApplicationInterface(gateway.getGatewayId(), + String amberInterfaceId = airavata.registerApplicationInterface(authzToken, gateway.getGatewayId(), createApplicationInterfaceDescription(TestFrameworkConstants.AppcatalogConstants.AMBER_APP_NAME, TestFrameworkConstants.AppcatalogConstants.AMBER_DESCRIPTION, appModules, applicationInputs, applicationOutputs)); System.out.println("Amber Application Interface Id " + amberInterfaceId); @@ -285,7 +288,7 @@ public class ApplicationRegister { applicationOutputs.add(output1); applicationOutputs.add(output2); - String echoInterfaceId = airavata.registerApplicationInterface(gateway.getGatewayId(), + String echoInterfaceId = airavata.registerApplicationInterface(authzToken, gateway.getGatewayId(), createApplicationInterfaceDescription(TestFrameworkConstants.AppcatalogConstants.ECHO_NAME, TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION, appModules, applicationInputs, applicationOutputs)); System.out.println("Echo Application Interface Id " + echoInterfaceId); @@ -304,7 +307,7 @@ public class ApplicationRegister { } if (isgatewayValid) { // add echo module - String echoModuleId = airavata.registerApplicationModule(gateway.getGatewayId(), + String echoModuleId = airavata.registerApplicationModule(authzToken, gateway.getGatewayId(), createApplicationModule(TestFrameworkConstants.AppcatalogConstants.ECHO_NAME, "1.0", TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION)); System.out.println("Echo Module Id " + echoModuleId); @@ -313,17 +316,17 @@ public class ApplicationRegister { applicationInterfaceListPerGateway.put(echoInterfaceId, gateway.getGatewayId()); // add amber deployment - String echoStampedeAppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(), + String echoStampedeAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), createApplicationDeployment(echoModuleId, stampedeResourceId, "/home1/01437/ogce/production/app_wrappers/echo_wrapper.sh", ApplicationParallelismType.SERIAL, TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION, null, null, null)); - String echoTrestlesAppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(), + String echoTrestlesAppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), createApplicationDeployment(echoModuleId, trestlesResourceId, "/home/ogce/production/app_wrappers/echo_wrapper.sh", ApplicationParallelismType.SERIAL, TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION, null, null, null)); - String echoBr2AppDeployId = airavata.registerApplicationDeployment(gateway.getGatewayId(), + String echoBr2AppDeployId = airavata.registerApplicationDeployment(authzToken, gateway.getGatewayId(), createApplicationDeployment(echoModuleId, br2ResourceId, "/N/u/cgateway/BigRed2/production/app_wrappers/echo_wrapper.sh", ApplicationParallelismType.SERIAL, TestFrameworkConstants.AppcatalogConstants.ECHO_DESCRIPTION, null, null, null)); http://git-wip-us.apache.org/repos/asf/airavata/blob/8b5b8869/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 b28b8b0..f063e99 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 @@ -26,14 +26,15 @@ import org.apache.airavata.model.appcatalog.computeresource.*; import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile; import org.apache.airavata.model.error.AiravataClientException; -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.airavata.model.security.AuthzToken; import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class ComputeResourceRegister { private Airavata.Client airavata; @@ -42,12 +43,14 @@ public class ComputeResourceRegister { private Map<String, String> loginNamesWithResourceIds; private final static Logger logger = LoggerFactory.getLogger(ComputeResourceRegister.class); private TestFrameworkProps properties; + private AuthzToken authzToken; public ComputeResourceRegister(Airavata.Client airavata, TestFrameworkProps props) throws Exception { this.airavata = airavata; this.properties = props; computeResourceIds = new ArrayList<String>(); loginNamesWithResourceMap = getLoginNamesMap(); + authzToken = new AuthzToken("emptyToken"); } @@ -64,7 +67,7 @@ public class ComputeResourceRegister { public Map<String, String> getLoginNamesWithResourceIDs() throws Exception { loginNamesWithResourceIds = new HashMap<String, String>(); - Map<String, String> allComputeResourceNames = airavata.getAllComputeResourceNames(); + Map<String, String> allComputeResourceNames = airavata.getAllComputeResourceNames(authzToken); for (String resourceId : allComputeResourceNames.keySet()) { String resourceName = allComputeResourceNames.get(resourceId); loginNamesWithResourceIds.put(resourceId, loginNamesWithResourceMap.get(resourceName)); @@ -127,7 +130,7 @@ public class ComputeResourceRegister { ComputeResourceDescription computeResourceDescription = createComputeResourceDescription(hostName, hostDesc, null, null); - String computeResourceId = airavata.registerComputeResource(computeResourceDescription); + String computeResourceId = airavata.registerComputeResource(authzToken, computeResourceDescription); if (computeResourceId.isEmpty()) throw new AiravataClientException(); @@ -144,12 +147,12 @@ public class ComputeResourceRegister { sshJobSubmission.setSecurityProtocol(securityProtocol); // sshJobSubmission.setMonitorMode(MonitorMode.JOB_EMAIL_NOTIFICATION_MONITOR); sshJobSubmission.setSshPort(portNumber); - airavata.addSSHJobSubmissionDetails(computeResourceId, 1, sshJobSubmission); + airavata.addSSHJobSubmissionDetails(authzToken, computeResourceId, 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(securityProtocol); scpDataMovement.setSshPort(portNumber); - airavata.addSCPDataMovementDetails(computeResourceId, 1, scpDataMovement); + airavata.addSCPDataMovementDetails(authzToken, computeResourceId, 1, scpDataMovement); return computeResourceId; } @@ -187,7 +190,7 @@ public class ComputeResourceRegister { loginNamesWithResourceIds = getLoginNamesWithResourceIDs(); - List<GatewayResourceProfile> allGatewayComputeResources = airavata.getAllGatewayComputeResources(); + List<GatewayResourceProfile> allGatewayComputeResources = airavata.getAllGatewayComputeResources(authzToken); for (GatewayResourceProfile gatewayResourceProfile : allGatewayComputeResources) { for (String resourceId : loginNamesWithResourceIds.keySet()) { String loginUserName = loginNamesWithResourceIds.get(resourceId); @@ -195,34 +198,34 @@ public class ComputeResourceRegister { if (loginUserName.equals("ogce")){ stampedeOGCEResourcePreferences = createComputeResourcePreference(resourceId, "TG-STA110014S", false, null, JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/scratch/01437/ogce/gta-work-dirs", loginUserName); - airavata.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), resourceId, stampedeOGCEResourcePreferences); + airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, stampedeOGCEResourcePreferences); }else if (loginUserName.equals("us3")){ stampedeUS3ResourcePreferences = createComputeResourcePreference(resourceId, "TG-MCB070039N", false, null, JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/scratch/01623/us3/jobs/", loginUserName); - airavata.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), resourceId, stampedeUS3ResourcePreferences); + airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, stampedeUS3ResourcePreferences); } }else if (resourceId.contains("trestles")){ if (loginUserName.equals("ogce")){ trestlesOGCEResourcePreferences = createComputeResourcePreference(resourceId, "sds128", false, null, JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/oasis/scratch/trestles/ogce/temp_project/gta-work-dirs", loginUserName); - airavata.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), resourceId, trestlesOGCEResourcePreferences); + airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, trestlesOGCEResourcePreferences); }else if (loginUserName.equals("us3")){ trestlesUS3ResourcePreferences = createComputeResourcePreference(resourceId, "uot111", false, null, JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/oasis/projects/nsf/uot111/us3/airavata-workdirs/", loginUserName); - airavata.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), resourceId, trestlesUS3ResourcePreferences); + airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, trestlesUS3ResourcePreferences); } }else if (resourceId.contains("bigred2") && loginUserName.equals("cgateway")){ bigRedCgatewayResourcePreferences = createComputeResourcePreference(resourceId, "TG-STA110014S", false, null, null, null, "/N/dc2/scratch/cgateway/gta-work-dirs", loginUserName); - airavata.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), resourceId, bigRedCgatewayResourcePreferences); + airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, bigRedCgatewayResourcePreferences); }else if (resourceId.contains("gordon") && loginUserName.equals("us3")){ gordenUS3ResourcePreference = createComputeResourcePreference(resourceId, "uot111", false, null, JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/home/us3/gordon/work/airavata", loginUserName); - airavata.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), resourceId, gordenUS3ResourcePreference); + airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, gordenUS3ResourcePreference); }else if (resourceId.contains("alamo") && loginUserName.equals("us3")){ alamoUS3ResourcePreference = createComputeResourcePreference(resourceId, null, false, "batch", JobSubmissionProtocol.SSH, DataMovementProtocol.SCP, "/home/us3/work/airavata", loginUserName); - airavata.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), resourceId, alamoUS3ResourcePreference); + airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, alamoUS3ResourcePreference); } } } http://git-wip-us.apache.org/repos/asf/airavata/blob/8b5b8869/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 6b89e20..ab5b521 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 @@ -27,17 +27,22 @@ import org.apache.airavata.messaging.core.MessageContext; import org.apache.airavata.messaging.core.MessageHandler; import org.apache.airavata.messaging.core.MessagingConstants; import org.apache.airavata.messaging.core.impl.RabbitMQStatusConsumer; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; +import org.apache.airavata.model.application.io.InputDataObjectType; +import org.apache.airavata.model.application.io.OutputDataObjectType; +import org.apache.airavata.model.commons.ErrorModel; 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.experiment.ExperimentModel; +import org.apache.airavata.model.experiment.UserConfigurationDataModel; import org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent; import org.apache.airavata.model.messaging.event.JobStatusChangeEvent; import org.apache.airavata.model.messaging.event.MessageType; +import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel; +import org.apache.airavata.model.security.AuthzToken; +import org.apache.airavata.model.status.ExperimentState; import org.apache.airavata.model.util.ExperimentModelUtil; import org.apache.airavata.model.workspace.Project; -import org.apache.airavata.model.experiment.*; import org.apache.airavata.testsuite.multitenantedairavata.utils.FrameworkUtils; import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyFileType; import org.apache.airavata.testsuite.multitenantedairavata.utils.PropertyReader; @@ -66,6 +71,7 @@ public class ExperimentExecution { private String testUser; private List<String> gatewaysToAvoid; private TestFrameworkProps properties; + private AuthzToken authzToken; public ExperimentExecution(Airavata.Client airavata, Map<String, String> tokenMap, @@ -75,6 +81,7 @@ public class ExperimentExecution { this.appInterfaceMap = getApplicationMap(tokenMap); this.propertyReader = new PropertyReader(); this.properties = props; + authzToken = new AuthzToken("emptyToken"); FrameworkUtils frameworkUtils = FrameworkUtils.getInstance(); testUser = props.getTestUserName(); gatewaysToAvoid = frameworkUtils.getGatewayListToAvoid(properties.getSkippedGateways()); @@ -107,7 +114,7 @@ public class ExperimentExecution { try { if (tokenMap != null && !tokenMap.isEmpty()){ for (String gatewayId : tokenMap.keySet()){ - Map<String, String> allApplicationInterfaceNames = airavata.getAllApplicationInterfaceNames(gatewayId); + Map<String, String> allApplicationInterfaceNames = airavata.getAllApplicationInterfaceNames(authzToken, gatewayId); appInterfaceMap.put(gatewayId, allApplicationInterfaceNames); } } @@ -140,7 +147,7 @@ public class ExperimentExecution { } } if (isgatewayValid){ - List<Project> allUserProjects = airavata.getAllUserProjects(gatewayId, testUser); + List<Project> allUserProjects = airavata.getUserProjects(authzToken, gatewayId, testUser, 5, 0); projectsMap.put(gatewayId, allUserProjects); } } @@ -164,7 +171,7 @@ public class ExperimentExecution { public void launchExperiments () throws Exception { try { for (String expId : experimentsWithTokens.keySet()){ - airavata.launchExperiment(expId, experimentsWithTokens.get(expId)); + airavata.launchExperiment(authzToken, expId, experimentsWithTokens.get(expId)); } }catch (Exception e){ logger.error("Error while launching experiment", e); @@ -216,7 +223,7 @@ public class ExperimentExecution { resultWriter.println("====================================================================="); resultWriter.println("Status : " + ExperimentState.COMPLETED.toString()); // check file transfers - List<OutputDataObjectType> experimentOutputs = airavata.getExperimentOutputs(expId); + List<OutputDataObjectType> experimentOutputs = airavata.getExperimentOutputs(authzToken, expId); int i = 1; for (OutputDataObjectType output : experimentOutputs) { System.out.println("################ Experiment : " + expId + " COMPLETES ###################"); @@ -232,14 +239,13 @@ public class ExperimentExecution { int j = 1; resultWriter.println("Status : " + ExperimentState.FAILED.toString()); System.out.println("################ Experiment : " + expId + " FAILED ###################"); - Experiment experiment = airavata.getExperiment(expId); - List<ErrorDetails> errors = experiment.getErrors(); + ExperimentModel experiment = airavata.getExperiment(authzToken, expId); + List<ErrorModel> errors = experiment.getErrors(); if (errors != null && !errors.isEmpty()){ - for (ErrorDetails errorDetails : errors) { + for (ErrorModel errorDetails : errors) { System.out.println(errorDetails.getActualErrorMessage()); resultWriter.println("Actual Error : " + j + " : " + errorDetails.getActualErrorMessage()); resultWriter.println("User Friendly Message : " + j + " : " + errorDetails.getUserFriendlyMessage()); - resultWriter.println("Corrective Action : " + j + " : " + errorDetails.getCorrectiveAction()); } } @@ -284,8 +290,8 @@ public class ExperimentExecution { String hostId, String appId) throws Exception { try { - List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(appId); - List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(appId); + List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(authzToken, appId); + List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(authzToken, appId); TestFrameworkProps.Error[] errors = properties.getErrors(); for (TestFrameworkProps.Error error : errors) { String name = error.getName(); @@ -300,38 +306,38 @@ public class ExperimentExecution { } } } - Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, testUser, "AmberErrorInputs", "Amber Experiment run", appId, applicationInputs); + ExperimentModel simpleExperiment = + ExperimentModelUtil.createSimpleExperiment(gatewayId, projectId, testUser, "AmberErrorInputs", "Amber Experiment run", appId, applicationInputs); simpleExperiment.setExperimentOutputs(appOutputs); String experimentId; if (hostName.equals(TestFrameworkConstants.AppcatalogConstants.TRESTLES_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); } else if (hostName.equals(TestFrameworkConstants.AppcatalogConstants.STAMPEDE_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); } else if (hostName.equals(TestFrameworkConstants.AppcatalogConstants.BR2_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); } @@ -359,8 +365,8 @@ public class ExperimentExecution { String hostName = error.getResoureName(); if (name.equals(TestFrameworkConstants.ErrorTypeConstants.ERROR_CONFIG)) { if (error.getApplication().equals(TestFrameworkConstants.AppcatalogConstants.AMBER_APP_NAME)) { - List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(appId); - List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(appId); + List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(authzToken, appId); + List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(authzToken, appId); TestFrameworkProps.Application[] applications = properties.getApplications(); Map<String, String> userGivenAmberInputs = new HashMap<>(); for (TestFrameworkProps.Application application : applications) { @@ -392,17 +398,17 @@ public class ExperimentExecution { } } - Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, testUser, "AmberErrorConfigs", "Amber Experiment run", appId, applicationInputs); + ExperimentModel simpleExperiment = + ExperimentModelUtil.createSimpleExperiment(gatewayId, projectId, testUser, "AmberErrorConfigs", "Amber Experiment run", appId, applicationInputs); simpleExperiment.setExperimentOutputs(appOutputs); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 4, 1, 1, queueName, walltime, 0, 1, allocationProject); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 4, 1, 1, queueName, walltime, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - String experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + String experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); @@ -432,8 +438,8 @@ public class ExperimentExecution { for (String appId : appsWithNames.keySet()){ String appName = appsWithNames.get(appId); if (appName.equals(TestFrameworkConstants.AppcatalogConstants.AMBER_APP_NAME)){ - List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(appId); - List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(appId); + List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(authzToken, appId); + List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(authzToken, appId); for (String inputName : userGivenAmberInputs.keySet()){ for (InputDataObjectType inputDataObjectType : applicationInputs) { if (inputDataObjectType.getName().equalsIgnoreCase(inputName)) { @@ -446,46 +452,46 @@ public class ExperimentExecution { if (projectsPerGateway != null && !projectsPerGateway.isEmpty()){ projectID = projectsPerGateway.get(0).getProjectID(); } - Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectID, testUser, "Amber Experiment", "Amber Experiment run", appId, applicationInputs); + ExperimentModel simpleExperiment = + ExperimentModelUtil.createSimpleExperiment(gatewayId, projectID, testUser, "Amber Experiment", "Amber Experiment run", appId, applicationInputs); simpleExperiment.setExperimentOutputs(appOutputs); String experimentId; - Map<String, String> computeResources = airavata.getAvailableAppInterfaceComputeResources(appId); + Map<String, String> computeResources = airavata.getAvailableAppInterfaceComputeResources(authzToken, appId); if (computeResources != null && computeResources.size() != 0) { for (String id : computeResources.keySet()) { String resourceName = computeResources.get(id); if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.TRESTLES_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.STAMPEDE_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); createAmberWithErrorInputs(gatewayId, token, projectID, id, appId); createAmberWithErrorUserConfig(gatewayId, token, projectID, id, appId); } else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.BR2_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); -// experimentId = airavata.createExperiment(gatewayId, simpleExperiment); -// experimentsWithTokens.put(experimentId, token); -// experimentsWithGateway.put(experimentId, gatewayId); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); + experimentsWithTokens.put(experimentId, token); + experimentsWithGateway.put(experimentId, gatewayId); } } } @@ -516,8 +522,8 @@ public class ExperimentExecution { for (String appId : appsWithNames.keySet()){ String appName = appsWithNames.get(appId); if (appName.equals(TestFrameworkConstants.AppcatalogConstants.ULTRASCAN)){ - List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(appId); - List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(appId); + List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(authzToken, appId); + List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(authzToken, appId); for (String inputName : userGivenAmberInputs.keySet()){ for (InputDataObjectType inputDataObjectType : applicationInputs) { if (inputDataObjectType.getName().equalsIgnoreCase(inputName)) { @@ -530,62 +536,62 @@ public class ExperimentExecution { if (projectsPerGateway != null && !projectsPerGateway.isEmpty()){ projectID = projectsPerGateway.get(0).getProjectID(); } - Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectID, testUser, "TestFR_Ultrascan_Experiment", "Ultrascan Experiment run", appId, applicationInputs); + ExperimentModel simpleExperiment = + ExperimentModelUtil.createSimpleExperiment(gatewayId, projectID, testUser, "TestFR_Ultrascan_Experiment", "Ultrascan Experiment run", appId, applicationInputs); simpleExperiment.setExperimentOutputs(appOutputs); String experimentId; - Map<String, String> computeResources = airavata.getAvailableAppInterfaceComputeResources(appId); + Map<String, String> computeResources = airavata.getAvailableAppInterfaceComputeResources(authzToken, appId); if (computeResources != null && computeResources.size() != 0) { for (String id : computeResources.keySet()) { String resourceName = computeResources.get(id); if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.STAMPEDE_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 30, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 30, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.ALAMO_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "batch", 30, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "batch", 30, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.GORDEN_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 30, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 30, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.COMET_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "compute", 30, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "compute", 30, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken,gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); }else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.LONESTAR_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 30, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 30, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); } @@ -619,8 +625,8 @@ public class ExperimentExecution { for (String appId : appsWithNames.keySet()) { String appName = appsWithNames.get(appId); if (appName.equals(TestFrameworkConstants.AppcatalogConstants.ECHO_NAME)) { - List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(appId); - List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(appId); + List<InputDataObjectType> applicationInputs = airavata.getApplicationInputs(authzToken, appId); + List<OutputDataObjectType> appOutputs = airavata.getApplicationOutputs(authzToken, appId); for (InputDataObjectType inputDataObjectType : applicationInputs) { if (inputDataObjectType.getName().equalsIgnoreCase("input_to_Echo")) { inputDataObjectType.setValue("Hello World !!!"); @@ -632,44 +638,44 @@ public class ExperimentExecution { if (projectsPerGateway != null && !projectsPerGateway.isEmpty()) { projectID = projectsPerGateway.get(0).getProjectID(); } - Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectID, "admin", "Echo Experiment", "Echo Experiment run", appId, applicationInputs); + ExperimentModel simpleExperiment = + ExperimentModelUtil.createSimpleExperiment(gatewayId, projectID, "admin", "Echo Experiment", "Echo Experiment run", appId, applicationInputs); simpleExperiment.setExperimentOutputs(appOutputs); String experimentId; - Map<String, String> computeResources = airavata.getAvailableAppInterfaceComputeResources(appId); + Map<String, String> computeResources = airavata.getAvailableAppInterfaceComputeResources(authzToken, appId); if (computeResources != null && computeResources.size() != 0) { for (String id : computeResources.keySet()) { String resourceName = computeResources.get(id); if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.TRESTLES_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); } else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.STAMPEDE_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); - experimentId = airavata.createExperiment(gatewayId, simpleExperiment); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); experimentsWithTokens.put(experimentId, token); experimentsWithGateway.put(experimentId, gatewayId); } else if (resourceName.equals(TestFrameworkConstants.AppcatalogConstants.BR2_RESOURCE_NAME)) { - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); -// experimentId = airavata.createExperiment(gatewayId, simpleExperiment); -// experimentsWithTokens.put(experimentId, token); -// experimentsWithGateway.put(experimentId, gatewayId); + experimentId = airavata.createExperiment(authzToken, gatewayId, simpleExperiment); + experimentsWithTokens.put(experimentId, token); + experimentsWithGateway.put(experimentId, gatewayId); } } } http://git-wip-us.apache.org/repos/asf/airavata/blob/8b5b8869/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 index a028799..6cf5354 100644 --- 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 @@ -34,6 +34,7 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfil 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.security.AuthzToken; import org.apache.airavata.model.workspace.Gateway; import org.apache.airavata.model.workspace.Project; import org.apache.airavata.testsuite.multitenantedairavata.utils.FrameworkUtils; @@ -60,6 +61,7 @@ public class GatewayRegister { private String testProject; private List<String> gatewaysToAvoid; private TestFrameworkProps properties; + private AuthzToken authzToken; public GatewayRegister(Airavata.Client client, TestFrameworkProps props) throws Exception{ try { @@ -72,6 +74,7 @@ public class GatewayRegister { testProject = properties.getTestProjectName(); FrameworkUtils frameworkUtils = FrameworkUtils.getInstance(); gatewaysToAvoid = frameworkUtils.getGatewayListToAvoid(properties.getSkippedGateways()); + authzToken = new AuthzToken("emptyToken"); }catch (Exception e){ logger.error("Error while initializing setup step", e); throw new Exception("Error while initializing setup step", e); @@ -90,10 +93,10 @@ public class GatewayRegister { gateway.setGatewayId(gatewayId); gateway.setGatewayName(gatewayId); gateway.setDomain(gatewayId + genericGatewayDomain); - airavata.addGateway(gateway); + airavata.addGateway(authzToken, gateway); GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile(); gatewayResourceProfile.setGatewayID(gatewayId); - airavata.registerGatewayResourceProfile(gatewayResourceProfile); + airavata.registerGatewayResourceProfile(authzToken, gatewayResourceProfile); // create a project per each gateway createProject(gatewayId); } @@ -116,7 +119,7 @@ public class GatewayRegister { Project project = new Project(); project.setName(testProject); project.setOwner(testUser); - String projectId = airavata.createProject(gatewayId, project); + String projectId = airavata.createProject(authzToken, gatewayId, project); projectMap.put(projectId, gatewayId); } @@ -137,7 +140,7 @@ public class GatewayRegister { String keyPassword = properties.getSshPassword(); DBUtil dbUtil = new DBUtil(jdbcURL, userName, password, jdbcDriver); SSHCredentialWriter writer = new SSHCredentialWriter(dbUtil); - List<Gateway> allGateways = airavata.getAllGateways(); + List<Gateway> allGateways = airavata.getAllGateways(authzToken); for (Gateway gateway : allGateways){ boolean isgatewayValid = true; for (String ovoidGateway : gatewaysToAvoid){ http://git-wip-us.apache.org/repos/asf/airavata/blob/8b5b8869/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index c5ed1f1..4f5837e 100644 --- a/pom.xml +++ b/pom.xml @@ -557,7 +557,7 @@ <module>modules/credential-store</module> <module>modules/orchestrator</module> <module>modules/server</module> - <!--<module>modules/test-suite</module>--> + <module>modules/test-suite</module> <!--<module>modules/integration-tests</module>--> <!--<module>modules/workflow</module>--> <!--<module>modules/xbaya-gui</module>-->
