You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2013/12/26 18:31:40 UTC
svn commit: r1553518 [8/15] - in /airavata/sandbox: orchestrator-service/
orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/
orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/
or...
Added: airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-derby.sql?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-derby.sql (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-derby.sql Thu Dec 26 17:31:35 2013
@@ -0,0 +1,267 @@
+/*
+ *
+ * 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_name varchar(255),
+ owner varchar(255),
+ PRIMARY KEY (gateway_name)
+);
+
+
+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.11', CURRENT_TIMESTAMP ,'SYSTEM');
+
+create table Users
+(
+ user_name varchar(255),
+ password varchar(255),
+ PRIMARY KEY(user_name)
+);
+
+create table Gateway_Worker
+(
+ gateway_name varchar(255),
+ user_name varchar(255),
+ PRIMARY KEY (gateway_name, user_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+
+);
+
+create table Project
+(
+ gateway_name varchar(255),
+ user_name varchar(255),
+ project_name varchar(255),
+ PRIMARY KEY (project_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Published_Workflow
+(
+ gateway_name varchar(255),
+ created_user varchar(255),
+ publish_workflow_name varchar(255),
+ version varchar(255),
+ published_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ path varchar (255),
+ workflow_content BLOB,
+ PRIMARY KEY(gateway_name, publish_workflow_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (created_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table User_Workflow
+
+(
+ gateway_name varchar(255),
+ owner varchar(255),
+ template_name varchar(255),
+ last_updated_date TIMESTAMP DEFAULT CURRENT TIMESTAMP,
+ path varchar (255),
+ workflow_graph BLOB,
+ PRIMARY KEY(gateway_name, owner, template_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (owner) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+
+create table Host_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ host_descriptor_ID varchar(255),
+ host_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name, host_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Service_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ service_descriptor_ID varchar(255),
+ service_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name,service_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Application_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ application_descriptor_ID varchar(255),
+ host_descriptor_ID varchar(255),
+ service_descriptor_ID varchar(255),
+ application_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name,application_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Experiment
+(
+ project_name varchar(255),
+ gateway_name varchar(255),
+ user_name varchar(255),
+ experiment_ID varchar(255),
+ submitted_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY(experiment_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (project_name) REFERENCES Project(project_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Experiment_Data
+(
+ experiment_ID varchar(255),
+ name varchar(255),
+ username varchar(255),
+ PRIMARY KEY (experiment_ID)
+);
+
+create table Experiment_Metadata
+(
+ experiment_ID varchar(255),
+ metadata BLOB,
+ PRIMARY KEY (experiment_ID)
+);
+
+
+create table Workflow_Data
+(
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ template_name varchar(255),
+ status varchar(255),
+ start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ last_update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY(workflow_instanceID),
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
+create table Node_Data
+(
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ node_type varchar(255),
+ inputs BLOB,
+ outputs BLOB,
+ status varchar(255),
+ start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ last_update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ execution_index int NOT NULL,
+ PRIMARY KEY(workflow_instanceID, node_id, execution_index),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+-- need to remove this in future
+create table Gram_Data
+(
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ rsl BLOB,
+ invoked_host varchar(255),
+ local_Job_ID varchar(255),
+ PRIMARY KEY(workflow_instanceID, node_id),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+create table GFac_Job_Data
+(
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ application_descriptor_ID varchar(255),
+ host_descriptor_ID varchar(255),
+ service_descriptor_ID varchar(255),
+ job_data CLOB,
+ local_Job_ID varchar(255),
+ submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status varchar(255),
+ metadata CLOB,
+ PRIMARY KEY(local_Job_ID),
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID)
+);
+
+create table GFac_Job_Status
+(
+ local_Job_ID varchar(255),
+ status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status varchar(255),
+ FOREIGN KEY (local_Job_ID) REFERENCES GFac_Job_Data(local_Job_ID)
+);
+
+
+CREATE TABLE community_user
+(
+ GATEWAY_NAME 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_NAME, 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)
+);
+
+CREATE TABLE Execution_Error
+(
+ error_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ gfacJobID varchar(255),
+ source_type varchar(255),
+ error_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ error_msg CLOB,
+ error_des CLOB,
+ error_code varchar(255),
+ error_reporter varchar(255),
+ error_location varchar(255),
+ action_taken varchar(255),
+ error_reference INTEGER,
+ PRIMARY KEY(error_id),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE,
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
Added: airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql Thu Dec 26 17:31:35 2013
@@ -0,0 +1,265 @@
+/*
+ *
+ * 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_name varchar(255),
+ owner varchar(255),
+ PRIMARY KEY (gateway_name)
+);
+
+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.11', CURRENT_TIMESTAMP ,'SYSTEM');
+
+create table Users
+(
+ user_name varchar(255),
+ password varchar(255),
+ PRIMARY KEY(user_name)
+);
+
+create table Gateway_Worker
+(
+ gateway_name varchar(255),
+ user_name varchar(255),
+ PRIMARY KEY (gateway_name, user_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+
+);
+
+create table Project
+(
+ gateway_name varchar(255),
+ user_name varchar(255),
+ project_name varchar(255),
+ PRIMARY KEY(project_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Published_Workflow
+(
+ gateway_name varchar(255),
+ created_user varchar(255),
+ publish_workflow_name varchar(255),
+ version varchar(255),
+ published_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ path varchar (255),
+ workflow_content MEDIUMBLOB,
+ PRIMARY KEY(gateway_name, publish_workflow_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (created_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table User_Workflow
+(
+ gateway_name varchar(255),
+ owner varchar(255),
+ template_name varchar(255),
+ last_updated_date TIMESTAMP DEFAULT now() on update now(),
+ path varchar (255),
+ workflow_graph MEDIUMBLOB,
+ PRIMARY KEY(gateway_name, owner, template_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (owner) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+
+create table Host_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ host_descriptor_ID varchar(255),
+ host_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name, host_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Service_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ service_descriptor_ID varchar(255),
+ service_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name,service_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Application_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ application_descriptor_ID varchar(255),
+ host_descriptor_ID varchar(255),
+ service_descriptor_ID varchar(255),
+ application_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name,application_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Experiment
+(
+ project_name varchar(255),
+ gateway_name varchar(255),
+ user_name varchar(255),
+ experiment_ID varchar(255),
+ submitted_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY(experiment_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (project_name) REFERENCES Project(project_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Experiment_Data
+(
+ experiment_ID varchar(255),
+ name varchar(255),
+ username varchar(255),
+ PRIMARY KEY (experiment_ID)
+);
+
+create table Experiment_Metadata
+(
+ experiment_ID varchar(255),
+ metadata BLOB,
+ PRIMARY KEY (experiment_ID)
+);
+
+
+create table Workflow_Data
+(
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ template_name varchar(255),
+ status varchar(255),
+ start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ last_update_time TIMESTAMP DEFAULT now() on update now(),
+ PRIMARY KEY(workflow_instanceID),
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
+create table Node_Data
+(
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ node_type varchar(255),
+ inputs BLOB,
+ outputs BLOB,
+ status varchar(255),
+ start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ last_update_time TIMESTAMP DEFAULT now() on update now(),
+ execution_index int NOT NULL,
+ PRIMARY KEY(workflow_instanceID, node_id, execution_index),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+create table Gram_Data
+(
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ rsl BLOB,
+ invoked_host varchar(255),
+ local_Job_ID varchar(255),
+ PRIMARY KEY(workflow_instanceID, node_id),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+create table GFac_Job_Data
+(
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ application_descriptor_ID varchar(255),
+ host_descriptor_ID varchar(255),
+ service_descriptor_ID varchar(255),
+ job_data LONGTEXT,
+ local_Job_ID varchar(255),
+ submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status varchar(255),
+ metadata LONGTEXT,
+ PRIMARY KEY(local_Job_ID),
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID)
+);
+
+create table GFac_Job_Status
+(
+ local_Job_ID varchar(255),
+ status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status varchar(255),
+ FOREIGN KEY (local_Job_ID) REFERENCES GFac_Job_Data(local_Job_ID)
+);
+
+
+CREATE TABLE community_user
+(
+ GATEWAY_NAME 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_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
+);
+
+
+CREATE TABLE credentials
+(
+ GATEWAY_ID VARCHAR(256) NOT NULL,
+ TOKEN_ID VARCHAR(256) NOT NULL,
+ CREDENTIAL TEXT NOT NULL,
+ PORTAL_USER_ID VARCHAR(256) NOT NULL,
+ TIME_PERSISTED TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
+);
+
+CREATE TABLE Execution_Error
+(
+ error_id INT NOT NULL AUTO_INCREMENT,
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ gfacJobID varchar(255),
+ source_type varchar(255),
+ error_date TIMESTAMP DEFAULT now() on update now(),
+ error_msg LONGTEXT,
+ error_des LONGTEXT,
+ error_code varchar(255),
+ error_reporter varchar(255),
+ error_location varchar(255),
+ action_taken varchar(255),
+ error_reference INTEGER,
+ PRIMARY KEY(error_id),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE,
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
+
Added: airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/provenance.sql
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/provenance.sql?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/provenance.sql (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/main/resources/provenance.sql Thu Dec 26 17:31:35 2013
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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 Experiment_Data
+(
+ experiment_ID varchar(255),
+ name varchar(255),
+ username varchar(255),
+ PRIMARY KEY (experiment_ID)
+);
+
+create table Experiment_Metadata
+(
+ experiment_ID varchar(255),
+ metadata BLOB,
+ PRIMARY KEY (experiment_ID)
+);
+
+
+create table Workflow_Data
+(
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ template_name varchar(255),
+ status varchar(100),
+ start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ last_update_time TIMESTAMP DEFAULT now() on update now(),
+ PRIMARY KEY(workflow_instanceID),
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
+create table Node_Data
+(
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ node_type varchar(255),
+ inputs BLOB,
+ outputs BLOB,
+ status varchar(100),
+ start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ last_update_time TIMESTAMP DEFAULT now() on update now(),
+ PRIMARY KEY(workflow_instanceID, node_id),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+create table Gram_Data
+(
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ rsl BLOB,
+ invoked_host varchar(255),
+ local_Job_ID varchar(255),
+ PRIMARY KEY(workflow_instanceID, node_id),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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.TestCase;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+import org.apache.airavata.persistance.registry.jpa.util.Initialize;
+
+public abstract class AbstractResourceTest extends TestCase {
+
+ private GatewayResource gatewayResource;
+ private WorkerResource workerResource;
+ private UserResource userResource;
+
+ private Initialize initialize;
+ @Override
+ public void setUp() throws Exception {
+ initialize = new Initialize();
+ initialize.initializeDB();
+ gatewayResource = (GatewayResource)ResourceUtils.getGateway("default");
+ workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "admin");
+ userResource = (UserResource)gatewayResource.create(ResourceType.USER);
+ userResource.setUserName("admin");
+ userResource.setPassword("admin");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ initialize.stopDerbyServer();
+ }
+
+ public GatewayResource getGatewayResource() {
+ return gatewayResource;
+ }
+
+ public WorkerResource getWorkerResource() {
+ return workerResource;
+ }
+
+ public UserResource getUserResource() {
+ return userResource;
+ }
+
+
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.ApplicationDescriptorResource;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+
+public class ApplicationDescriptorResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ }
+
+ public void testSave() throws Exception {
+ ApplicationDescriptorResource applicationDescriptorResouce = (ApplicationDescriptorResource) gatewayResource.create(ResourceType.APPLICATION_DESCRIPTOR);
+ applicationDescriptorResouce.setHostDescName("testHostDesc");
+ applicationDescriptorResouce.setServiceDescName("testServiceDesc");
+ applicationDescriptorResouce.setName("testAppDesc");
+ applicationDescriptorResouce.setContent("testContent");
+ applicationDescriptorResouce.setUpdatedUser("admin");
+ applicationDescriptorResouce.save();
+
+ assertTrue("application descriptor saved successfully", gatewayResource.isExists(ResourceType.APPLICATION_DESCRIPTOR, "testAppDesc"));
+
+ gatewayResource.remove(ResourceType.APPLICATION_DESCRIPTOR, "testAppDesc");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java Thu Dec 26 17:31:35 2013
@@ -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.persistance.registry.jpa;
+
+import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class ConfigurationResourceTest extends AbstractResourceTest {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testSave() throws Exception {
+ ConfigurationResource configuration = ResourceUtils.createConfiguration("testConfigKey");
+ configuration.setConfigVal("testConfigValue");
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ configuration.setExpireDate(currentTime);
+ configuration.setCategoryID("SYSTEM");
+ configuration.save();
+
+ assertTrue("Configuration Save succuessful", ResourceUtils.isConfigurationExist("testConfigKey"));
+ //remove test configuration
+ ResourceUtils.removeConfiguration("testConfigKey");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExecutionErrorResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExecutionErrorResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExecutionErrorResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExecutionErrorResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,93 @@
+/*
+*
+* 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 ExecutionErrorResourceTest extends AbstractResourceTest {
+ private ExperimentDataResource experimentDataResource;
+ private WorkflowDataResource workflowDataResource;
+ private NodeDataResource nodeDataResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ GatewayResource gatewayResource = super.getGatewayResource();
+ WorkerResource workerResource = super.getWorkerResource();
+
+ ExperimentResource experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setWorker(workerResource);
+ experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+ experimentResource.save();
+
+ experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+ experimentDataResource.setExpName("testExpID");
+ experimentDataResource.setUserName(workerResource.getUser());
+ experimentDataResource.save();
+
+ workflowDataResource = (WorkflowDataResource) experimentDataResource.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");
+ nodeDataResource.setWorkflowDataResource(workflowDataResource);
+ nodeDataResource.setInputs("testInput");
+ nodeDataResource.setOutputs("testOutput");
+ nodeDataResource.setStatus("testStatus");
+ nodeDataResource.save();
+ }
+
+ public void testSave() throws Exception {
+ ExecutionErrorResource executionErrorResource = (ExecutionErrorResource) workflowDataResource.create(ResourceType.EXECUTION_ERROR);
+ executionErrorResource.setErrorCode("testErrorCode");
+ executionErrorResource.setActionTaken("testAction");
+ executionErrorResource.setErrorLocation("testErrorLocation");
+ executionErrorResource.setErrorReference(0);
+ executionErrorResource.setWorkflowDataResource(workflowDataResource);
+
+ executionErrorResource.setExperimentDataResource(experimentDataResource);
+ executionErrorResource.setNodeID(nodeDataResource.getNodeID());
+ executionErrorResource.setGfacJobID("testGfacJobID");
+ executionErrorResource.setErrorDes("testDes");
+ executionErrorResource.setErrorMsg("errorMsg");
+ executionErrorResource.save();
+ System.out.println(executionErrorResource.getErrorID());
+
+ assertTrue("application descriptor saved successfully", workflowDataResource.isExists(ResourceType.EXECUTION_ERROR, executionErrorResource.getErrorID()));
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,107 @@
+/*
+*
+* 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 ExperimentDataResourceTest extends AbstractResourceTest {
+ private ExperimentDataResource experimentDataResource;
+ private ExperimentResource experimentResource;
+ private WorkflowDataResource workflowDataResource;
+ private ExperimentMetadataResource experimentMetadataResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ GatewayResource gatewayResource = super.getGatewayResource();
+ WorkerResource workerResource = super.getWorkerResource();
+
+ experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setWorker(workerResource);
+ experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+ experimentResource.save();
+
+ experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+ experimentDataResource.setExpName("testExpID");
+ experimentDataResource.setUserName(workerResource.getUser());
+ experimentDataResource.save();
+
+ experimentMetadataResource = experimentDataResource.createExperimentMetadata();
+ workflowDataResource = experimentDataResource.createWorkflowInstanceResource("testWorkflowInstance");
+
+ experimentMetadataResource.setExpID("testExpID");
+ experimentMetadataResource.setMetadata("testMetadata");
+ experimentMetadataResource.save();
+
+ workflowDataResource.setExperimentID("testExpID");
+ workflowDataResource.setStatus("testStatus");
+ workflowDataResource.setTemplateName("testWorkflowInstance");
+
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+
+ workflowDataResource.setLastUpdatedTime(currentTime);
+ workflowDataResource.setStartTime(currentTime);
+ workflowDataResource.save();
+ }
+
+ public void testCreate() throws Exception {
+ assertNotNull("workflowdata resource created", workflowDataResource);
+ assertNotNull("experimemt metadata resource created", experimentMetadataResource);
+ }
+
+ public void testGet() throws Exception {
+ assertNotNull("workflow data retrieved successfully", experimentDataResource.getWorkflowInstance("testWorkflowInstance"));
+ assertNotNull("experiment meta data retrieved successfully", experimentDataResource.getExperimentMetadata());
+ }
+
+ public void testGetList() throws Exception {
+ assertNotNull("workflow data retrieved successfully", experimentDataResource.get(ResourceType.WORKFLOW_DATA));
+ assertNotNull("experiment meta data retrieved successfully", experimentDataResource.get(ResourceType.EXPERIMENT_METADATA));
+ }
+
+ public void testSave() throws Exception {
+ experimentDataResource.save();
+ assertTrue("experiment data saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testExpID"));
+ }
+
+ public void testRemove() throws Exception {
+ experimentDataResource.remove(ResourceType.WORKFLOW_DATA, "testWFInstanceID");
+ assertTrue("workflow data resource removed successfully", !experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testWFInstanceID"));
+
+ experimentDataResource.remove(ResourceType.EXPERIMENT_METADATA, "testExpID");
+ assertTrue("experiment meta data resource removed successfully", !experimentDataResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID"));
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java Thu Dec 26 17:31:35 2013
@@ -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.persistance.registry.jpa;
+
+
+import org.apache.airavata.persistance.registry.jpa.resources.*;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class ExperimentMetadataResourceTest extends AbstractResourceTest {
+ private ExperimentDataResource experimentDataResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ GatewayResource gatewayResource = super.getGatewayResource();
+ WorkerResource workerResource = super.getWorkerResource();
+
+ ExperimentResource experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setWorker(workerResource);
+ experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentDate = new Timestamp(d.getTime());
+ experimentResource.setSubmittedDate(currentDate);
+ experimentResource.save();
+
+ experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+ experimentDataResource.setExpName("testExpID");
+ experimentDataResource.setUserName(workerResource.getUser());
+ experimentDataResource.save();
+ }
+
+ public void testSave() throws Exception {
+ ExperimentMetadataResource experimentMetadataResource = new ExperimentMetadataResource();
+ experimentMetadataResource.setExpID("testExpID");
+ experimentMetadataResource.setMetadata("testMetadata");
+ experimentMetadataResource.save();
+
+ assertTrue("experiment meta data saved successfully", experimentDataResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID"));
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,81 @@
+/*
+*
+* 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 ExperimentResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+ private ExperimentResource experimentResource;
+ private WorkerResource workerResource;
+ private ExperimentDataResource experimentDataResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ workerResource = super.getWorkerResource();
+
+ experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setWorker(workerResource);
+ experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentDate = new Timestamp(d.getTime());
+ experimentResource.setSubmittedDate(currentDate);
+ experimentResource.save();
+
+ experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+ experimentDataResource.setExpName("testExpID");
+ experimentDataResource.setUserName(workerResource.getUser());
+ experimentDataResource.save();
+ }
+
+ public void testCreate() throws Exception {
+ assertNotNull("experiment data resource has being created ", experimentDataResource);
+ }
+
+ public void testGet() throws Exception {
+ assertNotNull("experiment data retrieved successfully", experimentResource.get(ResourceType.EXPERIMENT_DATA, "testExpID"));
+ }
+
+ public void testSave() throws Exception {
+ experimentResource.save();
+ assertTrue("experiment save successfully", gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
+ }
+
+ public void testRemove() throws Exception {
+ if (!experimentDataResource.isWorkflowInstancePresent("testWFInstance")){
+ experimentResource.remove(ResourceType.EXPERIMENT_DATA, "testExpID");
+ assertTrue("experiment data removed successfully", !experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testExpID"));
+ }
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobDataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobDataResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobDataResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobDataResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,81 @@
+/*
+*
+* 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 GFacJobDataResourceTest extends AbstractResourceTest {
+ private WorkerResource workerResource;
+ private ExperimentDataResource experimentDataResource;
+ private WorkflowDataResource workflowDataResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ GatewayResource gatewayResource = super.getGatewayResource();
+ workerResource = super.getWorkerResource();
+
+ ExperimentResource experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setWorker(workerResource);
+ experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+ experimentResource.save();
+
+ experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+ experimentDataResource.setExpName("testExpID");
+ experimentDataResource.setUserName(workerResource.getUser());
+ experimentDataResource.save();
+
+ workflowDataResource = (WorkflowDataResource) experimentDataResource.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();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testSave() throws Exception {
+ GFacJobDataResource resource = (GFacJobDataResource)workflowDataResource.create(ResourceType.GFAC_JOB_DATA);
+ resource.setLocalJobID("testJobID");
+ resource.setApplicationDescID("testApplication");
+ resource.setExperimentDataResource(experimentDataResource);
+ resource.setNodeID("testNode");
+ resource.setHostDescID("testHost");
+ resource.setServiceDescID("testService");
+ resource.setStatus("testStatus");
+ resource.setJobData("testJobData");
+ resource.save();
+ assertTrue("GFac job data saved successfully", workerResource.isGFacJobExists("testJobID"));
+// workflowDataResource.remove(ResourceType.GFAC_JOB_DATA, "testJobID");
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobStatusResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobStatusResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobStatusResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobStatusResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,90 @@
+/*
+*
+* 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;
+import java.util.List;
+
+public class GFacJobStatusResourceTest extends AbstractResourceTest {
+ private GFacJobDataResource gFacJobDataResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ GatewayResource gatewayResource = super.getGatewayResource();
+ WorkerResource workerResource = super.getWorkerResource();
+
+ ExperimentResource experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setWorker(workerResource);
+ experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+ experimentResource.save();
+
+ ExperimentDataResource experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+ experimentDataResource.setExpName("testExpID");
+ experimentDataResource.setUserName(workerResource.getUser());
+ experimentDataResource.save();
+
+ WorkflowDataResource workflowDataResource = (WorkflowDataResource) experimentDataResource.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();
+
+ gFacJobDataResource = (GFacJobDataResource) workflowDataResource.create(ResourceType.GFAC_JOB_DATA);
+ gFacJobDataResource.setLocalJobID("testJobID");
+ gFacJobDataResource.setApplicationDescID("testApplication");
+ gFacJobDataResource.setExperimentDataResource(experimentDataResource);
+ gFacJobDataResource.setNodeID("testNode");
+ gFacJobDataResource.setHostDescID("testHost");
+ gFacJobDataResource.setServiceDescID("testService");
+ gFacJobDataResource.setStatus("testStatus");
+ gFacJobDataResource.setJobData("testJobData");
+ gFacJobDataResource.save();
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testSave() throws Exception {
+ GFacJobStatusResource resource = (GFacJobStatusResource)gFacJobDataResource.create(ResourceType.GFAC_JOB_STATUS);
+ resource.setStatus("testStatus");
+ resource.setgFacJobDataResource(gFacJobDataResource);
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp timestamp = new Timestamp(d.getTime());
+ resource.setStatusUpdateTime(timestamp);
+ resource.save();
+ List<Resource> resources = gFacJobDataResource.get(ResourceType.GFAC_JOB_STATUS);
+ assertTrue("GFac job status saved successfully", resources.size() != 0);
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,179 @@
+/*
+*
+* 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 GatewayResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+ private ProjectResource projectResource;
+ private UserResource userResource;
+ private WorkerResource workerResource;
+ private PublishWorkflowResource publishWorkflowResource;
+ private UserWorkflowResource userWorkflowResource;
+ private HostDescriptorResource hostDescriptorResource;
+ private ServiceDescriptorResource serviceDescriptorResource;
+ private ApplicationDescriptorResource applicationDescriptorResource;
+ private ExperimentResource experimentResource;
+
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ workerResource = super.getWorkerResource();
+ userResource = super.getUserResource();
+ if (gatewayResource == null) {
+ gatewayResource = (GatewayResource) ResourceUtils.getGateway("default");
+ }
+ projectResource = (ProjectResource) gatewayResource.create(ResourceType.PROJECT);
+ projectResource.setName("testProject");
+ projectResource.setWorker(workerResource);
+ projectResource.save();
+
+ publishWorkflowResource = (PublishWorkflowResource) gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
+ userWorkflowResource = (UserWorkflowResource) gatewayResource.create(ResourceType.USER_WORKFLOW);
+ hostDescriptorResource = (HostDescriptorResource) gatewayResource.create(ResourceType.HOST_DESCRIPTOR);
+ serviceDescriptorResource = (ServiceDescriptorResource) gatewayResource.create(ResourceType.SERVICE_DESCRIPTOR);
+ applicationDescriptorResource = (ApplicationDescriptorResource) gatewayResource.create(ResourceType.APPLICATION_DESCRIPTOR);
+ experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+
+ hostDescriptorResource.setUserName(workerResource.getUser());
+ hostDescriptorResource.setHostDescName("testHostDesc");
+ hostDescriptorResource.setContent("testContent");
+ hostDescriptorResource.save();
+
+ serviceDescriptorResource.setUserName(workerResource.getUser());
+ serviceDescriptorResource.setServiceDescName("testServiceDesc");
+ serviceDescriptorResource.setContent("testContent");
+ serviceDescriptorResource.save();
+
+ applicationDescriptorResource.setHostDescName(hostDescriptorResource.getHostDescName());
+ applicationDescriptorResource.setServiceDescName(serviceDescriptorResource.getServiceDescName());
+ applicationDescriptorResource.setUpdatedUser(workerResource.getUser());
+ applicationDescriptorResource.setName("testAppDesc");
+ applicationDescriptorResource.setContent("testContent");
+ applicationDescriptorResource.save();
+
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ userWorkflowResource.setName("workflow1");
+ userWorkflowResource.setLastUpdateDate(currentTime);
+ userWorkflowResource.setWorker(workerResource);
+ userWorkflowResource.setContent("testContent");
+ userWorkflowResource.save();
+
+ publishWorkflowResource.setName("pubworkflow1");
+ publishWorkflowResource.setCreatedUser("admin");
+ publishWorkflowResource.setContent("testContent");
+ Calendar c = Calendar.getInstance();
+ java.util.Date da = c.getTime();
+ Timestamp time = new Timestamp(da.getTime());
+ publishWorkflowResource.setPublishedDate(time);
+ publishWorkflowResource.save();
+
+ experimentResource.setExpID("testExpID");
+ experimentResource.setProject(projectResource);
+ experimentResource.setWorker(workerResource);
+ experimentResource.setSubmittedDate(currentTime);
+ experimentResource.save();
+ }
+
+ public void testSave() throws Exception {
+ gatewayResource.setOwner("owner1");
+ gatewayResource.save();
+
+ boolean gatewayExist = ResourceUtils.isGatewayExist("default");
+ assertTrue("The gateway exisits", gatewayExist);
+
+ }
+
+ 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("publish workflow resource cannot be null", publishWorkflowResource);
+ assertNotNull("user workflow resource cannot be null", userWorkflowResource);
+ assertNotNull("host descriptor resource cannot be null", hostDescriptorResource);
+ assertNotNull("service descriptor resource cannot be null", serviceDescriptorResource);
+ assertNotNull("application descriptor resource cannot be null", applicationDescriptorResource);
+ assertNotNull("experiment resource cannot be null", experimentResource);
+ }
+
+ public void testIsExists() throws Exception {
+ assertTrue(gatewayResource.isExists(ResourceType.USER, "admin"));
+ assertTrue(gatewayResource.isExists(ResourceType.PUBLISHED_WORKFLOW, "pubworkflow1"));
+ assertTrue(gatewayResource.isExists(ResourceType.HOST_DESCRIPTOR, "testHostDesc"));
+ assertTrue(gatewayResource.isExists(ResourceType.SERVICE_DESCRIPTOR, "testServiceDesc"));
+ assertTrue(gatewayResource.isExists(ResourceType.APPLICATION_DESCRIPTOR, "testAppDesc"));
+ assertTrue(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
+ }
+
+ public void testGet() throws Exception {
+ assertNotNull(gatewayResource.get(ResourceType.USER, "admin"));
+ assertNotNull(gatewayResource.get(ResourceType.PUBLISHED_WORKFLOW, "pubworkflow1"));
+ assertNotNull(gatewayResource.get(ResourceType.HOST_DESCRIPTOR, "testHostDesc"));
+ assertNotNull(gatewayResource.get(ResourceType.SERVICE_DESCRIPTOR, "testServiceDesc"));
+ assertNotNull(gatewayResource.get(ResourceType.APPLICATION_DESCRIPTOR, "testAppDesc"));
+ assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT, "testExpID"));
+ }
+
+ public void testGetList() throws Exception {
+ assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER));
+ assertNotNull(gatewayResource.get(ResourceType.PROJECT));
+ assertNotNull(gatewayResource.get(ResourceType.PUBLISHED_WORKFLOW));
+ assertNotNull(gatewayResource.get(ResourceType.HOST_DESCRIPTOR));
+ assertNotNull(gatewayResource.get(ResourceType.SERVICE_DESCRIPTOR));
+ assertNotNull(gatewayResource.get(ResourceType.APPLICATION_DESCRIPTOR));
+ assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT));
+ }
+
+ public void testRemove() throws Exception {
+
+ gatewayResource.remove(ResourceType.PUBLISHED_WORKFLOW, "pubworkflow1");
+ boolean exists = gatewayResource.isExists(ResourceType.PUBLISHED_WORKFLOW, "pubworkflow1");
+ assertFalse(exists);
+
+ gatewayResource.remove(ResourceType.HOST_DESCRIPTOR, "testHostDesc");
+ assertFalse(gatewayResource.isExists(ResourceType.HOST_DESCRIPTOR, "testHostDesc"));
+
+ gatewayResource.remove(ResourceType.SERVICE_DESCRIPTOR, "testServiceDesc");
+ assertFalse(gatewayResource.isExists(ResourceType.SERVICE_DESCRIPTOR, "testServiceDesc"));
+
+ gatewayResource.remove(ResourceType.EXPERIMENT, "testExpID");
+ assertFalse(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
+
+ gatewayResource.remove(ResourceType.APPLICATION_DESCRIPTOR, "testAppDesc");
+ assertFalse(gatewayResource.isExists(ResourceType.APPLICATION_DESCRIPTOR, "testAppDesc"));
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,76 @@
+/*
+*
+* 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 GramDataResourceTest extends AbstractResourceTest {
+ private WorkflowDataResource workflowDataResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ GatewayResource gatewayResource = super.getGatewayResource();
+ WorkerResource workerResource = super.getWorkerResource();
+
+ ExperimentResource experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setWorker(workerResource);
+ experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+ experimentResource.save();
+
+ ExperimentDataResource experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+ experimentDataResource.setExpName("testExpID");
+ experimentDataResource.setUserName(workerResource.getUser());
+ experimentDataResource.save();
+
+ workflowDataResource = (WorkflowDataResource) experimentDataResource.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();
+ }
+
+ public void testSave() throws Exception {
+ GramDataResource gramDataResource = workflowDataResource.createGramData("testNode");
+ gramDataResource.setWorkflowDataResource(workflowDataResource);
+ gramDataResource.setInvokedHost("testhost");
+ gramDataResource.setRsl("testRSL");
+ gramDataResource.save();
+
+ assertTrue("gram data saved successfully", workflowDataResource.isGramDataExists("testNode"));
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java Thu Dec 26 17:31:35 2013
@@ -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.persistance.registry.jpa;
+
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.HostDescriptorResource;
+
+public class HostDescriptorResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+ private HostDescriptorResource hostDescriptorResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ hostDescriptorResource = gatewayResource.createHostDescriptorResource("testHostDesc");
+ hostDescriptorResource.setUserName("admin");
+ hostDescriptorResource.setContent("testContent");
+ }
+
+ public void testGetList() throws Exception {
+ assertNotNull("application data being retrieved successfully", hostDescriptorResource.get(ResourceType.APPLICATION_DESCRIPTOR));
+ }
+
+ public void testSave() throws Exception {
+ hostDescriptorResource.save();
+ assertTrue("host descriptor saved successfully", gatewayResource.isHostDescriptorExists("testHostDesc"));
+ //remove host descriptor
+ gatewayResource.removeHostDescriptor("testHostDesc");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,76 @@
+/*
+*
+* 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 NodeDataResourceTest extends AbstractResourceTest {
+ private WorkflowDataResource workflowDataResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ GatewayResource gatewayResource = super.getGatewayResource();
+ WorkerResource workerResource = super.getWorkerResource();
+
+ ExperimentResource experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setWorker(workerResource);
+ experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+ experimentResource.save();
+
+ ExperimentDataResource experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+ experimentDataResource.setExpName("testExpID");
+ experimentDataResource.setUserName(workerResource.getUser());
+ experimentDataResource.save();
+
+ workflowDataResource = (WorkflowDataResource) experimentDataResource.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();
+ }
+
+ public void testSave() throws Exception {
+ NodeDataResource nodeDataResource = workflowDataResource.createNodeData("testNodeID");
+ nodeDataResource.setInputs("testInput");
+
+ nodeDataResource.setStatus("testStatus");
+ nodeDataResource.setExecutionIndex(0);
+ nodeDataResource.save();
+
+ assertTrue("node data resource saved successfully", workflowDataResource.isNodeExists("testNodeID"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,49 @@
+/*
+*
+* 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.*;
+import junit.framework.Test;
+import org.junit.Before;
+
+import java.util.Enumeration;
+
+public class PersistentDataTestSuite extends TestSuite{
+
+ @Before
+ public void setUp() throws Exception {
+
+ Class[] testClasses = { ConfigurationResourceTest.class,
+ GatewayResourceTest.class, UserResourceTest.class, WorkerResourceTest.class, ProjectResourceTest.class,
+ HostDescriptorResourceTest.class, ServiceDescriptorResourceTest.class, ApplicationDescriptorResourceTest.class,
+ UserWorkflowResourceTest.class, PublishWorkflowResourceTest.class,
+ ExperimentResourceTest.class, ExperimentMetadataResourceTest.class, ExperimentDataResourceTest.class,
+ WorkflowDataResourceTest.class, NodeDataResourceTest.class, GramDataResourceTest.class};
+ TestSuite testSuite = new TestSuite(testClasses);
+ }
+
+ @Override
+ public Enumeration<Test> tests() {
+
+ return super.tests();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,99 @@
+/*
+*
+* 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.ExperimentResource;
+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.WorkerResource;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class ProjectResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+ private WorkerResource workerResource;
+ private ProjectResource projectResource;
+ private ExperimentResource experimentResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ workerResource = super.getWorkerResource();
+ projectResource = workerResource.createProject("testProject");
+ projectResource.setGateway(gatewayResource);
+ projectResource.setWorker(workerResource);
+ projectResource.save();
+
+ experimentResource = projectResource.createExperiment("testExpID");
+ experimentResource.setGateway(gatewayResource);
+ experimentResource.setWorker(workerResource);
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ experimentResource.setSubmittedDate(currentTime);
+ experimentResource.setProject(projectResource);
+ experimentResource.save();
+ }
+
+ public void testCreate() throws Exception {
+ assertNotNull("experiment resource created successfully", experimentResource);
+ }
+
+ public void testGet() throws Exception {
+ ExperimentResource experiment = projectResource.getExperiment("testExpID");
+ assertNotNull("experiment resource retrieved successfully", experiment);
+ }
+
+ public void testGetList() throws Exception {
+ assertNotNull("experiment resources retrieved successfully", projectResource.getExperiments());
+ }
+
+ public void testSave() throws Exception {
+ projectResource.save();
+ assertTrue("Project saved successfully", workerResource.isProjectExists("testProject"));
+ //remove project
+ workerResource.removeProject("testProject");
+ }
+
+
+ public void testRemove() throws Exception {
+ projectResource.removeExperiment("testExpID");
+ assertFalse("experiment removed successfully", projectResource.isExperimentExists("testExpID"));
+
+ experimentResource = projectResource.createExperiment("testExpID");
+ experimentResource.setGateway(gatewayResource);
+ experimentResource.setWorker(workerResource);
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ experimentResource.setSubmittedDate(currentTime);
+ experimentResource.setProject(projectResource);
+ experimentResource.save();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,58 @@
+/*
+*
+* 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.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.PublishWorkflowResource;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class PublishWorkflowResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+ private PublishWorkflowResource publishWorkflowResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ publishWorkflowResource = gatewayResource.createPublishedWorkflow("workflow1");
+ publishWorkflowResource.setCreatedUser("admin");
+ publishWorkflowResource.setContent("testContent");
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ publishWorkflowResource.setPublishedDate(currentTime);
+ }
+
+ public void testSave() throws Exception {
+ publishWorkflowResource.save();
+ assertTrue("published workflow saved successfully", gatewayResource.isPublishedWorkflowExists("workflow1"));
+ //remove workflow
+ gatewayResource.removePublishedWorkflow("workflow1");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}