Search in sources :

Example 11 with PomModel

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

the class ProxyMigrationTaskTestCase method execute.

@Test
public void execute() throws Exception {
    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
    steps.forEach(step -> migrate((AbstractApplicationModelMigrationStep) step));
    String xmlString = outputter.outputString(doc);
    assertThat(xmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
    PomModel pm = appModel.getPomModel().get();
    String filename = configPath.toFile().getName();
    if (filename.equals("wsdl-mule3.xml")) {
        assertThat(pm.getDependencies().size(), is(3));
        assertWsdlDependency(pm, 2);
    } else if (filename.equals("custom-processor-mule3.xml")) {
        assertThat(pm.getDependencies().size(), is(3));
        assertCustomProcessorDependency(pm);
    } else {
        assertThat(pm.getDependencies().size(), is(4));
        assertCustomProcessorDependency(pm);
        assertWsdlDependency(pm, 3);
    }
}
Also used : XMLOutputter(org.jdom2.output.XMLOutputter) AbstractApplicationModelMigrationStep(com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep) PomModel(com.mulesoft.tools.migration.project.model.pom.PomModel) Test(org.junit.Test)

Example 12 with PomModel

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

the class ClientIdEnforcementMigrationTaskTestCase method assertPomModel.

private void assertPomModel() {
    PomModel pomModel = appModel.getPomModel().get();
    assertThat(pomModel.getDependencies().size(), is(4));
    Dependency clientIdEnforcementDependency = pomModel.getDependencies().get(3);
    assertThat(clientIdEnforcementDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
    assertThat(clientIdEnforcementDependency.getArtifactId(), is(MULE_CLIENT_ID_ENFORCEMENT_EXTENSION_ARTIFACT_ID));
    assertThat(clientIdEnforcementDependency.getVersion(), is(notNullValue()));
    assertThat(clientIdEnforcementDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
Also used : PomModel(com.mulesoft.tools.migration.project.model.pom.PomModel) Dependency(com.mulesoft.tools.migration.project.model.pom.Dependency)

Example 13 with PomModel

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

the class FederationMigrationTaskTestCase method assertPomModel.

private void assertPomModel() {
    PomModel pomModel = appModel.getPomModel().get();
    assertThat(pomModel.getDependencies().size(), is(2));
    Dependency httpPolicyTransformExtension = pomModel.getDependencies().get(0);
    assertThat(httpPolicyTransformExtension.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
    assertThat(httpPolicyTransformExtension.getArtifactId(), is(MULE_HTTP_POLICY_TRANSFORM_EXTENSION_ARTIFACT_ID));
    assertThat(httpPolicyTransformExtension.getVersion(), is(notNullValue()));
    assertThat(httpPolicyTransformExtension.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
    Dependency federationExtensionDependency = pomModel.getDependencies().get(1);
    assertThat(federationExtensionDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
    assertThat(federationExtensionDependency.getArtifactId(), is(MULE_FEDERATION_EXTENSION_ARTIFACT_ID));
    assertThat(federationExtensionDependency.getVersion(), is(notNullValue()));
    assertThat(federationExtensionDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
Also used : PomModel(com.mulesoft.tools.migration.project.model.pom.PomModel) Dependency(com.mulesoft.tools.migration.project.model.pom.Dependency)

Example 14 with PomModel

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

the class ProxyResponseHeadersProcessorMigrationStepTestCase method customProcessorPomContributionTest.

@Test
public void customProcessorPomContributionTest() throws Exception {
    final ProxyResponseHeadersProcessorMigrationStep step = new ProxyResponseHeadersProcessorMigrationStep();
    step.setApplicationModel(appModel);
    step.execute(appModel.getNode(XPATH_NODE_EXPRESSION), reportMock);
    PomModel pm = appModel.getPomModel().get();
    assertThat(pm.getDependencies().size(), is(1));
    Dependency customProcessorDependency = pm.getDependencies().get(0);
    assertThat(customProcessorDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
    assertThat(customProcessorDependency.getArtifactId(), is(MULE_HTTP_PROXY_EXTENSION_ARTIFACT_ID));
    assertThat(customProcessorDependency.getVersion(), is(notNullValue()));
    assertThat(customProcessorDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
Also used : PomModel(com.mulesoft.tools.migration.project.model.pom.PomModel) Dependency(com.mulesoft.tools.migration.project.model.pom.Dependency) Test(org.junit.Test)

Example 15 with PomModel

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

the class SetPropertyMigrationStepTestCase method pomContributionsInSetPropertyTest.

@Test
public void pomContributionsInSetPropertyTest() {
    SetPropertyMigrationStep step = new SetPropertyMigrationStep();
    step.setApplicationModel(appModel);
    Element element = appModel.getNodes(XPATH_NODE_EXPRESSION).get(0);
    step.execute(element, reportMock);
    PomModel pm = appModel.getPomModel().get();
    assertThat(pm.getDependencies().size(), is(1));
    Dependency httpPolicyTransformExtension = pm.getDependencies().get(0);
    assertThat(httpPolicyTransformExtension.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
    assertThat(httpPolicyTransformExtension.getArtifactId(), is(MULE_HTTP_POLICY_TRANSFORM_EXTENSION_ARTIFACT_ID));
    assertThat(httpPolicyTransformExtension.getVersion(), is(notNullValue()));
    assertThat(httpPolicyTransformExtension.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
Also used : Element(org.jdom2.Element) PomModel(com.mulesoft.tools.migration.project.model.pom.PomModel) SetPropertyMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.mule.SetPropertyMigrationStep) Dependency(com.mulesoft.tools.migration.project.model.pom.Dependency) Test(org.junit.Test)

Aggregations

PomModel (com.mulesoft.tools.migration.project.model.pom.PomModel)34 Dependency (com.mulesoft.tools.migration.project.model.pom.Dependency)24 Test (org.junit.Test)24 Element (org.jdom2.Element)10 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)9 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)6 Path (java.nio.file.Path)4 XMLOutputter (org.jdom2.output.XMLOutputter)3 Parent (com.mulesoft.tools.migration.project.model.pom.Parent)2 Plugin (com.mulesoft.tools.migration.project.model.pom.Plugin)2 ExpressionMigrator (com.mulesoft.tools.migration.util.ExpressionMigrator)2 List (java.util.List)2 StringUtils (org.apache.commons.lang3.StringUtils)2 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)2 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 MigrationAbortException (com.mulesoft.tools.migration.exception.MigrationAbortException)1 MigrationStepException (com.mulesoft.tools.migration.exception.MigrationStepException)1 MigrationTaskException (com.mulesoft.tools.migration.exception.MigrationTaskException)1