use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.Document in project mule-migration-assistant by mulesoft.
the class XmlToDomTransformerTest method execute.
@Test
public void execute() throws Exception {
Document doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
getElementsFromDocument(doc, xmlToDomTransformer.getAppliedTo().getExpression()).forEach(node -> xmlToDomTransformer.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());
report.expectReportEntry("mulexml.xmlToDom");
}
use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.Document in project mule-migration-assistant by mulesoft.
the class AssertFalseTest method execute.
@Test
public void execute() throws Exception {
Document doc = getDocument(this.getClass().getClassLoader().getResource(MUNIT_SAMPLE_PATH.toString()).toURI().getPath());
node = getElementsFromDocument(doc, assertFalse.getAppliedTo().getExpression()).get(0);
assertFalse.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(false)]"));
}
use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.Document in project mule-migration-assistant by mulesoft.
the class SplitterTest method execute.
@Test
public void execute() throws Exception {
Document document = Iterables.get(applicationModel.getApplicationDocuments().values(), 0);
vmNamespaceContribution.execute(applicationModel, report.getReport());
aggregatorsNamespaceContribution.execute(applicationModel, report.getReport());
getElementsFromDocument(document, collectionSplitter.getAppliedTo().getExpression()).forEach(node -> collectionSplitter.execute(node, report.getReport()));
getElementsFromDocument(document, expressionSplitter.getAppliedTo().getExpression()).forEach(node -> expressionSplitter.execute(node, report.getReport()));
getElementsFromDocument(document, customSplitter.getAppliedTo().getExpression()).forEach(node -> customSplitter.execute(node, report.getReport()));
getElementsFromDocument(document, mapSplitter.getAppliedTo().getExpression()).forEach(node -> mapSplitter.execute(node, report.getReport()));
getElementsFromDocument(document, messageChunkSplitter.getAppliedTo().getExpression()).forEach(node -> messageChunkSplitter.execute(node, report.getReport()));
getElementsFromDocument(document, aggregatorWithNoSplitter.getAppliedTo().getExpression()).forEach(node -> aggregatorWithNoSplitter.execute(node, report.getReport()));
getElementsFromDocument(document, removeSyntheticMigrationAttributes.getAppliedTo().getExpression()).forEach(node -> removeSyntheticMigrationAttributes.execute(node, report.getReport()));
getElementsFromDocument(document, removeSyntheticMigrationGlobalElements.getAppliedTo().getExpression()).forEach(node -> removeSyntheticMigrationGlobalElements.execute(node, report.getReport()));
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
String xmlString = outputter.outputString(document);
assertThat(xmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
}
use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.Document in project mule-migration-assistant by mulesoft.
the class SpringTest method execute.
@Test
public void execute() throws Exception {
Path resolvedConfigPath = Paths.get(this.getClass().getClassLoader().getResource(configPath.toString()).toURI());
ApplicationModel appModel = new ApplicationModelBuilder().withProjectBasePath(Paths.get(this.getClass().getClassLoader().getResource(SPRING_EXAMPLES_PATH.toString()).toURI())).withConfigurationFiles(asList(resolvedConfigPath)).withMuleVersion(muleVersion).withProjectType(MULE_FOUR_APPLICATION).build();
Document doc = appModel.getApplicationDocuments().get(configPath.getFileName());
springPropertiesPlaceholder.setApplicationModel(appModel);
springConfigContainingMuleConfig.setApplicationModel(appModel);
springConfigInMuleConfig.setApplicationModel(appModel);
springBeans.setApplicationModel(appModel);
springContext.setApplicationModel(appModel);
springContributions.setApplicationModel(appModel);
getElementsFromDocument(doc, springPropertiesPlaceholder.getAppliedTo().getExpression()).forEach(node -> springPropertiesPlaceholder.execute(node, report.getReport()));
getElementsFromDocument(doc, springConfigContainingMuleConfig.getAppliedTo().getExpression(), "spring").forEach(node -> springConfigContainingMuleConfig.execute(node, report.getReport()));
getElementsFromDocument(doc, springConfigInMuleConfig.getAppliedTo().getExpression()).forEach(node -> springConfigInMuleConfig.execute(node, report.getReport()));
getElementsFromDocument(doc, springBeans.getAppliedTo().getExpression()).forEach(node -> springBeans.execute(node, report.getReport()));
getElementsFromDocument(doc, springContext.getAppliedTo().getExpression()).forEach(node -> springContext.execute(node, report.getReport()));
getElementsFromDocument(doc, springContributions.getAppliedTo().getExpression()).forEach(node -> springContributions.execute(node, report.getReport()));
XMLOutputter muleOutputter = new XMLOutputter(Format.getPrettyFormat());
String muleXmlString = muleOutputter.outputString(doc);
assertThat(muleXmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetMulePath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
Document springDoc = appModel.getApplicationDocuments().get(Paths.get("src/main/resources/spring", targetSpringPath.getFileName().toString()));
if (this.getClass().getClassLoader().getResource(targetSpringPath.toString()) != null) {
XMLOutputter springOutputter = new XMLOutputter(Format.getPrettyFormat());
String springXmlString = springOutputter.outputString(springDoc);
assertThat(springXmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetSpringPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
} else {
assertThat(springDoc, nullValue());
}
}
use of com.forgerock.openbanking.common.model.openbanking.obie.pain00200109.Document in project mule-migration-assistant by mulesoft.
the class ScriptingModuleMigrationTest method executeScriptWithRuby.
@Test
public void executeScriptWithRuby() throws Exception {
Document doc = getDocument(this.getClass().getClassLoader().getResource(SCRIPTING_SAMPLE_PATH.toString()).toURI().getPath());
node = getElementsFromDocument(doc, scriptingModuleMigration.getAppliedTo().getExpression()).get(4);
scriptingModuleMigration.execute(node, report.getReport());
assertThat("The name didn't change.", node.getName(), equalTo("execute"));
assertThat("The file attribute wasn't moved.", node.getAttribute("engine").getValue(), equalTo("ruby"));
}
Aggregations