Search in sources :

Example 16 with QueryParam

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

the class BulkRequestGenerator_Test method toConstructorList_Test.

@Test
public void toConstructorList_Test() {
    final ImmutableList<Ds3Param> params = createTestDs3ParamList();
    final Ds3Request request = createDs3RequestTestData(true, null, params);
    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(4));
    assertThat(constructorParams.get(0).getName(), is("MaxUploadSize"));
    assertThat(constructorParams.get(1).getName(), is("Name"));
    assertThat(constructorParams.get(2).getName(), is("Priority"));
    assertThat(constructorParams.get(3).getName(), is("Objects"));
    final ImmutableList<Arguments> constructorAssignments = constructor.getAssignments();
    assertThat(constructorAssignments.size(), is(2));
    assertThat(constructorAssignments.get(0).getName(), is("MaxUploadSize"));
    assertThat(constructorAssignments.get(1).getName(), is("Name"));
    final ImmutableList<QueryParam> queryParams = constructor.getQueryParams();
    assertThat(queryParams.size(), is(4));
    assertThat(queryParams.get(0).getName(), is("IgnoreNamingConflicts"));
    assertThat(queryParams.get(1).getName(), is("MaxUploadSize"));
    assertThat(queryParams.get(2).getName(), is("Name"));
    assertThat(queryParams.get(3).getName(), is("Priority"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) 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 17 with QueryParam

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

the class CreateObjectRequestGenerator_Test method createDeprecatedConstructor_Test.

@Test
public void createDeprecatedConstructor_Test() {
    final RequestConstructor result = createDeprecatedConstructor(ImmutableList.of(new Arguments("Type", "Arg1")), "", new Ds3DocSpecEmptyImpl());
    assertThat(result.isDeprecated(), is(true));
    assertThat(result.getAdditionalLines().size(), is(1));
    assertThat(result.getAdditionalLines().get(0), is("this.stream = new SeekableByteChannelInputStream(channel);"));
    final ImmutableList<Arguments> params = result.getParameters();
    assertThat(params.size(), is(2));
    assertThat(params.get(0).getName(), is("Arg1"));
    assertThat(params.get(1).getName(), is("Channel"));
    final ImmutableList<Arguments> assignments = result.getAssignments();
    assertThat(assignments.size(), is(2));
    assertThat(assignments.get(0).getName(), is("Arg1"));
    assertThat(assignments.get(1).getName(), is("Channel"));
    final ImmutableList<QueryParam> queryParams = result.getQueryParams();
    assertThat(queryParams.size(), is(0));
}
Also used : QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) 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 18 with QueryParam

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

the class CreateObjectRequestGenerator_Test method createChannelConstructor_Test.

@Test
public void createChannelConstructor_Test() {
    final RequestConstructor result = getChannelConstructor(ImmutableList.of(new Arguments("Type", "Arg1")), ImmutableList.of(new Arguments("Type", "Arg2")), ImmutableList.of(new QueryParam("Type", "Arg3")), "", new Ds3DocSpecEmptyImpl());
    assertThat(result.isDeprecated(), is(false));
    assertThat(result.getAdditionalLines().size(), is(1));
    assertThat(result.getAdditionalLines().get(0), is("this.stream = new SeekableByteChannelInputStream(channel);"));
    final ImmutableList<Arguments> params = result.getParameters();
    assertThat(params.size(), is(3));
    assertThat(params.get(0).getName(), is("Arg1"));
    assertThat(params.get(1).getName(), is("Arg2"));
    assertThat(params.get(2).getName(), is("Channel"));
    final ImmutableList<Arguments> assignments = result.getAssignments();
    assertThat(assignments.size(), is(3));
    assertThat(assignments.get(0).getName(), is("Arg1"));
    assertThat(assignments.get(1).getName(), is("Arg2"));
    assertThat(assignments.get(2).getName(), is("Channel"));
    final ImmutableList<QueryParam> queryParams = result.getQueryParams();
    assertThat(queryParams.size(), is(1));
    assertThat(queryParams.get(0).getName(), is("Arg3"));
}
Also used : QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) 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 19 with QueryParam

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

the class CreateObjectRequestGenerator_Test method toQueryParamsList_Test.

@Test
public void toQueryParamsList_Test() {
    final ImmutableList<Ds3Param> params = createTestDs3ParamList();
    final Ds3Request request = createDs3RequestTestData(true, params, null);
    final ImmutableList<QueryParam> result = generator.toQueryParamsList(request);
    assertThat(result.size(), is(4));
    assertThat(result.get(0).getName(), is("IgnoreNamingConflicts"));
    assertThat(result.get(1).getName(), is("MaxUploadSize"));
    assertThat(result.get(2).getName(), is("Name"));
    assertThat(result.get(3).getName(), is("Priority"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 20 with QueryParam

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

the class GetObjectRequestGenerator_Test method createOutputStreamConstructor_Test.

@Test
public void createOutputStreamConstructor_Test() {
    final RequestConstructor result = createOutputStreamConstructor(ImmutableList.of(new Arguments("Type", "Arg1")), ImmutableList.of(new Arguments("Type", "Arg2")), ImmutableList.of(new QueryParam("Type", "Arg3")), "", new Ds3DocSpecEmptyImpl());
    assertThat(result.isDeprecated(), is(false));
    assertThat(result.getAdditionalLines().size(), is(1));
    assertThat(result.getAdditionalLines().get(0), is("this.channel = Channels.newChannel(stream);"));
    final ImmutableList<Arguments> constructorParams = result.getParameters();
    assertThat(constructorParams.size(), is(3));
    assertThat(constructorParams.get(0).getName(), is("Arg1"));
    assertThat(constructorParams.get(1).getName(), is("Arg2"));
    assertThat(constructorParams.get(2).getName(), is("Stream"));
    final ImmutableList<Arguments> constructorAssignments = result.getAssignments();
    assertThat(constructorAssignments.size(), is(2));
    assertThat(constructorAssignments.get(0).getName(), is("Arg1"));
    assertThat(constructorAssignments.get(1).getName(), is("Arg2"));
    final ImmutableList<QueryParam> queryParams = result.getQueryParams();
    assertThat(queryParams.size(), is(2));
    assertThat(queryParams.get(0).getName(), is("Arg3"));
    assertThat(queryParams.get(1).getName(), is("Arg2"));
}
Also used : QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) 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

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