Repository: airavata Updated Branches: refs/heads/master 8b5b8869a -> 9ce24a559
changing integration tests to work with new data models Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9ce24a55 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9ce24a55 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9ce24a55 Branch: refs/heads/master Commit: 9ce24a559e181034b0aca5f038d5cc886b8aed08 Parents: 8b5b886 Author: Chathuri Wimalasena <[email protected]> Authored: Fri Sep 18 16:03:47 2015 -0400 Committer: Chathuri Wimalasena <[email protected]> Committed: Fri Sep 18 16:03:47 2015 -0400 ---------------------------------------------------------------------- .../apache/airavata/integration/BaseCaseIT.java | 38 +++-- .../airavata/integration/DataRetrievalIT.java | 56 ++++--- .../airavata/integration/SimpleEchoIT.java | 27 +-- .../SingleAppIntegrationTestBase.java | 25 +-- .../WorkflowIntegrationTestBase.java | 13 +- .../integration/tools/DocumentCreatorNew.java | 165 ++++++++++--------- .../integration/tools/DocumentCreatorUtils.java | 11 +- 7 files changed, 178 insertions(+), 157 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/9ce24a55/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java ---------------------------------------------------------------------- diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java index 96553fe..7b59a2c 100644 --- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java +++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java @@ -23,17 +23,18 @@ package org.apache.airavata.integration; import junit.framework.Assert; import org.apache.airavata.integration.tools.DocumentCreatorNew; -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.experiment.UserConfigurationDataModel; +import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel; +import org.apache.airavata.model.security.AuthzToken; +import org.apache.airavata.model.status.JobState; +import org.apache.airavata.model.status.JobStatus; import org.apache.airavata.model.util.ExperimentModelUtil; import org.apache.airavata.model.util.ProjectModelUtil; import org.apache.airavata.model.workspace.Project; -import org.apache.airavata.model.experiment.ComputationalResourceScheduling; import org.apache.airavata.model.experiment.ExperimentModel; -import org.apache.airavata.model.experiment.JobState; -import org.apache.airavata.model.experiment.JobStatus; -import org.apache.airavata.model.experiment.UserConfigurationData; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -56,7 +57,7 @@ import java.util.Set; */ public class BaseCaseIT extends WorkflowIntegrationTestBase { - + private AuthzToken authzToken; public BaseCaseIT() throws Exception { setUpEnvironment(); } @@ -72,6 +73,7 @@ public class BaseCaseIT extends WorkflowIntegrationTestBase { Assert.assertNotNull(version); log("Airavata version - " + version); + } // @Test(groups = {"setupTests"}, dependsOnMethods = {"testSetup"}) @@ -103,14 +105,14 @@ public class BaseCaseIT extends WorkflowIntegrationTestBase { exOut.add(output); Project project = ProjectModelUtil.createProject("project1", "admin", "test project"); - String projectId = getClient().createProject("default", project); + String projectId = getClient().createProject(authzToken, "default", project); - Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", "SimpleEcho2", "SimpleEcho2", exInputs); + ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(gatewayName, projectId, "admin", "echoExperiment", "SimpleEcho2", "SimpleEcho2", exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0, 1, "sds128"); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0); scheduling.setResourceHostId("gsissh-trestles"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); @@ -126,7 +128,7 @@ public class BaseCaseIT extends WorkflowIntegrationTestBase { Map<String, JobStatus> jobStatuses = null; while (true) { try { - jobStatuses = client.getJobStatuses(expId); + jobStatuses = client.getJobStatuses(authzToken, expId); Set<String> strings = jobStatuses.keySet(); for (String key : strings) { JobStatus jobStatus = jobStatuses.get(key); @@ -177,14 +179,14 @@ public class BaseCaseIT extends WorkflowIntegrationTestBase { exOut.add(output); Project project = ProjectModelUtil.createProject("project1", "admin", "test project"); - String projectId = getClient().createProject("default", project); + String projectId = getClient().createProject(authzToken, "default", project); - Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", "SimpleEcho3", "SimpleEcho3", exInputs); + ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(gatewayName, projectId, "admin", "echoExperiment", "SimpleEcho3", "SimpleEcho3", exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 1, 1, 1, "normal", 0, 0, 1, "TG-STA110014S"); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 1, 1, 1, "normal", 0, 0); scheduling.setResourceHostId("stampede-host"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); @@ -200,7 +202,7 @@ public class BaseCaseIT extends WorkflowIntegrationTestBase { Map<String, JobStatus> jobStatuses = null; while (true) { try { - jobStatuses = client.getJobStatuses(expId); + jobStatuses = client.getJobStatuses(authzToken, expId); Set<String> strings = jobStatuses.keySet(); for (String key : strings) { JobStatus jobStatus = jobStatuses.get(key); http://git-wip-us.apache.org/repos/asf/airavata/blob/9ce24a55/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java ---------------------------------------------------------------------- diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java index 514c766..55a953e 100644 --- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java +++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java @@ -21,13 +21,15 @@ package org.apache.airavata.integration; +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.scheduling.ComputationalResourceSchedulingModel; +import org.apache.airavata.model.security.AuthzToken; import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.api.Airavata.Client; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.integration.tools.DocumentCreatorNew; -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.error.*; import org.apache.airavata.model.util.ExperimentModelUtil; import org.apache.airavata.model.util.ProjectModelUtil; @@ -56,6 +58,7 @@ public class DataRetrievalIT extends AbstractIntegrationTest { private String[] users={"admin"}; private String[] projects={"project1","project2","project3"}; private List<String> projectIds = new ArrayList<String>(); + private AuthzToken authzToken; private static final int NUM_OF_EXPERIMENTS=10; @@ -65,6 +68,7 @@ public class DataRetrievalIT extends AbstractIntegrationTest { @BeforeTest public void setUp() throws Exception { init(); + authzToken = new AuthzToken("empty token"); experimentDataList=new ArrayList<String[]>(); addApplications(); addProjects(); @@ -83,7 +87,7 @@ public class DataRetrievalIT extends AbstractIntegrationTest { private void addProjects() throws TException { for (int i = 0; i < projects.length; i++){ Project project = ProjectModelUtil.createProject(projects[i], "admin", "test project"); - String projectId = getClient().createProject("default", project); + String projectId = getClient().createProject(authzToken, "default", project); projectIds.add(projectId); } } @@ -105,12 +109,12 @@ public class DataRetrievalIT extends AbstractIntegrationTest { log.info("Testing user experiments"); log.info("========================"); for (String user : users) { - List<Experiment> listUserExperiments = listUserExperiments(user); + List<ExperimentModel> listUserExperiments = listUserExperiments(user); List<String> data = getData(1, user, 0); log.info("\t"+user+" : "+data.size()+" experiments"); Assert.assertEquals(listUserExperiments.size(), data.size()); - for (Experiment experiment : listUserExperiments) { - Assert.assertThat(experiment.getExperimentID(), isIn(data)); + for (ExperimentModel experiment : listUserExperiments) { + Assert.assertThat(experiment.getExperimentId(), isIn(data)); } } } @@ -120,12 +124,12 @@ public class DataRetrievalIT extends AbstractIntegrationTest { log.info("Testing project experiments"); log.info("==========================="); for (String project : projectIds) { - List<Experiment> listProjectExperiments = listProjectExperiments(project); + List<ExperimentModel> listProjectExperiments = listProjectExperiments(project); List<String> data = getData(2, project, 0); log.info("\t"+project+" : "+data.size()+" experiments"); Assert.assertEquals(listProjectExperiments.size(), data.size()); - for (Experiment experiment : listProjectExperiments) { - Assert.assertThat(experiment.getExperimentID(), isIn(data)); + for (ExperimentModel experiment : listProjectExperiments) { + Assert.assertThat(experiment.getExperimentId(), isIn(data)); } } } @@ -158,25 +162,25 @@ public class DataRetrievalIT extends AbstractIntegrationTest { } - public List<Experiment> listUserExperiments(String user) throws ApplicationSettingsException, - AiravataClientConnectException, InvalidRequestException, + public List<ExperimentModel> listUserExperiments(String user) throws ApplicationSettingsException, + AiravataClientException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException { - return getClient().getAllUserExperiments("default", user); + return getClient().getUserExperiments(authzToken, "default", user, 10, 0); } - public List<Experiment> listProjectExperiments(String projectID) throws ApplicationSettingsException, - AiravataClientConnectException, InvalidRequestException, + public List<ExperimentModel> listProjectExperiments(String projectID) throws ApplicationSettingsException, + AiravataClientException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException { - return getClient().getAllExperimentsInProject(projectID); + return getClient().getExperimentsInProject(authzToken, projectID, 10, 0); } public List<Project> listUserProjects(String user) throws ApplicationSettingsException, - AiravataClientConnectException, InvalidRequestException, + AiravataClientException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException { - return getClient().getAllUserProjects("default", user); + return getClient().getUserProjects(authzToken, "default", user, 10, 0); } - public String runExperiment(String user, String project) throws ApplicationSettingsException, AiravataClientConnectException, + public String runExperiment(String user, String project) throws ApplicationSettingsException, AiravataClientException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException, ExperimentNotFoundException { List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>(); @@ -193,25 +197,25 @@ public class DataRetrievalIT extends AbstractIntegrationTest { output.setValue(""); exOut.add(output); - Experiment simpleExperiment = ExperimentModelUtil - .createSimpleExperiment(project, user, "echoExperiment", + ExperimentModel simpleExperiment = ExperimentModelUtil + .createSimpleExperiment("default", project, user, "echoExperiment", "SimpleEcho0", "SimpleEcho0", exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil .createComputationResourceScheduling("localhost", 1, 1, 1, - "normal", 0, 0, 1, "sds128"); + "normal", 0, 0); scheduling.setResourceHostId("localhost"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); simpleExperiment.setUserConfigurationData(userConfigurationData); Client client = getClient(); - final String expId = client.createExperiment("default", simpleExperiment); + final String expId = client.createExperiment(authzToken, "default", simpleExperiment); - client.launchExperiment(expId, "testToken"); + client.launchExperiment(authzToken, expId, "testToken"); return expId; } http://git-wip-us.apache.org/repos/asf/airavata/blob/9ce24a55/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java ---------------------------------------------------------------------- diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java index bbe31ae..d89baa7 100644 --- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java +++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java @@ -21,17 +21,17 @@ package org.apache.airavata.integration; -import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.integration.tools.DocumentCreatorNew; -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.experiment.ExperimentModel; +import org.apache.airavata.model.experiment.UserConfigurationDataModel; +import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel; +import org.apache.airavata.model.security.AuthzToken; import org.apache.airavata.model.util.ExperimentModelUtil; import org.apache.airavata.model.util.ProjectModelUtil; import org.apache.airavata.model.workspace.Project; -import org.apache.airavata.model.experiment.ComputationalResourceScheduling; -import org.apache.airavata.model.experiment.ExperimentModel; -import org.apache.airavata.model.experiment.UserConfigurationData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeTest; @@ -42,6 +42,7 @@ import java.util.List; public class SimpleEchoIT extends SingleAppIntegrationTestBase { private final static Logger log = LoggerFactory.getLogger(SimpleEchoIT.class); + private AuthzToken authzToken; public SimpleEchoIT() { //super(); @@ -51,6 +52,8 @@ public class SimpleEchoIT extends SingleAppIntegrationTestBase { public void setUp() throws Exception { // Thread.sleep(20000); init(); + authzToken = new AuthzToken("empty token"); + } @Test @@ -78,14 +81,14 @@ public class SimpleEchoIT extends SingleAppIntegrationTestBase { exOut.add(output); Project project = ProjectModelUtil.createProject("project1", "admin", "test project"); - String projectId = getClient().createProject("php_reference_gateway", project); - Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", appId, appId, exInputs); + String projectId = getClient().createProject(authzToken, "php_reference_gateway", project); + ExperimentModel simpleExperiment = + ExperimentModelUtil.createSimpleExperiment("php_reference_gateway", projectId, "admin", "echoExperiment", appId, appId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 1, 1, 1, "normal", 1, 0, 1, "sds128"); + ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 1, 1, 1, "normal", 1, 0); scheduling.setResourceHostId(hostId); - UserConfigurationData userConfigurationData = new UserConfigurationData(); + UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel(); userConfigurationData.setAiravataAutoSchedule(false); userConfigurationData.setOverrideManualScheduledParams(false); userConfigurationData.setComputationalResourceScheduling(scheduling); http://git-wip-us.apache.org/repos/asf/airavata/blob/9ce24a55/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java ---------------------------------------------------------------------- diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java index 543c510..2afdcea 100644 --- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java +++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java @@ -23,13 +23,13 @@ package org.apache.airavata.integration; import java.util.Date; import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.error.AiravataSystemException; import org.apache.airavata.model.error.ExperimentNotFoundException; import org.apache.airavata.model.error.InvalidRequestException; import org.apache.airavata.model.experiment.ExperimentModel; -import org.apache.airavata.model.experiment.ExperimentState; -import org.apache.airavata.model.experiment.ExperimentStatus; +import org.apache.airavata.model.security.AuthzToken; +import org.apache.airavata.model.status.ExperimentState; +import org.apache.airavata.model.status.ExperimentStatus; import org.apache.thrift.TException; import org.junit.Assert; @@ -38,27 +38,32 @@ import org.junit.Assert; */ public class SingleAppIntegrationTestBase extends AbstractIntegrationTest { - protected String createExperiment(Experiment experiment) throws AiravataSystemException, InvalidRequestException, TException, ApplicationSettingsException { - return getClient().createExperiment("php_reference_gateway", experiment); + private AuthzToken authzToken; + + protected String createExperiment(ExperimentModel experiment) throws AiravataSystemException, InvalidRequestException, TException, ApplicationSettingsException { + authzToken = new AuthzToken("empty token"); + return getClient().createExperiment(authzToken, "php_reference_gateway", experiment); } protected void launchExperiment(String expId) throws ExperimentNotFoundException, AiravataSystemException, InvalidRequestException, TException { - getClient().launchExperiment(expId, "testToken"); + authzToken = new AuthzToken("empty token"); + getClient().launchExperiment(authzToken, expId, "testToken"); } //monitoring the job protected void monitorJob(final String expId) { Thread monitor = (new Thread() { public void run() { + authzToken = new AuthzToken("empty token"); long previousUpdateTime=-1; ExperimentStatus experimentStatus = null; do { try { - experimentStatus = airavataClient.getExperimentStatus(expId); + experimentStatus = airavataClient.getExperimentStatus(authzToken, expId); if (previousUpdateTime!=experimentStatus.getTimeOfStateChange()) { previousUpdateTime=experimentStatus.getTimeOfStateChange(); log.info(expId - + " : " + experimentStatus.getExperimentState().toString() + + " : " + experimentStatus.getState().toString() + " ["+new Date(previousUpdateTime).toString()+"]"); } @@ -66,8 +71,8 @@ public class SingleAppIntegrationTestBase extends AbstractIntegrationTest { } catch (Exception e) { log.error("Thread interrupted", e); } - Assert.assertFalse(experimentStatus.getExperimentState().equals(ExperimentState.FAILED)); - }while(!experimentStatus.getExperimentState().equals(ExperimentState.COMPLETED)); + Assert.assertFalse(experimentStatus.getState().equals(ExperimentState.FAILED)); + }while(!experimentStatus.getState().equals(ExperimentState.COMPLETED)); } }); monitor.start(); http://git-wip-us.apache.org/repos/asf/airavata/blob/9ce24a55/modules/integration-tests/src/test/java/org/apache/airavata/integration/WorkflowIntegrationTestBase.java ---------------------------------------------------------------------- diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/WorkflowIntegrationTestBase.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/WorkflowIntegrationTestBase.java index 0004a9d..e97f999 100644 --- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/WorkflowIntegrationTestBase.java +++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/WorkflowIntegrationTestBase.java @@ -27,6 +27,7 @@ import org.apache.airavata.common.utils.Constants; import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.error.*; import org.apache.airavata.model.experiment.ExperimentModel; +import org.apache.airavata.model.security.AuthzToken; import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,6 +49,7 @@ public abstract class WorkflowIntegrationTestBase { private static final String MYPROXY_USER_NAME = "myproxy.user"; private static final String MYPROXY_PWD = "myproxy.pass"; private static final String CERT_LOCATION = "trusted.cert.location"; + private AuthzToken authzToken; public static final String THRIFT_SERVER_HOST = "localhost"; @@ -61,7 +63,7 @@ public abstract class WorkflowIntegrationTestBase { log.info(message); } - public Airavata.Client getClient() throws AiravataClientConnectException { + public Airavata.Client getClient() throws AiravataClientException { if (client == null){ client = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); } @@ -106,6 +108,7 @@ public abstract class WorkflowIntegrationTestBase { String myProxyUserName = System.getProperty("myproxy.user"); String myProxyPassword = System.getProperty("myproxy.password"); String certLocation = System.getProperty("trusted.cert.location"); + authzToken = new AuthzToken("empty token"); if (myProxyUserName == null || myProxyPassword == null || certLocation == null ) { log.error(">>>>>> Please run tests with my proxy user name, password and grid cert location. " + "E.g :- mvn clean install -Duser=xxx -Dpwd=xxx -Dcert=/path<<<<<<<"); @@ -185,12 +188,12 @@ public abstract class WorkflowIntegrationTestBase { // // } - protected String createExperiment (Experiment experiment) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException, AiravataClientConnectException { - return getClient().createExperiment("default", experiment); + protected String createExperiment (ExperimentModel experiment) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException, AiravataClientException { + return getClient().createExperiment(authzToken, "default", experiment); } - protected void launchExperiment (String expId) throws ExperimentNotFoundException, AiravataSystemException, InvalidRequestException, AiravataClientException, TException, AiravataClientConnectException { - getClient().launchExperiment(expId, "testToken"); + protected void launchExperiment (String expId) throws ExperimentNotFoundException, AiravataSystemException, InvalidRequestException, AiravataClientException, TException, AiravataClientException { + getClient().launchExperiment(authzToken, expId, "testToken"); } http://git-wip-us.apache.org/repos/asf/airavata/blob/9ce24a55/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java ---------------------------------------------------------------------- diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java index ff0dd1c..154fffd 100644 --- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java +++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java @@ -20,6 +20,8 @@ */ package org.apache.airavata.integration.tools; +import org.apache.airavata.model.application.io.DataType; +import org.apache.airavata.model.security.AuthzToken; import org.apache.airavata.registry.cpi.AppCatalog; import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.api.Airavata; @@ -27,7 +29,6 @@ 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.computeresource.ComputeResourceDescription; import org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand; import org.apache.airavata.model.appcatalog.computeresource.LOCALDataMovement; @@ -60,6 +61,7 @@ public class DocumentCreatorNew { private String gridftpAddress = "gsiftp://trestles-dm1.sdsc.edu:2811"; private String gramAddress = "trestles-login1.sdsc.edu:2119/jobmanager-pbstest2"; private String bigRed2HostAddress = "bigred2.uits.iu.edu"; + private AuthzToken authzToken; //App Module Id's private static String echoModuleId; @@ -75,6 +77,7 @@ public class DocumentCreatorNew { private GatewayResourceProfile gatewayResourceProfile; public DocumentCreatorNew(Airavata.Client client) throws AppCatalogException { + authzToken = new AuthzToken("empty token"); this.client = client; } @@ -83,19 +86,19 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription( "localhost", new ArrayList<String>(Arrays.asList(new String[]{"127.0.0.1"})), new ArrayList<String>(Arrays.asList(new String[]{"127.0.0.1"}))); // host.setIsEmpty(true); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); LOCALSubmission localSubmission = new LOCALSubmission(); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.FORK, null, null, null); localSubmission.setResourceJobManager(resourceJobManager); - client.addLocalSubmissionDetails(host.getComputeResourceId(), 1, localSubmission); + client.addLocalSubmissionDetails(authzToken, host.getComputeResourceId(), 1, localSubmission); LOCALDataMovement localDataMovement = new LOCALDataMovement(); - client.addLocalDataMovementDetails(host.getComputeResourceId(), 1, localDataMovement); + client.addLocalDataMovementDetails(authzToken, host.getComputeResourceId(), 1, localDataMovement); //Define application module ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.0.0", "Local host echo applications"); - module.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module)); + module.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module)); //Define application interfaces ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); @@ -104,11 +107,11 @@ public class DocumentCreatorNew { application.addToApplicationModules(module.getAppModuleId()); application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", "Echo Input Data", null, DataType.STRING)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING)); - application.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application)); + application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application)); //Define application deployment ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "Local echo app depoyment"); - deployment.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment)); + deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment)); //Define gateway profile ComputeResourcePreference computeResourcePreference = DocumentCreatorUtils.createComputeResourcePreference( @@ -119,9 +122,9 @@ public class DocumentCreatorNew { // gatewayResourceProfile.setGatewayID("default"); gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY); gatewayResourceProfile.addToComputeResourcePreferences(computeResourcePreference); - String gatewayId = client.registerGatewayResourceProfile(gatewayResourceProfile); + String gatewayId = client.registerGatewayResourceProfile(authzToken, gatewayResourceProfile); gatewayResourceProfile.setGatewayID(gatewayId); - client.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), host.getComputeResourceId(), computeResourcePreference); + client.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), host.getComputeResourceId(), computeResourcePreference); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); } @@ -136,7 +139,7 @@ public class DocumentCreatorNew { gatewayResourceProfile = new GatewayResourceProfile(); // gatewayResourceProfile.setGatewayID("default"); gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY); - gatewayResourceProfile.setGatewayID(client.registerGatewayResourceProfile(gatewayResourceProfile)); + gatewayResourceProfile.setGatewayID(client.registerGatewayResourceProfile(authzToken, gatewayResourceProfile)); } // } return gatewayResourceProfile; @@ -148,7 +151,7 @@ public class DocumentCreatorNew { host.addToIpAddresses("gw111.iu.xsede.org"); host.addToHostAliases("gw111.iu.xsede.org"); host.setResourceDescription("gw111 ssh access"); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken,host)); SSHJobSubmission jobSubmission = new SSHJobSubmission(); @@ -156,18 +159,18 @@ public class DocumentCreatorNew { jobSubmission.setSecurityProtocol(SecurityProtocol.SSH_KEYS); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.FORK, null, null, null); jobSubmission.setResourceJobManager(resourceJobManager); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, jobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, jobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.1", null); - module.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module)); + module.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module)); ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "SSHEchoApplication"); - client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment); + client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment); ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); // application.setIsEmpty(false); @@ -175,8 +178,8 @@ public class DocumentCreatorNew { application.addToApplicationModules(module.getAppModuleId()); application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", null, null, DataType.STRING)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING)); - client.registerApplicationInterface(DEFAULT_GATEWAY, application); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/tmp", null, false, null, null, null)); + client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/tmp", null, false, null, null, null)); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); } @@ -277,23 +280,23 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(trestleshpcHostAddress, null, null); host.addToIpAddresses(trestleshpcHostAddress); host.addToHostAliases(trestleshpcHostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); SSHJobSubmission sshJobSubmission = new SSHJobSubmission(); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.PBS, "/opt/torque/bin/", null, null); sshJobSubmission.setResourceJobManager(resourceJobManager); sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI); sshJobSubmission.setSshPort(22); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); ApplicationModule module1 = DocumentCreatorUtils.createApplicationModule("echo", "1.2", null); - module1.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module1)); + module1.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module1)); ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); // application.setIsEmpty(false); @@ -302,12 +305,12 @@ public class DocumentCreatorNew { application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", "echo_input", null, DataType.STRING)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING)); - application.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application)); + application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application)); ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module1.getAppModuleId(), "/home/ogce/echo.sh", ApplicationParallelismType.SERIAL, "Echo application"); - deployment.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment)); + deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment)); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null)); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); } @@ -316,25 +319,25 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(trestleshpcHostAddress, null, null); host.addToIpAddresses(trestleshpcHostAddress); host.addToHostAliases(trestleshpcHostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); SSHJobSubmission sshJobSubmission = new SSHJobSubmission(); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.PBS, "/opt/torque/bin/", null, null); sshJobSubmission.setResourceJobManager(resourceJobManager); sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI); sshJobSubmission.setSshPort(22); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null)); ApplicationModule module2 = DocumentCreatorUtils.createApplicationModule("wrf", "1.0.0", null); - module2.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module2)); + module2.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module2)); ApplicationInterfaceDescription application2 = new ApplicationInterfaceDescription(); // application2.setIsEmpty(false); application2.setApplicationName("WRF"); @@ -345,10 +348,10 @@ public class DocumentCreatorNew { application2.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("WRF_Output", null, DataType.URI)); application2.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("WRF_Execution_Log", null, DataType.URI)); - application2.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application2)); + application2.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application2)); ApplicationDeploymentDescription deployment2 = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module2.getAppModuleId(), "/home/ogce/production/app_wrappers/wrf_wrapper.sh", ApplicationParallelismType.MPI, "WRF"); - deployment2.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment2)); + deployment2.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment2)); return host.getComputeResourceId() + "," + application2.getApplicationInterfaceId(); } @@ -356,7 +359,7 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(stampedeHostAddress, null, null); host.addToHostAliases(stampedeHostAddress); host.addToIpAddresses(stampedeHostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.SLURM, "/usr/bin/", null, "push"); SSHJobSubmission sshJobSubmission = new SSHJobSubmission(); @@ -364,17 +367,17 @@ public class DocumentCreatorNew { sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI); sshJobSubmission.setSshPort(2222); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null)); ApplicationModule module2 = DocumentCreatorUtils.createApplicationModule("wrf", "1.0.0", null); - module2.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module2)); + module2.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module2)); ApplicationInterfaceDescription application2 = new ApplicationInterfaceDescription(); // application2.setIsEmpty(false); application2.setApplicationName("WRF"); @@ -385,10 +388,10 @@ public class DocumentCreatorNew { application2.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("WRF_Output", null, DataType.URI)); application2.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("WRF_Execution_Log", null, DataType.URI)); - application2.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application2)); + application2.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application2)); ApplicationDeploymentDescription deployment2 = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module2.getAppModuleId(), "/home1/01437/ogce/production/app_wrappers/wrf_wrapper.sh", ApplicationParallelismType.MPI, "WRF"); - deployment2.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment2)); + deployment2.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment2)); return host.getComputeResourceId() + "," + application2.getApplicationInterfaceId(); } @@ -397,22 +400,22 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(stampedeHostAddress, null, null); host.addToHostAliases(stampedeHostAddress); host.addToIpAddresses(stampedeHostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.SLURM, "/usr/bin/", null, "push"); SSHJobSubmission sshJobSubmission = new SSHJobSubmission(); sshJobSubmission.setResourceJobManager(resourceJobManager); sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI); sshJobSubmission.setSshPort(2222); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.3", null); - module.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module)); + module.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module)); ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); // application.setIsEmpty(false); @@ -420,12 +423,12 @@ public class DocumentCreatorNew { application.addToApplicationModules(module.getAppModuleId()); application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", null, null, DataType.STRING)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING)); - application.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application)); + application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application)); ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "EchoLocal"); - deployment.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment)); + deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment)); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null)); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); } @@ -433,7 +436,7 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(lonestarHostAddress, null, null); host.addToHostAliases(lonestarHostAddress); host.addToIpAddresses(lonestarHostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.UGE, "/opt/sge6.2/bin/lx24-amd64/", null, null); SSHJobSubmission sshJobSubmission = new SSHJobSubmission(); @@ -441,15 +444,15 @@ public class DocumentCreatorNew { sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI); sshJobSubmission.setSshPort(22); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken,host.getComputeResourceId(), 1, scpDataMovement); ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.4", null); - module.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module)); + module.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module)); ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); // application.setIsEmpty(false); @@ -457,12 +460,12 @@ public class DocumentCreatorNew { application.addToApplicationModules(module.getAppModuleId()); application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", null, null, DataType.STRING)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING)); - application.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application)); + application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application)); ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "EchoLocal"); - deployment.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment)); + deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment)); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null)); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); } @@ -638,7 +641,7 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription("bigred2", null, null); host.addToHostAliases(bigRed2HostAddress); host.addToIpAddresses(bigRed2HostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>(); @@ -649,25 +652,25 @@ public class DocumentCreatorNew { sshJobSubmission.setSecurityProtocol(SecurityProtocol.SSH_KEYS); sshJobSubmission.setSshPort(22); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.5", null); - module.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module)); + module.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module)); ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); application.setApplicationName("SimpleEchoBR"); application.addToApplicationModules(module.getAppModuleId()); application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", null, null, DataType.STRING)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING)); - application.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application)); + application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application)); ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/N/u/lginnali/BigRed2/myjob/test.sh", ApplicationParallelismType.SERIAL, "EchoLocal"); - deployment.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment)); + deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment)); String date = (new Date()).toString(); date = date.replaceAll(" ", "_"); @@ -675,7 +678,7 @@ public class DocumentCreatorNew { String tempDir = "/N/u/lginnali/BigRed2/myjob"; tempDir = tempDir + File.separator + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID(); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), tempDir, "TG-STA110014S", false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), tempDir, "TG-STA110014S", false, null, null, null)); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); @@ -685,7 +688,7 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription("bigred2", null, null); host.addToHostAliases(bigRed2HostAddress); host.addToIpAddresses(bigRed2HostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>(); @@ -696,16 +699,16 @@ public class DocumentCreatorNew { sshJobSubmission.setSecurityProtocol(SecurityProtocol.SSH_KEYS); sshJobSubmission.setSshPort(22); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); ApplicationModule amodule = DocumentCreatorUtils.createApplicationModule("Amber", "12.0", null); - amodule.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, amodule)); + amodule.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, amodule)); ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); @@ -718,10 +721,10 @@ public class DocumentCreatorNew { application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.mdcrd", null, DataType.URI)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.out", null, DataType.URI)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.rst", null, DataType.URI)); - application.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application)); + application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application)); ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), amodule.getAppModuleId(), "/N/u/cgateway/BigRed2/sandbox/amber_wrapper.sh", ApplicationParallelismType.SERIAL, "AmberBR2"); - deployment.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment)); + deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment)); String date = (new Date()).toString(); @@ -731,7 +734,7 @@ public class DocumentCreatorNew { tempDir = tempDir + File.separator + "Amber"; - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), tempDir, null, false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), tempDir, null, false, null, null, null)); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); @@ -741,21 +744,21 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(stampedeHostAddress, null, null); host.addToHostAliases(stampedeHostAddress); host.addToIpAddresses(stampedeHostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.SLURM, "/usr/bin/", null, "push"); SSHJobSubmission sshJobSubmission = new SSHJobSubmission(); sshJobSubmission.setResourceJobManager(resourceJobManager); sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI); sshJobSubmission.setSshPort(2222); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); ApplicationModule amodule = DocumentCreatorUtils.createApplicationModule("Amber", "12.0", null); - amodule.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, amodule)); + amodule.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, amodule)); ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); @@ -768,12 +771,12 @@ public class DocumentCreatorNew { application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.mdcrd", null, DataType.URI)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.out", null, DataType.URI)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.rst", null, DataType.URI)); - application.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application)); + application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application)); ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), amodule.getAppModuleId(), "/home1/01437/ogce/production/app_wrappers/amber_wrapper.sh", ApplicationParallelismType.SERIAL, "AmberStampede"); - deployment.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment)); + deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment)); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null)); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); @@ -784,22 +787,22 @@ public class DocumentCreatorNew { ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(trestleshpcHostAddress, null, null); host.addToIpAddresses(trestleshpcHostAddress); host.addToHostAliases(trestleshpcHostAddress); - host.setComputeResourceId(client.registerComputeResource(host)); + host.setComputeResourceId(client.registerComputeResource(authzToken, host)); SSHJobSubmission sshJobSubmission = new SSHJobSubmission(); ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.PBS, "/opt/torque/bin/", null, null); sshJobSubmission.setResourceJobManager(resourceJobManager); sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI); sshJobSubmission.setSshPort(22); - client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission); + client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission); SCPDataMovement scpDataMovement = new SCPDataMovement(); scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI); scpDataMovement.setSshPort(22); - client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement); + client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement); ApplicationModule amodule = DocumentCreatorUtils.createApplicationModule("Amber", "12.0", null); - amodule.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, amodule)); + amodule.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, amodule)); ApplicationInterfaceDescription application = new ApplicationInterfaceDescription(); @@ -812,12 +815,12 @@ public class DocumentCreatorNew { application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.mdcrd", null, DataType.URI)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.out", null, DataType.URI)); application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.rst", null, DataType.URI)); - application.setApplicationInterfaceId(client.registerApplicationInterface(DEFAULT_GATEWAY, application)); + application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application)); ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), amodule.getAppModuleId(), "/home/ogce/production/app_wrappers/amber_wrapper.sh", ApplicationParallelismType.SERIAL, "AmberStampede"); - deployment.setAppDeploymentId(client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment)); + deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment)); - client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null)); + client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null)); return host.getComputeResourceId() + "," + application.getApplicationInterfaceId(); http://git-wip-us.apache.org/repos/asf/airavata/blob/9ce24a55/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java ---------------------------------------------------------------------- diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java index caad455..750255d 100644 --- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java +++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java @@ -21,12 +21,13 @@ package org.apache.airavata.integration.tools; +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.registry.cpi.AppCatalogException; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; import org.apache.airavata.model.appcatalog.computeresource.DataMovementInterface; import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol; @@ -113,7 +114,7 @@ public class DocumentCreatorUtils { String jobManagerBinPath, Map<JobManagerCommand, String> jobManagerCommands, String pushMonitoringEndpoint) { - ResourceJobManager resourceJobManager=new ResourceJobManager();; + ResourceJobManager resourceJobManager=new ResourceJobManager(); resourceJobManager.setResourceJobManagerType(resourceJobManagerType); resourceJobManager.setJobManagerBinPath(jobManagerBinPath); resourceJobManager.setJobManagerCommands(jobManagerCommands); @@ -121,7 +122,7 @@ public class DocumentCreatorUtils { return resourceJobManager; } - public static InputDataObjectType createAppInput (String inputName, String argumentName, String description, String value, org.apache.airavata.model.appcatalog.appinterface.DataType type ){ + public static InputDataObjectType createAppInput (String inputName, String argumentName, String description, String value, DataType type ){ InputDataObjectType input = new InputDataObjectType(); // input.setIsEmpty(false); if (inputName!=null) { @@ -142,7 +143,7 @@ public class DocumentCreatorUtils { return input; } - public static OutputDataObjectType createAppOutput (String inputName, String value, org.apache.airavata.model.appcatalog.appinterface.DataType type ){ + public static OutputDataObjectType createAppOutput (String inputName, String value, DataType type ){ OutputDataObjectType outputDataObjectType = new OutputDataObjectType(); // outputDataObjectType.setIsEmpty(false); if (inputName!=null) {
