use of com.mulesoft.tools.migration.report.DefaultMigrationReport in project mule-migration-assistant by mulesoft.
the class MigrationRunner method run.
public static int run(String[] args) throws Exception {
Stopwatch stopwatch = Stopwatch.createStarted();
Optional<MigrationRunner> migrationRunner = buildRunner(args);
if (!migrationRunner.isPresent()) {
return -1;
}
MigrationJob job = migrationRunner.get().buildMigrationJob();
try {
DefaultMigrationReport report = new DefaultMigrationReport();
log("Executing migrator " + job.getRunnerVersion() + "...");
job.execute(report);
printMigrationSummary(job.getReportPath().resolve(REPORT_HOME).toAbsolutePath().toString(), stopwatch.stop().elapsed(MILLISECONDS), report);
return 0;
} catch (Exception ex) {
printMigrationError(ex, stopwatch.stop().elapsed(MILLISECONDS));
return -1;
}
}
use of com.mulesoft.tools.migration.report.DefaultMigrationReport in project mule-migration-assistant by mulesoft.
the class MigrationJobTest method executeWithEmptyTaskList.
@Test
public void executeWithEmptyTaskList() throws Exception {
migrationJob = new MigrationJob.MigrationJobBuilder().withProject(originalProjectPath).withOutputProject(migratedProjectPath).withInputVersion(MULE_370_VERSION).withOuputVersion(MULE_413_VERSION).build();
migrationJob.execute(new DefaultMigrationReport());
}
use of com.mulesoft.tools.migration.report.DefaultMigrationReport in project mule-migration-assistant by mulesoft.
the class MigrationJobTest method execute_assertContentGitIgnoreFile.
@Test
public void execute_assertContentGitIgnoreFile() throws Exception {
migrationJob = new MigrationJob.MigrationJobBuilder().withProject(originalProjectPath).withOutputProject(migratedProjectPath).withInputVersion(MULE_370_VERSION).withOuputVersion(MULE_413_VERSION).build();
migrationJob.execute(new DefaultMigrationReport());
File gitIgnore = new File(migratedProjectPath.toFile(), ".gitignore");
InputStream gitignoreResourceStream = getClass().getClassLoader().getResourceAsStream("gitignore-maven-template");
byte[] sourceBytes = IOUtils.toByteArray(gitignoreResourceStream);
byte[] targetBytes = FileUtils.readFileToByteArray(gitIgnore);
assertArrayEquals(sourceBytes, targetBytes);
}
use of com.mulesoft.tools.migration.report.DefaultMigrationReport 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.report.DefaultMigrationReport in project mule-migration-assistant by mulesoft.
the class MigrationJobTest method execute_assertGitIgnoreFile.
@Test
public void execute_assertGitIgnoreFile() throws Exception {
migrationJob = new MigrationJob.MigrationJobBuilder().withProject(originalProjectPath).withOutputProject(migratedProjectPath).withInputVersion(MULE_370_VERSION).withOuputVersion(MULE_413_VERSION).build();
migrationJob.execute(new DefaultMigrationReport());
File gitIgnore = new File(migratedProjectPath.toFile(), ".gitignore");
assertTrue(gitIgnore.exists());
}
Aggregations