Search in sources :

Example 16 with Document

use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.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 17 with Document

use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.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)

Example 18 with Document

use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.Document in project mule-migration-assistant by mulesoft.

the class FirstSuccessfulTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    getElementsFromDocument(doc, firstSuccessful.getAppliedTo().getExpression()).forEach(node -> firstSuccessful.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 19 with Document

use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.Document in project mule-migration-assistant by mulesoft.

the class RemoveObjectToStringTransformerTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(FILE_SAMPLE_PATH.toString()).toURI().getPath());
    node = getElementsFromDocument(doc, removeObjectToStringTransformer.getAppliedTo().getExpression()).get(0);
    removeObjectToStringTransformer.execute(node, report.getReport());
    assertThat("The node wasn't remove.", node.getParent(), is(nullValue()));
}
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 20 with Document

use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.Document in project mule-migration-assistant by mulesoft.

the class RemoveSyntheticMigrationAttributesTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    getElementsFromDocument(doc, removeSyntheticMigrationAttributes.getAppliedTo().getExpression()).forEach(node -> removeSyntheticMigrationAttributes.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