Search in sources :

Example 6 with POLICY_APPLICATION_MODEL_PATH

use of com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_APPLICATION_MODEL_PATH in project mule-migration-assistant by mulesoft.

the class ThrottlingPolicyMigrationTestCase method setUp.

@Before
public void setUp() throws Exception {
    ApplicationModel.ApplicationModelBuilder amb = new ApplicationModel.ApplicationModelBuilder();
    amb.withProjectType(ProjectType.MULE_THREE_POLICY);
    amb.withProjectBasePath(POLICY_APPLICATION_MODEL_PATH);
    amb.withPom(pomPath);
    appModel = amb.build();
    doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    ThrottlingMigrationTask throttlingMigrationTask = new ThrottlingMigrationTask();
    throttlingMigrationTask.setApplicationModel(appModel);
    steps = throttlingMigrationTask.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
    BasicStructureMigrationTask basicStructureTask = new BasicStructureMigrationTask();
    basicStructureTask.setApplicationModel(appModel);
    List<MigrationStep> basicStructureSteps = basicStructureTask.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
    steps.addAll(basicStructureSteps);
}
Also used : RunWith(org.junit.runner.RunWith) ThrottlingMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.ThrottlingMigrationTask) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) POLICY_APPLICATION_MODEL_PATH(com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_APPLICATION_MODEL_PATH) Document(org.jdom2.Document) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) Arrays.asList(java.util.Arrays.asList) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) BasicStructureMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.BasicStructureMigrationTask) Path(java.nio.file.Path) DocumentHelper.getDocument(com.mulesoft.tools.migration.library.gateway.tasks.DocumentHelper.getDocument) Parameterized(org.junit.runners.Parameterized) Before(org.junit.Before) Format(org.jdom2.output.Format) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Collection(java.util.Collection) Test(org.junit.Test) ProjectType(com.mulesoft.tools.migration.project.ProjectType) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) XMLOutputter(org.jdom2.output.XMLOutputter) CompareMatcher.isSimilarTo(org.xmlunit.matchers.CompareMatcher.isSimilarTo) IOUtils(org.apache.commons.io.IOUtils) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.library.gateway.tasks.DocumentHelper.getElementsFromDocument) AbstractApplicationModelMigrationStep(com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep) POLICY_EXAMPLES_PATH(com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_EXAMPLES_PATH) Mockito.mock(org.mockito.Mockito.mock) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) AbstractApplicationModelMigrationStep(com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) AbstractApplicationModelMigrationStep(com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep) ThrottlingMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.ThrottlingMigrationTask) BasicStructureMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.BasicStructureMigrationTask) Before(org.junit.Before)

Example 7 with POLICY_APPLICATION_MODEL_PATH

use of com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_APPLICATION_MODEL_PATH in project mule-migration-assistant by mulesoft.

the class HttpPolicyMigrationTestCase method setUp.

@Before
public void setUp() throws Exception {
    ApplicationModel.ApplicationModelBuilder amb = new ApplicationModel.ApplicationModelBuilder();
    amb.withProjectType(ProjectType.MULE_THREE_POLICY);
    amb.withProjectBasePath(POLICY_APPLICATION_MODEL_PATH);
    appModel = amb.build();
    doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    HttpMigrationTask task = new HttpMigrationTask();
    task.setApplicationModel(appModel);
    steps = task.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
    BasicStructureMigrationTask basicStructureTask = new BasicStructureMigrationTask();
    basicStructureTask.setApplicationModel(appModel);
    List<MigrationStep> basicStructureSteps = basicStructureTask.getSteps().stream().filter(step -> step instanceof AbstractApplicationModelMigrationStep).collect(toList());
    steps.addAll(basicStructureSteps);
}
Also used : RunWith(org.junit.runner.RunWith) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) POLICY_APPLICATION_MODEL_PATH(com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_APPLICATION_MODEL_PATH) Document(org.jdom2.Document) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) Arrays.asList(java.util.Arrays.asList) After(org.junit.After) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) BasicStructureMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.BasicStructureMigrationTask) Path(java.nio.file.Path) DocumentHelper.getDocument(com.mulesoft.tools.migration.library.gateway.tasks.DocumentHelper.getDocument) Parameterized(org.junit.runners.Parameterized) Before(org.junit.Before) MIGRATION_RESOURCES_PATH(com.mulesoft.tools.migration.library.gateway.TestConstants.MIGRATION_RESOURCES_PATH) Format(org.jdom2.output.Format) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Collection(java.util.Collection) Test(org.junit.Test) ProjectType(com.mulesoft.tools.migration.project.ProjectType) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) File(java.io.File) XMLOutputter(org.jdom2.output.XMLOutputter) CompareMatcher.isSimilarTo(org.xmlunit.matchers.CompareMatcher.isSimilarTo) IOUtils(org.apache.commons.io.IOUtils) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.library.gateway.tasks.DocumentHelper.getElementsFromDocument) AbstractApplicationModelMigrationStep(com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep) POLICY_EXAMPLES_PATH(com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_EXAMPLES_PATH) HttpMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.HttpMigrationTask) Mockito.mock(org.mockito.Mockito.mock) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) AbstractApplicationModelMigrationStep(com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) AbstractApplicationModelMigrationStep(com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep) BasicStructureMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.BasicStructureMigrationTask) HttpMigrationTask(com.mulesoft.tools.migration.library.gateway.tasks.HttpMigrationTask) Before(org.junit.Before)

Aggregations

POLICY_APPLICATION_MODEL_PATH (com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_APPLICATION_MODEL_PATH)7 POLICY_EXAMPLES_PATH (com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_EXAMPLES_PATH)7 BasicStructureMigrationTask (com.mulesoft.tools.migration.library.gateway.tasks.BasicStructureMigrationTask)7 DocumentHelper.getDocument (com.mulesoft.tools.migration.library.gateway.tasks.DocumentHelper.getDocument)7 DocumentHelper.getElementsFromDocument (com.mulesoft.tools.migration.library.gateway.tasks.DocumentHelper.getElementsFromDocument)7 ProjectType (com.mulesoft.tools.migration.project.ProjectType)7 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)7 AbstractApplicationModelMigrationStep (com.mulesoft.tools.migration.step.AbstractApplicationModelMigrationStep)7 MigrationStep (com.mulesoft.tools.migration.step.MigrationStep)7 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)7 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)7 Path (java.nio.file.Path)7 Arrays.asList (java.util.Arrays.asList)7 Collection (java.util.Collection)7 List (java.util.List)7 Collectors.toList (java.util.stream.Collectors.toList)7 IOUtils (org.apache.commons.io.IOUtils)7 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)7 Document (org.jdom2.Document)7 Format (org.jdom2.output.Format)7