Search in sources :

Example 31 with Ds3ResponseCode

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.

the class BaseClientGenerator_Test method getHttpStatusCode_OK_Test.

@Test
public void getHttpStatusCode_OK_Test() {
    final ImmutableList<Ds3ResponseCode> responseCodes = ImmutableList.of(new Ds3ResponseCode(200, null), new Ds3ResponseCode(201, null));
    final String result = getHttpStatusCode(responseCodes);
    assertThat(result, is("OK"));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Test(org.junit.Test)

Example 32 with Ds3ResponseCode

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.

the class BaseResponseParserGenerator_Test method getResponseCode_Test.

@Test
public void getResponseCode_Test() {
    final ImmutableList<Ds3ResponseCode> codes = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.test.ResponsePayload", null))), new Ds3ResponseCode(400, ImmutableList.of(new Ds3ResponseType("com.test.ErrorPayload", null))));
    final Integer result = getResponseCode(codes);
    assertThat(result, is(200));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Example 33 with Ds3ResponseCode

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.

the class ResponseAndParserUtil_Test method getImportFromResponseCode_ErrorResponseCode_Test.

@Test
public void getImportFromResponseCode_ErrorResponseCode_Test() {
    final Ds3ResponseCode responseCode = createPopulatedErrorResponseCode("");
    final String result = getImportFromResponseCode(responseCode);
    assertThat(result, is(""));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Test(org.junit.Test)

Example 34 with Ds3ResponseCode

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.

the class AllocateJobChunkParserGenerator_Test method toResponseCodeList_Test.

@Test
public void toResponseCodeList_Test() {
    final ImmutableList<Ds3ResponseCode> responseCodes = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.spectralogic.s3.server.domain.JobChunkApiBean", null))));
    final ImmutableList<ResponseCode> result = generator.toResponseCodeList(responseCodes, "TestResponse", false);
    assertThat(result.size(), is(3));
    assertThat(result.get(0).getCode(), is(200));
    assertThat(result.get(1).getCode(), is(307));
    assertThat(result.get(2).getCode(), is(503));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) ResponseCode(com.spectralogic.ds3autogen.java.models.ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Example 35 with Ds3ResponseCode

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.

the class AllocateJobChunkParserGenerator_Test method toParsePayloadCode_Test.

@Test
public void toParsePayloadCode_Test() {
    final String expected = "try (final InputStream inputStream = response.getResponseStream()) {\n" + "                    final JobChunkApiBean result = XmlOutput.fromXml(inputStream, JobChunkApiBean.class);\n" + "                    return new MyResponse(result, 0, MyResponse.Status.ALLOCATED, this.getChecksum(), this.getChecksumType());\n" + "                }\n";
    final Ds3ResponseCode ds3ResponseCode = new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.spectralogic.s3.server.domain.JobChunkApiBean", null)));
    final String result = toParsePayloadCode(ds3ResponseCode, "MyResponse");
    assertThat(result, is(expected));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Aggregations

Ds3ResponseCode (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode)52 Test (org.junit.Test)43 Ds3ResponseType (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType)30 ResponseCode (com.spectralogic.ds3autogen.java.models.ResponseCode)8 ResponseCode (com.spectralogic.ds3autogen.go.models.response.ResponseCode)6 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)4 ImmutableList (com.google.common.collect.ImmutableList)3 CaseFormat (com.google.common.base.CaseFormat)1 com.spectralogic.ds3autogen.api.models (com.spectralogic.ds3autogen.api.models)1 Action (com.spectralogic.ds3autogen.api.models.enums.Action)1 HttpVerb (com.spectralogic.ds3autogen.api.models.enums.HttpVerb)1 Operation (com.spectralogic.ds3autogen.api.models.enums.Operation)1 Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode (com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode)1 Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode (com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode)1 ResponseAndParserUtils.getDs3ResponseCode (com.spectralogic.ds3autogen.java.utils.ResponseAndParserUtils.getDs3ResponseCode)1 ConverterUtil.isEmpty (com.spectralogic.ds3autogen.utils.ConverterUtil.isEmpty)1 CustomArgumentComparator (com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator)1 java.util (java.util)1 Collectors (java.util.stream.Collectors)1 StringUtils (org.apache.commons.lang3.StringUtils)1