use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class RamlProxyMigrationTaskTestCase method execute.
@Test
public void execute() throws Exception {
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
steps.forEach(step -> migrate(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();
assertThat(pm.getDependencies().size(), is(1));
assertRestValidatorDependency(pm);
}
use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class SlaBasedAlgorithmMigrationStepTestCase method rateLimitSlaPomContributionTest.
@Test
public void rateLimitSlaPomContributionTest() throws Exception {
SlaBasedAlgorithmMigrationStep step = new SlaBasedAlgorithmMigrationStep();
step.setApplicationModel(appModel);
Element element = getSlaPolicy(1, false);
step.execute(element, reportMock);
PomModel pm = appModel.getPomModel().get();
assertThat(pm.getDependencies().size(), is(2));
Dependency policyTransformExtensionDependency = pm.getDependencies().get(1);
assertThat(policyTransformExtensionDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
assertThat(policyTransformExtensionDependency.getArtifactId(), is(MULE_THROTTLING_EXTENSION_ARTIFACT_ID));
assertThat(policyTransformExtensionDependency.getVersion(), is(notNullValue()));
assertThat(policyTransformExtensionDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class RamlValidatorPomContributionMigrationStepTestCase method pomContributionTestWithNoPreviousDependency.
@Test
public void pomContributionTestWithNoPreviousDependency() {
PomModel pm = new PomModel();
RamlValidatorPomContributionMigrationStep step = new RamlValidatorPomContributionMigrationStep();
step.execute(pm, mock(MigrationReport.class));
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_REST_VALIDATOR_EXTENSION));
assertThat(httpPolicyTransformExtension.getVersion(), is(notNullValue()));
assertThat(httpPolicyTransformExtension.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class JsonPolicyTagMigrationStepTestCase method jsonPomContributionTest.
@Test
public void jsonPomContributionTest() {
JsonPolicyTagMigrationStep step = new JsonPolicyTagMigrationStep();
step.setApplicationModel(appModel);
Element element = appModel.getNode(XPATH_NODE_EXPRESSION);
step.execute(element, reportMock);
PomModel pm = appModel.getPomModel().get();
assertThat(pm.getDependencies().size(), is(1));
Dependency jsonThreatProtectionDependency = pm.getDependencies().get(0);
assertThat(jsonThreatProtectionDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
assertThat(jsonThreatProtectionDependency.getArtifactId(), is(MULE_JSON_THREAT_PROTECTION_EXTENSION_ARTIFACT_ID));
assertThat(jsonThreatProtectionDependency.getVersion(), is(notNullValue()));
assertThat(jsonThreatProtectionDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
assertJsonPolicyTag(element);
}
use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class MelToDwExpressionMigratorTest method migrateInstanceOfExpression.
@Test
public void migrateInstanceOfExpression() {
PomModel pomModel = PomModelUtils.buildMinimalMule4ApplicationPom("org.fake", "fake-app", "1.0.0", "mule-application");
when(modelMock.getPomModel()).thenReturn(Optional.of(pomModel));
Element elementMock = mock(Element.class);
String originalExpression = "a instanceof org.pepe.Pepito";
assertThat("Pom model should not have the java module dependency", pomModel.getDependencies().stream().noneMatch(d -> d.getArtifactId().equals("mule-java-module")));
String migratedExpression = expressionMigrator.migrateExpression("#[" + originalExpression + "]", false, elementMock);
assertThat("Migrated expression is not the expected", migratedExpression, equalTo("#[%dw 2.0 --- Java::isInstanceOf(vars.a, 'org.pepe.Pepito')]"));
assertThat("Pom model should have the java module dependency", pomModel.getDependencies().stream().anyMatch(d -> d.getArtifactId().equals("mule-java-module")));
}
Aggregations