Search in sources :

Example 11 with ResponseCode

use of com.spectralogic.ds3autogen.java.models.ResponseCode in project ds3_autogen by SpectraLogic.

the class BaseResponseParserGenerator_Test method toResponseCode_BaseResponse_Test.

@Test
public void toResponseCode_BaseResponse_Test() {
    final String expected = "try (final InputStream inputStream = response.getResponseStream()) {\n" + "                    final Type result = XmlOutput.fromXml(inputStream, Type.class);\n" + "                    return new TestResponse(result, this.getChecksum(), this.getChecksumType());\n" + "                }\n";
    final ResponseCode result = toResponseCode(getBaseResponseCode(), "TestResponse", true, false);
    assertThat(result.getCode(), is(202));
    assertThat(result.getProcessingCode(), is(expected));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode(com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode) ResponseCode(com.spectralogic.ds3autogen.java.models.ResponseCode) Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode(com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode) Test(org.junit.Test)

Example 12 with ResponseCode

use of com.spectralogic.ds3autogen.java.models.ResponseCode in project ds3_autogen by SpectraLogic.

the class BaseResponseParserGenerator_Test method toResponseCode_StringResponse_Test.

@Test
public void toResponseCode_StringResponse_Test() {
    final String expected = "try (final InputStream inputStream = response.getResponseStream()) {\n" + "                    final String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8);\n" + "                    return new TestResponse(result, this.getChecksum(), this.getChecksumType());\n" + "                }\n";
    final ResponseCode result = toResponseCode(getStringResponseCode(), "TestResponse", true, false);
    assertThat(result.getCode(), is(201));
    assertThat(result.getProcessingCode(), is(expected));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode(com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode) ResponseCode(com.spectralogic.ds3autogen.java.models.ResponseCode) Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode(com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode) Test(org.junit.Test)

Example 13 with ResponseCode

use of com.spectralogic.ds3autogen.java.models.ResponseCode in project ds3_autogen by SpectraLogic.

the class BaseResponseParserGenerator_Test method toStatusCodeList_FullList_Test.

@Test
public void toStatusCodeList_FullList_Test() {
    final ImmutableList<ResponseCode> responseCodes = ImmutableList.of(new ResponseCode(201, ""), new ResponseCode(202, ""), new ResponseCode(203, ""));
    final String result = toStatusCodeList(responseCodes);
    assertThat(result, is("201, 202, 203"));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode(com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode) ResponseCode(com.spectralogic.ds3autogen.java.models.ResponseCode) Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode(com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode) Test(org.junit.Test)

Example 14 with ResponseCode

use of com.spectralogic.ds3autogen.java.models.ResponseCode in project ds3_autogen by SpectraLogic.

the class GetJobChunksReadyParserGenerator_Test method toResponseCodeList_Test.

@Test
public void toResponseCodeList_Test() {
    final Ds3Request ds3Request = getJobChunksReadyForClientProcessingRequest();
    final ImmutableList<ResponseCode> result = generator.toResponseCodeList(ds3Request.getDs3ResponseCodes(), "TestResponse", false);
    assertThat(result.size(), is(1));
    assertThat(result.get(0).getCode(), is(200));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) ResponseCode(com.spectralogic.ds3autogen.java.models.ResponseCode) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Aggregations

Ds3ResponseCode (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode)14 ResponseCode (com.spectralogic.ds3autogen.java.models.ResponseCode)14 Test (org.junit.Test)9 Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode (com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode)6 Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode (com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode)6 Ds3ResponseType (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType)2 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)1 ResponseAndParserUtils.getDs3ResponseCode (com.spectralogic.ds3autogen.java.utils.ResponseAndParserUtils.getDs3ResponseCode)1