use of com.mulesoft.tools.migration.step.category.MigrationReport 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.step.category.MigrationReport 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.step.category.MigrationReport in project mule-migration-assistant by mulesoft.
the class PolicyFileRenameMigrationStepTestCase method renameTest.
@Test
public void renameTest() throws Exception {
MigrationReport migrationReport = mock(MigrationReport.class);
ApplicationModel.ApplicationModelBuilder amb = new ApplicationModel.ApplicationModelBuilder();
amb.withProjectType(ProjectType.MULE_THREE_POLICY);
amb.withConfigurationFiles(Arrays.asList(APPLICATION_MODEL_PATH.resolve("src/main/mule/simple-test-policy.xml")));
amb.withProjectBasePath(APPLICATION_MODEL_PATH);
appModel = amb.build();
PolicyFileRenameMigrationStep step = new PolicyFileRenameMigrationStep();
step.setApplicationModel(appModel);
step.execute(APPLICATION_MODEL_PATH, migrationReport);
assertThat(APPLICATION_MODEL_PATH.resolve(appModel.getPomModel().get().getArtifactId() + ".yaml").toFile().exists(), is(true));
assertThat(APPLICATION_MODEL_PATH.resolve("simple-test-policy.yaml").toFile().exists(), is(false));
Path sourcesFilePath = APPLICATION_MODEL_PATH.resolve("src/main/mule");
assertThat(sourcesFilePath.resolve("template.xml").toFile().exists(), is(true));
assertThat(sourcesFilePath.resolve("simple-test-policy.xml").toFile().exists(), is(false));
assertThat(appModel.getApplicationDocuments().size(), is(1));
assertThat(appModel.getApplicationDocuments().get(Paths.get("src/main/mule/template.xml")), notNullValue());
assertThat(appModel.getApplicationDocuments().get(Paths.get("src/main/mule/simple-test-policy.xml")), nullValue());
}
Aggregations