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));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode in project ds3_autogen by SpectraLogic.
the class GetJobChunksReadyParserGenerator_Test method toParsePayloadCode_Test.
@Test
public void toParsePayloadCode_Test() {
final String expected = "try (final InputStream inputStream = response.getResponseStream()) {\n" + " final JobWithChunksApiBean result = XmlOutput.fromXml(inputStream, JobWithChunksApiBean.class);\n" + " if (isNullOrEmpty(result.getObjects())) {\n" + " return new TestResponse(result, parseRetryAfter(response), TestResponse.Status.RETRYLATER, this.getChecksum(), this.getChecksumType());\n" + " }\n" + " return new TestResponse(result, 0, TestResponse.Status.AVAILABLE, this.getChecksum(), this.getChecksumType());\n" + " }\n";
final Ds3ResponseCode ds3ResponseCode = new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.spectralogic.s3.server.domain.JobWithChunksApiBean", null)));
final String result = toParsePayloadCode(ds3ResponseCode, "TestResponse");
assertThat(result, is(expected));
}
Aggregations