airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adham...@apache.org
Subject [7/7] airavata git commit: Adding test for task implementation reflection
Date Wed, 10 May 2017 16:13:16 GMT
Adding test for task implementation reflection


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

Branch: refs/heads/feature-workload-mgmt
Commit: 2defa8f1d85fbbaa015519d438d518953b6bb664
Parents: 7341de2
Author: Ajinkya Dhamnaskar <adhamnas@apache.org>
Authored: Wed May 10 12:12:57 2017 -0400
Committer: Ajinkya Dhamnaskar <adhamnas@apache.org>
Committed: Wed May 10 12:12:57 2017 -0400

----------------------------------------------------------------------
 .../src/test/java/TestWorkerMessaging.java      | 38 ++++++++++++++++----
 1 file changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2defa8f1/modules/worker/worker-messaging/src/test/java/TestWorkerMessaging.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-messaging/src/test/java/TestWorkerMessaging.java b/modules/worker/worker-messaging/src/test/java/TestWorkerMessaging.java
index b353ce7..d61f34d 100644
--- a/modules/worker/worker-messaging/src/test/java/TestWorkerMessaging.java
+++ b/modules/worker/worker-messaging/src/test/java/TestWorkerMessaging.java
@@ -1,6 +1,13 @@
 import org.apache.airavata.common.exception.AiravataException;
 import org.apache.airavata.model.task.TaskTypes;
+import org.apache.airavata.worker.core.exceptions.WorkerException;
+import org.apache.airavata.worker.core.task.Task;
+import org.apache.airavata.worker.core.utils.WorkerFactory;
 import org.apache.airavata.worker.messaging.utils.WorkerMessagingFactory;
+import org.apache.airavata.worker.task.datastaging.impl.DataStageTask;
+import org.apache.airavata.worker.task.datastaging.utils.DataStagingFactory;
+import org.apache.airavata.worker.task.envsetup.impl.EnvironmentSetupTask;
+import org.apache.airavata.worker.task.jobsubmission.impl.DefaultJobSubmissionTask;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -12,17 +19,36 @@ import java.util.List;
  */
 public class TestWorkerMessaging {
 
+//    @Test
+//    public void testSubscriberCreation(){
+//        List<String> tasks = new ArrayList<String>(){{add(TaskTypes.ENV_SETUP.toString());add(TaskTypes.DATA_STAGING.toString());}};
+//        try {
+//
+//            WorkerMessagingFactory.createSubscribers(tasks);
+//            Assert.assertEquals(WorkerMessagingFactory.getSubscriberMap().size(), tasks.size());
+//
+//        } catch (AiravataException e) {
+//            Assert.fail("Fail to start subscribers.", e);
+//        }
+//    }
+
     @Test
-    public void testSubscriberCreation(){
-        List<String> tasks = new ArrayList<String>(){{add(TaskTypes.ENV_SETUP.toString());add(TaskTypes.DATA_STAGING.toString());}};
+    public void testTaskImplementationFactory(){
+
         try {
+            WorkerMessagingFactory.loadConfiguration();
+            Task task = WorkerMessagingFactory.getTaskImplementation(TaskTypes.ENV_SETUP);
+            Assert.assertEquals(task instanceof EnvironmentSetupTask, true);
 
-            WorkerMessagingFactory.createSubscribers(tasks);
-            Assert.assertEquals(WorkerMessagingFactory.getSubscriberMap().size(), tasks.size());
+            task = WorkerMessagingFactory.getTaskImplementation(TaskTypes.DATA_STAGING);
+            Assert.assertEquals(task instanceof DataStageTask, true);
 
-        } catch (AiravataException e) {
-            Assert.fail("Fail to start subscribers.", e);
+            task = WorkerMessagingFactory.getTaskImplementation(TaskTypes.JOB_SUBMISSION);
+            Assert.assertEquals(task instanceof DefaultJobSubmissionTask, true);
+        } catch (WorkerException e) {
+            Assert.fail("Failed to load worker configuration.", e);
         }
+
     }
 
 }


Mime
View raw message