use of com.mulesoft.tools.migration.library.gateway.steps.policy.mule.SetPropertyMigrationStep in project mule-migration-assistant by mulesoft.
the class SetPropertyMigrationStepTestCase method doubleSetPropertyElementWithSetResponse.
@Test
public void doubleSetPropertyElementWithSetResponse() {
SetPropertyMigrationStep step = new SetPropertyMigrationStep();
step.setApplicationModel(appModel);
Element firstSetPropertyElement = getTestElement();
Element secondSetPropertyElement = getTestElement();
Element rootElement = setDocument(firstSetPropertyElement, secondSetPropertyElement, getSetResponseElement());
step.execute(firstSetPropertyElement, reportMock);
step.execute(secondSetPropertyElement, reportMock);
assertTestElementIsNotModified(firstSetPropertyElement);
assertTestElementIsNotModified(secondSetPropertyElement);
assertThat(rootElement.getContentSize(), is(4));
assertThat(((Element) rootElement.getContent(0)).getName(), is(SET_PROPERTY_TAG_NAME));
assertThat(((Element) rootElement.getContent(1)).getName(), is(SET_PROPERTY_TAG_NAME));
assertOutboundPropertiesToVarElement((Element) rootElement.getContent(2));
assertSetResponseElement((Element) rootElement.getContent(3));
}
use of com.mulesoft.tools.migration.library.gateway.steps.policy.mule.SetPropertyMigrationStep in project mule-migration-assistant by mulesoft.
the class SetPropertyMigrationStepTestCase method singleSetPropertyElementWithSetResponse.
@Test
public void singleSetPropertyElementWithSetResponse() {
SetPropertyMigrationStep step = new SetPropertyMigrationStep();
step.setApplicationModel(appModel);
Element element = getTestElement();
Element rootElement = setDocument(element, getSetResponseElement());
step.execute(element, reportMock);
assertTestElementIsNotModified(element);
assertThat(rootElement.getContentSize(), is(3));
assertThat(((Element) rootElement.getContent(0)).getName(), is(SET_PROPERTY_TAG_NAME));
assertOutboundPropertiesToVarElement((Element) rootElement.getContent(1));
assertSetResponseElement((Element) rootElement.getContent(2));
}
use of com.mulesoft.tools.migration.library.gateway.steps.policy.mule.SetPropertyMigrationStep in project mule-migration-assistant by mulesoft.
the class SetPropertyMigrationStepTestCase method singleSetPropertyElement.
@Test
public void singleSetPropertyElement() {
SetPropertyMigrationStep step = new SetPropertyMigrationStep();
step.setApplicationModel(appModel);
Element element = getTestElement();
Element rootElement = setDocument(element);
step.execute(element, reportMock);
assertTestElementIsNotModified(element);
assertThat(rootElement.getContentSize(), is(3));
assertThat(((Element) rootElement.getContent(0)).getName(), is(SET_PROPERTY_TAG_NAME));
assertOutboundPropertiesToVarElement((Element) rootElement.getContent(1));
assertSetResponseElement((Element) rootElement.getContent(2));
}
use of com.mulesoft.tools.migration.library.gateway.steps.policy.mule.SetPropertyMigrationStep in project mule-migration-assistant by mulesoft.
the class SetPropertyMigrationStepTestCase method pomContributionsInSetPropertyTest.
@Test
public void pomContributionsInSetPropertyTest() {
SetPropertyMigrationStep step = new SetPropertyMigrationStep();
step.setApplicationModel(appModel);
Element element = appModel.getNodes(XPATH_NODE_EXPRESSION).get(0);
step.execute(element, reportMock);
PomModel pm = appModel.getPomModel().get();
assertThat(pm.getDependencies().size(), is(1));
Dependency httpPolicyTransformExtension = pm.getDependencies().get(0);
assertThat(httpPolicyTransformExtension.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
assertThat(httpPolicyTransformExtension.getArtifactId(), is(MULE_HTTP_POLICY_TRANSFORM_EXTENSION_ARTIFACT_ID));
assertThat(httpPolicyTransformExtension.getVersion(), is(notNullValue()));
assertThat(httpPolicyTransformExtension.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
use of com.mulesoft.tools.migration.library.gateway.steps.policy.mule.SetPropertyMigrationStep in project mule-migration-assistant by mulesoft.
the class SetPropertyMigrationStepTestCase method nestedSetPropertyElement.
@Test
public void nestedSetPropertyElement() {
SetPropertyMigrationStep step = new SetPropertyMigrationStep();
step.setApplicationModel(appModel);
Element firstSetPropertyElement = getTestElement();
Element secondSetPropertyElement = getTestElement();
Element genericElement = new Element(GENERIC_TAG_NAME, MULE_4_POLICY_NAMESPACE).addContent(secondSetPropertyElement);
Element rootElement = setDocument(firstSetPropertyElement, genericElement);
step.execute(firstSetPropertyElement, reportMock);
performNestedElementTestsAssertions(rootElement, 4, 2, 3, 1, 1);
step.execute(secondSetPropertyElement, reportMock);
performNestedElementTestsAssertions(rootElement, 4, 2, 3, 1, 3);
}
Aggregations