You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2018/06/11 15:23:29 UTC

[airavata] branch group-based-auth updated: AIRAVATA-2820 Fix mapping of SUB_TASK_MODEL

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch group-based-auth
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/group-based-auth by this push:
     new c2c86a3  AIRAVATA-2820 Fix mapping of SUB_TASK_MODEL
c2c86a3 is described below

commit c2c86a3e1305f18c1fcc73cefb567ee102705d0f
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Jun 11 11:22:22 2018 -0400

    AIRAVATA-2820 Fix mapping of SUB_TASK_MODEL
    
    Also removed TASK_INTERNAL_STORE column since it isn't used nor does it
    correspond to a data model field.
---
 .../registry/core/entities/expcatalog/TaskEntity.java  | 18 +++---------------
 .../src/main/resources/expcatalog-derby.sql            |  2 +-
 .../src/main/resources/expcatalog-mysql.sql            |  2 +-
 .../repositories/expcatalog/TaskRepositoryTest.java    | 12 ++++++++----
 .../DeltaScripts/experimentCatalog_schema_delta.sql    |  3 +++
 5 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskEntity.java
index d1eee78..289abac 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskEntity.java
@@ -24,7 +24,6 @@ import org.apache.airavata.model.task.TaskTypes;
 
 import javax.persistence.*;
 import java.io.Serializable;
-import java.nio.ByteBuffer;
 import java.sql.Timestamp;
 import java.util.List;
 
@@ -57,12 +56,9 @@ public class TaskEntity implements Serializable {
     @Column(name = "TASK_DETAIL")
     private String taskDetail;
 
-    @Column(name = "TASK_INTERNAL_STORE")
-    private ByteBuffer taskInternalStore;
-
     @Lob
     @Column(name = "SUB_TASK_MODEL")
-    private ByteBuffer subTaskModel;
+    private byte[] subTaskModel;
 
     @OneToMany(targetEntity = TaskStatusEntity.class, cascade = CascadeType.ALL,
             mappedBy = "task", fetch = FetchType.EAGER)
@@ -131,19 +127,11 @@ public class TaskEntity implements Serializable {
         this.taskDetail = taskDetail;
     }
 
-    public ByteBuffer getTaskInternalStore() {
-        return taskInternalStore;
-    }
-
-    public void setTaskInternalStore(ByteBuffer taskInternalStore) {
-        this.taskInternalStore = taskInternalStore;
-    }
-
-    public ByteBuffer getSubTaskModel() {
+    public byte[] getSubTaskModel() {
         return subTaskModel;
     }
 
-    public void setSubTaskModel(ByteBuffer subTaskModel) {
+    public void setSubTaskModel(byte[] subTaskModel) {
         this.subTaskModel = subTaskModel;
     }
 
diff --git a/modules/registry-refactoring/src/main/resources/expcatalog-derby.sql b/modules/registry-refactoring/src/main/resources/expcatalog-derby.sql
index 06efd1a..042c66e 100644
--- a/modules/registry-refactoring/src/main/resources/expcatalog-derby.sql
+++ b/modules/registry-refactoring/src/main/resources/expcatalog-derby.sql
@@ -321,7 +321,7 @@ CREATE TABLE TASK (
         CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
         LAST_UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
         TASK_DETAIL CLOB,
-        TASK_INTERNAL_STORE CHAR,
+        SUB_TASK_MODEL BLOB,
         PRIMARY KEY (TASK_ID),
         FOREIGN KEY (PARENT_PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE
 );
diff --git a/modules/registry-refactoring/src/main/resources/expcatalog-mysql.sql b/modules/registry-refactoring/src/main/resources/expcatalog-mysql.sql
index 3a316a2..29952e5 100644
--- a/modules/registry-refactoring/src/main/resources/expcatalog-mysql.sql
+++ b/modules/registry-refactoring/src/main/resources/expcatalog-mysql.sql
@@ -324,7 +324,7 @@ CREATE TABLE TASK (
         CREATION_TIME timestamp DEFAULT NOW(),
         LAST_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
         TASK_DETAIL text,
-        TASK_INTERNAL_STORE tinyint(4),
+        SUB_TASK_MODEL BLOB,
         PRIMARY KEY (TASK_ID),
         FOREIGN KEY (PARENT_PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE
 );
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskRepositoryTest.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskRepositoryTest.java
index 9ad51ca..8b8d746 100644
--- a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskRepositoryTest.java
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskRepositoryTest.java
@@ -36,10 +36,10 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.nio.charset.StandardCharsets;
 import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+
+import static org.junit.Assert.*;
 
 public class TaskRepositoryTest {
 
@@ -102,6 +102,7 @@ public class TaskRepositoryTest {
         TaskModel taskModel = new TaskModel();
         taskModel.setTaskType(TaskTypes.JOB_SUBMISSION);
         taskModel.setParentProcessId(processId);
+        taskModel.setSubTaskModel("subtask model".getBytes(StandardCharsets.UTF_8));
 
         String taskId = taskRepository.addTask(taskModel, processId);
         assertTrue(taskId != null);
@@ -109,7 +110,10 @@ public class TaskRepositoryTest {
 
         taskModel.setTaskType(TaskTypes.MONITORING);
         taskRepository.updateTask(taskModel, taskId);
-        assertEquals(TaskTypes.MONITORING, taskRepository.getTask(taskId).getTaskType());
+        final TaskModel retrievedTask = taskRepository.getTask(taskId);
+        assertEquals(TaskTypes.MONITORING, retrievedTask.getTaskType());
+        assertArrayEquals("subtask model".getBytes(StandardCharsets.UTF_8), retrievedTask.getSubTaskModel());
+
 
         List<String> taskIdList = taskRepository.getTaskIds(DBConstants.Task.PARENT_PROCESS_ID, processId);
         assertTrue(taskIdList.size() == 1);
diff --git a/modules/registry/release-migration-scripts/next/DeltaScripts/experimentCatalog_schema_delta.sql b/modules/registry/release-migration-scripts/next/DeltaScripts/experimentCatalog_schema_delta.sql
index 95edeef..f70fdd2 100644
--- a/modules/registry/release-migration-scripts/next/DeltaScripts/experimentCatalog_schema_delta.sql
+++ b/modules/registry/release-migration-scripts/next/DeltaScripts/experimentCatalog_schema_delta.sql
@@ -20,3 +20,6 @@
 
 -- AIRAVATA-2768
 alter table EXPERIMENT_INPUT modify METADATA VARCHAR(4096);
+
+-- AIRAVATA-2820
+alter table TASK drop column TASK_INTERNAL_STORE;
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.