Repository: airavata Updated Branches: refs/heads/master 093643ac3 -> 4045c0947
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java deleted file mode 100644 index 7fd3d71..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java +++ /dev/null @@ -1,77 +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.registry.core.experiment.catalog; - -import org.apache.airavata.registry.core.experiment.catalog.ResourceType; -import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentExperimentCatResource; -import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentOutputExperimentCatResource; -import org.junit.After; -import org.junit.Test; - -import java.util.List; - -import static org.junit.Assert.assertTrue; - - -public class ExperimentOutputExperimentCatResourceTest extends AbstractResourceTest { - private ExperimentExperimentCatResource experimentResource; - private String experimentID = "testExpID"; - ExperimentOutputExperimentCatResource outputResource; - - @Override - public void setUp() throws Exception { - super.setUp(); - experimentResource = (ExperimentExperimentCatResource) getGatewayResource().create(ResourceType.EXPERIMENT); - experimentResource.setExpID(experimentID); - experimentResource.setExecutionUser(getWorkerResource().getUser()); - experimentResource.setProjectId(getProjectResource().getId()); - experimentResource.setCreationTime(getCurrentTimestamp()); - experimentResource.setApplicationId("testApplication"); - experimentResource.setApplicationVersion("1.0"); - experimentResource.setDescription("Test Application"); - experimentResource.setExpName("TestExperiment"); - experimentResource.save(); - - outputResource = (ExperimentOutputExperimentCatResource)experimentResource.create(ResourceType.EXPERIMENT_OUTPUT); - outputResource.setExperimentId(experimentResource.getExpID()); - outputResource.setExperimentKey("testKey"); - outputResource.setValue("testValue"); - outputResource.setDataType("string"); - outputResource.save(); - } - - @Test - public void testSave() throws Exception { - assertTrue("Experiment output saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_OUTPUT, experimentID)); - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testGet () throws Exception { - List<ExperimentOutputExperimentCatResource> outputs = experimentResource.getExperimentOutputs(); - System.out.println("output counts : " + outputs.size()); - assertTrue("Experiment output retrieved successfully...", outputs.size() > 0); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/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 new file mode 100644 index 0000000..7e7ccde --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java @@ -0,0 +1,77 @@ +/* +* +* 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.ExperimentOutputResource; +import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource; +import org.junit.After; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertTrue; + + +public class ExperimentOutputResourceTest extends AbstractResourceTest { + private ExperimentResource experimentResource; + private String experimentID = "testExpID"; + ExperimentOutputResource outputResource; + + @Override + public void setUp() throws Exception { + super.setUp(); + experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT); + experimentResource.setExpID(experimentID); + experimentResource.setExecutionUser(getWorkerResource().getUser()); + experimentResource.setProjectId(getProjectResource().getId()); + experimentResource.setCreationTime(getCurrentTimestamp()); + experimentResource.setApplicationId("testApplication"); + experimentResource.setApplicationVersion("1.0"); + experimentResource.setDescription("Test Application"); + experimentResource.setExpName("TestExperiment"); + experimentResource.save(); + + outputResource = (ExperimentOutputResource)experimentResource.create(ResourceType.EXPERIMENT_OUTPUT); + outputResource.setExperimentId(experimentResource.getExpID()); + outputResource.setExperimentKey("testKey"); + outputResource.setValue("testValue"); + outputResource.setDataType("string"); + outputResource.save(); + } + + @Test + public void testSave() throws Exception { + assertTrue("Experiment output saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_OUTPUT, experimentID)); + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGet () throws Exception { + List<ExperimentOutputResource> outputs = experimentResource.getExperimentOutputs(); + System.out.println("output counts : " + outputs.size()); + assertTrue("Experiment output retrieved successfully...", outputs.size() > 0); + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/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 new file mode 100644 index 0000000..0a24102 --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java @@ -0,0 +1,78 @@ +/* +* +* 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.registry.core.experiment.catalog.ResourceType; +import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource; +import org.junit.After; +import org.junit.Test; + +public class ExperimentResourceTest extends AbstractResourceTest { + private ExperimentResource experimentResource; + private String experimentID = "testExpID"; + + @Override + 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(); + } + + @Test + public void testCreate() throws Exception { + assertNotNull("experiment data resource has being created ", experimentResource); + } + + @Test + public void testSave() throws Exception { + assertTrue("experiment save successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID)); + } + + @Test + public void testGet() throws Exception { + assertNotNull("experiment data retrieved successfully", getGatewayResource().get(ResourceType.EXPERIMENT, experimentID)); + } + + @Test + public void testRemove() throws Exception { + getGatewayResource().remove(ResourceType.EXPERIMENT, experimentID); + assertFalse("experiment data removed successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID)); + } + + @After + public void tearDown() throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/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 new file mode 100644 index 0000000..0a9ebff --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentUseCaseTest.java @@ -0,0 +1,296 @@ +/* + * + * 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.appcatalog.appinterface.InputDataObjectType; +import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; +import org.apache.airavata.model.workspace.Project; +import org.apache.airavata.model.workspace.experiment.*; +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.getDefaultRegistry(); + } + + @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"); + + ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling(); + scheduling.setResourceHostId(UUID.randomUUID().toString()); + scheduling.setComputationalProjectAccount("TG-STA110014S"); + scheduling.setTotalCPUCount(1); + scheduling.setNodeCount(1); + scheduling.setWallTimeLimit(15); + scheduling.setQueueName("normal"); + + UserConfigurationData userConfigurationData = new UserConfigurationData(); + userConfigurationData.setAiravataAutoSchedule(false); + userConfigurationData.setOverrideManualScheduledParams(false); + userConfigurationData.setComputationalResourceScheduling(scheduling); + + Experiment experiment = new Experiment(); + experiment.setProjectID(projectId1); + experiment.setUserName("TestUser" + TAG); + experiment.setName("TestExperiment"+TAG); + experiment.setDescription("Test 1 experiment"); + experiment.setApplicationId(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 + Experiment retrievedExperiment = (Experiment) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, + experimentId1); + Assert.assertNotNull(retrievedExperiment); + Assert.assertEquals(retrievedExperiment.getProjectID(), experiment.getProjectID()); + Assert.assertEquals(retrievedExperiment.getDescription(), experiment.getDescription()); + Assert.assertEquals(retrievedExperiment.getName(), experiment.getName()); + Assert.assertEquals(retrievedExperiment.getApplicationId(), experiment.getApplicationId()); + Assert.assertNotNull(retrievedExperiment.getUserConfigurationData()); + Assert.assertNotNull(retrievedExperiment.getExperimentInputs()); + + //updating an existing experiment + experiment.setName("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 Experiment(); + experiment.setProjectID(projectId1); + experiment.setUserName("TestUser" + TAG); + experiment.setName("TestExperiment2" + TAG); + experiment.setDescription("Test 2 experiment"); + experiment.setApplicationId(UUID.randomUUID().toString()); + experiment.setUserConfigurationData(userConfigurationData); + experiment.addToExperimentInputs(inputDataObjectType); + + String experimentId2 = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, experiment, gatewayId); + Assert.assertNotNull(experimentId2); + + experiment = new Experiment(); + experiment.setProjectID(projectId1); + experiment.setUserName("TestUser" + TAG); + experiment.setName("TestExperiment3"+TAG); + experiment.setDescription("Test 3 experiment"); + experiment.setApplicationId(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); + ExperimentSummary exp1 = (ExperimentSummary)list.get(0); + ExperimentSummary exp2 = (ExperimentSummary)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/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java deleted file mode 100644 index 6f8f92a..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java +++ /dev/null @@ -1,122 +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.registry.core.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; -import org.apache.airavata.registry.core.experiment.catalog.resources.*; -import org.junit.After; -import org.junit.Test; - -import java.sql.Timestamp; -import java.util.Date; - - -public class GatewayExperimentCatResourceTest extends AbstractResourceTest { - private GatewayExperimentCatResource gatewayResource; - private ProjectExperimentCatResource projectResource; - private UserExperimentCatResource userResource; - private WorkerExperimentCatResource workerResource; - private ExperimentExperimentCatResource experimentResource; - - - @Override - public void setUp() throws Exception { - super.setUp(); - Timestamp currentDate = new Timestamp(new Date().getTime()); - - gatewayResource = super.getGatewayResource(); - workerResource = super.getWorkerResource(); - userResource = super.getUserResource(); - if (gatewayResource == null) { - gatewayResource = (GatewayExperimentCatResource) ExpCatResourceUtils.getGateway(ServerSettings.getDefaultUserGateway()); - } - projectResource = (ProjectExperimentCatResource) gatewayResource.create(ResourceType.PROJECT); - projectResource.setId("testProject"); - projectResource.setName("testProject"); - projectResource.setWorker(workerResource); - projectResource.save(); - - experimentResource = (ExperimentExperimentCatResource) gatewayResource.create(ResourceType.EXPERIMENT); - - experimentResource.setExpID("testExpID"); - experimentResource.setExecutionUser(getWorkerResource().getUser()); - experimentResource.setProjectId(getProjectResource().getId()); - experimentResource.setCreationTime(currentDate); - experimentResource.setApplicationId("testApplication"); - experimentResource.setApplicationVersion("1.0"); - experimentResource.setDescription("Test Application"); - experimentResource.setExpName("TestExperiment"); - experimentResource.save(); - } - @Test - public void testSave() throws Exception { - gatewayResource.setDomain("owner1"); - gatewayResource.save(); - - boolean gatewayExist = ExpCatResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway()); - assertTrue("The gateway exisits", gatewayExist); - - } - - @Test - public void testCreate() throws Exception { - assertNotNull("project resource cannot be null", projectResource); - assertNotNull("user resource cannot be null", userResource); - assertNotNull("worker resource cannot be null", workerResource); - assertNotNull("experiment resource cannot be null", experimentResource); - } - - @Test - public void testIsExists() throws Exception { - assertTrue(gatewayResource.isExists(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser())); - assertTrue(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID")); - } - - @Test - public void testGet() throws Exception { - assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser())); - assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT, "testExpID")); - } - - @Test - public void testGetList() throws Exception { - assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER)); - assertNotNull(gatewayResource.get(ResourceType.PROJECT)); - assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT)); - } - - @Test - public void testRemove() throws Exception { - - gatewayResource.remove(ResourceType.EXPERIMENT, "testExpID"); - assertFalse(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID")); - - } - - @After - public void tearDown() throws Exception { - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/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 new file mode 100644 index 0000000..cb2b792 --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java @@ -0,0 +1,122 @@ +/* +* +* 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.common.utils.ServerSettings; +import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils; +import org.apache.airavata.registry.core.experiment.catalog.ResourceType; +import org.apache.airavata.registry.core.experiment.catalog.resources.*; +import org.junit.After; +import org.junit.Test; + +import java.sql.Timestamp; +import java.util.Date; + + +public class GatewayResourceTest extends AbstractResourceTest { + private GatewayResource gatewayResource; + private ProjectResource projectResource; + private UserResource userResource; + private WorkerResource workerResource; + private ExperimentResource experimentResource; + + + @Override + public void setUp() throws Exception { + super.setUp(); + Timestamp currentDate = new Timestamp(new Date().getTime()); + + gatewayResource = super.getGatewayResource(); + workerResource = super.getWorkerResource(); + userResource = super.getUserResource(); + if (gatewayResource == null) { + gatewayResource = (GatewayResource) ExpCatResourceUtils.getGateway(ServerSettings.getDefaultUserGateway()); + } + projectResource = (ProjectResource) gatewayResource.create(ResourceType.PROJECT); + projectResource.setId("testProject"); + projectResource.setName("testProject"); + projectResource.setWorker(workerResource); + projectResource.save(); + + experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT); + + experimentResource.setExpID("testExpID"); + experimentResource.setExecutionUser(getWorkerResource().getUser()); + experimentResource.setProjectId(getProjectResource().getId()); + experimentResource.setCreationTime(currentDate); + experimentResource.setApplicationId("testApplication"); + experimentResource.setApplicationVersion("1.0"); + experimentResource.setDescription("Test Application"); + experimentResource.setExpName("TestExperiment"); + experimentResource.save(); + } + @Test + public void testSave() throws Exception { + gatewayResource.setDomain("owner1"); + gatewayResource.save(); + + boolean gatewayExist = ExpCatResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway()); + assertTrue("The gateway exisits", gatewayExist); + + } + + @Test + public void testCreate() throws Exception { + assertNotNull("project resource cannot be null", projectResource); + assertNotNull("user resource cannot be null", userResource); + assertNotNull("worker resource cannot be null", workerResource); + assertNotNull("experiment resource cannot be null", experimentResource); + } + + @Test + public void testIsExists() throws Exception { + assertTrue(gatewayResource.isExists(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser())); + assertTrue(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID")); + } + + @Test + public void testGet() throws Exception { + assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser())); + assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT, "testExpID")); + } + + @Test + public void testGetList() throws Exception { + assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER)); + assertNotNull(gatewayResource.get(ResourceType.PROJECT)); + assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT)); + } + + @Test + public void testRemove() throws Exception { + + gatewayResource.remove(ResourceType.EXPERIMENT, "testExpID"); + assertFalse(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID")); + + } + + @After + public void tearDown() throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java deleted file mode 100644 index d1b7e6e..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java +++ /dev/null @@ -1,94 +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.registry.core.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.ExperimentExperimentCatResource; -import org.apache.airavata.registry.core.experiment.catalog.resources.TaskDetailExperimentCatResource; -import org.apache.airavata.registry.core.experiment.catalog.resources.WorkflowNodeDetailExperimentCatResource; -import org.junit.Before; -import org.junit.Test; - -public class TaskDetailExperimentCatResourceTest extends AbstractResourceTest{ - - private ExperimentExperimentCatResource experimentResource; - private TaskDetailExperimentCatResource taskDetailResource; - private WorkflowNodeDetailExperimentCatResource 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 = (ExperimentExperimentCatResource) getGatewayResource().create(ResourceType.EXPERIMENT); - experimentResource.setExpID(experimentID); - experimentResource.setExecutionUser(getWorkerResource().getUser()); - experimentResource.setProjectId(getProjectResource().getId()); - experimentResource.setCreationTime(creationTime); - experimentResource.save(); - - nodeDetailResource = (WorkflowNodeDetailExperimentCatResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL); - nodeDetailResource.setExperimentId(experimentResource.getExpID()); - nodeDetailResource.setNodeInstanceId(nodeID); - nodeDetailResource.setNodeName(nodeID); - nodeDetailResource.setCreationTime(creationTime); - nodeDetailResource.save(); - - taskDetailResource = (TaskDetailExperimentCatResource)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/4045c094/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 new file mode 100644 index 0000000..e640f01 --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java @@ -0,0 +1,97 @@ +/** + * 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.workspace.experiment.ExecutionUnit; +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(ExecutionUnit.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/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java deleted file mode 100644 index 102f6fa..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java +++ /dev/null @@ -1,55 +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.registry.core.experiment.catalog; - -import static org.junit.Assert.*; - -import org.apache.airavata.registry.core.experiment.catalog.ResourceType; -import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayExperimentCatResource; -import org.apache.airavata.registry.core.experiment.catalog.resources.UserExperimentCatResource; -import org.junit.After; -import org.junit.Test; - -public class UserExperimentCatResourceTest extends AbstractResourceTest { - private UserExperimentCatResource userResource; - private GatewayExperimentCatResource gatewayResource; - private String userName = "testUser"; - - @Override - public void setUp() throws Exception { - super.setUp(); - gatewayResource = super.getGatewayResource(); - userResource = super.getUserResource(); - userResource.setUserName(userName); - userResource.setPassword("testPassword"); - userResource.save(); - } - - @Test - public void testSave() throws Exception { - assertTrue("user resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin")); - } - - @After - public void tearDown() throws Exception { - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java new file mode 100644 index 0000000..54af124 --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java @@ -0,0 +1,55 @@ +/* +* +* 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.ResourceType; +import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayResource; +import org.apache.airavata.registry.core.experiment.catalog.resources.UserResource; +import org.junit.After; +import org.junit.Test; + +public class UserResourceTest extends AbstractResourceTest { + private UserResource userResource; + private GatewayResource gatewayResource; + private String userName = "testUser"; + + @Override + public void setUp() throws Exception { + super.setUp(); + gatewayResource = super.getGatewayResource(); + userResource = super.getUserResource(); + userResource.setUserName(userName); + userResource.setPassword("testPassword"); + userResource.save(); + } + + @Test + public void testSave() throws Exception { + assertTrue("user resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin")); + } + + @After + public void tearDown() throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java deleted file mode 100644 index 887066b..0000000 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java +++ /dev/null @@ -1,86 +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.registry.core.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.ExperimentExperimentCatResource; -import org.apache.airavata.registry.core.experiment.catalog.resources.WorkflowNodeDetailExperimentCatResource; -import org.junit.Before; -import org.junit.Test; - -public class WorkflowNodeDetailExperimentCatResourceTest extends AbstractResourceTest { - - private ExperimentExperimentCatResource experimentResource; - private WorkflowNodeDetailExperimentCatResource 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 = (ExperimentExperimentCatResource) getGatewayResource().create(ResourceType.EXPERIMENT); - experimentResource.setExpID(experimentID); - experimentResource.setExecutionUser(getWorkerResource().getUser()); - experimentResource.setProjectId(getProjectResource().getId()); - experimentResource.setCreationTime(creationTime); - experimentResource.setApplicationId(applicationID); - experimentResource.save(); - - nodeDetailResource = (WorkflowNodeDetailExperimentCatResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL); - nodeDetailResource.setExperimentId(experimentResource.getExpID()); - nodeDetailResource.setNodeInstanceId(nodeID); - nodeDetailResource.setNodeName(nodeID); - nodeDetailResource.setCreationTime(creationTime); - 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)); - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/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 new file mode 100644 index 0000000..c55e872 --- /dev/null +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java @@ -0,0 +1,88 @@ +/** + * 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)); + } + +} http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java index 52b30aa..8dd7856 100644 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java @@ -19,7 +19,7 @@ * */ -package org.apache.airavata.registry.core.experiment.catalog.util; +package org.apache.airavata.experiment.catalog.util; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.ServerSettings; @@ -41,7 +41,7 @@ import java.util.StringTokenizer; public class Initialize { private static final Logger logger = LoggerFactory.getLogger(Initialize.class); public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer"; - public String scriptName = "registry-derby.sql"; + public String scriptName = "expcatalog-derby.sql"; private NetworkServerControl server; private static final String delimiter = ";"; public static final String PERSISTANT_DATA = "Configuration"; @@ -134,23 +134,23 @@ public class Initialize { } try{ - GatewayExperimentCatResource gatewayResource = new GatewayExperimentCatResource(); + GatewayResource gatewayResource = new GatewayResource(); gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway")); gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway")); gatewayResource.setDomain("test-domain"); gatewayResource.setEmailAddress("test-email"); gatewayResource.save(); - UserExperimentCatResource userResource = new UserExperimentCatResource(); + UserResource userResource = new UserResource(); userResource.setUserName(ServerSettings.getSetting("default.registry.user")); userResource.setPassword(ServerSettings.getSetting("default.registry.password")); userResource.save(); - WorkerExperimentCatResource workerResource = (WorkerExperimentCatResource) gatewayResource.create(ResourceType.GATEWAY_WORKER); + WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER); workerResource.setUser(userResource.getUserName()); workerResource.save(); - ProjectExperimentCatResource projectResource = (ProjectExperimentCatResource)workerResource.create(ResourceType.PROJECT); + ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT); projectResource.setGatewayId(gatewayResource.getGatewayId()); projectResource.setId("default"); projectResource.setName("default"); http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/workflow-model/workflow-engine/pom.xml ---------------------------------------------------------------------- diff --git a/modules/workflow-model/workflow-engine/pom.xml b/modules/workflow-model/workflow-engine/pom.xml index c115239..6189254 100644 --- a/modules/workflow-model/workflow-engine/pom.xml +++ b/modules/workflow-model/workflow-engine/pom.xml @@ -252,7 +252,7 @@ <!--</dependency>--> <dependency> <groupId>org.apache.airavata</groupId> - <artifactId.airavata.registry.core.experiment.catalog</artifactId> + <artifactId>airavata-registry-core</artifactId> <version>${project.version}</version> </dependency> <!-- JCR Support --> http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/workflow/workflow-core/pom.xml ---------------------------------------------------------------------- diff --git a/modules/workflow/workflow-core/pom.xml b/modules/workflow/workflow-core/pom.xml index 103ce93..80fa76d 100644 --- a/modules/workflow/workflow-core/pom.xml +++ b/modules/workflow/workflow-core/pom.xml @@ -27,7 +27,7 @@ </dependency> <dependency> <groupId>org.apache.airavata</groupId> - <artifactId.airavata.registry.core.experiment.catalog</artifactId> + <artifactId>airavata-registry-core</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/xbaya-gui/pom.xml ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/pom.xml b/modules/xbaya-gui/pom.xml index a1eeb7e..fa25025 100644 --- a/modules/xbaya-gui/pom.xml +++ b/modules/xbaya-gui/pom.xml @@ -221,7 +221,7 @@ </dependency> <dependency> <groupId>org.apache.airavata</groupId> - <artifactId.airavata.registry.core.experiment.catalog</artifactId> + <artifactId>airavata-registry-core</artifactId> <version>${project.version}</version> </dependency>
