Search in sources :

Example 6 with DefaultMigrationReport

use of com.mulesoft.tools.migration.report.DefaultMigrationReport in project mule-migration-assistant by mulesoft.

the class MigrationJobTest method assertProjectGav.

private void assertProjectGav(Path projectPath, String gav, String expectedGroupId, String expectedArtifactId, String expectedVersion) throws Exception {
    migrationJob = new MigrationJob.MigrationJobBuilder().withProject(projectPath).withOutputProject(migratedProjectPath).withInputVersion(MULE_380_VERSION).withOuputVersion(MULE_413_VERSION).withProjectGAV(gav).build();
    MunitMigrationTask migrationTask = new MunitMigrationTask();
    migrationTasks.add(migrationTask);
    Whitebox.setInternalState(migrationJob, "migrationTasks", migrationTasks);
    migrationJob.execute(new DefaultMigrationReport());
    assertThat(migrationTask.getApplicationModel().getPomModel().get().getGroupId(), is(expectedGroupId));
    assertThat(migrationTask.getApplicationModel().getPomModel().get().getArtifactId(), is(expectedArtifactId));
    assertThat(migrationTask.getApplicationModel().getPomModel().get().getVersion(), is(expectedVersion));
}
Also used : DefaultMigrationReport(com.mulesoft.tools.migration.report.DefaultMigrationReport) MunitMigrationTask(com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask)

Example 7 with DefaultMigrationReport

use of com.mulesoft.tools.migration.report.DefaultMigrationReport in project mule-migration-assistant by mulesoft.

the class MigrationJobTest method executeWithTaskThatFailsNotStopExecution.

@Test
public void executeWithTaskThatFailsNotStopExecution() throws Exception {
    migrationJob = new MigrationJob.MigrationJobBuilder().withProject(originalProjectPath).withOutputProject(migratedProjectPath).withInputVersion(MULE_380_VERSION).withOuputVersion(MULE_413_VERSION).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());
    verify(migrationTask, times(1)).execute(any(MigrationReport.class));
}
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 8 with DefaultMigrationReport

use of com.mulesoft.tools.migration.report.DefaultMigrationReport in project mule-migration-assistant by mulesoft.

the class MigrationJobTest method executeCheckApplicationModel.

@Test
public void executeCheckApplicationModel() throws Exception {
    migrationJob = new MigrationJob.MigrationJobBuilder().withProject(originalProjectPath).withOutputProject(migratedProjectPath).withInputVersion(MULE_380_VERSION).withOuputVersion(MULE_413_VERSION).build();
    MunitMigrationTask migrationTask = new MunitMigrationTask();
    migrationTasks.add(migrationTask);
    Whitebox.setInternalState(migrationJob, "migrationTasks", migrationTasks);
    migrationJob.execute(new DefaultMigrationReport());
    assertThat("The application model generated is wrong.", migrationTask.getApplicationModel().getApplicationDocuments().size(), is(2));
}
Also used : DefaultMigrationReport(com.mulesoft.tools.migration.report.DefaultMigrationReport) MunitMigrationTask(com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask) Test(org.junit.Test)

Example 9 with DefaultMigrationReport

use of com.mulesoft.tools.migration.report.DefaultMigrationReport in project mule-migration-assistant by mulesoft.

the class MigrationJobTest method execute.

@Test
public void execute() throws Exception {
    migrationJob = new MigrationJob.MigrationJobBuilder().withProject(originalProjectPath).withOutputProject(migratedProjectPath).withInputVersion(MULE_380_VERSION).withOuputVersion(MULE_413_VERSION).build();
    migrationJob.execute(new DefaultMigrationReport());
}
Also used : DefaultMigrationReport(com.mulesoft.tools.migration.report.DefaultMigrationReport) Test(org.junit.Test)

Aggregations

DefaultMigrationReport (com.mulesoft.tools.migration.report.DefaultMigrationReport)9 Test (org.junit.Test)7 MunitMigrationTask (com.mulesoft.tools.migration.library.munit.tasks.MunitMigrationTask)2 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)2 AbstractMigrationTask (com.mulesoft.tools.migration.task.AbstractMigrationTask)2 File (java.io.File)2 Stopwatch (com.google.common.base.Stopwatch)1 MigrationJob (com.mulesoft.tools.migration.engine.MigrationJob)1 ConsoleOptionsException (com.mulesoft.tools.migration.exception.ConsoleOptionsException)1 InputStream (java.io.InputStream)1