Search in sources :

Example 36 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.Document in project mule-migration-assistant by mulesoft.

the class ScriptingModuleMigrationTest method executeScriptWithParams.

@Test
public void executeScriptWithParams() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(SCRIPTING_SAMPLE_PATH.toString()).toURI().getPath());
    node = getElementsFromDocument(doc, scriptingModuleMigration.getAppliedTo().getExpression()).get(0);
    scriptingModuleMigration.execute(node, report.getReport());
    assertThat("The name didn't change.", node.getName(), equalTo("execute"));
    assertThat("The attributes weren't moved..", node.getChildren().get(1).getName(), equalTo("parameters"));
}
Also used : Document(org.jdom2.Document) DocumentHelper.getDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getDocument) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument) Test(org.junit.Test)

Example 37 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.Document in project mule-migration-assistant by mulesoft.

the class AssertNotEqualsTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(MUNIT_SAMPLE_PATH.toString()).toURI().getPath());
    node = getElementsFromDocument(doc, assertNotEquals.getAppliedTo().getExpression()).get(0);
    assertNotEquals.execute(node, report.getReport());
    assertThat("The node didn't change", node.getName(), is("assert-that"));
    assertThat("The attribute didn't change", node.getAttribute("is").getValue(), is("#[MunitTools::not(MUnitTools::equalTo(2))]"));
}
Also used : Document(org.jdom2.Document) DocumentHelper.getDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getDocument) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument) Test(org.junit.Test)

Example 38 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.Document in project mule-migration-assistant by mulesoft.

the class AssertPayloadTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(MUNIT_SAMPLE_PATH.toString()).toURI().getPath());
    node = getElementsFromDocument(doc, assertPayloadEquals.getAppliedTo().getExpression()).get(0);
    assertPayloadEquals.execute(node, report.getReport());
    assertThat("The node didn't change", node.getName(), is("assert-that"));
    assertThat("The attribute didn't change", node.getAttribute("expression").getValue(), is("#[payload]"));
    assertThat("The attribute didn't change", node.getAttribute("is").getValue(), is("#[MunitTools::equalTo(2)]"));
}
Also used : Document(org.jdom2.Document) DocumentHelper.getDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getDocument) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument) Test(org.junit.Test)

Example 39 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.Document in project mule-migration-assistant by mulesoft.

the class AssertTrueTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(MUNIT_SAMPLE_PATH.toString()).toURI().getPath());
    node = getElementsFromDocument(doc, assertTrue.getAppliedTo().getExpression()).get(0);
    assertTrue.execute(node, report.getReport());
    assertThat("The node didn't change", node.getName(), is("assert-that"));
    assertThat("The attribute didn't change", node.getAttribute("is"), is(notNullValue()));
    assertThat("The attribute didn't change", node.getAttribute("is").getValue(), is("#[MunitTools::equalTo(true)]"));
}
Also used : Document(org.jdom2.Document) DocumentHelper.getDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getDocument) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument) Test(org.junit.Test)

Example 40 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.Document in project mule-migration-assistant by mulesoft.

the class MUnitTestTest method validateTestStructure.

@Test
public void validateTestStructure() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(MUNIT_SAMPLE_PATH.toString()).toURI().getPath());
    node = getElementsFromDocument(doc, munitTest.getAppliedTo().getExpression()).get(0);
    munitTest.execute(node, report.getReport());
    assertThat("The munit test not contains sections.", node.getChildren().size(), is(3));
    assertThat("The munit test not contains sections.", node.getChildren().get(0).getName(), is("behavior"));
    assertThat("The munit test not contains sections.", node.getChildren().get(1).getName(), is("execution"));
    assertThat("The munit test not contains sections.", node.getChildren().get(2).getName(), is("validation"));
}
Also used : Document(org.jdom2.Document) DocumentHelper.getDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getDocument) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument) Test(org.junit.Test)

Aggregations

Document (org.jdom2.Document)1034 Element (org.jdom2.Element)587 Test (org.junit.Test)340 SAXBuilder (org.jdom2.input.SAXBuilder)271 IOException (java.io.IOException)266 XMLOutputter (org.jdom2.output.XMLOutputter)182 JDOMException (org.jdom2.JDOMException)162 File (java.io.File)148 ArrayList (java.util.ArrayList)75 InputStream (java.io.InputStream)74 StringReader (java.io.StringReader)63 Path (java.nio.file.Path)59 HashMap (java.util.HashMap)57 DocumentHelper.getDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getDocument)53 DocumentHelper.getElementsFromDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument)53 MCRJDOMContent (org.mycore.common.content.MCRJDOMContent)48 PID (edu.unc.lib.boxc.model.api.ids.PID)47 Attribute (org.jdom2.Attribute)44 List (java.util.List)42 Namespace (org.jdom2.Namespace)39