use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class BaseResponseGenerator_Test method getParsePayload_NoNameToMarshal_Test.
@Test
public void getParsePayload_NoNameToMarshal_Test() {
final Ds3Request request = getBucketRequest();
assertThat(getParsePayload(request), instanceOf(BaseParsePayload.class));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class BaseResponseGenerator_Test method getStatusCodes_Test.
@Test
public void getStatusCodes_Test() {
final Ds3Request request = getRequestAmazonS3GetObject();
final ImmutableList<Integer> result = generator.getStatusCodes(request.getDs3ResponseCodes(), request.getName());
assertThat(result, hasItem(200));
assertThat(result, hasItem(206));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class BaseResponseGenerator_Test method getParsePayload_NoPayload_Test.
@Test
public void getParsePayload_NoPayload_Test() {
final Ds3Request emptyRequest = createDs3RequestTestData("com.test.Request", Classification.amazons3);
assertThat(getParsePayload(emptyRequest), instanceOf(NoPayload.class));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class CCodeGeneratorAmazonS3InitRequests_Test method testGenerateInitAmazonS3WithOptionalQueryParams.
@Test
public void testGenerateInitAmazonS3WithOptionalQueryParams() throws IOException, ParseException, TemplateModelException {
final Map<String, Object> testMap = new HashMap<>();
final Request testRequest = RequestConverter.toRequest(new Ds3Request("com.spectralogic.s3.server.handler.reqhandler.amazons3.CreateObjectRequestHandler", HttpVerb.PUT, Classification.amazons3, Requirement.REQUIRED, Requirement.REQUIRED, null, null, null, null, false, null, ImmutableList.of(new Ds3Param("Job", "java.util.UUID", true), new Ds3Param("Offset", "long", false)), ImmutableList.of()), new Ds3DocSpecEmptyImpl());
testMap.put("requestEntry", testRequest);
final CCodeGenerator codeGenerator = new CCodeGenerator();
final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl();
codeGenerator.processTemplate(testMap, "request-templates/InitRequest.ftl", fileUtils.getOutputStream());
final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream();
final String output = new String(bstream.toByteArray());
final String expectedOutput = "ds3_request* ds3_init_create_object(const char *const bucket_name, const char *const object_name, const uint64_t length) {" + "\n" + " struct _ds3_request* request = _common_request_init(HTTP_PUT, _build_path(\"/\", bucket_name, object_name));" + "\n" + " request->length = length;" + "\n" + "\n" + " return (ds3_request*) request;" + "\n" + "}\n";
assertEquals(expectedOutput, output);
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class GetObjectParserGenerator_Test method toImportList_Test.
@Test
public void toImportList_Test() {
final Ds3Request request = getRequestAmazonS3GetObject();
final ImmutableSet<String> result = generator.toImportList("GetObjectResponse", request, request.getDs3ResponseCodes());
assertThat(result.size(), is(12));
assertThat(result, hasItem("com.spectralogic.ds3client.commands.GetObjectResponse"));
assertThat(result, hasItem("com.spectralogic.ds3client.commands.interfaces.MetadataImpl"));
assertThat(result, hasItem("com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser"));
assertThat(result, hasItem("com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils"));
assertThat(result, hasItem("com.spectralogic.ds3client.exceptions.ContentLengthNotMatchException"));
assertThat(result, hasItem("com.spectralogic.ds3client.networking.Metadata"));
assertThat(result, hasItem("com.spectralogic.ds3client.networking.WebResponse"));
assertThat(result, hasItem("com.spectralogic.ds3client.utils.IOUtils"));
assertThat(result, hasItem("com.spectralogic.ds3client.utils.PerformanceUtils"));
assertThat(result, hasItem("java.io.IOException"));
assertThat(result, hasItem("java.io.InputStream"));
assertThat(result, hasItem("java.nio.channels.WritableByteChannel"));
}
Aggregations