Search in sources :

Example 56 with Ds3Request

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.

the class BaseClientGenerator_Test method toVoidCommand_Test.

@Test
public void toVoidCommand_Test() throws IOException {
    final Ds3Request request = createTestRequestWithResponseCodes("com.test.WithoutPayloadRequest", false);
    final VoidCommand result = toVoidCommand(request, getTestDocSpec());
    assertThat(result.getCommandName(), is("WithoutPayload"));
    assertThat(result.getRequestName(), is("WithoutPayloadRequest"));
    assertThat(result.getResponseType(), is("void"));
}
Also used : VoidCommand(com.spectralogic.ds3autogen.net.model.client.VoidCommand) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 57 with Ds3Request

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.

the class Ds3SpecParserImpl_Test method SingleRequestHandler.

@Test
public void SingleRequestHandler() throws IOException {
    final Ds3SpecParser parser = new Ds3SpecParserImpl();
    final Ds3ApiSpec spec = parser.getSpec(Ds3SpecParserImpl_Test.class.getResourceAsStream("/specs/singleRequestHandler.xml"));
    assertThat(spec, is(notNullValue()));
    assertThat(spec.getRequests().size(), is(1));
    final Ds3Request ds3Request = spec.getRequests().get(0);
    assertThat(ds3Request.getName(), is("com.spectralogic.s3.server.handler.reqhandler.amazons3.GetObjectRequest"));
    assertThat(ds3Request.getHttpVerb(), is(HttpVerb.GET));
    assertThat(ds3Request.getClassification(), is(Classification.amazons3));
    assertThat(ds3Request.getBucketRequirement(), is(Requirement.REQUIRED));
    assertThat(ds3Request.getObjectRequirement(), is(Requirement.REQUIRED));
    assertThat(ds3Request.getAction(), is(nullValue()));
    assertThat(ds3Request.getResource(), is(nullValue()));
    assertThat(ds3Request.getResourceType(), is(nullValue()));
    assertThat(ds3Request.getOperation(), is(nullValue()));
    assertThat(ds3Request.getDs3ResponseCodes().size(), is(1));
    assertThat(ds3Request.getDs3ResponseCodes().get(0).getCode(), is(200));
    assertThat(ds3Request.getDs3ResponseCodes().get(0).getDs3ResponseTypes().size(), is(1));
    assertThat(ds3Request.getDs3ResponseCodes().get(0).getDs3ResponseTypes().get(0).getType(), is("java.lang.String"));
    assertThat(ds3Request.getDs3ResponseCodes().get(0).getDs3ResponseTypes().get(0).getComponentType(), is(nullValue()));
    assertThat(ds3Request.getOptionalQueryParams().size(), is(0));
    assertThat(ds3Request.getRequiredQueryParams().size(), is(1));
    assertThat(ds3Request.getRequiredQueryParams().get(0).getName(), is("Id"));
    assertThat(ds3Request.getRequiredQueryParams().get(0).getType(), is("java.util.UUID"));
}
Also used : Ds3SpecParser(com.spectralogic.ds3autogen.api.Ds3SpecParser) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Ds3ApiSpec(com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec) Test(org.junit.Test)

Example 58 with Ds3Request

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.

the class NotificationRequestGenerator_Test method toConstructorList_Test.

@Test
public void toConstructorList_Test() {
    final Ds3Request request = getRequestDeleteNotification();
    final ImmutableList<RequestConstructor> result = generator.toConstructorList(request, "", new Ds3DocSpecEmptyImpl());
    assertThat(result.size(), is(1));
    final RequestConstructor constructor = result.get(0);
    assertThat(constructor.getAdditionalLines().size(), is(0));
    assertThat(constructor.isDeprecated(), is(false));
    final ImmutableList<Arguments> constructorParams = constructor.getParameters();
    assertThat(constructorParams.size(), is(1));
    assertThat(constructorParams.get(0).getName(), is("NotificationId"));
    assertThat(constructor.getAssignments().size(), is(0));
    assertThat(constructor.getQueryParams().size(), is(0));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) RequestConstructor(com.spectralogic.ds3autogen.java.models.RequestConstructor) Test(org.junit.Test)

Example 59 with Ds3Request

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.

the class ObjectsRequestPayloadGenerator_Test method toConstructorArgumentsList_Test.

@Test
public void toConstructorArgumentsList_Test() {
    final Ds3Request request = createSimpleTestDs3Request();
    final ImmutableList<Arguments> result = generator.toConstructorArgumentsList(request);
    assertThat(result.size(), is(6));
    assertThat(result.get(0).getName(), is("BucketName"));
    assertThat(result.get(1).getName(), is("ObjectName"));
    assertThat(result.get(2).getName(), is("JobId"));
    assertThat(result.get(3).getName(), is("Priority"));
    assertThat(result.get(4).getName(), is("NotificationEndPoint"));
    assertThat(result.get(5).getName(), is("Objects"));
    assertThat(result.get(5).getType(), is("List<Ds3Object>"));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 60 with Ds3Request

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.

the class GetJobChunksReadyParserGenerator_Test method toResponseCodeList_Test.

@Test
public void toResponseCodeList_Test() {
    final Ds3Request ds3Request = getJobChunksReadyForClientProcessingRequest();
    final ImmutableList<ResponseCode> result = generator.toResponseCodeList(ds3Request.getDs3ResponseCodes(), "TestResponse", false);
    assertThat(result.size(), is(1));
    assertThat(result.get(0).getCode(), is(200));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) ResponseCode(com.spectralogic.ds3autogen.java.models.ResponseCode) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Aggregations

Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)92 Test (org.junit.Test)76 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)37 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)24 Ds3ModelPartialDataFixture.createEmptyDs3Request (com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request)17 ImmutableList (com.google.common.collect.ImmutableList)11 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)11 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)9 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)9 GuavaCollectors (com.spectralogic.ds3autogen.utils.collections.GuavaCollectors)8 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)7 ConstructorParam (com.spectralogic.ds3autogen.python.model.request.ConstructorParam)7 Helper.camelToUnderscore (com.spectralogic.ds3autogen.utils.Helper.camelToUnderscore)7 CustomArgumentComparator (com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator)7 RequestConverterUtil.getNonVoidArgsFromParamList (com.spectralogic.ds3autogen.utils.RequestConverterUtil.getNonVoidArgsFromParamList)6 Ds3ApiSpec (com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec)5 PythonHelper.pythonIndent (com.spectralogic.ds3autogen.python.helpers.PythonHelper.pythonIndent)5 Variable (com.spectralogic.ds3autogen.java.models.Variable)3 Ds3RequestClassificationUtil (com.spectralogic.ds3autogen.utils.Ds3RequestClassificationUtil)3 OutputStream (java.io.OutputStream)3