airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1397168 [1/2] - in /airavata/trunk/modules/registry/airavata-jpa-registry: ./ src/main/java/org/apache/airavata/persistance/registry/jpa/ src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ src/test/java/org/apache/airava...
Date Thu, 11 Oct 2012 17:06:11 GMT
Author: chathuri
Date: Thu Oct 11 17:06:09 2012
New Revision: 1397168

URL: http://svn.apache.org/viewvc?rev=1397168&view=rev
Log:
adding tests to jpa registry resources

Added:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
      - copied unchanged from r1396017, airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/repository.properties
Modified:
    airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml?rev=1397168&r1=1397167&r2=1397168&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/pom.xml Thu Oct 11 17:06:09 2012
@@ -69,6 +69,31 @@
             <artifactId>mysql-connector-java</artifactId>
             <version>5.1.6</version>
         </dependency-->
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbyclient</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbynet</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbytools</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <!--dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-registry-service</artifactId>
+            <version>${project.version}</version>
+        </dependency-->
 
     </dependencies>
 

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java?rev=1397168&r1=1397167&r2=1397168&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java Thu Oct 11 17:06:09 2012
@@ -76,6 +76,27 @@ public class ResourceUtils {
 
     }
 
+    public static Resource getGateway(String gatewayName) {
+        if (isGatewayExist(gatewayName)) {
+            EntityManager em = getEntityManager();
+            Gateway gateway = em.find(Gateway.class, gatewayName);
+            GatewayResource gatewayResource = (GatewayResource)Utils.getResource(ResourceType.GATEWAY, gateway);
+            em.close();
+            return gatewayResource;
+        }
+        return null;
+
+    }
+
+    public static Resource getWorker(String gatewayName, String userName) {
+        EntityManager em = getEntityManager();
+        Gateway_Worker gatewayWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayName, userName));
+        WorkerResource workerResource = (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+        em.close();
+        return workerResource;
+    }
+
+
     /**
      * @param gatewayName
      * @return

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java?rev=1397168&r1=1397167&r2=1397168&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java Thu Oct 11 17:06:09 2012
@@ -92,15 +92,14 @@ public class ExperimentDataResource exte
         switch (type){
             case WORKFLOW_DATA:
                 generator = new QueryGenerator(WORKFLOW_DATA);
-                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+//                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
                 generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
                 q = generator.deleteQuery(em);
                 q.executeUpdate();
                 break;
             case EXPERIMENT_METADATA:
                 generator = new QueryGenerator(EXPERIMENT_METADATA);
-                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, experimentID);
-                generator.setParameter(ExperimentDataConstants.METADATA, name);
+                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, name);
                 q = generator.deleteQuery(em);
                 q.executeUpdate();
                 break;

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java?rev=1397168&r1=1397167&r2=1397168&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java Thu Oct 11 17:06:09 2012
@@ -216,9 +216,9 @@ public class GatewayResource extends Abs
                 generator.setParameter(GatewayWorkerConstants.USERNAME, name);
                 generator.setParameter(GatewayWorkerConstants.GATEWAY_NAME, gatewayName);
                 q = generator.selectQuery(em);
-                Users eUser = (Users) q.getSingleResult();
+                Gateway_Worker worker = (Gateway_Worker) q.getSingleResult();
                 WorkerResource workerResource =
-                        (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, eUser);
+                        (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, worker);
                 em.getTransaction().commit();
                 em.close();
                 return workerResource;
@@ -302,7 +302,8 @@ public class GatewayResource extends Abs
         switch (type){
             case PROJECT:
                 generator = new QueryGenerator(PROJECT);
-                generator.setParameter(ProjectConstants.GATEWAY_NAME, gatewayName);
+                Gateway gatewayModel = em.find(Gateway.class, gatewayName);
+                generator.setParameter("gateway", gatewayModel);
                 q = generator.selectQuery(em);
                 results = q.getResultList();
                 if (results.size() != 0) {
@@ -453,6 +454,7 @@ public class GatewayResource extends Abs
                 em = ResourceUtils.getEntityManager();
                 Published_Workflow existingWf = em.find(Published_Workflow.class, new Published_Workflow_PK(gatewayName, name.toString()));
                 em.close();
+                boolean a = existingWf != null;
                 return existingWf != null;
             case HOST_DESCRIPTOR:
                 em = ResourceUtils.getEntityManager();

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java?rev=1397168&r1=1397167&r2=1397168&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java Thu Oct 11 17:06:09 2012
@@ -113,8 +113,8 @@ public class ProjectResource extends Abs
             EntityManager em = ResourceUtils.getEntityManager();
             em.getTransaction().begin();
         	QueryGenerator generator = new QueryGenerator(EXPERIMENT);
-        	generator.setParameter(ExperimentConstants.PROJECT_NAME, name);
-        	generator.setParameter(ExperimentConstants.USERNAME, getWorker().getUser());
+//        	generator.setParameter(ExperimentConstants.PROJECT_NAME, name);
+//        	generator.setParameter(ExperimentConstants.USERNAME, getWorker().getUser());
         	generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
         	Query q = generator.selectQuery(em);
             Experiment experiment = (Experiment) q.getSingleResult();
@@ -175,7 +175,7 @@ public class ProjectResource extends Abs
                 for (Object result : results) {
                     Experiment experiment = (Experiment) result;
                     ExperimentResource experimentResource = (ExperimentResource)
-                            Utils.getResource(ResourceType.USER, experiment);
+                            Utils.getResource(ResourceType.EXPERIMENT, experiment);
                     resourceList.add(experimentResource);
                 }
             }

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java?rev=1397168&r1=1397167&r2=1397168&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java Thu Oct 11 17:06:09 2012
@@ -375,8 +375,10 @@ public class Utils {
      * @return  Gateway_Worker resource object
      */
     private static Resource createGatewayWorker(Gateway_Worker o) {
-        GatewayResource gatewayResource = (GatewayResource)createGateway(o.getGateway());
-        return new WorkerResource(o.getUser().getUser_name(),gatewayResource);
+        GatewayResource gatewayResource = new GatewayResource(o.getGateway().getGateway_name());
+        gatewayResource.setOwner(o.getGateway().getOwner());
+        WorkerResource workerResource = new WorkerResource(o.getUser().getUser_name(), gatewayResource);
+        return workerResource;
     }
 
     /**

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java?rev=1397168&r1=1397167&r2=1397168&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java Thu Oct 11 17:06:09 2012
@@ -77,6 +77,12 @@ public class WorkerResource extends Abst
 				userWorkflowResource.setGateway(gateway);
 				result=userWorkflowResource;
                 break;
+            case EXPERIMENT:
+                ExperimentResource experimentResource = new ExperimentResource();
+                experimentResource.setWorker(this);
+                experimentResource.setGateway(gateway);
+                result=experimentResource;
+                break;
 			default:
                 logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
                 throw new IllegalArgumentException("Unsupported resource type for worker resource.");
@@ -199,8 +205,12 @@ public class WorkerResource extends Abst
 		switch (type) {
 			case PROJECT:
                 generator = new QueryGenerator(PROJECT);
-                generator.setParameter(ProjectConstants.USERNAME, getUser());
-                generator.setParameter(ProjectConstants.GATEWAY_NAME, gateway.getGatewayName());
+                Users users = em.find(Users.class, getUser());
+                Gateway gatewayModel = em.find(Gateway.class, gateway.getGatewayName());
+                generator.setParameter("users", users);
+                generator.setParameter("gateway", gatewayModel);
+//                generator.setParameter(ProjectConstants.USERNAME, getUser());
+//                generator.setParameter(ProjectConstants.GATEWAY_NAME, gateway.getGatewayName());
                 q = generator.selectQuery(em);
 	            for (Object o : q.getResultList()) {
 	            	Project project = (Project) o;

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ApplicationDescriptorResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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 junit.framework.TestSuite;
+import org.apache.airavata.persistance.registry.jpa.resources.ApplicationDescriptorResource;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.util.Initialize;
+import org.junit.*;
+
+public class ApplicationDescriptorResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+
+    @BeforeClass
+    public void setUp() throws Exception {
+        Initialize initialize = new Initialize();
+        initialize.initializeDB();
+        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);
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+    }
+
+    @org.junit.Test
+    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("testUser");
+        applicationDescriptorResouce.save();
+
+        if(gatewayResource.isExists(ResourceType.APPLICATION_DESCRIPTOR, "testAppDesc") ){
+            assertTrue("application descriptor saved successfully", true);
+        }
+
+        gatewayResource.remove(ResourceType.APPLICATION_DESCRIPTOR, "testAppDesc");
+    }
+
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,53 @@
+/*
+*
+* 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.ConfigurationResource;
+
+import java.sql.Date;
+import java.util.Calendar;
+
+public class ConfigurationResourceTest extends TestCase {
+
+    @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();
+        Date currentTime = new Date(d.getTime());
+        configuration.setExpireDate(currentTime);
+        configuration.save();
+
+        if(ResourceUtils.isConfigurationExist("testConfigKey")){
+            assertTrue("Configuration Save succuessful" , true);
+        }
+
+        //remove test configuration
+        ResourceUtils.removeConfiguration("testConfigKey");
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,135 @@
+/*
+*
+* 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.*;
+import org.apache.airavata.persistance.registry.jpa.util.Initialize;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class ExperimentDataResourceTest extends TestCase {
+    private ExperimentDataResource experimentDataResource;
+    private GatewayResource gatewayResource;
+    private ExperimentResource experimentResource;
+    private WorkerResource workerResource;
+    private WorkflowDataResource workflowDataResource;
+    private ExperimentMetadataResource experimentMetadataResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "testUser");
+
+        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("exp1");
+        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();
+
+        super.setUp();
+    }
+
+    public void testCreate() throws Exception {
+        WorkflowDataResource resource = (WorkflowDataResource)experimentDataResource.create(ResourceType.WORKFLOW_DATA);
+//        resource.setTemplateName("testTemplate");
+//        resource.setWorkflowInstanceID("testWFInstanceID");
+//        Calendar calender = Calendar.getInstance();
+//        java.util.Date d =  calender.getTime();
+//        Timestamp currentTime = new Timestamp(d.getTime());
+//        resource.setLastUpdatedTime(currentTime);
+//        resource.save();
+
+        ExperimentMetadataResource metadataResource = (ExperimentMetadataResource)experimentDataResource.create(ResourceType.EXPERIMENT_METADATA);
+//        metadataResource.setMetadata("testmetadata");
+//        metadataResource.save();
+
+        assertNotNull("workflowdata resource created", resource);
+        assertNotNull("experimemt metadata resource created" , metadataResource);
+    }
+
+    public void testGet() throws Exception {
+        WorkflowDataResource workflowDataResource = experimentDataResource.getWorkflowInstance("testWorkflowInstance");
+        assertNotNull("workflow data retrieved successfully", workflowDataResource);
+
+        ExperimentMetadataResource experimentMetadataResource = experimentDataResource.getExperimentMetadata();
+        assertNotNull("experiment meta data retrieved successfully", experimentMetadataResource);
+    }
+
+    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();
+
+        if (experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testExpID")){
+            assertTrue("experiment data saved successfully", true);
+        }
+        //remove experiment data
+        experimentResource.remove(ResourceType.EXPERIMENT_DATA, "testExpID");
+    }
+
+    public void testRemove() throws Exception {
+        experimentDataResource.remove(ResourceType.WORKFLOW_DATA, "testWFInstanceID");
+        if(!experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testWFInstanceID")) {
+            assertTrue("workflow data resource removed successfully", true);
+        }
+
+        experimentDataResource.remove(ResourceType.EXPERIMENT_METADATA, "testExpID");
+        if (! experimentDataResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID")) {
+            assertTrue("experiment meta data resource removed successfully", true);
+        }
+    }
+
+
+
+
+
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,74 @@
+/*
+*
+* 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.*;
+
+import java.sql.Date;
+import java.util.Calendar;
+
+public class ExperimentMetadataResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private ExperimentResource experimentResource;
+    private WorkerResource workerResource;
+    private ExperimentDataResource experimentDataResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "testUser");
+
+        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();
+        Date currentDate = new Date(d.getTime());
+        experimentResource.setSubmittedDate(currentDate);
+        experimentResource.save();
+
+        experimentDataResource = (ExperimentDataResource)experimentResource.create(ResourceType.EXPERIMENT_DATA);
+        experimentDataResource.setExpName("testExp");
+        experimentDataResource.setUserName(workerResource.getUser());
+        experimentDataResource.save();
+
+        super.setUp();
+    }
+
+    public void testSave() throws Exception {
+        ExperimentMetadataResource experimentMetadataResource = new ExperimentMetadataResource();
+        experimentMetadataResource.setExpID("testExpID");
+        experimentMetadataResource.setMetadata("testMetadata");
+        experimentMetadataResource.save();
+
+        if(experimentDataResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID")){
+            assertTrue("experiment meta data saved successfully" , true);
+        }
+
+        //remove the metadata
+        experimentDataResource.remove(ResourceType.EXPERIMENT_METADATA, "testExpID");
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,83 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.apache.airavata.persistance.registry.jpa;
+
+import junit.framework.TestCase;
+import org.apache.airavata.persistance.registry.jpa.resources.*;
+
+import java.sql.Date;
+import java.util.Calendar;
+
+public class ExperimentResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private ExperimentResource experimentResource;
+    private WorkerResource workerResource;
+    private ExperimentDataResource experimentDataResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "testUser");
+
+        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();
+        Date currentDate = new Date(d.getTime());
+        experimentResource.setSubmittedDate(currentDate);
+        experimentResource.save();
+
+        super.setUp();
+    }
+
+    public void testCreate() throws Exception{
+        experimentDataResource = (ExperimentDataResource)experimentResource.create(ResourceType.EXPERIMENT_DATA);
+        experimentDataResource.setExpName("testExp");
+        experimentDataResource.setUserName(workerResource.getUser());
+        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.setWorker(workerResource);
+        experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+        experimentResource.save();
+
+        if(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID")){
+            assertTrue("experiment save successfully", true);
+        }
+        //remove experiment
+        gatewayResource.remove(ResourceType.EXPERIMENT, "testExpID");
+    }
+
+    public void testRemove () throws Exception {
+         experimentResource.remove(ResourceType.EXPERIMENT_DATA, "testExpID");
+        if(!experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testExpID")){
+            assertTrue("experiment data removed successfully", true);
+        }
+    }
+}

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java?rev=1397168&r1=1397167&r2=1397168&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java Thu Oct 11 17:06:09 2012
@@ -1,49 +1,226 @@
-//package org.apache.airavata.persistance.registry.jpa;
-//
-//import junit.framework.TestCase;
-//import org.apache.airavata.persistance.registry.jpa.resources.*;
-//
-//
-//public class GatewayResourceTest extends TestCase {
-//    private GatewayResource gatewayResource;
-//
-//    @Override
-//    public void setUp() throws Exception {
-//        super.setUp();
-////        gatewayResource = (GatewayResource)ResourceUtils.createGateway("gateway1");
-//    }
-
-//    public void testSave() throws Exception {
-//        gatewayResource.setOwner("owner1");
-//        gatewayResource.save();
-//
-//        boolean gatewayExist = ResourceUtils.isGatewayExist("gateway1");
-//        if(gatewayExist){
-//            assertTrue("The gateway exisits", gatewayExist);
-//        }
-//
-//    }
-//
-//    public void testCreate() throws Exception {
-//        ProjectResource projectResource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
-//        UserResource userResource = (UserResource)gatewayResource.create(ResourceType.USER);
-//        WorkerResource workerResource = (WorkerResource)gatewayResource.create(ResourceType.USER_WORKFLOW);
-//        PublishWorkflowResource publishWorkflowResource = (PublishWorkflowResource)gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
-//        UserWorkflowResource userWorkflowResource = (UserWorkflowResource)gatewayResource.create(ResourceType.USER_WORKFLOW);
-//        HostDescriptorResource hostDescriptorResource = (HostDescriptorResource)gatewayResource.create(ResourceType.HOST_DESCRIPTOR);
-//
-//
-//    }
-//
-//    public void testIsExists() throws Exception {
-//
-//    }
-//
-//    public void testGet() throws Exception {
-//
-//    }
-//
-//    public void testGetList() throws Exception {
-//
-//    }
-//}
+/*
+*
+* 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.*;
+
+import java.sql.Date;
+import java.util.Calendar;
+
+
+public class GatewayResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private ProjectResource projectResource;
+    private UserResource userResource;
+    private WorkerResource workerResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.createGateway("gateway1");
+        if(gatewayResource == null){
+            gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        }
+        projectResource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
+        userResource = (UserResource)gatewayResource.create(ResourceType.USER);
+        workerResource = (WorkerResource)gatewayResource.create(ResourceType.GATEWAY_WORKER);
+
+        userResource.setUserName("testUser");
+        userResource.setPassword("testUser");
+        userResource.save();
+
+        workerResource.setUser("testUser");
+        workerResource.save();
+
+        projectResource.setName("testProject");
+        projectResource.setWorker(workerResource);
+        projectResource.save();
+    }
+
+     @org.junit.Test
+    public void testSave() throws Exception {
+        gatewayResource.setOwner("owner1");
+        gatewayResource.save();
+
+        boolean gatewayExist = ResourceUtils.isGatewayExist("gateway1");
+        if(gatewayExist){
+            assertTrue("The gateway exisits", gatewayExist);
+        }
+
+    }
+
+    @org.junit.Test
+    public void testCreate() throws Exception {
+
+        PublishWorkflowResource publishWorkflowResource = (PublishWorkflowResource)gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
+        UserWorkflowResource userWorkflowResource = (UserWorkflowResource)gatewayResource.create(ResourceType.USER_WORKFLOW);
+        HostDescriptorResource hostDescriptorResource = (HostDescriptorResource)gatewayResource.create(ResourceType.HOST_DESCRIPTOR);
+        ServiceDescriptorResource serviceDescriptorResource = (ServiceDescriptorResource)gatewayResource.create(ResourceType.SERVICE_DESCRIPTOR);
+        ApplicationDescriptorResource applicationDescriptorResource = (ApplicationDescriptorResource)gatewayResource.create(ResourceType.APPLICATION_DESCRIPTOR);
+        ExperimentResource 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();
+        Date currentTime = new Date(d.getTime());
+        userWorkflowResource.setName("workflow1");
+        userWorkflowResource.setLastUpdateDate(currentTime);
+        userWorkflowResource.setWorker(workerResource);
+        userWorkflowResource.setContent("testContent");
+        userWorkflowResource.save();
+
+        publishWorkflowResource.setName("pubworkflow1");
+        publishWorkflowResource.setCreatedUser("testUser");
+        publishWorkflowResource.setContent("testContent");
+        Calendar c = Calendar.getInstance();
+        java.util.Date da =  c.getTime();
+        Date time = new Date(da.getTime());
+        publishWorkflowResource.setPublishedDate(time);
+        publishWorkflowResource.save();
+
+        experimentResource.setExpID("testExpID");
+        experimentResource.setProject(projectResource);
+        experimentResource.setWorker(workerResource);
+        experimentResource.setSubmittedDate(currentTime);
+        experimentResource.save();
+
+        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);
+    }
+
+    @org.junit.Test
+    public void testIsExists() throws Exception {
+        assertTrue(gatewayResource.isExists(ResourceType.USER, "testUser"));
+        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"));
+    }
+
+    @org.junit.Test
+    public void testGet() throws Exception {
+        assertNotNull(gatewayResource.get(ResourceType.USER, "testUser"));
+        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.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));
+        assertNotNull(gatewayResource.get(ResourceType.PROJECT));
+        assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER));
+    }
+
+    @org.junit.Test
+    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"));
+
+        PublishWorkflowResource publishWorkflowResource = (PublishWorkflowResource)gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
+        HostDescriptorResource hostDescriptorResource = (HostDescriptorResource)gatewayResource.create(ResourceType.HOST_DESCRIPTOR);
+        ServiceDescriptorResource serviceDescriptorResource = (ServiceDescriptorResource)gatewayResource.create(ResourceType.SERVICE_DESCRIPTOR);
+        ApplicationDescriptorResource applicationDescriptorResource = (ApplicationDescriptorResource)gatewayResource.create(ResourceType.APPLICATION_DESCRIPTOR);
+        ExperimentResource 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();
+        Date currentTime = new Date(d.getTime());
+
+        publishWorkflowResource.setName("pubworkflow1");
+        publishWorkflowResource.setCreatedUser("testUser");
+        publishWorkflowResource.setContent("testContent");
+        Calendar c = Calendar.getInstance();
+        java.util.Date da =  c.getTime();
+        Date time = new Date(da.getTime());
+        publishWorkflowResource.setPublishedDate(time);
+        publishWorkflowResource.save();
+
+        experimentResource.setExpID("testExpID");
+        experimentResource.setProject(projectResource);
+        experimentResource.setWorker(workerResource);
+        experimentResource.setSubmittedDate(currentTime);
+        experimentResource.save();
+
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java Thu Oct 11 17:06:09 2012
@@ -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 junit.framework.TestCase;
+import org.apache.airavata.persistance.registry.jpa.resources.*;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class GramDataResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private ExperimentResource experimentResource;
+    private WorkerResource workerResource;
+    private ExperimentDataResource experimentDataResource;
+    private WorkflowDataResource workflowDataResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "testUser");
+
+        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("testExp");
+        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();
+
+//        super.setUp();
+    }
+
+    public void testSave() throws Exception {
+        GramDataResource gramDataResource = workflowDataResource.createGramData("testNode");
+        gramDataResource.setWorkflowDataResource(workflowDataResource);
+        gramDataResource.setInvokedHost("testhost");
+        gramDataResource.setRsl("testRSL");
+        gramDataResource.save();
+
+        if (workflowDataResource.isGramDataExists("testNodeID"))  {
+            assertTrue("gram data saved successfully", true);
+        }
+
+        //remove the gram data
+        workflowDataResource.removeGramData("testNodeID");
+    }
+
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/HostDescriptorResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,53 @@
+/*
+*
+* 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.HostDescriptorResource;
+
+public class HostDescriptorResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private HostDescriptorResource hostDescriptorResource;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        hostDescriptorResource = gatewayResource.createHostDescriptorResource("testHostDesc");
+        hostDescriptorResource.setUserName("testUser");
+        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();
+        if(gatewayResource.isHostDescriptorExists("testHostDesc")){
+            assertTrue("host descriptor saved successfully", true);
+        }
+        //remove host descriptor
+        gatewayResource.removeHostDescriptor("testHostDesc");
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java Thu Oct 11 17:06:09 2012
@@ -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 junit.framework.TestCase;
+import org.apache.airavata.persistance.registry.jpa.resources.*;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class NodeDataResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private ExperimentResource experimentResource;
+    private WorkerResource workerResource;
+    private ExperimentDataResource experimentDataResource;
+    private WorkflowDataResource workflowDataResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "testUser");
+
+        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("testExp");
+        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();
+
+//        super.setUp();
+    }
+
+    public void testSave() throws Exception {
+        NodeDataResource nodeDataResource = workflowDataResource.createNodeData("testNodeID");
+        nodeDataResource.setInputs("testInput");
+
+//        nodeDataResource.setWorkflowDataResource(workflowDataResource);
+        nodeDataResource.setStatus("testStatus");
+        nodeDataResource.save();
+
+        if(workflowDataResource.isNodeExists("testNodeID")){
+            assertTrue("node data resource saved successfully", true);
+        }
+        //remove node data
+        workflowDataResource.removeNodeData("testNodeID");
+    }
+
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PersistentDataTestSuite.java Thu Oct 11 17:06:09 2012
@@ -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/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ProjectResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,89 @@
+/*
+*
+* 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.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.Date;
+import java.util.Calendar;
+
+public class ProjectResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private WorkerResource workerResource;
+    private ProjectResource projectResource;
+    private ExperimentResource experimentResource;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "testUser");
+        projectResource =  workerResource.createProject("testProject");
+        projectResource.setGateway(gatewayResource);
+        projectResource.setWorker(workerResource);
+        projectResource.save();
+    }
+
+    public void testCreate() throws Exception {
+        experimentResource = projectResource.createExperiment("testExpID");
+        experimentResource.setGateway(gatewayResource);
+        experimentResource.setWorker(workerResource);
+        Calendar calender = Calendar.getInstance();
+        java.util.Date d =  calender.getTime();
+        Date currentTime = new Date(d.getTime());
+        experimentResource.setSubmittedDate(currentTime);
+        experimentResource.setProject(projectResource);
+        experimentResource.save();
+        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();
+
+        if(workerResource.isProjectExists("testProject")){
+            assertTrue("Project saved successfully", true);
+        }
+        //remove project
+        workerResource.removeProject("testProject");
+    }
+
+
+    public void testRemove() throws Exception {
+        projectResource.removeExperiment("testExpID");
+        if(!projectResource.isExperimentExists("testExpID")) {
+            assertTrue("experiment removed successfully", true);
+        }
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,56 @@
+/*
+*
+* 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.PublishWorkflowResource;
+
+import java.sql.Date;
+import java.util.Calendar;
+
+public class PublishWorkflowResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private PublishWorkflowResource publishWorkflowResource;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        publishWorkflowResource = gatewayResource.createPublishedWorkflow("workflow1");
+        publishWorkflowResource.setCreatedUser("testUser");
+        publishWorkflowResource.setContent("testContent");
+        Calendar calender = Calendar.getInstance();
+        java.util.Date d =  calender.getTime();
+        Date currentTime = new Date(d.getTime());
+        publishWorkflowResource.setPublishedDate(currentTime);
+    }
+
+    public void testSave() throws Exception {
+        publishWorkflowResource.save();
+        if(gatewayResource.isPublishedWorkflowExists("workflow1")){
+            assertTrue("published workflow saved successfully", true);
+        }
+        //remove workflow
+        gatewayResource.removePublishedWorkflow("workflow1");
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,53 @@
+/*
+*
+* 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.ServiceDescriptorResource;
+
+public class ServiceDescriptorResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private ServiceDescriptorResource serviceDescriptorResource;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        serviceDescriptorResource = gatewayResource.createServiceDescriptorResource("testServiceDesc");
+        serviceDescriptorResource.setUserName("testUser");
+        serviceDescriptorResource.setContent("testContent");
+    }
+
+    public void testGetList() throws Exception{
+        assertNotNull("application data being retrieved successfully" ,serviceDescriptorResource.get(ResourceType.APPLICATION_DESCRIPTOR));
+    }
+
+    public void testSave() throws Exception {
+        serviceDescriptorResource.save();
+        if(gatewayResource.isServiceDescriptorExists("testServiceDesc")){
+            assertTrue("service descriptor saved successfully", true);
+        }
+        //remove host descriptor
+        gatewayResource.removeServiceDescriptor("testServiceDesc");
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java Thu Oct 11 17:06:09 2012
@@ -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.TestCase;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+
+public class UserResourceTest extends TestCase {
+    private UserResource userResource;
+    private GatewayResource gatewayResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        userResource = (UserResource)gatewayResource.create(ResourceType.USER);
+        userResource.setUserName("testUser");
+        userResource.setPassword("testPassword");
+        super.setUp();
+    }
+
+    public void testSave() throws Exception {
+        userResource.save();
+        if(gatewayResource.isExists(ResourceType.USER, "testUser")) {
+            assertTrue("user resource saved successfully", true);
+        }
+        //remove user
+//        gatewayResource.remove(ResourceType.USER, "testUser");
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,60 @@
+/*
+*
+* 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.UserWorkflowResource;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+
+import java.sql.Date;
+import java.util.Calendar;
+
+public class UserWorkflowResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private WorkerResource workerResource;
+    private UserWorkflowResource userWorkflowResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "testUser");
+
+        userWorkflowResource =  workerResource.createWorkflowTemplate("workflow1");
+        userWorkflowResource.setGateway(gatewayResource);
+        userWorkflowResource.setContent("testContent");
+        Calendar calender = Calendar.getInstance();
+        java.util.Date d =  calender.getTime();
+        Date currentTime = new Date(d.getTime());
+        userWorkflowResource.setLastUpdateDate(currentTime);
+        super.setUp();
+    }
+
+    public void testSave() throws Exception {
+        userWorkflowResource.save();
+        if(workerResource.isWorkflowTemplateExists("workflow1")){
+            assertTrue("user workflow saved successfully", true);
+        }
+        //remove user workflow
+        workerResource.removeWorkflowTemplate("workflow1");
+    }
+}

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java?rev=1397168&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java (added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java Thu Oct 11 17:06:09 2012
@@ -0,0 +1,114 @@
+/*
+*
+* 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.*;
+
+import java.sql.Date;
+import java.util.Calendar;
+
+public class WorkerResourceTest extends TestCase {
+    private GatewayResource gatewayResource;
+    private WorkerResource workerResource;
+    private UserResource userResource;
+
+    @Override
+    public void setUp() throws Exception {
+        gatewayResource = (GatewayResource)ResourceUtils.getGateway("gateway1");
+        workerResource = new WorkerResource();
+        workerResource.setGateway(gatewayResource);
+        workerResource.setUser("testUser");
+        userResource = (UserResource)gatewayResource.create(ResourceType.USER);
+        userResource.setUserName("testUser");
+        userResource.setPassword("testPassword");
+        userResource.save();
+    }
+
+    public void testCreate() throws Exception {
+        ProjectResource testProject = workerResource.createProject("testProject");
+        UserWorkflowResource userWorkflowResource = workerResource.createWorkflowTemplate("workflow1");
+        ExperimentResource experimentResource = (ExperimentResource)workerResource.create(ResourceType.EXPERIMENT);
+
+        testProject.setGateway(gatewayResource);
+        testProject.save();
+
+        userWorkflowResource.setGateway(gatewayResource);
+        userWorkflowResource.setContent("testContent");
+        userWorkflowResource.save();
+
+        experimentResource.setGateway(gatewayResource);
+        experimentResource.setExpID("testExpID");
+        experimentResource.setProject(testProject);
+        Calendar calender = Calendar.getInstance();
+        java.util.Date d =  calender.getTime();
+        Date currentTime = new Date(d.getTime());
+        experimentResource.setSubmittedDate(currentTime);
+        experimentResource.save();
+
+        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, "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));
+
+    }
+
+    public void testSave() throws Exception {
+        workerResource.save();
+        if(gatewayResource.isExists(ResourceType.USER, "testUser")){
+            assertTrue("worker resource saved successfully", true);
+        }
+        //remove
+//        ResourceUtils.removeGatewayWorker(gatewayResource, userResource);
+//        gatewayResource.remove(ResourceType.USER, "testUser");
+    }
+
+    public void testRemove() throws Exception {
+        workerResource.removeProject("testProject");
+        workerResource.removeWorkflowTemplate("workflow1");
+        workerResource.removeExperiment("testExpID");
+
+        if(!workerResource.isProjectExists("testProject")){
+            assertTrue("project has been removed successfully", true);
+        }
+
+        if(!workerResource.isExperimentExists("testExpID")){
+            assertTrue("experiment has been removed successfully", true);
+        }
+
+        if(!workerResource.isWorkflowTemplateExists("workflow1")){
+            assertTrue("user workflow has been removed successfully", true);
+        }
+    }
+
+
+    }



Mime
View raw message