'Validates import for java node: main_class, args.'

def test_import_workflow_java(self):

    workflow = Workflow.objects.new_workflow(self.user)
    workflow.save()
    f = open('apps/oozie/src/oozie/test_data/workflows/0.4/test-java.xml')
    import_workflow(workflow, f.read())
    f.close()
    workflow.save()
    assert_equal(5, len(Node.objects.filter(workflow=workflow)))
    assert_equal(6, len(Link.objects.filter(parent__workflow=workflow)))
    java_nodes = Node.objects.filter(workflow=workflow, node_type='java').order_by('name')
    tera_gen_node = java_nodes[0].get_full_node()
    tera_sort_node = java_nodes[1].get_full_node()
    assert_equal('org.apache.hadoop.examples.terasort.TeraGen', tera_gen_node.main_class)
    assert_equal('${records}    ${output_dir}/teragen', tera_gen_node.args)
    assert_equal('org.apache.hadoop.examples.terasort.TeraSort', tera_sort_node.main_class)
    assert_equal('-Dmapred.reduce.tasks=${terasort_reducers}    ${output_dir}/teragen    ${output_dir}/terasort', tera_sort_node.args)
    assert_true(tera_gen_node.capture_output)
    assert_false(tera_sort_node.capture_output)
    workflow.delete(skip_trash=True)
