You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/06/02 22:41:09 UTC
[13/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
deleted file mode 100644
index 55757fc..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
+++ /dev/null
@@ -1,296 +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.persistance.registry.jpa;
-
-import junit.framework.Assert;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-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.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.persistance.registry.jpa.util.Initialize;
-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 RegistryUseCaseTest {
-
- private static Registry registry;
- private static Initialize initialize;
-
- @BeforeClass
- public static void setupBeforeClass() throws RegistryException, SQLException {
- initialize = new Initialize("registry-derby.sql");
- initialize.initializeDB();
- registry = 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)registry.add(ParentDataType.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);
- registry.update(RegistryModelType.PROJECT, updatedProject, projectId1);
-
- //testing project retrieval
- Project retrievedProject = (Project)registry.get(RegistryModelType.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)registry.add(ParentDataType.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)registry.add(ParentDataType.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)registry.add(ParentDataType.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)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId5);
-
- //test get all projects created by the user
- List<Object> list = registry.get(RegistryModelType.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 = registry.search(RegistryModelType.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 = registry.search(RegistryModelType.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 = registry.search(RegistryModelType.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 = registry.search(RegistryModelType.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)registry.add(ParentDataType.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)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId1);
-
- //retrieving the stored experiment
- Experiment retrievedExperiment = (Experiment)registry.get(RegistryModelType.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);
- registry.update(RegistryModelType.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)registry.add(ParentDataType.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)registry.add(ParentDataType.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 = registry.search(RegistryModelType.EXPERIMENT, filters);
- Assert.assertTrue(results.size()==1);
-
- //retrieving all experiments in project
- List<Object> list = registry.get(RegistryModelType.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 = registry.search(RegistryModelType.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 = registry.search(RegistryModelType.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/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
deleted file mode 100644
index f971838..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
+++ /dev/null
@@ -1,93 +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.persistance.registry.jpa;
-
-import static org.junit.Assert.*;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
-import org.apache.airavata.persistance.registry.jpa.resources.TaskDetailResource;
-import org.apache.airavata.persistance.registry.jpa.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.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.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/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
deleted file mode 100644
index 4facbc7..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
+++ /dev/null
@@ -1,54 +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.persistance.registry.jpa;
-
-import static org.junit.Assert.*;
-
-import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import org.apache.airavata.persistance.registry.jpa.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/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java
deleted file mode 100644
index 876452f..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.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.persistance.registry.jpa;
-//
-//import org.apache.airavata.persistance.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class WorkerResourceTest extends AbstractResourceTest {
-// private GatewayResource gatewayResource;
-// private WorkerResource workerResource;
-// private ProjectResource testProject;
-// private UserWorkflowResource userWorkflowResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// gatewayResource = super.getGatewayResource();
-// workerResource = super.getWorkerResource();
-//
-// testProject = workerResource.createProject("testProject");
-// userWorkflowResource = workerResource.createWorkflowTemplate("workflow1");
-// experimentResource = (ExperimentMetadataResource) workerResource.create(ResourceType.EXPERIMENT_METADATA);
-//
-// testProject.setGateway(gatewayResource);
-// testProject.save();
-//
-// userWorkflowResource.setGateway(gatewayResource);
-// userWorkflowResource.setContent("testContent");
-// userWorkflowResource.save();
-//
-// experimentResource.setGateway(gatewayResource);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setProject(testProject);
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setSubmittedDate(getCurrentTimestamp());
-// experimentResource.save();
-//
-//
-// }
-//
-// public void testCreate() throws Exception {
-// assertNotNull("project resource created successfully", testProject);
-// assertNotNull("user workflow created successfully", userWorkflowResource);
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("project resource retrieved successfully", workerResource.get(ResourceType.PROJECT, "testProject"));
-// assertNotNull("user workflow retrieved successfully", workerResource.get(ResourceType.USER_WORKFLOW, "workflow1"));
-// assertNotNull("experiment retrieved successfully", workerResource.get(ResourceType.EXPERIMENT_METADATA, "testExpID"));
-// }
-//
-// public void testGetList() throws Exception {
-// assertNotNull("project resources retrieved successfully", workerResource.get(ResourceType.PROJECT));
-// assertNotNull("user workflows retrieved successfully", workerResource.get(ResourceType.USER_WORKFLOW));
-// assertNotNull("experiments retrieved successfully", workerResource.get(ResourceType.EXPERIMENT_METADATA));
-//
-// }
-//
-// public void testSave() throws Exception {
-// workerResource.save();
-// assertTrue("worker resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin"));
-// //remove
-//// ResourceUtils.removeGatewayWorker(gatewayResource, userResource);
-//// gatewayResource.remove(ResourceType.USER, "testUser");
-// }
-//
-// public void testRemove() throws Exception {
-// workerResource.removeWorkflowTemplate("workflow1");
-//// workerResource.removeExperiment("testExpID");
-//// workerResource.removeProject("testProject");
-//
-// assertTrue("user workflow has been removed successfully", !workerResource.isWorkflowTemplateExists("workflow1"));
-//// assertTrue("experiment has been removed successfully", !workerResource.isExperimentExists("testExpID"));
-//
-//// assertTrue("project has been removed successfully", !workerResource.isProjectExists("testProject"));
-//
-//
-//// testProject.setGateway(gatewayResource);
-//// testProject.save();
-////
-//// userWorkflowResource.setGateway(gatewayResource);
-//// userWorkflowResource.setContent("testContent");
-//// userWorkflowResource.save();
-////
-//// experimentResource.setGateway(gatewayResource);
-//// experimentResource.setExpID("testExpID");
-//// experimentResource.setProject(testProject);
-//// experimentResource.setSubmittedDate(getCurrentTimestamp());
-//// experimentResource.save();
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java
deleted file mode 100644
index 9c3b107..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java
+++ /dev/null
@@ -1,106 +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.persistance.registry.jpa;
-//
-//import org.apache.airavata.persistance.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class WorkflowDataResourceTest extends AbstractResourceTest {
-// private ExperimentMetadataResource experimentResource;
-// private WorkflowDataResource workflowDataResource;
-// private NodeDataResource nodeDataResource;
-// private GramDataResource gramDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-//
-// nodeDataResource = workflowDataResource.createNodeData("testNodeID");
-// gramDataResource = workflowDataResource.createGramData("testNodeID");
-//
-// nodeDataResource.setWorkflowDataResource(workflowDataResource);
-// nodeDataResource.setInputs("testInput");
-// nodeDataResource.setOutputs("testOutput");
-// nodeDataResource.setStatus("testStatus");
-// nodeDataResource.save();
-//
-// gramDataResource.setRsl("testRSL");
-// gramDataResource.setWorkflowDataResource(workflowDataResource);
-// gramDataResource.save();
-// }
-//
-// public void testCreate() throws Exception {
-// assertNotNull("node data resource created successfully", nodeDataResource);
-// assertNotNull("gram data resource created successfully", gramDataResource);
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("Node data retrieved successfully", workflowDataResource.getNodeData("testNodeID"));
-// assertNotNull("Gram data retrieved successfully", workflowDataResource.getGramData("testNodeID"));
-// }
-//
-// public void testGetList() throws Exception {
-// assertNotNull("Node data retrieved successfully", workflowDataResource.getNodeData());
-// assertNotNull("Gram data retrieved successfully", workflowDataResource.getGramData());
-// }
-//
-// public void testRemove() throws Exception {
-// workflowDataResource.removeNodeData("testNodeID");
-// workflowDataResource.removeGramData("testNodeID");
-//
-// assertTrue("node date removed successfully", !workflowDataResource.isNodeExists("testNodeID"));
-// assertTrue("gram date removed successfully", !workflowDataResource.isGramDataExists("testNodeID"));
-//
-// }
-//
-// public void testSave() throws Exception {
-// assertTrue("workflow data saved successfully", experimentResource.isExists(ResourceType.WORKFLOW_DATA, "testWFInstance"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
deleted file mode 100644
index 19590e6..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.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.persistance.registry.jpa;
-
-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.persistance.registry.jpa.resources.ExperimentResource;
-import org.apache.airavata.persistance.registry.jpa.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.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.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/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
deleted file mode 100644
index 6ebf1d9..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
+++ /dev/null
@@ -1,334 +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.persistance.registry.jpa.util;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource;
-import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
-import org.apache.airavata.persistance.registry.jpa.resources.Utils;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.derby.drda.NetworkServerControl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.sql.*;
-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";
- private NetworkServerControl server;
- private static final String delimiter = ";";
- public static final String PERSISTANT_DATA = "Configuration";
-
- public Initialize(String scriptName) {
- this.scriptName = scriptName;
- }
-
- public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
- if (suffix.length() > buffer.length()) {
- return false;
- }
- // this loop is done on purpose to avoid memory allocation performance
- // problems on various JDKs
- // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
- // implementation is ok though does allocation/copying
- // StringBuffer.toString().endsWith() does massive memory
- // allocation/copying on JDK 1.5
- // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
- int endIndex = suffix.length() - 1;
- int bufferIndex = buffer.length() - 1;
- while (endIndex >= 0) {
- if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
- return false;
- }
- bufferIndex--;
- endIndex--;
- }
- return true;
- }
-
- private static boolean isServerStarted(NetworkServerControl server, int ntries)
- {
- for (int i = 1; i <= ntries; i ++)
- {
- try {
- Thread.sleep(500);
- server.ping();
- return true;
- }
- catch (Exception e) {
- if (i == ntries)
- return false;
- }
- }
- return false;
- }
-
- public void initializeDB() throws SQLException{
- String jdbcUrl = null;
- String jdbcUser = null;
- String jdbcPassword = null;
- try{
- jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
- jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
- jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
- jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read properties", e);
- }
- startDerbyInServerMode();
- if(!isServerStarted(server, 20)){
- throw new RuntimeException("Derby server cound not started within five seconds...");
- }
-
- Connection conn = null;
- try {
- Class.forName(Utils.getJDBCDriver()).newInstance();
- conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
- if (!isDatabaseStructureCreated(PERSISTANT_DATA, conn)) {
- executeSQLScript(conn);
- logger.info("New Database created for Registry");
- } else {
- logger.debug("Database already created for Registry!");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RuntimeException("Database failure", e);
- } finally {
- try {
- if (conn != null){
- if (!conn.getAutoCommit()) {
- conn.commit();
- }
- conn.close();
- }
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- try{
- 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();
-
- UserResource userResource = new UserResource();
- userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
- userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
- userResource.save();
-
- WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
- workerResource.setUser(userResource.getUserName());
- workerResource.save();
-
- ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT);
- projectResource.setGatewayId(gatewayResource.getGatewayId());
- projectResource.setId("default");
- projectResource.setName("default");
- projectResource.setWorker(workerResource);
- projectResource.save();
-
-
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read properties", e);
- throw new SQLException(e.getMessage(), e);
- } catch (RegistryException e) {
- logger.error("Unable to save data to registry", e);
- throw new SQLException(e.getMessage(), e);
- }
- }
-
- public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
- try {
- System.out.println("Running a query to test the database tables existence.");
- // check whether the tables are already created with a query
- Statement statement = null;
- try {
- statement = conn.createStatement();
- ResultSet rs = statement.executeQuery("select * from " + tableName);
- if (rs != null) {
- rs.close();
- }
- } finally {
- try {
- if (statement != null) {
- statement.close();
- }
- } catch (SQLException e) {
- return false;
- }
- }
- } catch (SQLException e) {
- return false;
- }
-
- return true;
- }
-
- private void executeSQLScript(Connection conn) throws Exception {
- StringBuffer sql = new StringBuffer();
- BufferedReader reader = null;
- try{
-
- InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
- reader = new BufferedReader(new InputStreamReader(inputStream));
- String line;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.startsWith("//")) {
- continue;
- }
- if (line.startsWith("--")) {
- continue;
- }
- StringTokenizer st = new StringTokenizer(line);
- if (st.hasMoreTokens()) {
- String token = st.nextToken();
- if ("REM".equalsIgnoreCase(token)) {
- continue;
- }
- }
- sql.append(" ").append(line);
-
- // SQL defines "--" as a comment to EOL
- // and in Oracle it may contain a hint
- // so we cannot just remove it, instead we must end it
- if (line.indexOf("--") >= 0) {
- sql.append("\n");
- }
- if ((checkStringBufferEndsWith(sql, delimiter))) {
- executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
- sql.replace(0, sql.length(), "");
- }
- }
- // Catch any statements not followed by ;
- if (sql.length() > 0) {
- executeSQL(sql.toString(), conn);
- }
- }catch (IOException e){
- logger.error("Error occurred while executing SQL script for creating Airavata database", e);
- throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
- }finally {
- if (reader != null) {
- reader.close();
- }
-
- }
-
- }
-
- private static void executeSQL(String sql, Connection conn) throws Exception {
- // Check and ignore empty statements
- if ("".equals(sql.trim())) {
- return;
- }
-
- Statement statement = null;
- try {
- logger.debug("SQL : " + sql);
-
- boolean ret;
- int updateCount = 0, updateCountTotal = 0;
- statement = conn.createStatement();
- ret = statement.execute(sql);
- updateCount = statement.getUpdateCount();
- do {
- if (!ret) {
- if (updateCount != -1) {
- updateCountTotal += updateCount;
- }
- }
- ret = statement.getMoreResults();
- if (ret) {
- updateCount = statement.getUpdateCount();
- }
- } while (ret);
-
- logger.debug(sql + " : " + updateCountTotal + " rows affected");
-
- SQLWarning warning = conn.getWarnings();
- while (warning != null) {
- logger.warn(warning + " sql warning");
- warning = warning.getNextWarning();
- }
- conn.clearWarnings();
- } catch (SQLException e) {
- if (e.getSQLState().equals("X0Y32")) {
- // eliminating the table already exception for the derby
- // database
- logger.info("Table Already Exists", e);
- } else {
- throw new Exception("Error occurred while executing : " + sql, e);
- }
- } finally {
- if (statement != null) {
- try {
- statement.close();
- } catch (SQLException e) {
- logger.error("Error occurred while closing result set.", e);
- }
- }
- }
- }
-
- private void startDerbyInServerMode() {
- try {
- System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
- server = new NetworkServerControl(InetAddress.getByName(Utils.getHost()),
- 20000,
- Utils.getJDBCUser(), Utils.getJDBCPassword());
- java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
- server.start(consoleWriter);
- } catch (IOException e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- } catch (Exception e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- }
-
- }
-
- public void stopDerbyServer() throws SQLException{
- try {
- server.shutdown();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new SQLException("Error while stopping derby server", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java
deleted file mode 100644
index 0b32b82..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java
+++ /dev/null
@@ -1,151 +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.provenance.test;
-
-import static org.junit.Assert.assertTrue;
-
-public class JpaTest {
-// private static final String PERSISTENCE_UNIT_NAME = "airavata_provenance";
-// private EntityManagerFactory factory;
-//
-// @Before
-// public void setUp() throws Exception {
-// factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
-// EntityManager em = factory.createEntityManager();
-//
-// // Begin a new local transaction so that we can persist a new entity
-// em.getTransaction().begin();
-//
-// // Read the existing entries
-// Query q = em.createQuery("select m from Experiment_Data m");
-// // Persons should be empty
-//
-// // Do we have entries?
-// boolean createNewEntries = (q.getResultList().size() == 0);
-//
-// // No, so lets create new entries
-// if (createNewEntries) {
-// assertTrue(q.getResultList().size() == 0);
-// Experiment_Data data = new Experiment_Data();
-// data.setExperiment_ID("Experiement_ID1");
-// data.setName("Name1");
-// em.persist(data);
-// for (int i = 0; i < 5; i++) {
-// Workflow_Data wData = new Workflow_Data();
-// wData.setWorkflow_instanceID("instance_ID" + i);
-// wData.setExperiment_Data(data);
-// em.persist(wData);
-// for (int j = 0; j < 5; j++) {
-// Node_Data nData = new Node_Data();
-// nData.setNode_id("node_ID" + j);
-// nData.setWorkflow_Data(wData);
-// em.persist(nData);
-//
-// Gram_Data gData = new Gram_Data();
-// gData.setNode_id("node_ID" + j);
-// gData.setWorkflow_Data(wData);
-// em.persist(gData);
-// }
-// // Now persists the family person relationship
-// // data.getWorkflows().add(wData);
-// // em.persist(wData);
-// // em.persist(data);
-// }
-// }
-//
-// // Commit the transaction, which will cause the entity to
-// // be stored in the database
-// em.getTransaction().commit();
-//
-// // It is always good practice to close the EntityManager so that
-// // resources are conserved.
-// em.close();
-//
-// }
-//
-// @Test
-// public void checkInsertedWorkflow() {
-//
-// // Now lets check the database and see if the created entries are there
-// // Create a fresh, new EntityManager
-// EntityManager em = factory.createEntityManager();
-//
-// // Perform a simple query for all the Message entities
-// Query q = em.createQuery("select m from Workflow_Data m");
-//
-// // We should have 5 Persons in the database
-// assertTrue(q.getResultList().size() == 5);
-//
-// em.close();
-// }
-//
-// @Test
-// public void checkInsertedNode() {
-// EntityManager em = factory.createEntityManager();
-//
-// Query q = em.createQuery("select m from Node_Data m");
-//
-// assertTrue(q.getResultList().size() == 25);
-//
-// em.close();
-// }
-//
-// @Test (expected = javax.persistence.NoResultException.class)
-// public void deleteNode_Data() throws InterruptedException {
-// Thread.sleep(1000);
-// EntityManager em = factory.createEntityManager();
-// // Begin a new local transaction so that we can persist a new entity
-// em.getTransaction().begin();
-// Query q = em.createQuery("SELECT p FROM Experiment_Data p WHERE p.experiment_ID = :firstName");
-// q.setParameter("firstName", "Experiement_ID1");
-// Experiment_Data eData = (Experiment_Data) q.getSingleResult();
-//
-// q = em.createQuery("SELECT p FROM Workflow_Data p WHERE p.experiment_Data = :firstName AND p.workflow_instanceID = :lastName");
-// q.setParameter("firstName", eData);
-// q.setParameter("lastName", "instance_ID4");
-// Workflow_Data wData = (Workflow_Data) q.getSingleResult();
-//
-// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
-// q.setParameter("firstName", wData);
-// q.setParameter("lastName", "node_ID4");
-// Node_Data nData = (Node_Data) q.getSingleResult();
-//
-// //System.out.println(nData.getStart_time());
-// em.remove(nData);
-//
-// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
-// q.setParameter("firstName", wData);
-// q.setParameter("lastName", "node_ID3");
-// nData = (Node_Data) q.getSingleResult();
-// nData.setStatus("finished");
-// Thread.sleep(5000);
-// em.getTransaction().commit();
-//
-// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
-// q.setParameter("firstName", wData);
-// q.setParameter("lastName", "node_ID4");
-// Node_Data person = (Node_Data) q.getSingleResult();
-// person.getInputs();
-// // Begin a new local transaction so that we can persist a new entity
-//
-// em.close();
-// }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql b/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
deleted file mode 100644
index 7ab3755..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
+++ /dev/null
@@ -1,391 +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.
- *
- */
-CREATE TABLE GATEWAY
-(
- GATEWAY_ID VARCHAR (255),
- GATEWAY_NAME VARCHAR(255),
- DOMAIN VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID)
-);
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- CATEGORY_ID VARCHAR (255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
-
-CREATE TABLE USERS
-(
- USER_NAME VARCHAR(255),
- PASSWORD VARCHAR(255),
- PRIMARY KEY(USER_NAME)
-);
-
-CREATE TABLE GATEWAY_WORKER
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID, USER_NAME),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255),
- PROJECT_NAME VARCHAR(255) NOT NULL,
- DESCRIPTION VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (PROJECT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT_USER
-(
- PROJECT_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (PROJECT_ID,USER_NAME),
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT
-(
- EXPERIMENT_ID VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- EXECUTION_USER VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- EXPERIMENT_NAME VARCHAR(255) NOT NULL,
- EXPERIMENT_DESCRIPTION VARCHAR(255),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- WORKFLOW_TEMPLATE_ID VARCHAR(255),
- WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
- WORKFLOW_EXECUTION_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- GATEWAY_EXECUTION_ID VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_INPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_OUTPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-
-CREATE TABLE WORKFLOW_NODE_DETAIL
-(
- EXPERIMENT_ID VARCHAR(255) NOT NULL,
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- NODE_NAME VARCHAR(255) NOT NULL,
- EXECUTION_UNIT VARCHAR(255) NOT NULL,
- EXECUTION_UNIT_DATA VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE TASK_DETAIL
-(
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- APPLICATION_DEPLOYMENT_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- PRIMARY KEY(TASK_ID),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NOTIFICATION_EMAIL
-(
- EMAIL_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY(EMAIL_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ERROR_DETAIL
-(
- ERROR_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- ACTUAL_ERROR_MESSAGE CLOB,
- USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
- TRANSIENT_OR_PERSISTENT SMALLINT,
- ERROR_CATEGORY VARCHAR(255),
- CORRECTIVE_ACTION VARCHAR(255),
- ACTIONABLE_GROUP VARCHAR(255),
- PRIMARY KEY(ERROR_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- TASK_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(TASK_ID,INPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- TASK_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(TASK_ID,OUTPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_INPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE VARCHAR(255),
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_OUTPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_DETAIL
-(
- JOB_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_DESCRIPTION CLOB NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
- JOBNAME VARCHAR (255),
- WORKING_DIR VARCHAR(255),
- PRIMARY KEY (TASK_ID, JOB_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_TRANSFER_DETAIL
-(
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- TRANSFER_DESC VARCHAR(255) NOT NULL,
- PRIMARY KEY(TRANSFER_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE STATUS
-(
- STATUS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- STATE VARCHAR(255),
- STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- STATUS_TYPE VARCHAR(255),
- PRIMARY KEY(STATUS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE CONFIG_DATA
-(
- EXPERIMENT_ID VARCHAR(255),
- AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
- OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
- SHARE_EXPERIMENT SMALLINT,
- USER_DN VARCHAR(255),
- GENERATE_CERT SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID)
-);
-
-CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
-(
- RESOURCE_SCHEDULING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- RESOURCE_HOST_ID VARCHAR(255),
- CPU_COUNT INTEGER,
- NODE_COUNT INTEGER,
- NO_OF_THREADS INTEGER,
- QUEUE_NAME VARCHAR(255),
- WALLTIME_LIMIT INTEGER,
- JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- TOTAL_PHYSICAL_MEMORY INTEGER,
- COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
- CHESSIS_NAME VARCHAR(255),
- PRIMARY KEY(RESOURCE_SCHEDULING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
-(
- INPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- WORKING_DIR_PARENT VARCHAR(255),
- UNIQUE_WORKING_DIR VARCHAR(255),
- STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
- CLEAN_AFTER_JOB SMALLINT,
- PRIMARY KEY(INPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
-(
- OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- OUTPUT_DATA_DIR VARCHAR(255),
- DATA_REG_URL VARCHAR (255),
- PERSIST_OUTPUT_DATA SMALLINT,
- PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE QOS_PARAM
-(
- QOS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- START_EXECUTION_AT VARCHAR(255),
- EXECUTE_BEFORE VARCHAR(255),
- NO_OF_RETRIES INTEGER,
- PRIMARY KEY(QOS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMMUNITY_USER
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
- PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-CREATE TABLE CREDENTIALS
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- CREDENTIAL BLOB NOT NULL,
- PORTAL_USER_ID VARCHAR(256) NOT NULL,
- TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/pom.xml b/modules/registry/experiment-catalog/pom.xml
new file mode 100644
index 0000000..c624e2e
--- /dev/null
+++ b/modules/registry/experiment-catalog/pom.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--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. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>registry</artifactId>
+ <version>0.16-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-experiment-catalog</artifactId>
+ <packaging>jar</packaging>
+ <name>Airavata Experiment Catalog</name>
+ <url>http://airavata.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-common-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency-->
+ <!-- Test -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-credential-store</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-data-models</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-registry-cpi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency-->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbyclient</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbynet</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbytools</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-server-configuration</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>${antrun.version}</version>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="maven.compile.classpath" />
+ <openjpac>
+ <classpath refid="maven.compile.classpath" />
+ </openjpac>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <inherited>true</inherited>
+ <configuration>
+ <failIfNoTests>false</failIfNoTests>
+ <skipTests>${skipTests}</skipTests>
+ <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
+ <!-- making sure that the sure-fire plugin doesn't run the integration tests-->
+ <!-- Integration tests are run using the fail-safe plugin in the module pom-->
+ <excludes>
+ <exclude>**/TaskDetailResourceTest.java</exclude>
+ <exclude>**/WorkflowNodeDetailResourceTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
new file mode 100644
index 0000000..b558d03
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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;
+
+public class JPAConstants {
+ public static final String KEY_JDBC_URL = "registry.jdbc.url";
+ public static final String KEY_JDBC_USER = "registry.jdbc.user";
+ public static final String KEY_JDBC_PASSWORD = "registry.jdbc.password";
+ public static final String KEY_JDBC_DRIVER = "registry.jdbc.driver";
+ public static final String KEY_DERBY_START_ENABLE = "start.derby.server.mode";
+ public static final String VALIDATION_QUERY = "validationQuery";
+ public static final String JPA_CACHE_SIZE = "jpa.cache.size";
+ public static final String ENABLE_CACHING = "cache.enable";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
new file mode 100644
index 0000000..bdfd948
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.cpi.RegistryException;
+
+import java.util.List;
+
+public interface Resource {
+ /**
+ * This method will create associate resource objects for the given resource type.
+ * @param type child resource type
+ * @return associate child resource
+ */
+ Resource create(ResourceType type) throws RegistryException, RegistryException;
+
+ /**
+ * This method will remove the given child resource from the database
+ * @param type child resource type
+ * @param name child resource name
+ */
+ void remove(ResourceType type, Object name) throws RegistryException;
+
+ /**
+ * This method will return the given child resource from the database
+ * @param type child resource type
+ * @param name child resource name
+ * @return associate child resource
+ */
+ Resource get(ResourceType type, Object name) throws RegistryException;
+
+ /**
+ * This method will list all the child resources for the given resource type
+ * @param type child resource type
+ * @return list of child resources of the given child resource type
+ */
+ List<Resource> get(ResourceType type) throws RegistryException;
+
+ /**
+ * This method will save the resource to the database.
+ */
+ void save() throws RegistryException;
+
+ /**
+ * This method will check whether an entry from the given resource type and resource name
+ * exists in the database
+ * @param type child resource type
+ * @param name child resource name
+ * @return whether the entry exists in the database or not
+ */
+ boolean isExists(ResourceType type, Object name) throws RegistryException;
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
new file mode 100644
index 0000000..ea66a90
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.experiment.catalog;
+
+public enum ResourceType {
+ GATEWAY,
+ PROJECT,
+ USER,
+ PROJECT_USER,
+ CONFIGURATION,
+ GATEWAY_WORKER,
+ EXPERIMENT,
+ EXPERIMENT_SUMMARY,
+ NOTIFICATION_EMAIL,
+ EXPERIMENT_INPUT,
+ EXPERIMENT_OUTPUT,
+ WORKFLOW_NODE_DETAIL,
+ TASK_DETAIL,
+ ERROR_DETAIL,
+ APPLICATION_INPUT,
+ APPLICATION_OUTPUT,
+ NODE_INPUT,
+ NODE_OUTPUT,
+ JOB_DETAIL,
+ DATA_TRANSFER_DETAIL,
+ STATUS,
+ CONFIG_DATA,
+ COMPUTATIONAL_RESOURCE_SCHEDULING,
+ ADVANCE_INPUT_DATA_HANDLING,
+ ADVANCE_OUTPUT_DATA_HANDLING,
+ QOS_PARAM
+}