Search in sources :

Example 11 with Document

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

the class GatewayMigrationStep method getRootElement.

protected Element getRootElement(final Element element) {
    Document doc = element.getDocument();
    if (doc != null) {
        return doc.getRootElement();
    }
    Element e = new Element(MULE_4_TAG_NAME, MULE_4_POLICY_NAMESPACE).addContent(element);
    e.addNamespaceDeclaration(MULE_4_CORE_NAMESPACE_NO_PREFIX);
    new Document().setRootElement(e);
    return e;
}
Also used : Element(org.jdom2.Element) Document(org.jdom2.Document)

Example 12 with Document

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

the class DefaultMigrationReportTest method notAddDuplicateEntryTest.

@Test
public void notAddDuplicateEntryTest() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(MUNIT_SAMPLE_PATH.toString()).toURI().getPath());
    Element node = getElementsFromDocument(doc, assertTrue.getAppliedTo().getExpression()).get(0);
    defaultMigrationReport.report(WARN, node, node, "Message", "docLink");
    defaultMigrationReport.report(WARN, node, node, "Message2", "newLink");
    defaultMigrationReport.report(WARN, node, node, "Message", "docLink");
    assertThat("Duplicate entry added.", defaultMigrationReport.getReportEntries().size(), is(2));
}
Also used : Element(org.jdom2.Element) 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 13 with Document

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

the class HttpRequesterConfigTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    getElementsFromDocument(doc, httpRequesterConfig.getAppliedTo().getExpression()).forEach(node -> httpRequesterConfig.execute(node, report.getReport()));
    getElementsFromDocument(doc, socketsConfig.getAppliedTo().getExpression()).forEach(node -> socketsConfig.execute(node, report.getReport()));
    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
    String xmlString = outputter.outputString(doc);
    assertThat(xmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
}
Also used : XMLOutputter(org.jdom2.output.XMLOutputter) 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 14 with Document

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

the class HttpListenerConfigTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    getElementsFromDocument(doc, httpListenerConfig.getAppliedTo().getExpression()).forEach(node -> httpListenerConfig.execute(node, report.getReport()));
    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
    String xmlString = outputter.outputString(doc);
    assertThat(xmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
}
Also used : XMLOutputter(org.jdom2.output.XMLOutputter) 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 15 with Document

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

the class EnricherTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    getElementsFromDocument(doc, enricher.getAppliedTo().getExpression()).forEach(node -> enricher.execute(node, report.getReport()));
    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
    String xmlString = outputter.outputString(doc);
    assertThat(xmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
}
Also used : XMLOutputter(org.jdom2.output.XMLOutputter) 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