Search in sources :

Example 46 with Ds3DocSpecEmptyImpl

use of com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl in project ds3_autogen by SpectraLogic.

the class JavaDocGenerator_Test method toParamListDocs_EmptyList_Test.

@Test
public void toParamListDocs_EmptyList_Test() {
    final String result = toParamListDocs(ImmutableList.of(), new Ds3DocSpecEmptyImpl(), 1);
    assertThat(result, is(""));
}
Also used : Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) Test(org.junit.Test)

Example 47 with Ds3DocSpecEmptyImpl

use of com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl in project ds3_autogen by SpectraLogic.

the class CommonRequestGeneratorUtils_Test method createChannelConstructor_Test.

@Test
public void createChannelConstructor_Test() {
    final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("Type1", "Arg1"));
    final RequestConstructor result = createChannelConstructor(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("Channel"));
    assertThat(result.getAssignments().size(), is(2));
    assertThat(result.getAssignments().get(0).getName(), is("Arg1"));
    assertThat(result.getAssignments().get(1).getName(), is("Channel"));
    assertThat(result.getQueryParams().size(), is(1));
    assertThat(result.getQueryParams().get(0).getName(), is("Arg1"));
    assertThat(result.getAdditionalLines().size(), is(1));
    assertThat(result.getAdditionalLines().get(0), is("this.stream = new SeekableByteChannelInputStream(channel);"));
}
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)

Example 48 with Ds3DocSpecEmptyImpl

use of com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl in project ds3_autogen by SpectraLogic.

the class JavaDocGenerator_Test method toParam_EmptyDocSpec_Test.

@Test
public void toParam_EmptyDocSpec_Test() {
    final String expected = "     * @param ParamOne \n";
    final String result = toParamDocs("ParamOne", new Ds3DocSpecEmptyImpl(), 1);
    assertThat(result, is(expected));
}
Also used : Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) Test(org.junit.Test)

Example 49 with Ds3DocSpecEmptyImpl

use of com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl in project ds3_autogen by SpectraLogic.

the class GetObjectRequestGenerator_Test method createRegularConstructor_Test.

@Test
public void createRegularConstructor_Test() {
    final RequestConstructor result = createChannelConstructor(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(0));
    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(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)

Example 50 with Ds3DocSpecEmptyImpl

use of com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl in project ds3_autogen by SpectraLogic.

the class MultiFileDeleteRequestGenerator_Test method toConstructorList_Test.

@Test
public void toConstructorList_Test() {
    final Ds3Request request = getRequestMultiFileDelete();
    final ImmutableList<RequestConstructor> result = generator.toConstructorList(request, "", new Ds3DocSpecEmptyImpl());
    assertThat(result.size(), is(2));
    //Create Objects
    final RequestConstructor constructor1 = result.get(0);
    assertThat(constructor1.isDeprecated(), is(false));
    assertThat(constructor1.getAdditionalLines().size(), is(0));
    final ImmutableList<Arguments> constructorParams1 = constructor1.getParameters();
    assertThat(constructorParams1.size(), is(2));
    assertThat(constructorParams1.get(0).getName(), is("BucketName"));
    assertThat(constructorParams1.get(1).getName(), is("Objects"));
    final ImmutableList<Arguments> constructorAssignments1 = constructor1.getAssignments();
    assertThat(constructorAssignments1.size(), is(2));
    assertThat(constructorAssignments1.get(0).getName(), is("BucketName"));
    assertThat(constructorAssignments1.get(1).getName(), is("Objects"));
    final ImmutableList<QueryParam> queryParams1 = constructor1.getQueryParams();
    assertThat(queryParams1.size(), is(1));
    assertThat(queryParams1.get(0).getName(), is("Delete"));
    //Create Iterable
    final RequestConstructor constructor2 = result.get(1);
    assertThat(constructor2.isDeprecated(), is(false));
    assertThat(constructor2.getAdditionalLines().size(), is(1));
    assertThat(constructor2.getAdditionalLines().get(0), is("this.objects = contentsToString(objs);"));
    final ImmutableList<Arguments> constructorParams2 = constructor2.getParameters();
    assertThat(constructorParams2.size(), is(2));
    assertThat(constructorParams2.get(0).getName(), is("BucketName"));
    assertThat(constructorParams2.get(1).getName(), is("Objs"));
    final ImmutableList<Arguments> constructorAssignments2 = constructor2.getAssignments();
    assertThat(constructorAssignments2.size(), is(1));
    assertThat(constructorAssignments2.get(0).getName(), is("BucketName"));
    final ImmutableList<QueryParam> queryParams2 = constructor2.getQueryParams();
    assertThat(queryParams2.size(), is(1));
    assertThat(queryParams2.get(0).getName(), is("Delete"));
}
Also used : QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) 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

Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)83 Test (org.junit.Test)79 TestFileUtilsImpl (com.spectralogic.ds3autogen.utils.TestFileUtilsImpl)36 ByteArrayOutputStream (java.io.ByteArrayOutputStream)34 Ds3SpecParserImpl (com.spectralogic.ds3autogen.Ds3SpecParserImpl)26 Ds3ApiSpec (com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec)26 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)25 Ds3SpecParser (com.spectralogic.ds3autogen.api.Ds3SpecParser)24 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)18 Request (com.spectralogic.ds3autogen.c.models.Request)16 HashMap (java.util.HashMap)16 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)14 Enum (com.spectralogic.ds3autogen.c.models.Enum)13 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)10 Source (com.spectralogic.ds3autogen.c.models.Source)9 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)6 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)5 Ds3DocSpec (com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec)4 CodeGenerator (com.spectralogic.ds3autogen.api.CodeGenerator)3 JavaCodeGenerator (com.spectralogic.ds3autogen.java.JavaCodeGenerator)3