airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject git commit: fixed the models and utils based on unit testing and added new tests. AIRAVATA-1025
Date Fri, 21 Feb 2014 18:45:47 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 0c58b97e0 -> d91a0133d


fixed the models and utils based on unit testing and added new tests. AIRAVATA-1025


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d91a0133
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d91a0133
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d91a0133

Branch: refs/heads/master
Commit: d91a0133d69f375defd91da0fb4a1c8f657b7a0b
Parents: 0c58b97
Author: raminder <raminder@apache.org>
Authored: Fri Feb 21 13:45:29 2014 -0500
Committer: raminder <raminder@apache.org>
Committed: Fri Feb 21 13:45:29 2014 -0500

----------------------------------------------------------------------
 .../registry/jpa/TaskDetailResourceTest.java    | 75 ++++++++++++++++++++
 .../jpa/WorkflowNodeDetailResourceTest.java     | 66 +++++++++++++++++
 2 files changed, 141 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/d91a0133/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
new file mode 100644
index 0000000..f7dc517
--- /dev/null
+++ b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
@@ -0,0 +1,75 @@
+package org.apache.airavata.persistance.registry.jpa;
+
+import static org.junit.Assert.*;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
+import org.apache.airavata.persistance.registry.jpa.resources.TaskDetailResource;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkflowNodeDetailResource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TaskDetailResourceTest extends AbstractResourceTest{
+	
+	   private ExperimentResource experimentResource;
+	   private TaskDetailResource  taskDetailResource;
+	   private WorkflowNodeDetailResource nodeDetailResource;
+	   private String experimentID = "testExpID";
+	   private String applicationID = "testAppID"; 
+	   private String taskID = "testTask";
+	   private String nodeID = "testNode";
+
+	
+	@Before
+	public void setUp() throws Exception {
+		super.setUp();
+	    Timestamp creationTime = new Timestamp(new Date().getTime());
+	    
+	    experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+        experimentResource.setExpID(experimentID);
+        experimentResource.setWorker(getWorkerResource());
+        experimentResource.setProject(getProjectResource());
+        experimentResource.setCreationTime(creationTime);
+        experimentResource.save();
+        
+        nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
+        nodeDetailResource.setExperimentResource(experimentResource);
+        nodeDetailResource.setNodeInstanceId(nodeID);
+        nodeDetailResource.setNodeName(nodeID);
+        nodeDetailResource.setCreationTime(creationTime);
+        nodeDetailResource.save();
+        
+        taskDetailResource = (TaskDetailResource)nodeDetailResource.create(ResourceType.TASK_DETAIL);
+        taskDetailResource.setWorkflowNodeDetailResource(nodeDetailResource);
+        taskDetailResource.setTaskId(taskID);
+        taskDetailResource.setApplicationId(applicationID);
+        taskDetailResource.setApplicationVersion("1.0");
+        taskDetailResource.setCreationTime(creationTime);
+        taskDetailResource.save();
+    }
+	
+
+	@Test
+    public void testCreate() throws Exception {
+    	assertNotNull("task data resource has being created ", taskDetailResource);
+    }
+    
+    @Test
+    public void testSave() throws Exception {
+        assertTrue("task save successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL,
taskID));
+    }
+    
+    @Test
+    public void testGet() throws Exception {
+        assertNotNull("task data retrieved successfully", nodeDetailResource.get(ResourceType.TASK_DETAIL,
taskID));
+    }
+
+    @Test
+    public void testRemove() throws Exception {
+    	nodeDetailResource.remove(ResourceType.TASK_DETAIL, taskID);
+    	assertFalse("task data removed successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL,
taskID));        
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d91a0133/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
new file mode 100644
index 0000000..1f56414
--- /dev/null
+++ b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
@@ -0,0 +1,66 @@
+package org.apache.airavata.persistance.registry.jpa;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkflowNodeDetailResource;
+import org.junit.Before;
+import org.junit.Test;
+
+public class WorkflowNodeDetailResourceTest extends AbstractResourceTest {
+
+	private ExperimentResource experimentResource;
+	private WorkflowNodeDetailResource nodeDetailResource;
+	private String experimentID = "testExpID";
+	private String applicationID = "testAppID";
+	private String nodeID = "testNode";
+
+	@Before
+	public void setUp() throws Exception {
+		super.setUp();
+		Timestamp creationTime = new Timestamp(new Date().getTime());
+
+		experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+		experimentResource.setExpID(experimentID);
+		experimentResource.setWorker(getWorkerResource());
+		experimentResource.setProject(getProjectResource());
+		experimentResource.setCreationTime(creationTime);
+		experimentResource.setApplicationId(applicationID);
+		experimentResource.save();
+
+		nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
+		nodeDetailResource.setExperimentResource(experimentResource);
+		nodeDetailResource.setNodeInstanceId(nodeID);
+		nodeDetailResource.setNodeName(nodeID);
+		nodeDetailResource.setCreationTime(creationTime);
+		nodeDetailResource.save();
+
+	}
+
+	@Test
+	public void testCreate() throws Exception {
+		assertNotNull("task data resource has being created ", nodeDetailResource);
+	}
+
+	@Test
+	public void testSave() throws Exception {
+		assertTrue("task save successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL,
nodeID));
+	}
+
+	@Test
+	public void testGet() throws Exception {
+		assertNotNull("task data retrieved successfully", experimentResource.get(ResourceType.WORKFLOW_NODE_DETAIL,
nodeID));
+	}
+
+	@Test
+	public void testRemove() throws Exception {
+		experimentResource.remove(ResourceType.WORKFLOW_NODE_DETAIL, nodeID);
+		assertFalse("task data removed successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL,
nodeID));
+	}
+
+}


Mime
View raw message