use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.
the class HttpMigrationTask method getSteps.
@Override
public List<MigrationStep> getSteps() {
ApplicationModel applicationModel = getApplicationModel();
ResponseBuilderMigrationStep responseBuilderMigrationStep = new ResponseBuilderMigrationStep();
responseBuilderMigrationStep.setApplicationModel(applicationModel);
ErrorResponseBuilderMigrationStep errorResponseBuilderMigrationStep = new ErrorResponseBuilderMigrationStep();
errorResponseBuilderMigrationStep.setApplicationModel(applicationModel);
return Arrays.asList(responseBuilderMigrationStep, errorResponseBuilderMigrationStep);
}
use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.
the class ResponseBuilderMigrationStepTestCase method responseBuilderWithNoContentType.
@Test
public void responseBuilderWithNoContentType() {
ResponseBuilderMigrationStep step = new ResponseBuilderMigrationStep();
step.setApplicationModel(appModel);
Element element = getTestElement();
element.removeAttribute(CONTENT_TYPE_ATTR_NAME);
step.execute(element, reportMock);
Text headersText = assertBasicStructure(element);
assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(STATUS_ATTR_VALUE));
assertThat(headersText.getText(), is(HEADERS_CONTENT_VALUE + "]"));
}
use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.
the class ResponseBuilderMigrationStepTestCase method responseBuilderFull.
@Test
public void responseBuilderFull() {
ResponseBuilderMigrationStep step = new ResponseBuilderMigrationStep();
step.setApplicationModel(appModel);
Element element = getTestElement().addContent(getHeadersElement()).addContent(getFullSetCookieElement()).addContent(getCacheControlElement()).addContent(getExpiresElement()).addContent(getLocationElement());
step.execute(element, reportMock);
Text headersText = assertBasicStructure(element);
assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(STATUS_ATTR_VALUE));
assertFullResponseHeaders(headersText.getText());
}
use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.
the class ResponseBuilderMigrationStepTestCase method responseBuilderElementWithCacheControl.
@Test
public void responseBuilderElementWithCacheControl() {
ResponseBuilderMigrationStep step = new ResponseBuilderMigrationStep();
step.setApplicationModel(appModel);
Element element = getTestElement().addContent(getCacheControlElement());
step.execute(element, reportMock);
Text headersText = assertBasicStructure(element);
assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(STATUS_ATTR_VALUE));
assertCacheControlHeaders(headersText.getText());
}
use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.
the class ResponseBuilderMigrationStepTestCase method responseBuilderElementWithLocation.
@Test
public void responseBuilderElementWithLocation() {
ResponseBuilderMigrationStep step = new ResponseBuilderMigrationStep();
step.setApplicationModel(appModel);
Element element = getTestElement().addContent(getLocationElement());
step.execute(element, reportMock);
Text headersText = assertBasicStructure(element);
assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(STATUS_ATTR_VALUE));
assertLocationHeaders(headersText.getText());
}
Aggregations