You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/06/20 23:01:57 UTC
[06/11] airavata git commit: fixing registry test cases compilation
issues
fixing registry test cases compilation issues
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/21de9e05
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/21de9e05
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/21de9e05
Branch: refs/heads/master
Commit: 21de9e0521282428a1ed672248da6fecac7770b7
Parents: 066030b
Author: Supun Nakandala <sc...@apache.org>
Authored: Sat Jun 20 18:39:33 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Sat Jun 20 18:39:33 2015 +0530
----------------------------------------------------------------------
.../catalog/ComputationalSchedulingTest.java | 85 ------
.../catalog/ConfigurationResourceTest.java | 58 ----
.../catalog/ExperimentInputResourceTest.java | 12 +-
.../catalog/ExperimentOutputResourceTest.java | 14 +-
.../catalog/ExperimentResourceTest.java | 18 +-
.../catalog/ExperimentUseCaseTest.java | 300 -------------------
.../experiment/catalog/GatewayResourceTest.java | 12 +-
.../experiment/catalog/ProcessResourceTest.java | 82 +++++
.../catalog/TaskDetailResourceTest.java | 97 ------
.../catalog/UserConfigurationDataTest.java | 83 +++++
.../catalog/WorkflowNodeDetailResourceTest.java | 88 ------
11 files changed, 193 insertions(+), 656 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
deleted file mode 100644
index 9b9e945..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.experiment.catalog;
-
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.resources.ComputationSchedulingResource;
-import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class ComputationalSchedulingTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private ComputationSchedulingResource schedulingResource;
- private String experimentID = "testExpID";
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- Timestamp currentDate = new Timestamp(new Date().getTime());
- experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
-
- schedulingResource = (ComputationSchedulingResource)experimentResource.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
- schedulingResource.setResourceHostId("testResource");
- schedulingResource.setCpuCount(10);
- schedulingResource.setNodeCount(5);
- schedulingResource.setPhysicalMemory(1000);
- schedulingResource.setProjectName("project1");
- schedulingResource.setQueueName("testQueue");
- schedulingResource.save();
- System.out.println("scheduling id : " + schedulingResource.getSchedulingId());
- }
-
-
- @Test
- public void testSave() throws Exception {
- assertTrue("Computational schedule successfully", experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID));
- }
-
- @Test
- public void testRemove() throws Exception {
- experimentResource.remove(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID);
- assertFalse("Computational schedule removed successfully", experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
deleted file mode 100644
index fdcc553..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-package org.apache.airavata.experiment.catalog;
-import static org.junit.Assert.*;
-
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.resources.ConfigurationResource;
-import org.junit.After;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-public class ConfigurationResourceTest extends AbstractResourceTest {
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- }
- @Test
- public void testSave() throws Exception {
- ConfigurationResource configuration = ExpCatResourceUtils.createConfiguration("testConfigKey");
- configuration.setConfigVal("testConfigValue");
- Calendar calender = Calendar.getInstance();
- java.util.Date d = calender.getTime();
- Timestamp currentTime = new Timestamp(d.getTime());
- configuration.setExpireDate(currentTime);
- configuration.setCategoryID("SYSTEM");
- configuration.save();
-
- assertTrue("Configuration Save succuessful", ExpCatResourceUtils.isConfigurationExist("testConfigKey"));
- //remove test configuration
- ExpCatResourceUtils.removeConfiguration("testConfigKey");
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
index aaf4f9d..20c88e9 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
@@ -41,20 +41,20 @@ public class ExperimentInputResourceTest extends AbstractResourceTest {
public void setUp() throws Exception {
super.setUp();
experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setExperimentId(experimentID);
+ experimentResource.setUserName(getWorkerResource().getUser());
experimentResource.setProjectId(getProjectResource().getId());
experimentResource.setCreationTime(getCurrentTimestamp());
experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
+ experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
+ experimentResource.setExperimentName("TestExperiment");
experimentResource.save();
experimentInputResource = (ExperimentInputResource)experimentResource.create(ResourceType.EXPERIMENT_INPUT);
experimentInputResource.setExperimentId(experimentID);
- experimentInputResource.setExperimentKey("testKey");
- experimentInputResource.setValue("testValue");
+ experimentInputResource.setInputName("testKey");
+ experimentInputResource.setInputValue("testValue");
experimentInputResource.setDataType("string");
experimentInputResource.save();
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
index 7e7ccde..9f3a2b6 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
@@ -41,20 +41,20 @@ public class ExperimentOutputResourceTest extends AbstractResourceTest {
public void setUp() throws Exception {
super.setUp();
experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setExperimentId(experimentID);
+ experimentResource.setUserName(getWorkerResource().getUser());
experimentResource.setProjectId(getProjectResource().getId());
experimentResource.setCreationTime(getCurrentTimestamp());
experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
+ experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
+ experimentResource.setExperimentName("TestExperiment");
experimentResource.save();
outputResource = (ExperimentOutputResource)experimentResource.create(ResourceType.EXPERIMENT_OUTPUT);
- outputResource.setExperimentId(experimentResource.getExpID());
- outputResource.setExperimentKey("testKey");
- outputResource.setValue("testValue");
+ outputResource.setExperimentId(experimentResource.getExperimentId());
+ outputResource.setOutputName("testKey");
+ outputResource.setOutputValue("testValue");
outputResource.setDataType("string");
outputResource.save();
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
index 0a24102..e90883f 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
@@ -21,16 +21,16 @@
package org.apache.airavata.experiment.catalog;
-import static org.junit.Assert.*;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource;
import org.junit.After;
import org.junit.Test;
+import java.sql.Timestamp;
+import java.util.Date;
+
+import static org.junit.Assert.*;
+
public class ExperimentResourceTest extends AbstractResourceTest {
private ExperimentResource experimentResource;
private String experimentID = "testExpID";
@@ -39,15 +39,15 @@ public class ExperimentResourceTest extends AbstractResourceTest {
public void setUp() throws Exception {
super.setUp();
experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setExperimentId(experimentID);
+ experimentResource.setUserName(getWorkerResource().getUser());
experimentResource.setProjectId(getProjectResource().getId());
Timestamp currentDate = new Timestamp(new Date().getTime());
experimentResource.setCreationTime(currentDate);
experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
+ experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
+ experimentResource.setExperimentName("TestExperiment");
experimentResource.save();
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentUseCaseTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentUseCaseTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentUseCaseTest.java
deleted file mode 100644
index 75b347d..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentUseCaseTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.experiment.catalog;
-
-import junit.framework.Assert;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.util.Initialize;
-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.ExperimentSummaryModel;
-import org.apache.airavata.model.experiment.UserConfigurationDataModel;
-import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel;
-import org.apache.airavata.model.status.ExperimentState;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.*;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * This class contains test cases for the RegistryImpl class which is the default registry
- * implementation. These test cases are written from the perspective of the Airavata API
- * such as creating/updating/deleting/searching projects and experiments etc.
- */
-public class ExperimentUseCaseTest {
-
- private static ExperimentCatalog experimentCatalog;
- private static Initialize initialize;
-
- @BeforeClass
- public static void setupBeforeClass() throws RegistryException, SQLException {
- initialize = new Initialize("expcatalog-derby.sql");
- initialize.initializeDB();
- experimentCatalog = RegistryFactory.getDefaultExpCatalog();
- }
-
- @Test
- public void testProject(){
- try {
- String TAG = System.currentTimeMillis() + "";
-
- String gatewayId = ServerSettings.getDefaultUserGateway();
-
- //testing the creation of a project
- Project project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("TestProject"+TAG);
- project.setDescription("This is a test project"+TAG);
- String projectId1 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId1);
-
- //testing the update of a project
- Project updatedProject = new Project();
- updatedProject.setProjectID(projectId1);
- updatedProject.setOwner("TestUser"+TAG);
- updatedProject.setName("UpdatedTestProject"+TAG);
- updatedProject.setDescription("This is an updated test project"+TAG);
- experimentCatalog.update(ExperimentCatalogModelType.PROJECT, updatedProject, projectId1);
-
- //testing project retrieval
- Project retrievedProject = (Project) experimentCatalog.get(ExperimentCatalogModelType.PROJECT, projectId1);
- Assert.assertEquals(updatedProject.getProjectID(), retrievedProject.getProjectID());
- Assert.assertEquals(updatedProject.getOwner(), retrievedProject.getOwner());
- Assert.assertEquals(updatedProject.getName(), retrievedProject.getName());
- Assert.assertEquals(updatedProject.getDescription(), retrievedProject.getDescription());
- Assert.assertNotNull(retrievedProject.getCreationTime());
- //created user should be in the shared users list
- Assert.assertTrue(retrievedProject.getSharedUsers().size()==1);
-
- //creating more projects for the same user
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Terrible"+TAG);
- project.setDescription("This is a test project_2"+TAG);
- String projectId2 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId2);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Funny"+TAG);
- project.setDescription("This is a test project_3"+TAG);
- String projectId3 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId3);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Stupid"+TAG);
- project.setDescription("This is a test project_4"+TAG);
- String projectId4 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId4);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Boring"+TAG);
- project.setDescription("This is a test project_5"+TAG);
- String projectId5 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId5);
-
- //test get all projects created by the user
- List<Object> list = experimentCatalog.get(ExperimentCatalogModelType.PROJECT,
- Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- Assert.assertTrue(list.size()==5);
-
- //search project by project name
- Map<String, String> filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- filters.put(Constants.FieldConstants.ProjectConstants.PROJECT_NAME, "Terrible"+TAG);
- list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==1);
-
- //search project by project description
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- filters.put(Constants.FieldConstants.ProjectConstants.DESCRIPTION, "test project_2"+TAG);
- list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==1);
-
- //search project with only ownername
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==5);
-
- //search projects with pagination
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters, 2, 2,
- Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
- Assert.assertTrue(list.size()==2);
- Project project1 = (Project)list.get(0);
- Project project2 = (Project)list.get(1);
- Assert.assertTrue(project1.getCreationTime()-project2.getCreationTime() > 0);
- } catch (RegistryException e) {
- e.printStackTrace();
- Assert.fail();
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testExperiment(){
- try {
- long time = System.currentTimeMillis();
- String TAG = time + "";
-
- String gatewayId = ServerSettings.getDefaultUserGateway();
-
- //creating project
- Project project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("TestProject"+TAG);
- project.setDescription("This is a test project"+TAG);
- String projectId1 = (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId1);
-
- //creating sample echo experiment. assumes echo application is already defined
- InputDataObjectType inputDataObjectType = new InputDataObjectType();
- inputDataObjectType.setName("Input_to_Echo");
- inputDataObjectType.setValue("Hello World");
-
- ComputationalResourceSchedulingModel scheduling = new ComputationalResourceSchedulingModel();
- scheduling.setResourceHostId(UUID.randomUUID().toString());
-// scheduling.setComputationalProjectAccount("TG-STA110014S");
- scheduling.setTotalCPUCount(1);
- scheduling.setNodeCount(1);
- scheduling.setWallTimeLimit(15);
- scheduling.setQueueName("normal");
-
- UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
- userConfigurationData.setAiravataAutoSchedule(false);
- userConfigurationData.setOverrideManualScheduledParams(false);
- userConfigurationData.setComputationalResourceScheduling(scheduling);
-
- ExperimentModel experiment = new ExperimentModel();
- experiment.setProjectId(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setExperimentName("TestExperiment" + TAG);
- experiment.setDescription("Test 1 experiment");
- experiment.setExecutionId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId1 = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId1);
-
- //retrieving the stored experiment
- ExperimentModel retrievedExperiment = (ExperimentModel) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT,
- experimentId1);
- Assert.assertNotNull(retrievedExperiment);
- Assert.assertEquals(retrievedExperiment.getProjectId(), experiment.getProjectId());
- Assert.assertEquals(retrievedExperiment.getDescription(), experiment.getDescription());
- Assert.assertEquals(retrievedExperiment.getExperimentName(), experiment.getExperimentName());
- Assert.assertEquals(retrievedExperiment.getExecutionId(), experiment.getExecutionId());
- Assert.assertNotNull(retrievedExperiment.getUserConfigurationData());
- Assert.assertNotNull(retrievedExperiment.getExperimentInputs());
-
- //updating an existing experiment
- experiment.setExperimentName("NewExperimentName" + TAG);
- OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
- outputDataObjectType.setName("Output_to_Echo");
- outputDataObjectType.setValue("Hello World");
- experiment.addToExperimentOutputs(outputDataObjectType);
- experimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT, experiment, experimentId1);
-
- //creating more experiments
- experiment = new ExperimentModel();
- experiment.setProjectId(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setExperimentName("TestExperiment2" + TAG);
- experiment.setDescription("Test 2 experiment");
- experiment.setExecutionId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId2 = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId2);
-
- experiment = new ExperimentModel();
- experiment.setProjectId(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setExperimentName("TestExperiment3" + TAG);
- experiment.setDescription("Test 3 experiment");
- experiment.setExecutionId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId3 = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId3);
-
- //searching experiments by
- Map<String, String> filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME, "Experiment2");
- filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS, ExperimentState.CREATED.toString());
- filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, time - 999999999 + "");
- filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, time + 999999999 + "");
- List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters);
- Assert.assertTrue(results.size()==1);
-
- //retrieving all experiments in project
- List<Object> list = experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT,
- Constants.FieldConstants.ExperimentConstants.PROJECT_ID, projectId1);
- Assert.assertTrue(list.size()==3);
-
- //searching all user experiments
- filters = new HashMap();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- list = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters);
- Assert.assertTrue(list.size()==3);
-
- //searching user experiments with pagination
- filters = new HashMap();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- list = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, 2, 1,
- Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
- Assert.assertTrue(list.size()==2);
- ExperimentSummaryModel exp1 = (ExperimentSummaryModel)list.get(0);
- ExperimentSummaryModel exp2 = (ExperimentSummaryModel)list.get(1);
- Assert.assertTrue(exp1.getCreationTime()-exp2.getCreationTime() > 0);
-
- } catch (RegistryException e) {
- e.printStackTrace();
- Assert.fail();
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
index cb2b792..91d582c 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
@@ -21,8 +21,6 @@
package org.apache.airavata.experiment.catalog;
-import static org.junit.Assert.*;
-
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
@@ -33,6 +31,8 @@ import org.junit.Test;
import java.sql.Timestamp;
import java.util.Date;
+import static org.junit.Assert.*;
+
public class GatewayResourceTest extends AbstractResourceTest {
private GatewayResource gatewayResource;
@@ -61,14 +61,14 @@ public class GatewayResourceTest extends AbstractResourceTest {
experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- experimentResource.setExpID("testExpID");
- experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setExecutionId("testExpID");
+ experimentResource.setUserName(getWorkerResource().getUser());
experimentResource.setProjectId(getProjectResource().getId());
experimentResource.setCreationTime(currentDate);
experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
+ experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
+ experimentResource.setExperimentName("TestExperiment");
experimentResource.save();
}
@Test
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java
new file mode 100644
index 0000000..c2ed8f8
--- /dev/null
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ProcessResourceTest.java
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.airavata.experiment.catalog;
+
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.ProcessResource;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import static org.junit.Assert.*;
+
+public class ProcessResourceTest extends AbstractResourceTest{
+
+ private ExperimentResource experimentResource;
+ private ProcessResource processResource;
+ private String experimentID = "testExpID";
+ private String processId = "processID";
+
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ Timestamp creationTime = new Timestamp(new Date().getTime());
+
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExperimentId(experimentID);
+ experimentResource.setExperimentName(experimentID);
+ experimentResource.setUserName(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ experimentResource.setCreationTime(creationTime);
+ experimentResource.save();
+
+ processResource = (ProcessResource)experimentResource.create(ResourceType.PROCESS);
+ processResource.setProcessId(processId);
+ processResource.setExperimentId(experimentID);
+ processResource.setCreationTime(creationTime);
+ processResource.save();
+ }
+
+
+ @Test
+ public void testCreate() throws Exception {
+ assertNotNull("process data resource has being created ", processResource);
+ }
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("process save successfully", experimentResource.isExists(ResourceType.PROCESS, processId));
+ }
+
+ @Test
+ public void testGet() throws Exception {
+ assertNotNull("process data retrieved successfully", experimentResource.get(ResourceType.PROCESS, processId));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+ experimentResource.remove(ResourceType.PROCESS, processId);
+ assertFalse("process data removed successfully", processResource.isExists(ResourceType.PROCESS, processId));
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
deleted file mode 100644
index b50910b..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.airavata.experiment.catalog;
-
-import static org.junit.Assert.*;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.apache.airavata.model.experiment.ExperimentType;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource;
-import org.apache.airavata.registry.core.experiment.catalog.resources.TaskDetailResource;
-import org.apache.airavata.registry.core.experiment.catalog.resources.WorkflowNodeDetailResource;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TaskDetailResourceTest extends AbstractResourceTest{
-
- private ExperimentResource experimentResource;
- private TaskDetailResource taskDetailResource;
- private WorkflowNodeDetailResource nodeDetailResource;
- private String experimentID = "testExpID";
- private String applicationID = "testAppID";
- private String taskID = "testTask";
- private String nodeID = "testNode";
-
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- Timestamp creationTime = new Timestamp(new Date().getTime());
-
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExpName(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(creationTime);
- experimentResource.save();
-
- nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
- nodeDetailResource.setExperimentId(experimentResource.getExpID());
- nodeDetailResource.setNodeInstanceId(nodeID);
- nodeDetailResource.setNodeName(nodeID);
- nodeDetailResource.setCreationTime(creationTime);
- nodeDetailResource.setExecutionUnit(ExperimentType.SINGLE_APPLICATION.toString());
- nodeDetailResource.save();
-
- taskDetailResource = (TaskDetailResource)nodeDetailResource.create(ResourceType.TASK_DETAIL);
- taskDetailResource.setNodeId(nodeDetailResource.getNodeInstanceId());
- taskDetailResource.setTaskId(taskID);
- taskDetailResource.setApplicationId(applicationID);
- taskDetailResource.setApplicationVersion("1.0");
- taskDetailResource.setCreationTime(creationTime);
- taskDetailResource.save();
- }
-
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("task data resource has being created ", taskDetailResource);
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("task save successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL, taskID));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull("task data retrieved successfully", nodeDetailResource.get(ResourceType.TASK_DETAIL, taskID));
- }
-
- @Test
- public void testRemove() throws Exception {
- nodeDetailResource.remove(ResourceType.TASK_DETAIL, taskID);
- assertFalse("task data removed successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL, taskID));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java
new file mode 100644
index 0000000..2975e95
--- /dev/null
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.experiment.catalog;
+
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.UserConfigurationDataResource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class UserConfigurationDataTest extends AbstractResourceTest {
+ private ExperimentResource experimentResource;
+ private UserConfigurationDataResource userConfigurationData;
+ private String experimentID = "testExpID";
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExperimentId(experimentID);
+ experimentResource.setUserName(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ Timestamp currentDate = new Timestamp(new Date().getTime());
+ experimentResource.setCreationTime(currentDate);
+ experimentResource.setApplicationId("testApplication");
+ experimentResource.setExecutionId("1.0");
+ experimentResource.setDescription("Test Application");
+ experimentResource.setExperimentName("TestExperiment");
+ experimentResource.save();
+
+ userConfigurationData = (UserConfigurationDataResource)experimentResource.create(ResourceType.USER_CONFIGURATION_DATA);
+ userConfigurationData.setResourceHostId("testResource");
+ userConfigurationData.setTotalCpuCount(10);
+ userConfigurationData.setNodeCount(5);
+ userConfigurationData.setTotalPhysicalMemory(1000);
+ userConfigurationData.setQueueName("testQueue");
+ userConfigurationData.save();
+ System.out.println("scheduling id (experiment id) : " + userConfigurationData.getExperimentId());
+ }
+
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("Computational schedule successfully", experimentResource.isExists(ResourceType.USER_CONFIGURATION_DATA, experimentID));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+ experimentResource.remove(ResourceType.USER_CONFIGURATION_DATA, experimentID);
+ assertFalse("Computational schedule removed successfully", experimentResource.isExists(ResourceType.USER_CONFIGURATION_DATA, experimentID));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/21de9e05/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
deleted file mode 100644
index c55e872..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.airavata.experiment.catalog;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource;
-import org.apache.airavata.registry.core.experiment.catalog.resources.WorkflowNodeDetailResource;
-import org.junit.Before;
-import org.junit.Test;
-
-public class WorkflowNodeDetailResourceTest extends AbstractResourceTest {
-
- private ExperimentResource experimentResource;
- private WorkflowNodeDetailResource nodeDetailResource;
- private String experimentID = "testExpID";
- private String applicationID = "testAppID";
- private String nodeID = "testNode";
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- Timestamp creationTime = new Timestamp(new Date().getTime());
-
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExpName(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(creationTime);
- experimentResource.setApplicationId(applicationID);
- experimentResource.save();
-
- nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
- nodeDetailResource.setExperimentId(experimentResource.getExpID());
- nodeDetailResource.setNodeInstanceId(nodeID);
- nodeDetailResource.setNodeName(nodeID);
- nodeDetailResource.setCreationTime(creationTime);
- nodeDetailResource.setExecutionUnit("workflow");
- nodeDetailResource.save();
-
- }
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("task data resource has being created ", nodeDetailResource);
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("task save successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull("task data retrieved successfully", experimentResource.get(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
- @Test
- public void testRemove() throws Exception {
- experimentResource.remove(ResourceType.WORKFLOW_NODE_DETAIL, nodeID);
- assertFalse("task data removed successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
-}