Search in sources :

Example 31 with RequestConstructor

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

the class BaseRequestGenerator_Test method splitUuidConstructor_NoUuid_Test.

@Test
public void splitUuidConstructor_NoUuid_Test() {
    final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("String", "StringArg"), new Arguments("int", "IntArg"));
    final RequestConstructor constructor = new RequestConstructor(args, args, argsToQueryParams(args), "");
    final ImmutableList<RequestConstructor> result = splitUuidConstructor(constructor);
    assertThat(result.size(), is(1));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) RequestConstructor(com.spectralogic.ds3autogen.java.models.RequestConstructor) Test(org.junit.Test)

Example 32 with RequestConstructor

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

the class BaseRequestGenerator_Test method splitAllUuidConstructors_Test.

@Test
public void splitAllUuidConstructors_Test() {
    final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("String", "StringArg"), new Arguments("UUID", "UuidArg"), new Arguments("int", "IntArg"));
    final RequestConstructor constructor = new RequestConstructor(args, args, argsToQueryParams(args), "");
    final ImmutableList<RequestConstructor> result = splitAllUuidConstructors(ImmutableList.of(constructor));
    assertThat(result.size(), is(2));
    assertThat(getAllArgumentTypes(result.get(0).getParameters()), hasItem("UUID"));
    assertThat(getQueryParamTypes(result.get(0).getQueryParams()), hasItem("UUID"));
    assertThat(getAllArgumentTypes(result.get(0).getAssignments()), hasItem("UUID"));
    assertThat(getAllArgumentTypes(result.get(1).getParameters()), not(hasItem("UUID")));
    assertThat(getQueryParamTypes(result.get(1).getQueryParams()), not(hasItem("UUID")));
    assertThat(getAllArgumentTypes(result.get(1).getAssignments()), not(hasItem("UUID")));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) RequestConstructor(com.spectralogic.ds3autogen.java.models.RequestConstructor) Test(org.junit.Test)

Example 33 with RequestConstructor

use of com.spectralogic.ds3autogen.java.models.RequestConstructor 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 34 with RequestConstructor

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

the class CommonRequestGeneratorUtils_Test method createInputStreamConstructor_Test.

@Test
public void createInputStreamConstructor_Test() {
    final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("Type1", "Arg1"));
    final RequestConstructor result = createInputStreamConstructor(args, argsToQueryParams(args), "", new Ds3DocSpecEmptyImpl());
    assertThat(result.getParameters().size(), is(2));
    assertThat(result.getParameters().get(0).getName(), is("Arg1"));
    assertThat(result.getParameters().get(1).getName(), is("Stream"));
    assertThat(result.getAssignments().size(), is(2));
    assertThat(result.getAssignments().get(0).getName(), is("Arg1"));
    assertThat(result.getAssignments().get(1).getName(), is("Stream"));
    assertThat(result.getQueryParams().size(), is(1));
    assertThat(result.getQueryParams().get(0).getName(), is("Arg1"));
    assertThat(result.getAdditionalLines().size(), is(0));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) RequestConstructor(com.spectralogic.ds3autogen.java.models.RequestConstructor) Test(org.junit.Test)

Aggregations

RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)34 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)33 Test (org.junit.Test)22 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)18 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)18 ImmutableList (com.google.common.collect.ImmutableList)10 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)8 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)6 Helper.removeVoidArguments (com.spectralogic.ds3autogen.utils.Helper.removeVoidArguments)5 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)3 Ds3DocSpec (com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec)1 JavaDocGenerator.toConstructorDocs (com.spectralogic.ds3autogen.java.utils.JavaDocGenerator.toConstructorDocs)1 Ds3ModelPartialDataFixture.createEmptyDs3Request (com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request)1 ConverterUtil.hasContent (com.spectralogic.ds3autogen.utils.ConverterUtil.hasContent)1 GuavaCollectors (com.spectralogic.ds3autogen.utils.collections.GuavaCollectors)1