Search in sources :

Example 26 with ApplicationModel

use of com.mulesoft.tools.migration.project.model.ApplicationModel in project mule-migration-assistant by mulesoft.

the class SecurePropertiesTest 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(SECURE_PROPS_EXAMPLES_PATH.toString()).toURI())).withConfigurationFiles(asList(resolvedConfigPath)).withMuleVersion(muleVersion).withProjectType(MULE_FOUR_APPLICATION).build();
    Document doc = appModel.getApplicationDocuments().get(configPath.getFileName());
    securePropertiesPlaceholder.setApplicationModel(appModel);
    getElementsFromDocument(doc, securePropertiesPlaceholder.getAppliedTo().getExpression()).forEach(node -> securePropertiesPlaceholder.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());
}
Also used : Path(java.nio.file.Path) XMLOutputter(org.jdom2.output.XMLOutputter) ApplicationModelBuilder(com.mulesoft.tools.migration.project.model.ApplicationModel.ApplicationModelBuilder) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) Document(org.jdom2.Document) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument) Test(org.junit.Test)

Example 27 with ApplicationModel

use of com.mulesoft.tools.migration.project.model.ApplicationModel in project mule-migration-assistant by mulesoft.

the class TrackingTest method setUp.

@Before
public void setUp() throws Exception {
    tracking = new Tracking();
    ApplicationModel appModel = mock(ApplicationModel.class);
    tracking.setExpressionMigrator(new MelToDwExpressionMigrator(report.getReport(), appModel));
    tracking.setApplicationModel(appModel);
}
Also used : MelToDwExpressionMigrator(com.mulesoft.tools.migration.library.tools.MelToDwExpressionMigrator) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) Before(org.junit.Before)

Example 28 with ApplicationModel

use of com.mulesoft.tools.migration.project.model.ApplicationModel in project mule-migration-assistant by mulesoft.

the class PropertyPlaceholderTest method setUp.

@Before
public void setUp() throws Exception {
    ApplicationModel appModel = mock(ApplicationModel.class);
    propertyPlaceholder = new PropertyPlaceholder();
    propertyPlaceholder.setApplicationModel(appModel);
}
Also used : ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) Before(org.junit.Before)

Aggregations

ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)28 Path (java.nio.file.Path)9 Namespace (org.jdom2.Namespace)9 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)8 Document (org.jdom2.Document)8 Before (org.junit.Before)8 Test (org.junit.Test)7 Element (org.jdom2.Element)6 PomModel (com.mulesoft.tools.migration.project.model.pom.PomModel)5 DocumentHelper.getElementsFromDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument)4 ExpressionMigratorAware (com.mulesoft.tools.migration.step.ExpressionMigratorAware)4 ExpressionMigrator (com.mulesoft.tools.migration.util.ExpressionMigrator)4 List (java.util.List)4 Optional (java.util.Optional)4 XMLOutputter (org.jdom2.output.XMLOutputter)4 ApplicationModelBuilder (com.mulesoft.tools.migration.project.model.ApplicationModel.ApplicationModelBuilder)3 AbstractApplicationModelMigrationStep (com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep)3 NamespaceContribution (com.mulesoft.tools.migration.step.category.NamespaceContribution)3 Map (java.util.Map)3 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)2