Search in sources :

Example 1 with AbstractMigrationTask

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;
}
Also used : SoapkitMigrationTask(com.mulesoft.tools.migration.library.soapkit.tasks.SoapkitMigrationTask) DbMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.DbMigrationTask) EndpointsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.EndpointsMigrationTask) ScriptingMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ScriptingMigrationTask) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) FtpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.FtpMigrationTask) ValidationMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ValidationMigrationTask) SocketsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SocketsMigrationTask) VmDomainMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.VmDomainMigrationTask) ApikitMigrationTask(com.mulesoft.tools.migration.library.apikit.tasks.ApikitMigrationTask) VMMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.VMMigrationTask) MunitMigrationTask(com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask) JsonMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JsonMigrationTask) JmsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JmsMigrationTask) SecurityOAuth2ProviderMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityOAuth2ProviderMigrationTask) JmsDomainMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JmsDomainMigrationTask) SecurePropertiesMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurePropertiesMigrationTask) CompressionMigrationTask(com.mulesoft.tools.migration.library.mule.steps.compression.CompressionMigrationTask) SecurityFiltersMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityFiltersMigrationTask) DomainAppMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.DomainAppMigrationTask) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) WscMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.WscMigrationTask) ObjectStoreMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ObjectStoreMigrationTask) SplitterAggregatorTask(com.mulesoft.tools.migration.library.mule.tasks.SplitterAggregatorTask) RequestReplyMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.RequestReplyMigrationTask) AmqpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.AmqpMigrationTask) EmailMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.EmailMigrationTask) SftpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SftpMigrationTask) FileMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.FileMigrationTask) MuleDeprecatedCoreComponentsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.MuleDeprecatedCoreComponentsMigrationTask) SalesforceMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SalesforceMigrationTask) BatchMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.BatchMigrationTask) ExpressionTransformerMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ExpressionTransformerMigrationTask) SecurityCrc32MigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityCrc32MigrationTask) TransformersMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.TransformersMigrationTask) HTTPMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.HTTPMigrationTask) MuleCoreComponentsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.MuleCoreComponentsMigrationTask) PropertiesMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.PropertiesMigrationTask) SecurePropertiesMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurePropertiesMigrationTask) QuartzMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.QuartzMigrationTask)

Example 2 with AbstractMigrationTask

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());
}
Also used : BatchMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.BatchMigrationTask) VersionUtils.isVersionGreaterOrEquals(com.mulesoft.tools.migration.util.version.VersionUtils.isVersionGreaterOrEquals) HTTPMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.HTTPMigrationTask) DbMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.DbMigrationTask) FiltersMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.FiltersMigrationTask) ScriptingMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ScriptingMigrationTask) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) PostprocessGeneral(com.mulesoft.tools.migration.library.mule.tasks.PostprocessGeneral) EmailMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.EmailMigrationTask) EndpointsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.EndpointsMigrationTask) JmsDomainMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JmsDomainMigrationTask) SecurityCrc32MigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityCrc32MigrationTask) WscMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.WscMigrationTask) SftpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SftpMigrationTask) ExpressionTransformerMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ExpressionTransformerMigrationTask) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) MigrationCleanTask(com.mulesoft.tools.migration.library.mule.tasks.MigrationCleanTask) MuleDeprecatedCoreComponentsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.MuleDeprecatedCoreComponentsMigrationTask) BasicStructureMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.BasicStructureMigrationTask) VmDomainMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.VmDomainMigrationTask) PropertiesMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.PropertiesMigrationTask) MuleElementsMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.MuleElementsMigrationTask) AmqpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.AmqpMigrationTask) RamlProxyMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.RamlProxyMigrationTask) Collectors(java.util.stream.Collectors) PolicyUtilsMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.PolicyUtilsMigrationTask) ObjectStoreMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ObjectStoreMigrationTask) RequestReplyMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.RequestReplyMigrationTask) DomainAppMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.DomainAppMigrationTask) List(java.util.List) ApikitMigrationTask(com.mulesoft.tools.migration.library.apikit.tasks.ApikitMigrationTask) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) IpFilterMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.IpFilterMigrationTask) JsonMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JsonMigrationTask) HttpMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.HttpMigrationTask) MuleCoreComponentsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.MuleCoreComponentsMigrationTask) ThreatProtectionMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.ThreatProtectionMigrationTask) TRUE(java.lang.Boolean.TRUE) SecurityOAuth2ProviderMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityOAuth2ProviderMigrationTask) FederationMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.FederationMigrationTask) MigrationTask(com.mulesoft.tools.migration.task.MigrationTask) ThrottlingMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.ThrottlingMigrationTask) VMMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.VMMigrationTask) ArrayList(java.util.ArrayList) SecurityFiltersMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurityFiltersMigrationTask) SpringMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SpringMigrationTask) HTTPCleanupTask(com.mulesoft.tools.migration.library.mule.tasks.HTTPCleanupTask) FtpMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.FtpMigrationTask) ValidationMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.ValidationMigrationTask) PreprocessMuleApplication(com.mulesoft.tools.migration.library.mule.tasks.PreprocessMuleApplication) MunitMigrationTask(com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask) FALSE(java.lang.Boolean.FALSE) SecurePropertiesMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SecurePropertiesMigrationTask) SocketsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SocketsMigrationTask) JmsMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.JmsMigrationTask) TransformersMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.TransformersMigrationTask) SoapkitMigrationTask(com.mulesoft.tools.migration.library.soapkit.tasks.SoapkitMigrationTask) FileMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.FileMigrationTask) SalesforceMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.SalesforceMigrationTask) CompressionMigrationTask(com.mulesoft.tools.migration.library.mule.steps.compression.CompressionMigrationTask) ClientIdEnforcementMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.ClientIdEnforcementMigrationTask) ProxyMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.ProxyMigrationTask) SplitterAggregatorTask(com.mulesoft.tools.migration.library.mule.tasks.SplitterAggregatorTask) QuartzMigrationTask(com.mulesoft.tools.migration.library.mule.tasks.QuartzMigrationTask) PostprocessMuleApplication(com.mulesoft.tools.migration.library.mule.tasks.PostprocessMuleApplication) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) PreprocessMuleApplication(com.mulesoft.tools.migration.library.mule.tasks.PreprocessMuleApplication)

