Search in sources :

Example 1 with BaseParseResponse

use of com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse in project ds3_autogen by SpectraLogic.

the class JavaFunctionalTests method getObjectsDetailsRequest_Test.

@Test
public void getObjectsDetailsRequest_Test() throws IOException, TemplateModelException {
    final String requestName = "GetObjectsDetailsSpectraS3Request";
    final FileUtils fileUtils = mock(FileUtils.class);
    final TestGeneratedComponentResponseCode testGeneratedCode = new TestGeneratedComponentResponseCode(fileUtils, requestName, "./ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/spectrads3/", "./ds3-sdk/src/main/java/com/spectralogic/ds3client/models/S3ObjectList.java");
    testGeneratedCode.generateCode(fileUtils, "/input/getObjectsDetailsRequestHandler.xml");
    final String requestGeneratedCode = testGeneratedCode.getRequestGeneratedCode();
    CODE_LOGGER.logFile(requestGeneratedCode, FileTypeToLog.REQUEST);
    //Verify that name mapped from GetObjects to GetObjectsDetailsSpectraS3
    assertTrue(extendsClass(requestName, "AbstractPaginationRequest", 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, "AbstractPaginationResponse", responseGeneratedCode));
    assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractPaginationResponse", responseGeneratedCode));
    assertTrue(isReqParamOfType("s3ObjectListResult", "S3ObjectList", responseName, responseGeneratedCode, false));
    assertTrue(isReqParamOfType("pagingTotalResultCount", "Integer", responseName, responseGeneratedCode, true));
    assertTrue(isReqParamOfType("pagingTruncated", "Integer", responseName, responseGeneratedCode, true));
    //Test the Ds3Client
    final String ds3ClientGeneratedCode = testGeneratedCode.getDs3ClientGeneratedCode();
    CODE_LOGGER.logFile(ds3ClientGeneratedCode, FileTypeToLog.CLIENT);
    testDs3Client(requestName, ds3ClientGeneratedCode);
    assertTrue(ds3ClientGeneratedCode.contains("@ResponsePayloadModel(\"S3ObjectList\")"));
    assertTrue(ds3ClientGeneratedCode.contains("@Action(\"LIST\")"));
    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.S3ObjectList", 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, "S3ObjectList", true);
    assertTrue(responseParserCode.contains(expectedParsing.toJavaCode()));
    assertTrue(responseParserCode.contains("private final int[] expectedStatusCodes = new int[]{200};"));
}
Also used : TestGeneratedComponentResponseCode(com.spectralogic.ds3autogen.java.utils.TestGeneratedComponentResponseCode) FileUtils(com.spectralogic.ds3autogen.api.FileUtils) BaseParseResponse(com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse) Test(org.junit.Test)

Example 2 with BaseParseResponse

use of com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse 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};"));
}
Also used : TestGeneratedCode(com.spectralogic.ds3autogen.java.utils.TestGeneratedCode) FileUtils(com.spectralogic.ds3autogen.api.FileUtils) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) BaseParseResponse(com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse) Test(org.junit.Test)

Example 3 with BaseParseResponse

use of com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse 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};"));
}
Also used : TestGeneratedCode(com.spectralogic.ds3autogen.java.utils.TestGeneratedCode) FileUtils(com.spectralogic.ds3autogen.api.FileUtils) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) BaseParseResponse(com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse) Test(org.junit.Test)

Example 4 with BaseParseResponse

use of com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse in project ds3_autogen by SpectraLogic.

the class JavaFunctionalTests method getJobCompletedNotificationRegistrationsRequestHandler.

