helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject [23/33] helix git commit: Add unit tests to retrieve all workflows and job info from a cluster.
Date Wed, 17 Aug 2016 04:27:19 GMT
Add unit tests to retrieve all workflows and job info from a cluster.


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

Branch: refs/heads/helix-0.6.x
Commit: 2efa4485145ddfc8533c66c3e67077afe3a1ae9c
Parents: 4f7fe13
Author: Lei Xia <lxia@linkedin.com>
Authored: Thu Apr 21 10:58:49 2016 -0700
Committer: Lei Xia <lxia@linkedin.com>
Committed: Tue Jul 5 16:17:13 2016 -0700

----------------------------------------------------------------------
 .../integration/task/TestRetrieveWorkflows.java | 26 +++++++-------------
 1 file changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/2efa4485/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
index 786be7c..ddd6c85 100644
--- 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
@@ -18,13 +18,10 @@ package org.apache.helix.integration.task;
  * 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.TaskState;
 import org.apache.helix.task.Workflow;
 import org.apache.helix.task.WorkflowConfig;
 import org.apache.helix.task.WorkflowContext;
@@ -36,33 +33,28 @@ import java.util.List;
 import java.util.Map;
 
 public class TestRetrieveWorkflows extends TaskTestBase {
-  @Test
-  public void testGetAllWorkflows() throws Exception {
+  @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();
+    for (int i = 0; i < 2; 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);
+      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();
+    Map<String, WorkflowConfig> workflowConfigMap = _driver.getWorkflows();
     Assert.assertEquals(workflowConfigMap.size(), workflowList.size());
 
-    for(Map.Entry<String, WorkflowConfig> workflow :  workflowConfigMap.entrySet())
{
+    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()) {
+      for (String job : workflowConfig.getJobDag().getAllNodes()) {
         JobConfig jobConfig = _driver.getJobConfig(job);
         JobContext jobContext = _driver.getJobContext(job);
 


Mime
View raw message