use of com.mulesoft.tools.migration.step.MigrationStep in project mule-migration-assistant by mulesoft.
the class SoapkitMigrationTask method getSteps.
@Override
public List<MigrationStep> getSteps() {
List<MigrationStep> steps = new ArrayList<>();
steps.add(new SoapkitMigrationTaskPomContribution());
steps.add(new SoapkitRouterConfig());
steps.add(new SoapkitRouter());
steps.add(new SoapkitHttpListenerMapping());
steps.add(new SoapkitWsdlLocation());
steps.add(new SoapkitFault());
return steps;
}
use of com.mulesoft.tools.migration.step.MigrationStep in project mule-migration-assistant by mulesoft.
the class AbstractMigrationTaskTest method executeWithFailedMigrationStep.
@Test(expected = MigrationTaskException.class)
public void executeWithFailedMigrationStep() throws Exception {
NamespaceContribution namespaceContribution = mock(NamespaceContribution.class);
doThrow(NullPointerException.class).when(namespaceContribution).execute(eq(applicationModelMock), any(MigrationReport.class));
List<MigrationStep> steps = new ArrayList<>();
steps.add(namespaceContribution);
migrationTask.setApplicationModel(applicationModelMock);
((MigrationTaskImpl) migrationTask).setMigrationSteps(steps);
migrationTask.execute(mock(MigrationReport.class));
}
use of com.mulesoft.tools.migration.step.MigrationStep in project mule-migration-assistant by mulesoft.
the class AbstractMigrationTaskTest method execute.
@Test
public void execute() throws Exception {
NamespaceContribution namespaceContributionMock = mock(NamespaceContribution.class);
ApplicationModelContribution applicationModelContributionMock = mock(ApplicationModelContribution.class);
ProjectStructureContribution projectStructureContributionMock = mock(ProjectStructureContribution.class);
PomContribution pomContributionMock = mock(PomContribution.class);
List<MigrationStep> steps = new ArrayList<>();
steps.add(namespaceContributionMock);
steps.add(applicationModelContributionMock);
steps.add(projectStructureContributionMock);
steps.add(pomContributionMock);
InOrder inOrder = Mockito.inOrder(steps.toArray());
migrationTask.setApplicationModel(applicationModelMock);
((MigrationTaskImpl) migrationTask).setMigrationSteps(new ArrayList<>(steps));
migrationTask.execute(mock(MigrationReport.class));
verify(namespaceContributionMock, times(1)).execute(any(ApplicationModel.class), any(MigrationReport.class));
verify(applicationModelContributionMock, times(2)).getAppliedTo();
verify(projectStructureContributionMock, times(1)).execute(isNull(), any(MigrationReport.class));
verify(pomContributionMock, times(1)).execute(any(PomModel.class), any(MigrationReport.class));
inOrder.verify(namespaceContributionMock).execute(any(ApplicationModel.class), any(MigrationReport.class));
inOrder.verify(projectStructureContributionMock).execute(isNull(), any(MigrationReport.class));
inOrder.verify(pomContributionMock).execute(any(PomModel.class), any(MigrationReport.class));
}
use of com.mulesoft.tools.migration.step.MigrationStep in project mule-migration-assistant by mulesoft.
the class ApikitMigrationTask method getSteps.
@Override
public List<MigrationStep> getSteps() {
List<MigrationStep> steps = new ArrayList<>();
steps.add(new ApikitMigrationTaskPomContribution());
steps.add(new ApikitNamespace());
steps.add(new ApikitRouterConfig());
steps.add(new ApikitHttpListenerMapping());
steps.add(new ApikitErrorHandler());
steps.add(new ApikitApiLocation());
return steps;
}
use of com.mulesoft.tools.migration.step.MigrationStep in project mule-migration-assistant by mulesoft.
the class AbstractMigrationTask method execute.
@Override
public void execute(MigrationReport report) throws Exception {
// TODO depending on the project type this may not be true
checkState(applicationModel != null, "An application model must be provided.");
List<MigrationStep> steps = enableReporting(getSteps());
try {
if (steps != null) {
MigrationStepSelector stepSelector = new MigrationStepSelector(steps);
if (shouldExecuteAllSteps(stepSelector)) {
steps.stream().filter(s -> s instanceof ExpressionMigratorAware).forEach(s -> ((ExpressionMigratorAware) s).setExpressionMigrator(getExpressionMigrator()));
stepSelector.getNameSpaceContributionSteps().forEach(s -> s.execute(applicationModel, report));
stepSelector.getApplicationModelContributionSteps().forEach(s -> {
s.setApplicationModel(applicationModel);
fetchAndProcessNodes(report, s, new ArrayList<>());
});
stepSelector.getProjectStructureContributionSteps().forEach(s -> {
s.setApplicationModel(applicationModel);
s.execute(applicationModel.getProjectBasePath(), report);
});
stepSelector.getPomContributionSteps().forEach(s -> {
s.setApplicationModel(applicationModel);
s.execute(applicationModel.getPomModel().orElse(new PomModel()), report);
});
}
}
} catch (MigrationAbortException e) {
throw e;
} catch (Exception e) {
throw new MigrationTaskException("Task execution exception. " + e.getMessage(), e);
}
}
Aggregations