Search in sources :

Example 56 with Ds3DocSpecEmptyImpl

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

the class BaseRequestGenerator_Test method toWithConstructor_UUID_Test.

@Test
public void toWithConstructor_UUID_Test() {
    final String expected = "    public MyRequest withMyId(final UUID myId) {\n" + "        this.myId = myId.toString();\n" + "        this.updateQueryParam(\"my_id\", myId);\n" + "        return this;\n" + "    }\n";
    final Arguments idArg = new Arguments("UUID", "MyId");
    final String result = generator.toWithConstructor(idArg, "MyRequest", new Ds3DocSpecEmptyImpl());
    assertThat(result, is(expected));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) Test(org.junit.Test)

Example 57 with Ds3DocSpecEmptyImpl

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

the class NetDocGeneratorUtil_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 58 with Ds3DocSpecEmptyImpl

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

the class NetDocGeneratorUtil_Test method toConstructorDocs_EmptyDocSpec_Test.

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

Example 59 with Ds3DocSpecEmptyImpl

use of com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl 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 60 with Ds3DocSpecEmptyImpl

use of com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl 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

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