Search in sources :

Example 1 with ProjectStructureContribution

use of com.mulesoft.tools.migration.step.category.ProjectStructureContribution in project mule-migration-assistant by mulesoft.

the class AbstractMigrationTaskTest method execute.

@Test
public void execute() throws Exception {
    NamespaceContribution namespaceContributionMock = mock(NamespaceContribution.class);
    ApplicationModelContribution applicationModelContributionMock = mock(ApplicationModelContribution.class);
    ProjectStructureContribution projectStructureContributionMock = mock(ProjectStructureContribution.class);
    PomContribution pomContributionMock = mock(PomContribution.class);
    List<MigrationStep> steps = new ArrayList<>();
    steps.add(namespaceContributionMock);
    steps.add(applicationModelContributionMock);
    steps.add(projectStructureContributionMock);
    steps.add(pomContributionMock);
    InOrder inOrder = Mockito.inOrder(steps.toArray());
    migrationTask.setApplicationModel(applicationModelMock);
    ((MigrationTaskImpl) migrationTask).setMigrationSteps(new ArrayList<>(steps));
    migrationTask.execute(mock(MigrationReport.class));
    verify(namespaceContributionMock, times(1)).execute(any(ApplicationModel.class), any(MigrationReport.class));
    verify(applicationModelContributionMock, times(2)).getAppliedTo();
    verify(projectStructureContributionMock, times(1)).execute(isNull(), any(MigrationReport.class));
    verify(pomContributionMock, times(1)).execute(any(PomModel.class), any(MigrationReport.class));
    inOrder.verify(namespaceContributionMock).execute(any(ApplicationModel.class), any(MigrationReport.class));
    inOrder.verify(projectStructureContributionMock).execute(isNull(), any(MigrationReport.class));
    inOrder.verify(pomContributionMock).execute(any(PomModel.class), any(MigrationReport.class));
}
Also used : InOrder(org.mockito.InOrder) NamespaceContribution(com.mulesoft.tools.migration.step.category.NamespaceContribution) ArrayList(java.util.ArrayList) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) PomContribution(com.mulesoft.tools.migration.step.category.PomContribution) ProjectStructureContribution(com.mulesoft.tools.migration.step.category.ProjectStructureContribution) ApplicationModelContribution(com.mulesoft.tools.migration.step.category.ApplicationModelContribution) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) PomModel(com.mulesoft.tools.migration.project.model.pom.PomModel) Test(org.junit.Test)

Aggregations

Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)1 PomModel (com.mulesoft.tools.migration.project.model.pom.PomModel)1 MigrationStep (com.mulesoft.tools.migration.step.MigrationStep)1 ApplicationModelContribution (com.mulesoft.tools.migration.step.category.ApplicationModelContribution)1 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)1 NamespaceContribution (com.mulesoft.tools.migration.step.category.NamespaceContribution)1 PomContribution (com.mulesoft.tools.migration.step.category.PomContribution)1 ProjectStructureContribution (com.mulesoft.tools.migration.step.category.ProjectStructureContribution)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 InOrder (org.mockito.InOrder)1