use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class UpdateMuleMavenPlugin method execute.
@Override
public void execute(PomModel pomModel, MigrationReport report) throws RuntimeException {
String packagingType = pomModel.getPackaging();
if (StringUtils.equals(packagingType, MULE_APPLICATION_3_PACKAGING_TYPE)) {
pomModel.setPackaging(MULE_APPLICATION_4_PACKAGING_TYPE);
}
Plugin muleMavenPlugin = pomModel.removePlugin(p -> p.getArtifactId().equals(MULE_MAVEN_PLUGIN_ARTIFACT_ID)).orElse(buildMule4MuleMavenPluginConfiguration());
muleMavenPlugin.setVersion(MULE_MAVEN_PLUGIN_VERSION);
muleMavenPlugin.setExtensions("true");
Xpp3Dom configuration = muleMavenPlugin.getConfiguration();
if (configuration != null) {
updateDeploymentConfiguration(configuration);
}
pomModel.addPlugin(muleMavenPlugin);
}
use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class ThrottlingWithFileRenameMigrationTestCase method assertPomModel.
private void assertPomModel() {
PomModel pomModel = appModel.getPomModel().get();
assertThat(pomModel.getDependencies().size(), is(2));
Dependency httpTransformDependency = pomModel.getDependencies().get(0);
assertThat(httpTransformDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
assertThat(httpTransformDependency.getArtifactId(), is(MULE_HTTP_POLICY_TRANSFORM_EXTENSION_ARTIFACT_ID));
assertThat(httpTransformDependency.getVersion(), is(notNullValue()));
assertThat(httpTransformDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
Dependency policyTransformExtensionDependency = pomModel.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));
assertPomDeployProperties(pomModel);
}
use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class FederationPomContributionMigrationStepTestCase method pomContributionTest.
@Test
public void pomContributionTest() {
MigrationReport reportMock = reportMock = mock(MigrationReport.class);
PomModel pm = new PomModel();
FederationPomContributionMigrationStep step = new FederationPomContributionMigrationStep();
step.execute(pm, reportMock);
assertThat(pm.getDependencies().size(), is(2));
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));
Dependency federationExtensionDependency = pm.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));
}
use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class ProxyRequestHeadersProcessorMigrationStepTestCase 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));
}
use of com.mulesoft.tools.migration.project.model.pom.PomModel in project mule-migration-assistant by mulesoft.
the class ProxyRequestHeadersProcessorMigrationStepTestCase method migrateElementAndPomTest.
@Test
public void migrateElementAndPomTest() throws Exception {
final ProxyRequestHeadersProcessorMigrationStep step = new ProxyRequestHeadersProcessorMigrationStep();
Element element = appModel.getNode(XPATH_NODE_EXPRESSION);
step.setApplicationModel(appModel);
step.execute(element, reportMock);
assertThat(element.getName(), is(REQUEST_HEADERS));
assertThat(element.getNamespace(), is(PROXY_NAMESPACE));
assertThat(element.getAttributes().size(), is(2));
assertThat(element.getAttribute(CONFIG_REF).getValue(), is(PROXY_CONFIG));
assertThat(element.getAttribute(TARGET).getValue(), is(PROXY_REQUEST_HEADERS));
assertThat(element.getContent().size(), is(0));
assertConfigElement(element);
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));
}
Aggregations