use of com.mulesoft.tools.migration.task.AbstractMigrationTask in project mule-migration-assistant by mulesoft.
the class MigrationTaskLocator method getCoreMigrationTasks.
public List<AbstractMigrationTask> getCoreMigrationTasks() {
List<AbstractMigrationTask> coreMigrationTasks = new ArrayList<>();
coreMigrationTasks.add(new SecurePropertiesMigrationTask());
coreMigrationTasks.add(new SecurityCrc32MigrationTask());
coreMigrationTasks.add(new SecurityFiltersMigrationTask());
coreMigrationTasks.add(new PropertiesMigrationTask());
coreMigrationTasks.add(new MuleCoreComponentsMigrationTask());
coreMigrationTasks.add(new SplitterAggregatorTask());
coreMigrationTasks.add(new BatchMigrationTask());
coreMigrationTasks.add(new ValidationMigrationTask());
coreMigrationTasks.add(new RequestReplyMigrationTask());
coreMigrationTasks.add(new QuartzMigrationTask());
coreMigrationTasks.add(new HTTPMigrationTask());
coreMigrationTasks.add(new EmailMigrationTask());
coreMigrationTasks.add(new SocketsMigrationTask());
coreMigrationTasks.add(new WscMigrationTask());
coreMigrationTasks.add(new DbMigrationTask());
coreMigrationTasks.add(new ObjectStoreMigrationTask());
coreMigrationTasks.add(new FileMigrationTask());
coreMigrationTasks.add(new FtpMigrationTask());
coreMigrationTasks.add(new SftpMigrationTask());
coreMigrationTasks.add(new EndpointsMigrationTask());
coreMigrationTasks.add(new JmsDomainMigrationTask());
coreMigrationTasks.add(new JmsMigrationTask());
coreMigrationTasks.add(new AmqpMigrationTask());
coreMigrationTasks.add(new VmDomainMigrationTask());
coreMigrationTasks.add(new VMMigrationTask());
coreMigrationTasks.add(new CompressionMigrationTask());
coreMigrationTasks.add(new ScriptingMigrationTask());
coreMigrationTasks.add(new JsonMigrationTask());
coreMigrationTasks.add(new SecurityOAuth2ProviderMigrationTask());
coreMigrationTasks.add(new SalesforceMigrationTask());
coreMigrationTasks.add(new DomainAppMigrationTask());
coreMigrationTasks.add(new MuleDeprecatedCoreComponentsMigrationTask());
coreMigrationTasks.add(new MunitMigrationTask());
coreMigrationTasks.add(new TransformersMigrationTask());
coreMigrationTasks.add(new ExpressionTransformerMigrationTask());
coreMigrationTasks.add(new ApikitMigrationTask());
coreMigrationTasks.add(new SoapkitMigrationTask());
return coreMigrationTasks;
}
use of com.mulesoft.tools.migration.task.AbstractMigrationTask in project mule-migration-assistant by mulesoft.
the class MigrationTaskLocator method locate.
public List<AbstractMigrationTask> locate() {
List<AbstractMigrationTask> migrationTasks = newArrayList(new PreprocessMuleApplication());
migrationTasks.addAll(getCoreMigrationTasks());
migrationTasks.addAll(getGatewayMigrationTasks());
migrationTasks.addAll(getCoreAfterMigrationTasks());
return migrationTasks.stream().filter(mt -> shouldNotFilterTask(mt)).collect(Collectors.toList());
}
use of com.mulesoft.tools.migration.task.AbstractMigrationTask in project mule-migration-assistant by mulesoft.
the class MigrationJobTest method executeWithTaskThatFailsAndStopExecution.
@Test(expected = MigrationTaskException.class)
public void executeWithTaskThatFailsAndStopExecution() throws Exception {
migrationJob = new MigrationJob.MigrationJobBuilder().withProject(originalProjectPath).withOutputProject(migratedProjectPath).withInputVersion(MULE_380_VERSION).withOuputVersion(MULE_413_VERSION).withCancelOnError(true).build();
AbstractMigrationTask migrationTask = mock(AbstractMigrationTask.class);
doThrow(MigrationTaskException.class).when(migrationTask).execute(any(MigrationReport.class));
when(migrationTask.getApplicableProjectTypes()).thenReturn(singleton(MULE_FOUR_APPLICATION));
migrationTasks.add(migrationTask);
Whitebox.setInternalState(migrationJob, "migrationTasks", migrationTasks);
migrationJob.execute(new DefaultMigrationReport());
}
use of com.mulesoft.tools.migration.task.AbstractMigrationTask in project mule-migration-assistant by mulesoft.
the class MigrationTaskLocatorTest method locateFromAnyToAny.
@Test
public void locateFromAnyToAny() {
MigrationTaskLocator migrationTaskLocator = new MigrationTaskLocator(ANY_VERSION_3, ANY_VERSION_4);
List<AbstractMigrationTask> migrationTaskList = migrationTaskLocator.locate();
assertThat("The number of migration task is wrong", migrationTaskList.size(), greaterThanOrEqualTo(9));
MigrationTask migrationTask = migrationTaskList.stream().filter(t -> t instanceof MunitMigrationTask).findFirst().get();
assertThat("The migration task from is wrong", isVersionGreaterOrEquals(migrationTask.getFrom(), from), is(true));
assertThat("The migration task to is wrong", isVersionGreaterOrEquals(to, migrationTask.getTo()), is(true));
assertThat("The migration task project type is wrong", migrationTask.getProjectType(), is(projectType));
}
use of com.mulesoft.tools.migration.task.AbstractMigrationTask in project mule-migration-assistant by mulesoft.
the class MigrationJob method execute.
@Override
public void execute(MigrationReport report) throws Exception {
ApplicationModel applicationModel = generateSourceApplicationModel(project);
report.initialize(applicationModel.getProjectType(), project.getFileName().toString());
Path sourceProjectBasePath = applicationModel.getProjectBasePath();
persistApplicationModel(applicationModel);
ProjectType targetProjectType = applicationModel.getProjectType().getTargetType();
applicationModel = generateTargetApplicationModel(outputProject, targetProjectType, sourceProjectBasePath, projectParentGAV, projectGAV);
try {
for (AbstractMigrationTask task : migrationTasks) {
if (task.getApplicableProjectTypes().contains(targetProjectType)) {
task.setApplicationModel(applicationModel);
task.setExpressionMigrator(new MelToDwExpressionMigrator(report, applicationModel));
try {
task.execute(report);
persistApplicationModel(applicationModel);
applicationModel = generateTargetApplicationModel(outputProject, targetProjectType, sourceProjectBasePath, projectParentGAV, projectGAV);
} catch (MigrationTaskException ex) {
if (cancelOnError) {
throw ex;
} else {
logger.error("Failed to apply task, rolling back and continuing with the next one.", ex);
}
} catch (RuntimeException e) {
throw new MigrationJobException("Failed to continue executing migration: " + e.getClass().getName() + ": " + e.getMessage(), e);
}
}
}
} finally {
generateReport(report, applicationModel);
}
}
Aggregations