helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject [22/33] helix git commit: Add unit test to retrieve workflow and job configurations.
Date Wed, 17 Aug 2016 04:27:18 GMT
Add unit test to retrieve workflow and job configurations.


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

Branch: refs/heads/helix-0.6.x
Commit: 4f7fe1306431210ee681a9eae64687f788f46bb3
Parents: 7f18483
Author: Lei Xia <lxia@linkedin.com>
Authored: Tue Apr 19 13:40:29 2016 -0700
Committer: Lei Xia <lxia@linkedin.com>
Committed: Tue Jul 5 16:17:03 2016 -0700

----------------------------------------------------------------------
 .../integration/task/TestRetrieveWorkflows.java | 75 ++++++++++++++++++++
 1 file changed, 75 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/4f7fe130/helix-core/src/test/java/org/apache/helix/integration/task/TestRetrieveWorkflows.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/task/TestRetrieveWorkflows.java
b/helix-core/src/test/java/org/apache/helix/integration/task/TestRetrieveWorkflows.java
new file mode 100644
index 0000000..786be7c
--- /dev/null
+++ b/helix-core/src/test/java/org/apache/helix/integration/task/TestRetrieveWorkflows.java
@@ -0,0 +1,75 @@
+package org.apache.helix.integration.task;
+
+/*
+ * 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.
+ */
+import org.apache.helix.HelixManagerFactory;
+import org.apache.helix.InstanceType;
+import org.apache.helix.TestHelper;
+import org.apache.helix.manager.zk.ZkClient;
+import org.apache.helix.task.JobConfig;
+import org.apache.helix.task.JobContext;
+import org.apache.helix.task.TaskDriver;
+import org.apache.helix.task.Workflow;
+import org.apache.helix.task.WorkflowConfig;
+import org.apache.helix.task.WorkflowContext;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class TestRetrieveWorkflows extends TaskTestBase {
+  @Test
+  public void testGetAllWorkflows() throws Exception {
+    List<Workflow> workflowList = new ArrayList<Workflow>();
+    for (int i = 0; i < 4; i++) {
+      Workflow workflow = WorkflowGenerator.generateDefaultRepeatedJobWorkflowBuilder(TestHelper.getTestMethodName()
+ i).build();
+      _driver.start(workflow);
+      workflowList.add(workflow);
+    }
+
+    for (Workflow workflow : workflowList) {
+      //TaskTestUtil.pollForWorkflowState(_driver, workflow.getName(), TaskState.COMPLETED);
+    }
+
+    _manager = HelixManagerFactory
+        .getZKHelixManager("ESPRESSO_TEST_NUAGE", "Admin", InstanceType.ADMINISTRATOR, "zk-ei1-espresso.stg.linkedin.com:12913");
+    _manager.connect();
+    TaskDriver taskDriver = new TaskDriver(_manager);
+
+    Map<String, WorkflowConfig> workflowConfigMap = taskDriver.getWorkflows();
+    Assert.assertEquals(workflowConfigMap.size(), workflowList.size());
+
+    for(Map.Entry<String, WorkflowConfig> workflow :  workflowConfigMap.entrySet())
{
+      WorkflowConfig workflowConfig = workflow.getValue();
+      WorkflowContext workflowContext = _driver.getWorkflowContext(workflow.getKey());
+      Assert.assertNotNull(workflowContext);
+
+      for(String job : workflowConfig.getJobDag().getAllNodes()) {
+        JobConfig jobConfig = _driver.getJobConfig(job);
+        JobContext jobContext = _driver.getJobContext(job);
+
+        Assert.assertNotNull(jobConfig);
+        Assert.assertNotNull(jobContext);
+      }
+    }
+  }
+}
+


Mime
View raw message