Search in sources :

Example 6 with ResponseBuilderMigrationStep

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);
}
Also used : ErrorResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep) ResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep) ErrorResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel)

Example 7 with ResponseBuilderMigrationStep

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 + "]"));
}
Also used : ResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep) Element(org.jdom2.Element) Text(org.jdom2.Text) Test(org.junit.Test)

Example 8 with ResponseBuilderMigrationStep

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());
}
Also used : ResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep) Element(org.jdom2.Element) Text(org.jdom2.Text) Test(org.junit.Test)

Example 9 with ResponseBuilderMigrationStep

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());
}
Also used : ResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep) Element(org.jdom2.Element) Text(org.jdom2.Text) Test(org.junit.Test)

Example 10 with ResponseBuilderMigrationStep

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());
}
Also used : ResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep) Element(org.jdom2.Element) Text(org.jdom2.Text) Test(org.junit.Test)

Aggregations

ResponseBuilderMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.http.ResponseBuilderMigrationStep)12 Element (org.jdom2.Element)11 Text (org.jdom2.Text)11 Test (org.junit.Test)11 ErrorResponseBuilderMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep)1 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)1