use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.
the class BaseResponseGenerator_Test method toResponsePayloadType_MultipleCodes_Test.
@Test
public void toResponsePayloadType_MultipleCodes_Test() {
final String expected = "*Type";
final ImmutableList<Ds3ResponseCode> input = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of()), new Ds3ResponseCode(204, ImmutableList.of()), new Ds3ResponseCode(300, ImmutableList.of()));
final String result = generator.toResponsePayloadType("com.test.Type", input);
assertThat(result, is(expected));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.
the class BaseResponseGenerator_Test method toExpectedStatusCodes_Test.
@Test
public void toExpectedStatusCodes_Test() {
final String expected = "200, 204";
final ImmutableList<Ds3ResponseCode> responseCodes = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of()), new Ds3ResponseCode(204, ImmutableList.of()), new Ds3ResponseCode(300, ImmutableList.of()));
final String result = generator.toExpectedStatusCodes(responseCodes);
assertThat(result, is(expected));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.
the class AllocateJobChunkParserGenerator method toResponseCodeList.
/**
* Gets the non-error response codes required to generate this response
*/
@Override
public ImmutableList<ResponseCode> toResponseCodeList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes, final String responseName, final boolean hasPaginationHeaders) {
//Verify that the expected status codes are present
final ImmutableList<Integer> codes = getResponseCodes(ds3ResponseCodes);
if (!codes.containsAll(EXPECTED_RESPONSE_CODES)) {
throw new IllegalArgumentException("Does not contain expected response codes: " + EXPECTED_RESPONSE_CODES.toString());
}
final ResponseCode code200 = new ResponseCode(200, toParsePayloadCode(getDs3ResponseCode(ds3ResponseCodes, 200), responseName));
// The switch case for 307 should fall through to the 503 handling
final ResponseCode code307 = new ResponseCode(307, "");
final ResponseCode code503 = new ResponseCode(503, toRetryLaterCode(responseName));
return ImmutableList.of(code200, code307, code503);
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.
the class GetJobChunksReadyParserGenerator method toResponseCodeList.
/**
* Gets the non-error response codes required to generate this response
*/
@Override
public ImmutableList<ResponseCode> toResponseCodeList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes, final String responseName, final boolean hasPaginationHeaders) {
//Verify that the expected status codes are present
final ImmutableList<Integer> codes = getResponseCodes(ds3ResponseCodes);
if (!codes.containsAll(EXPECTED_RESPONSE_CODES)) {
throw new IllegalArgumentException("Does not contain expected response codes: " + EXPECTED_RESPONSE_CODES.toString());
}
final Ds3ResponseCode ds3ResponseCode = getDs3ResponseCode(ds3ResponseCodes, 200);
final ResponseCode code200 = new ResponseCode(200, toParsePayloadCode(ds3ResponseCode, responseName));
return ImmutableList.of(code200);
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.
the class HeadBucketParserGenerator method toResponseCodeList.
/**
* Gets the non-error response codes required to generate this response
*/
@Override
public ImmutableList<ResponseCode> toResponseCodeList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes, final String responseName, final boolean hasPaginationHeaders) {
//Verify that the expected status codes are present
final ImmutableList<Integer> codes = getResponseCodes(ds3ResponseCodes);
if (!codes.containsAll(EXPECTED_RESPONSE_CODES)) {
throw new IllegalArgumentException("Does not contain expected response codes: " + EXPECTED_RESPONSE_CODES.toString());
}
final ResponseCode code200 = new ResponseCode(200, toReturnCode(responseName, "EXISTS"));
final ResponseCode code403 = new ResponseCode(403, toReturnCode(responseName, "NOTAUTHORIZED"));
final ResponseCode code404 = new ResponseCode(404, toReturnCode(responseName, "DOESNTEXIST"));
return ImmutableList.of(code200, code403, code404);
}
Aggregations