Search in sources :

Example 1 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 responseBuilderElementWithCookie.

@Test
public void responseBuilderElementWithCookie() {
    ResponseBuilderMigrationStep step = new ResponseBuilderMigrationStep();
    step.setApplicationModel(appModel);
    Element element = getTestElement().addContent(getSimpleSetCookieElement());
    step.execute(element, reportMock);
    Text headersText = assertBasicStructure(element);
    assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(STATUS_ATTR_VALUE));
    assertSimpleCookieHeaders(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 2 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 responseBuilderWithNoStatus.

@Test
public void responseBuilderWithNoStatus() {
    ResponseBuilderMigrationStep step = new ResponseBuilderMigrationStep();
    step.setApplicationModel(appModel);
    Element element = getTestElement();
    element.removeAttribute(STATUS_ATTR_NAME);
    step.execute(element, reportMock);
    Text headersText = assertBasicStructure(element);
    assertThat(element.getAttributeValue(STATUS_CODE_ATTR_NAME), is(HTTP_LISTENER_RESPONSE_SUCCESS_STATUS_CODE));
    assertNoStatusHeaders(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 3 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 responseBuilderElementWithHeader.

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

Example 4 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 responseBuilderRaw.

@Test
public void responseBuilderRaw() {
    ResponseBuilderMigrationStep step = new ResponseBuilderMigrationStep();
    step.setApplicationModel(appModel);
    Element element = new Element(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_SUCCESS_STATUS_CODE));
    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 5 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 responseBuilderElementWithExpires.

@Test
public void responseBuilderElementWithExpires() {
    ResponseBuilderMigrationStep step = new ResponseBuilderMigrationStep();
    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 : 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