Search in sources :

Example 11 with Arguments

use of com.spectralogic.ds3autogen.api.models.Arguments in project ds3_autogen by SpectraLogic.

the class BulkRequestGenerator_Test method toConstructorAssignmentList_FullList_Test.

@Test
public void toConstructorAssignmentList_FullList_Test() {
    final ImmutableList<Arguments> arguments = ImmutableList.of(new Arguments("type", "Priority"), new Arguments("type", "Name1"), new Arguments("type", "WriteOptimization"), new Arguments("type", "BucketName"), new Arguments("type", "Name2"), new Arguments("type", "Objects"));
    final ImmutableList<Arguments> result = toConstructorAssignmentList(arguments);
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("Name1"));
    assertThat(result.get(1).getName(), is("Name2"));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 12 with Arguments

use of com.spectralogic.ds3autogen.api.models.Arguments in project ds3_autogen by SpectraLogic.

the class BulkRequestGenerator_Test method toWithConstructor_Test.

@Test
public void toWithConstructor_Test() {
    final String expectedResult = "    public GetBucketRequestHandler withDelimiter(final String delimiter) {\n" + "        this.delimiter = delimiter;\n" + "        this.updateQueryParam(\"delimiter\", delimiter);\n" + "        return this;\n" + "    }\n";
    final Arguments arg = new Arguments("String", "Delimiter");
    final String result = generator.toWithConstructor(arg, "GetBucketRequestHandler", new Ds3DocSpecEmptyImpl());
    assertThat(result, is(expectedResult));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) Test(org.junit.Test)

Example 13 with Arguments

use of com.spectralogic.ds3autogen.api.models.Arguments in project ds3_autogen by SpectraLogic.

the class BaseResponseGenerator_Test method toParam_SimpleType_Test.

@Test
public void toParam_SimpleType_Test() {
    final Ds3ResponseCode responseCode = new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.test.TestType", null)));
    final Optional<Arguments> result = toParam(responseCode);
    assertTrue(result.isPresent());
    assertThat(result.get().getName(), is("testTypeResult"));
    assertThat(result.get().getType(), is("TestType"));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 14 with Arguments

use of com.spectralogic.ds3autogen.api.models.Arguments in project ds3_autogen by SpectraLogic.

the class BaseResponseGenerator_Test method toParamList_FullList_Test.

@Test
public void toParamList_FullList_Test() {
    final ImmutableList<Ds3ResponseCode> responseCodes = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.test.TestTypeB", null))), new Ds3ResponseCode(201, ImmutableList.of(new Ds3ResponseType("null", null))), new Ds3ResponseCode(203, ImmutableList.of(new Ds3ResponseType("com.test.TestTypeA", null))), new Ds3ResponseCode(400, ImmutableList.of(new Ds3ResponseType("com.test.TestTypeC", null))));
    final ImmutableList<Arguments> result = generator.toParamList(responseCodes);
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("testTypeAResult"));
    assertThat(result.get(1).getName(), is("testTypeBResult"));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 15 with Arguments

use of com.spectralogic.ds3autogen.api.models.Arguments in project ds3_autogen by SpectraLogic.

the class BaseResponseGenerator_Test method toParam_NullPayload_Test.

@Test
public void toParam_NullPayload_Test() {
    final Ds3ResponseCode responseCode = new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("null", null)));
    final Optional<Arguments> result = toParam(responseCode);
    assertFalse(result.isPresent());
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Aggregations

Arguments (com.spectralogic.ds3autogen.api.models.Arguments)188 Test (org.junit.Test)144 FileUtils (com.spectralogic.ds3autogen.api.FileUtils)46 ImmutableList (com.google.common.collect.ImmutableList)40 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)33 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)25 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)25 TestGeneratedCode (com.spectralogic.ds3autogen.java.utils.TestGeneratedCode)25 TestGenerateCode (com.spectralogic.ds3autogen.net.utils.TestGenerateCode)21 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)19 Helper.removeVoidArguments (com.spectralogic.ds3autogen.utils.Helper.removeVoidArguments)15 BaseParseResponse (com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse)14 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)13 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)9 GuavaCollectors (com.spectralogic.ds3autogen.utils.collections.GuavaCollectors)8 CustomArgumentComparator (com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator)8 ConstructorParam (com.spectralogic.ds3autogen.python.model.request.ConstructorParam)7 Helper.camelToUnderscore (com.spectralogic.ds3autogen.utils.Helper.camelToUnderscore)7 RequestConverterUtil.getNonVoidArgsFromParamList (com.spectralogic.ds3autogen.utils.RequestConverterUtil.getNonVoidArgsFromParamList)6 Ds3ResponseType (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType)5