Search in sources :

Example 1 with ErrorResponseBuilderMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.

the class ErrorResponseBuilderMigrationStepTestCase method errorResponseBuilderFull.

@Test
public void errorResponseBuilderFull() {
    ErrorResponseBuilderMigrationStep step = new ErrorResponseBuilderMigrationStep();
    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 : Element(org.jdom2.Element) ErrorResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep) Text(org.jdom2.Text) Test(org.junit.Test)

Example 2 with ErrorResponseBuilderMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.

the class ErrorResponseBuilderMigrationStepTestCase method errorResponseBuilderRaw.

@Test
public void errorResponseBuilderRaw() {
    ErrorResponseBuilderMigrationStep step = new ErrorResponseBuilderMigrationStep();
    step.setApplicationModel(appModel);
    Element element = new Element(ERROR_RESPONSE_BUILDER_TAG_NAME, HTTP_NAMESPACE);
    step.execute(element, reportMock);
    Text headersText = assertBasicStructure(element);
    assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(HTTP_LISTENER_RESPONSE_ERROR_STATUS_CODE));
    assertThat(headersText.getText(), is(HEADERS_CONTENT_VALUE + "]"));
}
Also used : Element(org.jdom2.Element) ErrorResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep) Text(org.jdom2.Text) Test(org.junit.Test)

Example 3 with ErrorResponseBuilderMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.

the class ErrorResponseBuilderMigrationStepTestCase method errorResponseBuilderElementWithCacheControl.

@Test
public void errorResponseBuilderElementWithCacheControl() {
    ErrorResponseBuilderMigrationStep step = new ErrorResponseBuilderMigrationStep();
    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 : Element(org.jdom2.Element) ErrorResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep) Text(org.jdom2.Text) Test(org.junit.Test)

Example 4 with ErrorResponseBuilderMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.

the class ErrorResponseBuilderMigrationStepTestCase method errorResponseBuilderElementWithHeader.

@Test
public void errorResponseBuilderElementWithHeader() {
    ErrorResponseBuilderMigrationStep step = new ErrorResponseBuilderMigrationStep();
    step.setApplicationModel(appModel);
    Element element = getTestElement().addContent(getHeadersElement());
    step.execute(element, reportMock);
    Text headersText = assertBasicStructure(element);
    assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(STATUS_ATTR_VALUE));
    assertSimpleHeaders(headersText.getText());
}
Also used : Element(org.jdom2.Element) ErrorResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep) Text(org.jdom2.Text) Test(org.junit.Test)

Example 5 with ErrorResponseBuilderMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep in project mule-migration-assistant by mulesoft.

the class ErrorResponseBuilderMigrationStepTestCase method errorResponseBuilderElementWithExpires.

@Test
public void errorResponseBuilderElementWithExpires() {
    ErrorResponseBuilderMigrationStep step = new ErrorResponseBuilderMigrationStep();
    step.setApplicationModel(appModel);
    Element element = getTestElement().addContent(getExpiresElement());
    step.execute(element, reportMock);
    Text headersText = assertBasicStructure(element);
    assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(STATUS_ATTR_VALUE));
    assertExpiresHeaders(headersText.getText());
}
Also used : Element(org.jdom2.Element) ErrorResponseBuilderMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.http.ErrorResponseBuilderMigrationStep) Text(org.jdom2.Text) Test(org.junit.Test)

Aggregations

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