'Validates import for sqoop node: script_path, files.'

def test_import_workflow_sqoop(self):

    workflow = Workflow.objects.new_workflow(self.user)
    workflow.save()
    f = open('apps/oozie/src/oozie/test_data/workflows/0.4/test-sqoop.0.2.xml')
    import_workflow(workflow, f.read())
    f.close()
    workflow.save()
    assert_equal(4, len(Node.objects.filter(workflow=workflow)))
    assert_equal(4, len(Link.objects.filter(parent__workflow=workflow)))
    node = Node.objects.get(workflow=workflow, node_type='sqoop').get_full_node()
    assert_equal('["db.hsqldb.properties#db.hsqldb.properties","db.hsqldb.script#db.hsqldb.script"]', node.files)
    assert_equal('import    --connect    jdbc:hsqldb:file:db.hsqldb    --table    TT    --target-dir    ${output}    -m    1', node.script_path)
    assert_equal('[{"type":"arg","value":"My    invalid    arg"},{"type":"arg","value":"My    invalid    arg    2"}]', node.params)
    workflow.delete(skip_trash=True)