Example 3 with AbstractMigrationTask

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());
}
Also used : DefaultMigrationReport(com.mulesoft.tools.migration.report.DefaultMigrationReport) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) DefaultMigrationReport(com.mulesoft.tools.migration.report.DefaultMigrationReport) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) Test(org.junit.Test)

Example 4 with AbstractMigrationTask

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));
}
Also used : MigrationTask(com.mulesoft.tools.migration.task.MigrationTask) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) MunitMigrationTask(com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask) MunitMigrationTask(com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) Test(org.junit.Test)

Example 5 with AbstractMigrationTask

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);
    }
}
Also used : Path(java.nio.file.Path) MelToDwExpressionMigrator(com.mulesoft.tools.migration.library.tools.MelToDwExpressionMigrator) MigrationJobException(com.mulesoft.tools.migration.engine.exception.MigrationJobException) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) ProjectType(com.mulesoft.tools.migration.project.ProjectType) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) MigrationTaskException(com.mulesoft.tools.migration.exception.MigrationTaskException)

Aggregations

AbstractMigrationTask (com.mulesoft.tools.migration.task.AbstractMigrationTask)11 ArrayList (java.util.ArrayList)6 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)4 MunitMigrationTask (com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask)4 DbMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.DbMigrationTask)3 DomainAppMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.DomainAppMigrationTask)3 EndpointsMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.EndpointsMigrationTask)3 HTTPCleanupTask (com.mulesoft.tools.migration.library.mule.tasks.HTTPCleanupTask)3 HTTPMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.HTTPMigrationTask)3 JmsDomainMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.JmsDomainMigrationTask)3 JmsMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.JmsMigrationTask)3 MigrationCleanTask (com.mulesoft.tools.migration.library.mule.tasks.MigrationCleanTask)3 MuleCoreComponentsMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.MuleCoreComponentsMigrationTask)3 PostprocessGeneral (com.mulesoft.tools.migration.library.mule.tasks.PostprocessGeneral)3 PostprocessMuleApplication (com.mulesoft.tools.migration.library.mule.tasks.PostprocessMuleApplication)3 SecurityFiltersMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.SecurityFiltersMigrationTask)3 SpringMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.SpringMigrationTask)3 ApikitMigrationTask (com.mulesoft.tools.migration.library.apikit.tasks.ApikitMigrationTask)2 CompressionMigrationTask (com.mulesoft.tools.migration.library.mule.steps.compression.CompressionMigrationTask)2 AmqpMigrationTask (com.mulesoft.tools.migration.library.mule.tasks.AmqpMigrationTask)2