You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/06/22 15:48:54 UTC
[1/3] airavata git commit: Fixing worker resource
Repository: airavata
Updated Branches:
refs/heads/master f9032d4dd -> 0a90a404c
Fixing worker resource
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/8d6ba82d
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/8d6ba82d
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/8d6ba82d
Branch: refs/heads/master
Commit: 8d6ba82da21eb9a83abfa8c3ae171fad518ff1f3
Parents: f9032d4
Author: Supun Nakandala <sc...@apache.org>
Authored: Mon Jun 22 18:43:47 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Mon Jun 22 18:43:47 2015 +0530
----------------------------------------------------------------------
.../catalog/resources/WorkerResource.java | 242 +++++++++----------
1 file changed, 111 insertions(+), 131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d6ba82d/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
index 3cb47d5..6488afb 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java
@@ -32,7 +32,6 @@ import org.apache.airavata.registry.cpi.ResultOrderType;
import org.apache.airavata.registry.cpi.utils.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -40,7 +39,6 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
public class WorkerResource extends AbstractExpCatResource {
private final static Logger logger = LoggerFactory.getLogger(WorkerResource.class);
@@ -399,11 +397,6 @@ public class WorkerResource extends AbstractExpCatResource {
return project;
}
- public String getProjectID(String projectName) {
- String pro = projectName.replaceAll("\\s", "");
- return pro + "_" + UUID.randomUUID();
- }
-
/**
* @param id project id
* @return project resource
@@ -597,88 +590,81 @@ public class WorkerResource extends AbstractExpCatResource {
*/
public List<ExperimentSummaryResource> searchExperiments(Timestamp fromTime, Timestamp toTime, Map<String, String> filters, int limit,
int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
-// List<ExperimentSummaryResource> result = new ArrayList();
-// EntityManager em = null;
-// try {
-// String query = "SELECT e, s FROM Experiment e " +
-// ",Status s WHERE e.expId=s.expId AND " +
-// "s.statusType='" + StatusType.EXPERIMENT + "' AND ";
-// if (filters.get(StatusConstants.STATE) != null) {
-// String experimentState = ExperimentState.valueOf(filters.get(StatusConstants.STATE)).toString();
-// query += "s.state='" + experimentState + "' AND ";
-// }
-//
-// if (toTime != null && fromTime != null && toTime.after(fromTime)) {
-// query += "e.creationTime > '" + fromTime + "' " + "AND e.creationTime <'" + toTime + "' AND ";
-// }
-//
-// filters.remove(StatusConstants.STATE);
-// if (filters != null && filters.size() != 0) {
-// for (String field : filters.keySet()) {
-// String filterVal = filters.get(field);
-// if (field.equals(ExperimentConstants.EXECUTION_USER)) {
-// query += "e." + field + "= '" + filterVal + "' AND ";
-// } else if (field.equals(ExperimentConstants.GATEWAY_ID)) {
-// query += "e." + field + "= '" + filterVal + "' AND ";
-// } else if (field.equals(ExperimentConstants.PROJECT_ID)) {
-// query += "e." + field + "= '" + filterVal + "' AND ";
-// } else {
-// if (filterVal.contains("*")) {
-// filterVal = filterVal.replaceAll("\\*", "");
-// }
-// query += "e." + field + " LIKE '%" + filterVal + "%' AND ";
-// }
-// }
-// }
-// query = query.substring(0, query.length() - 5);
-//
-// //ordering
-// if (orderByIdentifier != null && resultOrderType != null
-// && orderByIdentifier.equals(Constants.FieldConstants.ExperimentConstants.CREATION_TIME)) {
-// String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
-// query += " ORDER BY e." + ExperimentConstants.CREATION_TIME + " " + order;
-// }
-//
-// em = ExpCatResourceUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-//
-// //pagination
-// if (offset >= 0 && limit >= 0) {
-// q = em.createQuery(query).setFirstResult(offset).setMaxResults(limit);
-// } else {
-// q = em.createQuery(query);
-// }
-// OpenJPAQuery kq = OpenJPAPersistence.cast(q);
-// JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
-// fetch.setEagerFetchMode(FetchMode.JOIN);
-//
-// List resultList = q.getResultList();
-// for (Object o : resultList) {
-// Experiment experiment = (Experiment) ((Object[]) o)[0];
-// Status experimentStatus = (Status) ((Object[]) o)[1];
-// experiment.setExperimentStatus(experimentStatus);
-// ExperimentSummaryResource experimentSummaryResource =
-// (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY, experiment);
-// result.add(experimentSummaryResource);
-// }
-// em.getTransaction().commit();
-// em.close();
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new RegistryException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// return result;
- throw new NotImplementedException();
- }
+ List<ExperimentSummaryResource> result = new ArrayList();
+ EntityManager em = null;
+ try {
+ String query = "SELECT e FROM ExperimentSummary e " +
+ "WHERE e.expId=s.expId AND ";
+ if (filters.get(ExperimentStatusConstants.STATE) != null) {
+ String experimentState = ExperimentState.valueOf(filters.get(ExperimentStatusConstants.STATE)).toString();
+ query += "e.state='" + experimentState + "' AND ";
+ }
+
+ if (toTime != null && fromTime != null && toTime.after(fromTime)) {
+ query += "e.creationTime > '" + fromTime + "' " + "AND e.creationTime <'" + toTime + "' AND ";
+ }
+
+ filters.remove(ExperimentStatusConstants.STATE);
+ if (filters != null && filters.size() != 0) {
+ for (String field : filters.keySet()) {
+ String filterVal = filters.get(field);
+ if (field.equals(ExperimentConstants.USER_NAME)) {
+ query += "e." + field + "= '" + filterVal + "' AND ";
+ } else if (field.equals(ExperimentConstants.GATEWAY_ID)) {
+ query += "e." + field + "= '" + filterVal + "' AND ";
+ } else if (field.equals(ExperimentConstants.PROJECT_ID)) {
+ query += "e." + field + "= '" + filterVal + "' AND ";
+ } else {
+ if (filterVal.contains("*")) {
+ filterVal = filterVal.replaceAll("\\*", "");
+ }
+ query += "e." + field + " LIKE '%" + filterVal + "%' AND ";
+ }
+ }
+ }
+ query = query.substring(0, query.length() - 5);
+
+ //ordering
+ if (orderByIdentifier != null && resultOrderType != null
+ && orderByIdentifier.equals(Constants.FieldConstants.ExperimentConstants.CREATION_TIME)) {
+ String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
+ query += " ORDER BY e." + ExperimentConstants.CREATION_TIME + " " + order;
+ }
+
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ //pagination
+ if (offset >= 0 && limit >= 0) {
+ q = em.createQuery(query).setFirstResult(offset).setMaxResults(limit);
+ } else {
+ q = em.createQuery(query);
+ }
+
+ List resultList = q.getResultList();
+ for (Object o : resultList) {
+ ExperimentSummary experimentSummary = (ExperimentSummary) o;
+ ExperimentSummaryResource experimentSummaryResource =
+ (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY,
+ experimentSummary);
+ result.add(experimentSummaryResource);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return result;
+ }
/**
* Method to get experiment statistics for a gateway
@@ -712,48 +698,42 @@ public class WorkerResource extends AbstractExpCatResource {
private List<ExperimentSummaryResource> getExperimentStatisticsForState(
ExperimentState expState, String gatewayId, Timestamp fromTime, Timestamp toTime) throws RegistryException {
-// EntityManager em = null;
-// List<ExperimentSummaryResource> result = new ArrayList();
-// try {
-// String query = "SELECT e, s FROM Experiment e " +
-// ",Status s WHERE e.expId=s.expId AND " +
-// "s.statusType='" + StatusType.EXPERIMENT + "' AND ";
-// if (expState != null) {
-// query += "s.state='" + expState.toString() + "' AND ";
-// }
-// query += "e.creationTime > '" + fromTime + "' " + "AND e.creationTime <'" + toTime + "' AND ";
-// query += "e." + ExperimentConstants.GATEWAY_ID + "= '" + gatewayId + "'";
-//
-// em = ExpCatResourceUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q = em.createQuery(query);
-// OpenJPAQuery kq = OpenJPAPersistence.cast(q);
-// JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
-// fetch.setEagerFetchMode(FetchMode.JOIN);
-//
-// List resultList = q.getResultList();
-// for (Object o : resultList) {
-// Experiment experiment = (Experiment) ((Object[]) o)[0];
-// Status experimentStatus = (Status) ((Object[]) o)[1];
-// experiment.setExperimentStatus(experimentStatus);
-// ExperimentSummaryResource experimentSummaryResource =
-// (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY, experiment);
-// result.add(experimentSummaryResource);
-// }
-// em.getTransaction().commit();
-// em.close();
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new RegistryException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// return result;
- throw new NotImplementedException();
+ EntityManager em = null;
+ List<ExperimentSummaryResource> result = new ArrayList();
+ try {
+ String query = "SELECT e FROM ExperimentSummary e " +
+ "WHERE e.expId=s.expId AND ";
+ if (expState != null) {
+ query += "e.state='" + expState.toString() + "' AND ";
+ }
+ query += "e.creationTime > '" + fromTime + "' " + "AND e.creationTime <'" + toTime + "' AND ";
+ query += "e." + ExperimentConstants.GATEWAY_ID + "= '" + gatewayId + "'";
+
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q = em.createQuery(query);
+
+ List resultList = q.getResultList();
+ for (Object o : resultList) {
+ ExperimentSummary experimentSummary = (ExperimentSummary) o;
+ ExperimentSummaryResource experimentSummaryResource =
+ (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY,
+ experimentSummary);
+ result.add(experimentSummaryResource);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return result;
}
}
[3/3] airavata git commit: Adding TaskResource test class,
fixing compilation issues in other test classes
Posted by sc...@apache.org.
Adding TaskResource test class, fixing compilation issues in other test classes
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/0a90a404
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/0a90a404
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/0a90a404
Branch: refs/heads/master
Commit: 0a90a404c6e813810c12d3f5303d9d8d257bb4d4
Parents: 65afe6f
Author: Supun Nakandala <sc...@apache.org>
Authored: Mon Jun 22 19:12:00 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Mon Jun 22 19:12:00 2015 +0530
----------------------------------------------------------------------
.../catalog/resources/TaskResource.java | 5 +-
.../src/main/resources/expcatalog-derby.sql | 1 -
.../src/main/resources/expcatalog-mysql.sql | 1 -
.../catalog/ExperimentInputResourceTest.java | 1 -
.../catalog/ExperimentOutputResourceTest.java | 1 -
.../catalog/ExperimentResourceTest.java | 1 -
.../experiment/catalog/GatewayResourceTest.java | 1 -
.../experiment/catalog/TaskResourceTest.java | 94 ++++++++++++++++++++
.../catalog/UserConfigurationDataTest.java | 1 -
.../src/test/resources/expcatalog-derby.sql | 1 -
10 files changed, 95 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/TaskResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/TaskResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/TaskResource.java
index 5193943..e620278 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/TaskResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/TaskResource.java
@@ -274,11 +274,8 @@ public class TaskResource extends AbstractExpCatResource {
EntityManager em = null;
try {
em = ExpCatResourceUtils.getEntityManager();
- Task task = em.find(Task.class, taskId);
- em.close();
-
- em = ExpCatResourceUtils.getEntityManager();
em.getTransaction().begin();
+ Task task = em.find(Task.class, taskId);
if(task == null){
task = new Task();
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql b/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql
index 6e1174d..3156aa2 100644
--- a/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql
+++ b/modules/registry/registry-core/src/main/resources/expcatalog-derby.sql
@@ -70,7 +70,6 @@ CREATE TABLE EXPERIMENT (
PROJECT_ID varchar(255),
EXPERIMENT_TYPE varchar(255),
USER_NAME varchar(255),
- APPLICATION_ID varchar(255),
EXPERIMENT_NAME varchar(255),
CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
DESCRIPTION varchar(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
index e15c79c..39b9aeb 100644
--- a/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
@@ -70,7 +70,6 @@ CREATE TABLE EXPERIMENT (
PROJECT_ID varchar(255),
EXPERIMENT_TYPE varchar(255),
USER_NAME varchar(255),
- APPLICATION_ID varchar(255),
EXPERIMENT_NAME varchar(255),
CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
DESCRIPTION varchar(255),
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
index 9b11921..0ebaecb 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
@@ -45,7 +45,6 @@ public class ExperimentInputResourceTest extends AbstractResourceTest {
experimentResource.setUserName(getWorkerResource().getUser());
experimentResource.setProjectId(getProjectResource().getId());
experimentResource.setCreationTime(getCurrentTimestamp());
- experimentResource.setApplicationId("testApplication");
experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
experimentResource.setExperimentName("TestExperiment");
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
index 1aea3bd..937c7d8 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
@@ -45,7 +45,6 @@ public class ExperimentOutputResourceTest extends AbstractResourceTest {
experimentResource.setUserName(getWorkerResource().getUser());
experimentResource.setProjectId(getProjectResource().getId());
experimentResource.setCreationTime(getCurrentTimestamp());
- experimentResource.setApplicationId("testApplication");
experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
experimentResource.setExperimentName("TestExperiment");
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
index e90883f..06f8699 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
@@ -44,7 +44,6 @@ public class ExperimentResourceTest extends AbstractResourceTest {
experimentResource.setProjectId(getProjectResource().getId());
Timestamp currentDate = new Timestamp(new Date().getTime());
experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
experimentResource.setExperimentName("TestExperiment");
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
index b88d561..12343d6 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
@@ -65,7 +65,6 @@ public class GatewayResourceTest extends AbstractResourceTest {
experimentResource.setUserName(getWorkerResource().getUser());
experimentResource.setProjectId(getProjectResource().getId());
experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
experimentResource.setExperimentName("TestExperiment");
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskResourceTest.java
new file mode 100644
index 0000000..8ff32eb
--- /dev/null
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskResourceTest.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.airavata.experiment.catalog;
+
+import org.apache.airavata.model.task.TaskTypes;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.ProcessResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.TaskResource;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import static org.junit.Assert.*;
+
+public class TaskResourceTest extends AbstractResourceTest{
+
+ private ExperimentResource experimentResource;
+ private ProcessResource processResource;
+ private TaskResource taskResource;
+ private String experimentID = "testExpID";
+ private String processId = "processID";
+ private String taskId = "taskID";
+
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ Timestamp creationTime = new Timestamp(new Date().getTime());
+
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExperimentId(experimentID);
+ experimentResource.setExperimentName(experimentID);
+ experimentResource.setUserName(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ experimentResource.setCreationTime(creationTime);
+ experimentResource.save();
+
+ processResource = (ProcessResource)experimentResource.create(ResourceType.PROCESS);
+ processResource.setProcessId(processId);
+ processResource.setExperimentId(experimentID);
+ processResource.setCreationTime(creationTime);
+ processResource.save();
+
+ taskResource = (TaskResource)processResource.create(ResourceType.TASK);
+ taskResource.setTaskId(taskId);
+ taskResource.setParentProcessId(processId);
+ taskResource.setTaskType(TaskTypes.DATA_STAGING.toString());
+ taskResource.setTaskDetail("task detail");
+ taskResource.setTaskInternalStore((byte)2);
+ taskResource.save();
+ }
+
+
+ @Test
+ public void testCreate() throws Exception {
+ assertNotNull("task data resource has being created ", taskResource);
+ }
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("task save successfully", processResource.isExists(ResourceType.TASK, taskId));
+ }
+
+ @Test
+ public void testGet() throws Exception {
+ assertNotNull("task data retrieved successfully", processResource.get(ResourceType.TASK, taskId));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+ processResource.remove(ResourceType.TASK, taskId);
+ assertFalse("task data removed successfully", processResource.isExists(ResourceType.TASK, taskId));
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java
index 2975e95..6387aa8 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserConfigurationDataTest.java
@@ -49,7 +49,6 @@ public class UserConfigurationDataTest extends AbstractResourceTest {
experimentResource.setProjectId(getProjectResource().getId());
Timestamp currentDate = new Timestamp(new Date().getTime());
experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
experimentResource.setExecutionId("1.0");
experimentResource.setDescription("Test Application");
experimentResource.setExperimentName("TestExperiment");
http://git-wip-us.apache.org/repos/asf/airavata/blob/0a90a404/modules/registry/registry-core/src/test/resources/expcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/resources/expcatalog-derby.sql b/modules/registry/registry-core/src/test/resources/expcatalog-derby.sql
index 6e1174d..3156aa2 100644
--- a/modules/registry/registry-core/src/test/resources/expcatalog-derby.sql
+++ b/modules/registry/registry-core/src/test/resources/expcatalog-derby.sql
@@ -70,7 +70,6 @@ CREATE TABLE EXPERIMENT (
PROJECT_ID varchar(255),
EXPERIMENT_TYPE varchar(255),
USER_NAME varchar(255),
- APPLICATION_ID varchar(255),
EXPERIMENT_NAME varchar(255),
CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
DESCRIPTION varchar(255),
[2/3] airavata git commit: Fixing compilation issues in registry-core
module
Posted by sc...@apache.org.
Fixing compilation issues in registry-core module
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/65afe6f1
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/65afe6f1
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/65afe6f1
Branch: refs/heads/master
Commit: 65afe6f1c2da1c9e1cb084bbe0572cc9f3521b9b
Parents: 8d6ba82
Author: Supun Nakandala <sc...@apache.org>
Authored: Mon Jun 22 18:50:46 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Mon Jun 22 18:50:46 2015 +0530
----------------------------------------------------------------------
.../registry/core/experiment/catalog/impl/ExperimentRegistry.java | 3 +++
.../registry/core/experiment/catalog/resources/Utils.java | 1 -
.../core/experiment/catalog/utils/ThriftDataModelConversion.java | 1 -
3 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/65afe6f1/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
index a855808..ca3f56b 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
@@ -958,6 +958,9 @@ public class ExperimentRegistry {
return null;
}
+ public Object getTaskStatus(String identifier) {
+ return null;
+ }
public List<ExperimentModel> getExperimentList(String fieldName, Object value) throws RegistryException {
List<ExperimentModel> experiments = new ArrayList<ExperimentModel>();
http://git-wip-us.apache.org/repos/asf/airavata/blob/65afe6f1/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
index c7d2873..442e908 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/Utils.java
@@ -402,7 +402,6 @@ public class Utils {
experimentResource.setProjectId(o.getProjectId());
experimentResource.setExperimentType(o.getExperimentType());
experimentResource.setUserName(o.getUserName());
- experimentResource.setApplicationId(o.getApplicationId());
experimentResource.setExperimentName(o.getExperimentName());
experimentResource.setCreationTime(o.getCreationTime());
experimentResource.setDescription(o.getDescription());
http://git-wip-us.apache.org/repos/asf/airavata/blob/65afe6f1/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java
index 5dae874..3e2fab9 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/utils/ThriftDataModelConversion.java
@@ -114,7 +114,6 @@ public class ThriftDataModelConversion {
experiment.setUserName(experimentResource.getUserName());
experiment.setExperimentName(experimentResource.getExperimentName());
experiment.setDescription(experimentResource.getDescription());
- experiment.setExecutionId(experimentResource.getApplicationId());
experiment.setEnableEmailNotification(experimentResource.getEnableEmailNotification());
experiment.setGatewayExecutionId(experimentResource.getGatewayExecutionId());
if (experiment.isEnableEmailNotification()){