Search in sources :

Example 6 with QueryParam

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

the class GetObjectRequestGenerator_Test method toConstructorList_Test.

@Test
public void toConstructorList_Test() {
    final Ds3Request request = getRequestAmazonS3GetObject();
    final ImmutableList<RequestConstructor> result = generator.toConstructorList(request, "", new Ds3DocSpecEmptyImpl());
    assertThat(result.size(), is(3));
    //Deprecated Constructor
    final RequestConstructor constructor1 = result.get(0);
    assertThat(constructor1.isDeprecated(), is(true));
    assertThat(constructor1.getAdditionalLines().size(), is(0));
    final ImmutableList<Arguments> constructorParams1 = constructor1.getParameters();
    assertThat(constructorParams1.size(), is(3));
    assertThat(constructorParams1.get(0).getName(), is("BucketName"));
    assertThat(constructorParams1.get(1).getName(), is("ObjectName"));
    assertThat(constructorParams1.get(2).getName(), is("Channel"));
    final ImmutableList<Arguments> constructorAssignments1 = constructor1.getAssignments();
    assertThat(constructorAssignments1.size(), is(3));
    assertThat(constructorAssignments1.get(0).getName(), is("BucketName"));
    assertThat(constructorAssignments1.get(1).getName(), is("ObjectName"));
    assertThat(constructorAssignments1.get(2).getName(), is("Channel"));
    final ImmutableList<QueryParam> queryParams1 = constructor1.getQueryParams();
    assertThat(queryParams1.size(), is(0));
    //Channel Constructor
    final RequestConstructor constructor2 = result.get(1);
    assertThat(constructor2.isDeprecated(), is(false));
    assertThat(constructor2.getAdditionalLines().size(), is(0));
    final ImmutableList<Arguments> constructorParams2 = constructor2.getParameters();
    assertThat(constructorParams2.size(), is(5));
    assertThat(constructorParams2.get(0).getName(), is("BucketName"));
    assertThat(constructorParams2.get(1).getName(), is("ObjectName"));
    assertThat(constructorParams2.get(2).getName(), is("Job"));
    assertThat(constructorParams2.get(3).getName(), is("Offset"));
    assertThat(constructorParams2.get(4).getName(), is("Channel"));
    final ImmutableList<Arguments> constructorAssignments2 = constructor2.getAssignments();
    assertThat(constructorAssignments2.size(), is(5));
    assertThat(constructorAssignments2.get(0).getName(), is("BucketName"));
    assertThat(constructorAssignments2.get(1).getName(), is("ObjectName"));
    assertThat(constructorAssignments2.get(2).getName(), is("Job"));
    assertThat(constructorAssignments2.get(3).getName(), is("Offset"));
    assertThat(constructorAssignments2.get(4).getName(), is("Channel"));
    final ImmutableList<QueryParam> queryParams2 = constructor2.getQueryParams();
    assertThat(queryParams2.size(), is(2));
    assertThat(queryParams2.get(0).getName(), is("Job"));
    assertThat(queryParams2.get(1).getName(), is("Offset"));
    //
    //Channel Constructor
    final RequestConstructor constructor3 = result.get(2);
    assertThat(constructor3.isDeprecated(), is(false));
    assertThat(constructor3.getAdditionalLines().size(), is(1));
    assertThat(constructor3.getAdditionalLines().get(0), is("this.channel = Channels.newChannel(stream);"));
    final ImmutableList<Arguments> constructorParams3 = constructor3.getParameters();
    assertThat(constructorParams3.size(), is(5));
    assertThat(constructorParams3.get(0).getName(), is("BucketName"));
    assertThat(constructorParams3.get(1).getName(), is("ObjectName"));
    assertThat(constructorParams3.get(2).getName(), is("Job"));
    assertThat(constructorParams3.get(3).getName(), is("Offset"));
    assertThat(constructorParams3.get(4).getName(), is("Stream"));
    final ImmutableList<Arguments> constructorAssignments3 = constructor3.getAssignments();
    assertThat(constructorAssignments3.size(), is(4));
    assertThat(constructorAssignments3.get(0).getName(), is("BucketName"));
    assertThat(constructorAssignments3.get(1).getName(), is("ObjectName"));
    assertThat(constructorAssignments3.get(2).getName(), is("Job"));
    assertThat(constructorAssignments3.get(3).getName(), is("Offset"));
    final ImmutableList<QueryParam> queryParams3 = constructor3.getQueryParams();
    assertThat(queryParams3.size(), is(2));
    assertThat(queryParams3.get(0).getName(), is("Job"));
    assertThat(queryParams3.get(1).getName(), is("Offset"));
}
Also used : 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 7 with QueryParam

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

