Przeglądaj źródła

HUE-6819 [oozie] Add test to validate graph with multiple generic actions

krish 8 lat temu
rodzic
commit
2df69de709
1 zmienionych plików z 42 dodań i 0 usunięć
  1. 42 0
      apps/oozie/src/oozie/models2_tests.py

+ 42 - 0
apps/oozie/src/oozie/models2_tests.py

@@ -1189,6 +1189,48 @@ class TestExternalWorkflowGraph(object):
     assert_equal(workflow_data['layout'][0]['rows'][1]['widgets'][0]['widgetType'], 'generic-widget')
     assert_true(len(workflow_data['workflow']['nodes'][1]['children']) == 2)
 
+  def test_gen_workflow_data_for_xml_with_multiple_generic_nodes(self):
+    self.wf.definition = """<workflow-app name="Test" xmlns="uri:oozie:workflow:0.5" xmlns:sla="uri:oozie:sla:0.2">
+        <start to="email-1"/>
+        <kill name="Kill">
+            <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
+        </kill>
+        <action name="email-1">
+            <generic_action xmlns="uri:oozie:email-action:0.2">
+                <to>test</to>
+                <subject>test</subject>
+                <body>test</body>
+                <content_type>text/plain</content_type>
+            </generic_action>
+            <ok to="email-2"/>
+            <error to="Kill"/>
+              <sla:info>
+                <sla:nominal-time>${nominal_time}</sla:nominal-time>
+                <sla:should-start>10</sla:should-start>
+                <sla:should-end>${30 * MINUTES}</sla:should-end>
+              </sla:info>
+        </action>
+        <action name="email-2">
+            <generic_action2 xmlns="uri:oozie:email-action:0.2">
+                <to>test</to>
+                <subject>test</subject>
+                <body>test</body>
+                <content_type>text/plain</content_type>
+            </generic_action2>
+            <ok to="End"/>
+            <error to="Kill"/>
+        </action>
+        <end name="End"/>
+    </workflow-app>
+    """
+
+    workflow_data = Workflow.gen_workflow_data_from_xml(self.user, self.wf)
+
+    assert_true(len(workflow_data['layout'][0]['rows']) == 5)
+    assert_true(len(workflow_data['workflow']['nodes']) == 5)
+    assert_equal(workflow_data['layout'][0]['rows'][1]['widgets'][0]['widgetType'], 'generic-widget')
+    assert_true(len(workflow_data['workflow']['nodes'][1]['children']) == 2)
+
 class TestModelAPI(OozieMockBase):
 
   def setUp(self):