@Test
public void getJobCompletedNotificationRegistrationsRequestHandler() throws IOException, TemplateModelException {
    final String requestName = "GetJobCompletedNotificationRegistrationsSpectraS3Request";
    final FileUtils fileUtils = mock(FileUtils.class);
    final TestGeneratedComponentResponseCode testGeneratedCode = new TestGeneratedComponentResponseCode(fileUtils, requestName, "./ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/spectrads3/notifications/", "./ds3-sdk/src/main/java/com/spectralogic/ds3client/models/JobCompletedNotificationRegistrationList.java");
    testGeneratedCode.generateCode(fileUtils, "/input/getJobCompletedNotificationRegistrationsRequestHandler.xml");
    final String requestGeneratedCode = testGeneratedCode.getRequestGeneratedCode();
    CODE_LOGGER.logFile(requestGeneratedCode, FileTypeToLog.REQUEST);
    assertTrue(extendsClass(requestName, "AbstractPaginationRequest", requestGeneratedCode));
    assertTrue(hasPath("\"/_rest_/job_completed_notification_registration\"", requestGeneratedCode));
    assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3.notifications", requestGeneratedCode));
    assertTrue(hasImport("java.util.UUID", requestGeneratedCode));
    assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractPaginationRequest", requestGeneratedCode));
    assertTrue(isOptParamOfType("LastPage", "boolean", requestName, requestGeneratedCode, false));
    assertTrue(isOptParamOfType("PageLength", "int", requestName, requestGeneratedCode, false));
    assertTrue(isOptParamOfType("PageOffset", "int", requestName, requestGeneratedCode, false));
    assertTrue(isOptParamOfType("PageStartMarker", "String", requestName, requestGeneratedCode, false));
    assertTrue(isOptParamOfType("UserId", "String", requestName, requestGeneratedCode, false));
    assertTrue(hasCopyright(requestGeneratedCode));
    assertFalse(doesConstructorContainParam("Test", "boolean", requestName, requestGeneratedCode));
    assertFalse(isReqVariable("Test", "boolean", requestGeneratedCode));
    assertFalse(hasGetter("Test", "boolean", requestGeneratedCode));
    assertTrue(hasConstructor(requestName, ImmutableList.of(), 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, "AbstractPaginationResponse", responseGeneratedCode));
    assertTrue(isOfPackage("com.spectralogic.ds3client.commands.spectrads3.notifications", responseGeneratedCode));
    assertTrue(hasImport("com.spectralogic.ds3client.commands.interfaces.AbstractPaginationResponse", responseGeneratedCode));
    assertTrue(hasImport("com.spectralogic.ds3client.models.JobCompletedNotificationRegistrationList", responseGeneratedCode));
    assertTrue(isReqParamOfType("jobCompletedNotificationRegistrationListResult", "JobCompletedNotificationRegistrationList", responseName, responseGeneratedCode, false));
    assertTrue(isReqParamOfType("pagingTotalResultCount", "Integer", responseName, responseGeneratedCode, true));
    assertTrue(isReqParamOfType("pagingTruncated", "Integer", responseName, responseGeneratedCode, true));
    //Test the Ds3Client
    final String ds3ClientGeneratedCode = testGeneratedCode.getDs3ClientGeneratedCode();
    CODE_LOGGER.logFile(ds3ClientGeneratedCode, FileTypeToLog.CLIENT);
    testDs3Client(requestName, ds3ClientGeneratedCode);
    assertTrue(ds3ClientGeneratedCode.contains("@ResponsePayloadModel(\"JobCompletedNotificationRegistrationList\")"));
    assertTrue(ds3ClientGeneratedCode.contains("@Action(\"LIST\")"));
    assertTrue(ds3ClientGeneratedCode.contains("@Resource(\"JOB_COMPLETED_NOTIFICATION_REGISTRATION\")"));
    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.notifications." + responseName, responseParserCode));
    assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser", responseParserCode));
    assertTrue(hasImport("com.spectralogic.ds3client.models.JobCompletedNotificationRegistrationList", 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, "JobCompletedNotificationRegistrationList", true);
    assertTrue(responseParserCode.contains(expectedParsing.toJavaCode()));
    assertTrue(responseParserCode.contains("private final int[] expectedStatusCodes = new int[]{200};"));
}
Also used : TestGeneratedComponentResponseCode(com.spectralogic.ds3autogen.java.utils.TestGeneratedComponentResponseCode) FileUtils(com.spectralogic.ds3autogen.api.FileUtils) BaseParseResponse(com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse) Test(org.junit.Test)

Example 5 with BaseParseResponse

use of com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse in project ds3_autogen by SpectraLogic.

the class JavaFunctionalTests method getBucketsAMZ_Test.

@Test
public void getBucketsAMZ_Test() throws IOException, TemplateModelException {
    final String requestName = "GetServiceRequest";
    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/getBucketsAMZ.xml");
    final String requestGeneratedCode = testGeneratedCode.getRequestGeneratedCode();
    CODE_LOGGER.logFile(requestGeneratedCode, FileTypeToLog.REQUEST);
    //Verify that name mapped from GetBuckets to GetService
    assertTrue(extendsClass(requestName, "AbstractRequest", 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(isReqParamOfType("listAllMyBucketsResult", "ListAllMyBucketsResult", responseName, responseGeneratedCode, false));
    //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.models.ListAllMyBucketsResult", responseParserCode));
    assertTrue(hasImport("com.spectralogic.ds3client.serializer.XmlOutput", responseParserCode));
    assertTrue(hasImport("com.spectralogic.ds3client.networking.WebResponse", responseParserCode));
    assertTrue(hasImport("java.io.IOException", responseParserCode));
    assertTrue(hasImport("java.io.InputStream", responseParserCode));
    assertTrue(hasImport("com.spectralogic.ds3client.commands.GetServiceResponse", responseParserCode));
    assertTrue(hasImport("com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils", responseParserCode));
    final BaseParseResponse expectedParsing = new BaseParseResponse(responseName, "ListAllMyBucketsResult");
    assertTrue(responseParserCode.contains(expectedParsing.toJavaCode()));
    assertTrue(responseParserCode.contains("private final int[] expectedStatusCodes = new int[]{200};"));
}
Also used : TestGeneratedCode(com.spectralogic.ds3autogen.java.utils.TestGeneratedCode) FileUtils(com.spectralogic.ds3autogen.api.FileUtils) BaseParseResponse(com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse) Test(org.junit.Test)

Aggregations

FileUtils (com.spectralogic.ds3autogen.api.FileUtils)18 BaseParseResponse (com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse)18 Test (org.junit.Test)18 TestGeneratedCode (com.spectralogic.ds3autogen.java.utils.TestGeneratedCode)15 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)14 TestGeneratedComponentResponseCode (com.spectralogic.ds3autogen.java.utils.TestGeneratedComponentResponseCode)3 NullParseResponse (com.spectralogic.ds3autogen.java.models.parseresponse.NullParseResponse)1