the class MultiFileDeleteRequestGenerator_Test method createIterableConstructor_Test.

@Test
public void createIterableConstructor_Test() {
    final RequestConstructor result = createIterableConstructor(ImmutableList.of(new Arguments("Type", "Arg1")), ImmutableList.of(new QueryParam("Type", "Arg2")), "", new Ds3DocSpecEmptyImpl());
    assertThat(result.isDeprecated(), is(false));
    assertThat(result.getAdditionalLines().size(), is(1));
    assertThat(result.getAdditionalLines().get(0), is("this.objects = contentsToString(objs);"));
    final ImmutableList<Arguments> params = result.getParameters();
    assertThat(params.size(), is(2));
    assertThat(params.get(0).getName(), is("Arg1"));
    assertThat(params.get(1).getName(), is("Objs"));
    final ImmutableList<Arguments> assignments = result.getAssignments();
    assertThat(assignments.size(), is(1));
    assertThat(assignments.get(0).getName(), is("Arg1"));
    final ImmutableList<QueryParam> queryParams = result.getQueryParams();
    assertThat(queryParams.size(), is(1));
    assertThat(queryParams.get(0).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)

Example 8 with QueryParam

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

the class MultiFileDeleteRequestGenerator_Test method createObjectsConstructor_Test.

@Test
public void createObjectsConstructor_Test() {
    final RequestConstructor result = createObjectsConstructor(ImmutableList.of(new Arguments("Type", "Arg1")), ImmutableList.of(new QueryParam("Type", "Arg2")), "", new Ds3DocSpecEmptyImpl());
    assertThat(result.isDeprecated(), is(false));
    assertThat(result.getAdditionalLines().size(), is(0));
    final ImmutableList<Arguments> params = result.getParameters();
    assertThat(params.size(), is(2));
    assertThat(params.get(0).getName(), is("Arg1"));
    assertThat(params.get(1).getName(), is("Objects"));
    final ImmutableList<Arguments> assignments = result.getAssignments();
    assertThat(assignments.size(), is(2));
    assertThat(assignments.get(0).getName(), is("Arg1"));
    assertThat(assignments.get(1).getName(), is("Objects"));
    final ImmutableList<QueryParam> queryParams = result.getQueryParams();
    assertThat(queryParams.size(), is(1));
    assertThat(queryParams.get(0).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)

Example 9 with QueryParam

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

the class BaseRequestGenerator_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(3));
    assertThat(constructorParams.get(0).getName(), is("MaxUploadSize"));
    assertThat(constructorParams.get(1).getName(), is("Name"));
    assertThat(constructorParams.get(2).getName(), is("Priority"));
    final ImmutableList<Arguments> constructorAssignments = constructor.getAssignments();
    assertThat(constructorAssignments.size(), is(3));
    assertThat(constructorAssignments.get(0).getName(), is("MaxUploadSize"));
    assertThat(constructorAssignments.get(1).getName(), is("Name"));
    assertThat(constructorAssignments.get(2).getName(), is("Priority"));
    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) Ds3ModelPartialDataFixture.createEmptyDs3Request(com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request) 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 10 with QueryParam

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

the class CreateNotificationRequestGenerator_Test method toConstructorList_Test.

@Test
public void toConstructorList_Test() {
    final ImmutableList.Builder<Ds3Param> builder = ImmutableList.builder();
    builder.addAll(createTestDs3ParamList());
    builder.add(new Ds3Param("NotificationEndPoint", "String", false));
    final Ds3Request request = createDs3RequestTestData(true, null, builder.build());
    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("NotificationEndPoint"));
    final ImmutableList<Arguments> constructorAssignments = constructor.getAssignments();
    assertThat(constructorAssignments.size(), is(3));
    assertThat(constructorAssignments.get(0).getName(), is("MaxUploadSize"));
    assertThat(constructorAssignments.get(1).getName(), is("Name"));
    assertThat(constructorAssignments.get(2).getName(), is("Priority"));
    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) ImmutableList(com.google.common.collect.ImmutableList) 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)

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