use of com.spectralogic.ds3autogen.java.utils.TestGeneratedCode in project ds3_autogen by SpectraLogic.
the class JavaFunctionalTests method getJobChunksReadyForClientProcessingRequest.
@Test
public void getJobChunksReadyForClientProcessingRequest() throws IOException, TemplateModelException {
final String requestName = "GetJobChunksReadyForClientProcessingSpectraS3Request";
final FileUtils fileUtils = mock(FileUtils.class);
final TestGeneratedCode testGeneratedCode = new TestGeneratedCode(fileUtils, requestName, "./ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/spectrads3/");
testGeneratedCode.generateCode(fileUtils, "/input/getJobChunksReadyForClientProcessingRequest.xml");
final String requestGeneratedCode = testGeneratedCode.getRequestGeneratedCode();
CODE_LOGGER.logFile(requestGeneratedCode, FileTypeToLog.REQUEST);
assertTrue(extendsClass(requestName, "AbstractRequest", requestGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3", requestGeneratedCode));
assertTrue(hasCopyright(requestGeneratedCode));
assertTrue(isReqParamOfType("Job", "String", requestName, requestGeneratedCode, false));
assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractRequest", requestGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.networking.HttpVerb", requestGeneratedCode));
assertTrue(hasImport("java.util.UUID", requestGeneratedCode));
assertTrue(doesNotHaveOperation(requestGeneratedCode));
assertTrue(hasPath("\"/_rest_/job_chunk\"", requestGeneratedCode));
final ImmutableList<Arguments> constructorArgs = ImmutableList.of(new Arguments("UUID", "Job"));
assertTrue(hasConstructor(requestName, constructorArgs, requestGeneratedCode));
assertTrue(hasConstructor(requestName, modifyType(constructorArgs, "UUID", "String"), requestGeneratedCode));
//Test the generated response
final String responseGeneratedCode = testGeneratedCode.getResponseGeneratedCode();
CODE_LOGGER.logFile(responseGeneratedCode, FileTypeToLog.RESPONSE);
final String responseName = requestName.replace("Request", "Response");
assertTrue(extendsClass(responseName, "AbstractResponse", responseGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3", responseGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractResponse", responseGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.MasterObjectList", responseGeneratedCode));
assertTrue(isReqParamOfType("masterObjectListResult", "MasterObjectList", responseName, responseGeneratedCode, false));
assertTrue(isReqParamOfType("retryAfterSeconds", "int", responseName, responseGeneratedCode, false));
assertTrue(isReqParamOfType("status", "Status", responseName, responseGeneratedCode, false));
assertTrue(responseGeneratedCode.contains("public enum Status { AVAILABLE, RETRYLATER }"));
//Test the Ds3Client
final String ds3ClientGeneratedCode = testGeneratedCode.getDs3ClientGeneratedCode();
CODE_LOGGER.logFile(ds3ClientGeneratedCode, FileTypeToLog.CLIENT);
testDs3Client(requestName, ds3ClientGeneratedCode);
assertTrue(ds3ClientGeneratedCode.contains("@ResponsePayloadModel(\"MasterObjectList\")"));
assertTrue(ds3ClientGeneratedCode.contains("@Action(\"LIST\")"));
assertTrue(ds3ClientGeneratedCode.contains("@Resource(\"JOB_CHUNK\")"));
final String ds3ClientImplGeneratedCode = testGeneratedCode.getDs3ClientImplGeneratedCode();
CODE_LOGGER.logFile(ds3ClientImplGeneratedCode, FileTypeToLog.CLIENT);
testDs3ClientImpl(requestName, ds3ClientImplGeneratedCode);
//Test the response parser
final String responseParserCode = testGeneratedCode.getResponseParserGeneratedCode();
CODE_LOGGER.logFile(responseParserCode, FileTypeToLog.PARSER);
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.parsers", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.networking.WebResponse", responseParserCode));
assertTrue(hasImport("java.io.IOException", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.spectrads3." + responseName, responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.exceptions.RetryAfterExpectedException", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.MasterObjectList", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.serializer.XmlOutput", responseParserCode));
assertTrue(hasImport("java.io.InputStream", responseParserCode));
assertTrue(responseParserCode.contains("import static com.spectralogic.ds3client.utils.Guard.isNullOrEmpty"));
assertTrue(responseParserCode.contains("return new GetJobChunksReadyForClientProcessingSpectraS3Response(result, parseRetryAfter(response), GetJobChunksReadyForClientProcessingSpectraS3Response.Status.RETRYLATER, this.getChecksum(), this.getChecksumType());"));
assertTrue(responseParserCode.contains("return new GetJobChunksReadyForClientProcessingSpectraS3Response(result, 0, GetJobChunksReadyForClientProcessingSpectraS3Response.Status.AVAILABLE, this.getChecksum(), this.getChecksumType());"));
assertTrue(responseParserCode.contains("private final int[] expectedStatusCodes = new int[]{200};"));
}
use of com.spectralogic.ds3autogen.java.utils.TestGeneratedCode in project ds3_autogen by SpectraLogic.
the class JavaFunctionalTests method headBucketRequest.
@Test
public void headBucketRequest() throws IOException, TemplateModelException {
final String requestName = "HeadBucketRequest";
final FileUtils fileUtils = mock(FileUtils.class);
final TestGeneratedCode testGeneratedCode = new TestGeneratedCode(fileUtils, requestName, "./ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/");
testGeneratedCode.generateCode(fileUtils, "/input/headBucketRequest.xml");
final String requestGeneratedCode = testGeneratedCode.getRequestGeneratedCode();
CODE_LOGGER.logFile(requestGeneratedCode, FileTypeToLog.REQUEST);
assertTrue(extendsClass(requestName, "AbstractRequest", requestGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands", requestGeneratedCode));
assertTrue(hasCopyright(requestGeneratedCode));
assertTrue(isReqParamOfType("BucketName", "String", requestName, requestGeneratedCode, false));
assertFalse(hasImport("com.spectralogic.ds3client.commands.AbstractRequest", requestGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.networking.HttpVerb", requestGeneratedCode));
assertTrue(doesNotHaveOperation(requestGeneratedCode));
assertTrue(hasPath("\"/\" + this.bucketName", requestGeneratedCode));
final ImmutableList<Arguments> constructorArgs = ImmutableList.of(new Arguments("String", "BucketName"));
assertTrue(hasConstructor(requestName, constructorArgs, requestGeneratedCode));
//Test the generated response
final String responseGeneratedCode = testGeneratedCode.getResponseGeneratedCode();
CODE_LOGGER.logFile(responseGeneratedCode, FileTypeToLog.RESPONSE);
final String responseName = requestName.replace("Request", "Response");
assertTrue(extendsClass(responseName, "AbstractResponse", responseGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands", responseGeneratedCode));
assertFalse(hasImport("com.spectralogic.ds3client.commands.AbstractResponse", responseGeneratedCode));
assertTrue(isReqParamOfType("status", "Status", responseName, responseGeneratedCode, false));
assertTrue(responseGeneratedCode.contains("public enum Status { EXISTS, DOESNTEXIST, NOTAUTHORIZED, UNKNOWN }"));
//Test the Ds3Client
final String ds3ClientGeneratedCode = testGeneratedCode.getDs3ClientGeneratedCode();
CODE_LOGGER.logFile(ds3ClientGeneratedCode, FileTypeToLog.CLIENT);
testDs3Client(requestName, ds3ClientGeneratedCode);
final String ds3ClientImplGeneratedCode = testGeneratedCode.getDs3ClientImplGeneratedCode();
CODE_LOGGER.logFile(ds3ClientImplGeneratedCode, FileTypeToLog.CLIENT);
testDs3ClientImpl(requestName, ds3ClientImplGeneratedCode);
//Test the response parser
final String responseParserCode = testGeneratedCode.getResponseParserGeneratedCode();
CODE_LOGGER.logFile(responseParserCode, FileTypeToLog.PARSER);
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.parsers", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.networking.WebResponse", responseParserCode));
assertTrue(hasImport("java.io.IOException", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands." + responseName, responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils", responseParserCode));
assertTrue(responseParserCode.contains("return new HeadBucketResponse(HeadBucketResponse.Status.EXISTS, this.getChecksum(), this.getChecksumType());"));
assertTrue(responseParserCode.contains("return new HeadBucketResponse(HeadBucketResponse.Status.NOTAUTHORIZED, this.getChecksum(), this.getChecksumType());"));
assertTrue(responseParserCode.contains("return new HeadBucketResponse(HeadBucketResponse.Status.DOESNTEXIST, this.getChecksum(), this.getChecksumType());"));
assertTrue(responseParserCode.contains("private final int[] expectedStatusCodes = new int[]{200, 403, 404};"));
}
use of com.spectralogic.ds3autogen.java.utils.TestGeneratedCode in project ds3_autogen by SpectraLogic.
the class JavaFunctionalTests method createPutJobRequestHandler.
@Test
public void createPutJobRequestHandler() throws IOException, TemplateModelException {
final String requestName = "PutBulkJobSpectraS3Request";
final FileUtils fileUtils = mock(FileUtils.class);
final TestGeneratedCode testGeneratedCode = new TestGeneratedCode(fileUtils, requestName, "./ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/spectrads3/");
testGeneratedCode.generateCode(fileUtils, "/input/createPutJobRequestHandler.xml");
final String requestGeneratedCode = testGeneratedCode.getRequestGeneratedCode();
CODE_LOGGER.logFile(requestGeneratedCode, FileTypeToLog.REQUEST);
assertTrue(extendsClass(requestName, "BulkRequest", requestGeneratedCode));
assertTrue(hasMethod("getCommand", "BulkCommand", Scope.PUBLIC, requestGeneratedCode));
assertTrue(isOptParamOfType("IgnoreNamingConflicts", "boolean", requestName, requestGeneratedCode, false));
assertTrue(isOptParamOfType("MaxUploadSize", "long", requestName, requestGeneratedCode, true));
assertTrue(isOptParamOfType("Priority", "Priority", requestName, requestGeneratedCode, true));
assertFalse(hasGetter("MaxUploadSize", "long", requestGeneratedCode));
assertFalse(isReqVariable("BucketName", "String", requestGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.BulkCommand", requestGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.Priority", requestGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.bulk.Ds3Object", requestGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.BulkRequest", requestGeneratedCode));
assertFalse(hasImport("java.util.List", requestGeneratedCode));
assertFalse(hasImport("com.spectralogic.ds3client.serializer.XmlProcessingException", requestGeneratedCode));
assertFalse(requestGeneratedCode.contains("XmlProcessingException"));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3", requestGeneratedCode));
assertFalse(requestGeneratedCode.contains("RestOperationType"));
assertTrue(hasOperation(Operation.START_BULK_PUT, requestGeneratedCode));
assertTrue(hasCopyright(requestGeneratedCode));
final ImmutableList<Arguments> constructorArgs = ImmutableList.of(new Arguments("String", "BucketName"), new Arguments("Iterable<Ds3Object>", "Objects"));
assertTrue(hasConstructor(requestName, constructorArgs, requestGeneratedCode));
//Test the generated response
final String responseGeneratedCode = testGeneratedCode.getResponseGeneratedCode();
CODE_LOGGER.logFile(responseGeneratedCode, FileTypeToLog.RESPONSE);
final String responseName = requestName.replace("Request", "Response");
assertTrue(extendsClass(responseName, "BulkResponse", responseGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3", responseGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.MasterObjectList", responseGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.BulkResponse", responseGeneratedCode));
final ImmutableList<Arguments> responseConstructorArg = ImmutableList.of(new Arguments("MasterObjectList", "masterObjectListResult"), new Arguments("String", "checksum"), new Arguments("ChecksumType.Type", "checksumType"));
assertTrue(hasUnsortedConstructor(responseName, responseConstructorArg, responseGeneratedCode));
//Test the Ds3Client
final String ds3ClientGeneratedCode = testGeneratedCode.getDs3ClientGeneratedCode();
CODE_LOGGER.logFile(ds3ClientGeneratedCode, FileTypeToLog.CLIENT);
testDs3Client(requestName, ds3ClientGeneratedCode);
assertTrue(ds3ClientGeneratedCode.contains("@ResponsePayloadModel(\"MasterObjectList\")"));
assertTrue(ds3ClientGeneratedCode.contains("@Action(\"MODIFY\")"));
assertTrue(ds3ClientGeneratedCode.contains("@Resource(\"BUCKET\")"));
final String ds3ClientImplGeneratedCode = testGeneratedCode.getDs3ClientImplGeneratedCode();
CODE_LOGGER.logFile(ds3ClientImplGeneratedCode, FileTypeToLog.CLIENT);
testDs3ClientImpl(requestName, ds3ClientImplGeneratedCode);
//Test the response parser
final String responseParserCode = testGeneratedCode.getResponseParserGeneratedCode();
CODE_LOGGER.logFile(responseParserCode, FileTypeToLog.PARSER);
checkBulkResponseParserCode(responseName, responseParserCode);
assertTrue(responseParserCode.contains("private final int[] expectedStatusCodes = new int[]{200};"));
}
use of com.spectralogic.ds3autogen.java.utils.TestGeneratedCode in project ds3_autogen by SpectraLogic.
the class JavaFunctionalTests method getJobRequest.
@Test
public void getJobRequest() throws IOException, TemplateModelException {
final String requestName = "GetJobSpectraS3Request";
final FileUtils fileUtils = mock(FileUtils.class);
final TestGeneratedCode testGeneratedCode = new TestGeneratedCode(fileUtils, requestName, "./ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/spectrads3/");
testGeneratedCode.generateCode(fileUtils, "/input/getJobRequestHandler.xml");
final String requestGeneratedCode = testGeneratedCode.getRequestGeneratedCode();
CODE_LOGGER.logFile(requestGeneratedCode, FileTypeToLog.REQUEST);
assertTrue(extendsClass(requestName, "AbstractRequest", requestGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3", requestGeneratedCode));
assertTrue(hasCopyright(requestGeneratedCode));
assertTrue(isReqParamOfType("JobId", "String", requestName, requestGeneratedCode, false));
assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractRequest", requestGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.networking.HttpVerb", requestGeneratedCode));
assertTrue(hasImport("java.util.UUID", requestGeneratedCode));
assertTrue(doesNotHaveOperation(requestGeneratedCode));
assertTrue(hasPath("\"/_rest_/job/\" + jobId", requestGeneratedCode));
final ImmutableList<Arguments> constructorArgs = ImmutableList.of(new Arguments("UUID", "JobId"));
assertTrue(hasConstructor(requestName, constructorArgs, requestGeneratedCode));
assertTrue(hasConstructor(requestName, modifyType(constructorArgs, "UUID", "String"), requestGeneratedCode));
assertTrue(requestGeneratedCode.contains("public int hashCode()"));
assertTrue(requestGeneratedCode.contains("public boolean equals(final Object obj)"));
//Test the generated response
final String responseGeneratedCode = testGeneratedCode.getResponseGeneratedCode();
CODE_LOGGER.logFile(responseGeneratedCode, FileTypeToLog.RESPONSE);
final String responseName = requestName.replace("Request", "Response");
assertTrue(extendsClass(responseName, "AbstractResponse", responseGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3", responseGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractResponse", responseGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.MasterObjectList", responseGeneratedCode));
assertTrue(isReqParamOfType("masterObjectListResult", "MasterObjectList", responseName, responseGeneratedCode, false));
//Test the Ds3Client
final String ds3ClientGeneratedCode = testGeneratedCode.getDs3ClientGeneratedCode();
CODE_LOGGER.logFile(ds3ClientGeneratedCode, FileTypeToLog.CLIENT);
testDs3Client(requestName, ds3ClientGeneratedCode);
assertTrue(ds3ClientGeneratedCode.contains("@ResponsePayloadModel(\"MasterObjectList\")"));
assertTrue(ds3ClientGeneratedCode.contains("@Action(\"SHOW\")"));
assertTrue(ds3ClientGeneratedCode.contains("@Resource(\"JOB\")"));
final String ds3ClientImplGeneratedCode = testGeneratedCode.getDs3ClientImplGeneratedCode();
CODE_LOGGER.logFile(ds3ClientImplGeneratedCode, FileTypeToLog.CLIENT);
testDs3ClientImpl(requestName, ds3ClientImplGeneratedCode);
//Test the response parser
final String responseParserCode = testGeneratedCode.getResponseParserGeneratedCode();
CODE_LOGGER.logFile(responseParserCode, FileTypeToLog.PARSER);
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.parsers", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.spectrads3." + responseName, responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.MasterObjectList", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.networking.WebResponse", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.serializer.XmlOutput", responseParserCode));
assertTrue(hasImport("java.io.IOException", responseParserCode));
assertTrue(hasImport("java.io.InputStream", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils", responseParserCode));
final BaseParseResponse expectedParsing = new BaseParseResponse(responseName, "MasterObjectList");
assertTrue(responseParserCode.contains(expectedParsing.toJavaCode()));
assertTrue(responseParserCode.contains("private final int[] expectedStatusCodes = new int[]{200};"));
}
use of com.spectralogic.ds3autogen.java.utils.TestGeneratedCode in project ds3_autogen by SpectraLogic.
the class JavaFunctionalTests method getObjectSpectraS3RequestHandler.
@Test
public void getObjectSpectraS3RequestHandler() throws IOException, TemplateModelException {
final String requestName = "GetObjectDetailsSpectraS3Request";
final FileUtils fileUtils = mock(FileUtils.class);
final TestGeneratedCode testGeneratedCode = new TestGeneratedCode(fileUtils, requestName, "./ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/spectrads3/");
testGeneratedCode.generateCode(fileUtils, "/input/getObjectSpectraS3RequestHandler.xml");
final String requestGeneratedCode = testGeneratedCode.getRequestGeneratedCode();
CODE_LOGGER.logFile(requestGeneratedCode, FileTypeToLog.REQUEST);
assertTrue(extendsClass(requestName, "AbstractRequest", requestGeneratedCode));
assertTrue(isReqParamOfType("BucketId", "String", requestName, requestGeneratedCode, false));
assertTrue(isReqParamOfType("ObjectName", "String", requestName, requestGeneratedCode, false));
assertFalse(hasStaticMethod("buildRangeHeaderText", "String", Scope.PRIVATE, requestGeneratedCode));
assertFalse(isOptParamOfType("ByteRanges", "Collection<Range>", requestName, requestGeneratedCode, true));
assertFalse(isReqParamOfType("Channel", "WritableByteChannel", requestName, requestGeneratedCode, false));
assertTrue(hasImport("com.spectralogic.ds3client.networking.HttpVerb", requestGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractRequest", requestGeneratedCode));
assertFalse(hasImport("com.google.common.base.Joiner", requestGeneratedCode));
assertFalse(hasImport("com.google.common.collect.ImmutableCollection", requestGeneratedCode));
assertFalse(hasImport("com.google.common.collect.ImmutableList", requestGeneratedCode));
assertFalse(hasImport("com.spectralogic.ds3client.models.common.Range", requestGeneratedCode));
assertFalse(hasImport("org.apache.http.entity.ContentType", requestGeneratedCode));
assertFalse(hasImport("java.nio.channels.WritableByteChannel", requestGeneratedCode));
assertFalse(hasImport("java.util.Collection", requestGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3", requestGeneratedCode));
assertTrue(doesNotHaveOperation(requestGeneratedCode));
assertTrue(hasCopyright(requestGeneratedCode));
assertTrue(hasPath("\"/_rest_/object/\" + objectName", requestGeneratedCode));
final ImmutableList<Arguments> constructorArgs = ImmutableList.of(new Arguments("String", "BucketId"), new Arguments("String", "ObjectName"));
assertTrue(hasConstructor(requestName, constructorArgs, requestGeneratedCode));
//Test the generated response
final String responseGeneratedCode = testGeneratedCode.getResponseGeneratedCode();
CODE_LOGGER.logFile(responseGeneratedCode, FileTypeToLog.RESPONSE);
final String responseName = requestName.replace("Request", "Response");
assertTrue(extendsClass(responseName, "AbstractResponse", responseGeneratedCode));
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3", responseGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractResponse", responseGeneratedCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.S3Object", responseGeneratedCode));
assertTrue(isReqParamOfType("s3ObjectResult", "S3Object", responseName, responseGeneratedCode, false));
//Test the Ds3Client
final String ds3ClientGeneratedCode = testGeneratedCode.getDs3ClientGeneratedCode();
CODE_LOGGER.logFile(ds3ClientGeneratedCode, FileTypeToLog.CLIENT);
testDs3Client(requestName, ds3ClientGeneratedCode);
assertTrue(ds3ClientGeneratedCode.contains("@ResponsePayloadModel(\"S3Object\")"));
assertTrue(ds3ClientGeneratedCode.contains("@Action(\"SHOW\")"));
assertTrue(ds3ClientGeneratedCode.contains("@Resource(\"OBJECT\")"));
final String ds3ClientImplGeneratedCode = testGeneratedCode.getDs3ClientImplGeneratedCode();
CODE_LOGGER.logFile(ds3ClientImplGeneratedCode, FileTypeToLog.CLIENT);
testDs3ClientImpl(requestName, ds3ClientImplGeneratedCode);
//Test the response parser
final String responseParserCode = testGeneratedCode.getResponseParserGeneratedCode();
CODE_LOGGER.logFile(responseParserCode, FileTypeToLog.PARSER);
assertTrue(isOfPackage("com.spectralogic.ds3client.commands.parsers", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.spectrads3." + responseName, responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.models.S3Object", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.networking.WebResponse", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.serializer.XmlOutput", responseParserCode));
assertTrue(hasImport("java.io.IOException", responseParserCode));
assertTrue(hasImport("java.io.InputStream", responseParserCode));
assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils", responseParserCode));
final BaseParseResponse expectedParsing = new BaseParseResponse(responseName, "S3Object");
assertTrue(responseParserCode.contains(expectedParsing.toJavaCode()));
assertTrue(responseParserCode.contains("private final int[] expectedStatusCodes = new int[]{200};"));
}
Aggregations