Search in sources :

Example 1 with AbstractSoapkitMigrationStep

use of com.mulesoft.tools.migration.library.soapkit.steps.AbstractSoapkitMigrationStep in project mule-migration-assistant by mulesoft.

the class SoapkitMigrationTest method setUp.

@Before
public void setUp() throws Exception {
    final ApplicationModel applicationModel = getApplicationModel();
    final SoapkitMigrationTask soapkitMigrationTask = new SoapkitMigrationTask();
    steps = soapkitMigrationTask.getSteps().stream().filter(step -> step instanceof AbstractSoapkitMigrationStep).collect(toList());
    steps.forEach(step -> ((AbstractSoapkitMigrationStep) step).setApplicationModel(applicationModel));
}
Also used : SoapkitMigrationTask(com.mulesoft.tools.migration.library.soapkit.tasks.SoapkitMigrationTask) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) AbstractSoapkitMigrationStep(com.mulesoft.tools.migration.library.soapkit.steps.AbstractSoapkitMigrationStep) Before(org.junit.Before)

Example 2 with AbstractSoapkitMigrationStep

use of com.mulesoft.tools.migration.library.soapkit.steps.AbstractSoapkitMigrationStep in project mule-migration-assistant by mulesoft.

the class SoapkitMigrationTest method execute.

@Test
public void execute() throws Exception {
    Document doc = getDocument(this.getClass().getClassLoader().getResource(configPath.toString()).toURI().getPath());
    steps.forEach(step -> getElementsFromDocument(doc, ((AbstractSoapkitMigrationStep) step).getAppliedTo().getExpression()).forEach(node -> step.execute(node, mock(MigrationReport.class))));
    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
    String xmlString = outputter.outputString(doc);
    assertThat(xmlString, isSimilarTo(IOUtils.toString(this.getClass().getClassLoader().getResource(targetPath.toString()).toURI(), UTF_8)).ignoreComments().normalizeWhitespace());
}
Also used : Mockito.doCallRealMethod(org.mockito.Mockito.doCallRealMethod) RunWith(org.junit.runner.RunWith) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.library.soapkit.helpers.DocumentHelper.getElementsFromDocument) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) Matchers.anyString(org.mockito.Matchers.anyString) Document(org.jdom2.Document) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) Namespace(org.jdom2.Namespace) URI(java.net.URI) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Path(java.nio.file.Path) Mockito.doReturn(org.mockito.Mockito.doReturn) Parameterized(org.junit.runners.Parameterized) Before(org.junit.Before) AbstractSoapkitMigrationStep(com.mulesoft.tools.migration.library.soapkit.steps.AbstractSoapkitMigrationStep) Format(org.jdom2.output.Format) Files(java.nio.file.Files) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Test(org.junit.Test) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) SoapkitMigrationTask(com.mulesoft.tools.migration.library.soapkit.tasks.SoapkitMigrationTask) File(java.io.File) XMLOutputter(org.jdom2.output.XMLOutputter) Matchers.any(org.mockito.Matchers.any) IOUtils(org.apache.commons.io.IOUtils) CompareMatcher.isSimilarTo(org.xmlunit.matchers.CompareMatcher.isSimilarTo) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Paths(java.nio.file.Paths) DocumentHelper.getDocument(com.mulesoft.tools.migration.library.soapkit.helpers.DocumentHelper.getDocument) Mockito.mock(org.mockito.Mockito.mock) XMLOutputter(org.jdom2.output.XMLOutputter) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) AbstractSoapkitMigrationStep(com.mulesoft.tools.migration.library.soapkit.steps.AbstractSoapkitMigrationStep) Matchers.anyString(org.mockito.Matchers.anyString) DocumentHelper.getElementsFromDocument(com.mulesoft.tools.migration.library.soapkit.helpers.DocumentHelper.getElementsFromDocument) Document(org.jdom2.Document) DocumentHelper.getDocument(com.mulesoft.tools.migration.library.soapkit.helpers.DocumentHelper.getDocument) Test(org.junit.Test)

Aggregations

AbstractSoapkitMigrationStep (com.mulesoft.tools.migration.library.soapkit.steps.AbstractSoapkitMigrationStep)2 SoapkitMigrationTask (com.mulesoft.tools.migration.library.soapkit.tasks.SoapkitMigrationTask)2 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)2 Before (org.junit.Before)2 DocumentHelper.getDocument (com.mulesoft.tools.migration.library.soapkit.helpers.DocumentHelper.getDocument)1 DocumentHelper.getElementsFromDocument (com.mulesoft.tools.migration.library.soapkit.helpers.DocumentHelper.getElementsFromDocument)1 MigrationStep (com.mulesoft.tools.migration.step.MigrationStep)1 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)1 File (java.io.File)1 URI (java.net.URI)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 List (java.util.List)1 Collectors.toList (java.util.stream.Collectors.toList)1 IOUtils (org.apache.commons.io.IOUtils)1 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1 Document (org.jdom2.Document)1 Namespace (org.jdom2.Namespace)1