Search in sources :

Example 1 with PolicyFileRenameMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyFileRenameMigrationStep in project mule-migration-assistant by mulesoft.

the class BasicStructureMigrationTask method getSteps.

@Override
public List<MigrationStep> getSteps() {
    PolicyFileRenameMigrationStep policyFileRenameMigrationStep = new PolicyFileRenameMigrationStep();
    policyFileRenameMigrationStep.setApplicationModel(getApplicationModel());
    List<MigrationStep> steps = new ArrayList<>();
    steps.add(new PolicyTagMigrationStep());
    steps.add(new BeforeTagMigrationStep());
    steps.add(new AfterTagMigrationStep());
    steps.add(new BeforeExceptionTagMigrationStep());
    steps.add(new AfterExceptionTagMigrationStep());
    steps.add(new PointcutTagMigrationStep());
    steps.add(new DataTagMigrationStep());
    steps.add(new CleanupAttributesMigrationStep());
    steps.add(policyFileRenameMigrationStep);
    return steps;
}
Also used : BeforeExceptionTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.BeforeExceptionTagMigrationStep) AfterExceptionTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.AfterExceptionTagMigrationStep) BeforeTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.BeforeTagMigrationStep) AfterExceptionTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.AfterExceptionTagMigrationStep) PolicyFileRenameMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyFileRenameMigrationStep) AfterTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.AfterTagMigrationStep) PointcutTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PointcutTagMigrationStep) BeforeTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.BeforeTagMigrationStep) BeforeExceptionTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.BeforeExceptionTagMigrationStep) PolicyTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyTagMigrationStep) CleanupAttributesMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.CleanupAttributesMigrationStep) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) DataTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.DataTagMigrationStep) ArrayList(java.util.ArrayList) DataTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.DataTagMigrationStep) PolicyFileRenameMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyFileRenameMigrationStep) PolicyTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyTagMigrationStep) AfterTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.AfterTagMigrationStep) CleanupAttributesMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.CleanupAttributesMigrationStep) PointcutTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PointcutTagMigrationStep)

Example 2 with PolicyFileRenameMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyFileRenameMigrationStep 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());
}
Also used : Path(java.nio.file.Path) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) PolicyFileRenameMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyFileRenameMigrationStep) Test(org.junit.Test)

Aggregations

PolicyFileRenameMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyFileRenameMigrationStep)2 AfterExceptionTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.AfterExceptionTagMigrationStep)1 AfterTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.AfterTagMigrationStep)1 BeforeExceptionTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.BeforeExceptionTagMigrationStep)1 BeforeTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.BeforeTagMigrationStep)1 CleanupAttributesMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.CleanupAttributesMigrationStep)1 DataTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.DataTagMigrationStep)1 PointcutTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PointcutTagMigrationStep)1 PolicyTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.basicstructure.PolicyTagMigrationStep)1 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)1 MigrationStep (com.mulesoft.tools.migration.step.MigrationStep)1 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1