Search in sources :

Example 1 with MigrationTask

use of com.mulesoft.tools.migration.task.MigrationTask 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 2 with MigrationTask

use of com.mulesoft.tools.migration.task.MigrationTask in project mule-migration-assistant by mulesoft.

the class AdditionalNamespacesFactory method getTasksDeclaredNamespaces.

public static List<Namespace> getTasksDeclaredNamespaces(List<AbstractMigrationTask> migrationTasks) {
    List<Namespace> taskSupportedNamespaces = new ArrayList<>();
    for (MigrationTask task : ofNullable(migrationTasks).orElse(emptyList())) {
        MigrationStepSelector stepSelector = new MigrationStepSelector(task.getSteps());
        stepSelector.getApplicationModelContributionSteps().forEach(s -> taskSupportedNamespaces.addAll(s.getNamespacesContributions()));
    }
    taskSupportedNamespaces.add(getNamespace("mule", CORE_NAMESPACE.getURI()));
    return taskSupportedNamespaces;
}
Also used : MigrationTask(com.mulesoft.tools.migration.task.MigrationTask) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) ArrayList(java.util.ArrayList) Namespace(org.jdom2.Namespace) Namespace.getNamespace(org.jdom2.Namespace.getNamespace) MigrationStepSelector(com.mulesoft.tools.migration.task.MigrationStepSelector)

Example 3 with MigrationTask

use of com.mulesoft.tools.migration.task.MigrationTask in project mule-migration-assistant by mulesoft.

the class MigrationTaskLocatorTest method locate.

@Test
public void locate() {
    MigrationTaskLocator migrationTaskLocator = new MigrationTaskLocator(from, to);
    List<AbstractMigrationTask> migrationTaskList = migrationTaskLocator.locate();
    assertThat("The number of migration task is wrong", migrationTaskList.size(), greaterThan(0));
    MigrationTask migrationTask = migrationTaskList.get(0);
    assertThat("The migration task type is wrong", migrationTask, instanceOf(PreprocessMuleApplication.class));
    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) AbstractMigrationTask(com.mulesoft.tools.migration.task.AbstractMigrationTask) PreprocessMuleApplication(com.mulesoft.tools.migration.library.mule.tasks.PreprocessMuleApplication) Test(org.junit.Test)

Aggregations

AbstractMigrationTask (com.mulesoft.tools.migration.task.AbstractMigrationTask)3 MigrationTask (com.mulesoft.tools.migration.task.MigrationTask)3 MunitMigrationTask (com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask)2 Test (org.junit.Test)2 PreprocessMuleApplication (com.mulesoft.tools.migration.library.mule.tasks.PreprocessMuleApplication)1 MigrationStepSelector (com.mulesoft.tools.migration.task.MigrationStepSelector)1 ArrayList (java.util.ArrayList)1 Namespace (org.jdom2.Namespace)1 Namespace.getNamespace (org.jdom2.Namespace.getNamespace)1