use of com.google.firestore.v1beta1.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.google.firestore.v1beta1.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.google.firestore.v1beta1.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"));
}
use of com.google.firestore.v1beta1.Document in project mule-migration-assistant by mulesoft.
the class ScriptingModuleMigrationTest method executeScriptWithCode.
@Test
public void executeScriptWithCode() throws Exception {
Document doc = getDocument(this.getClass().getClassLoader().getResource(SCRIPTING_SAMPLE_PATH.toString()).toURI().getPath());
node = getElementsFromDocument(doc, scriptingModuleMigration.getAppliedTo().getExpression()).get(2);
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("nashorn"));
}
use of com.google.firestore.v1beta1.Document in project mule-migration-assistant by mulesoft.
the class ScriptingModuleMigrationTest method executeScriptWithGroovyCode.
@Test
public void executeScriptWithGroovyCode() throws Exception {
Document doc = getDocument(this.getClass().getClassLoader().getResource(SCRIPTING_SAMPLE_PATH.toString()).toURI().getPath());
node = getElementsFromDocument(doc, scriptingModuleMigration.getAppliedTo().getExpression()).get(3);
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("groovy"));
}
Aggregations