Search in sources :

Example 56 with Arguments

use of com.spectralogic.ds3autogen.api.models.Arguments 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 57 with Arguments

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

the class BaseRequestGenerator_Test method toWithConstructor_Boolean_Test.

@Test
public void toWithConstructor_Boolean_Test() {
    final String expectedResultBoolean = "    public RequestName withArgName(final boolean argName) {\n" + "        this.argName = argName;\n" + "        this.updateQueryParam(\"arg_name\", argName);\n" + "        return this;\n" + "    }\n";
    final Arguments booleanArgument = new Arguments("boolean", "ArgName");
    final String booleanResult = generator.toWithConstructor(booleanArgument, "RequestName", new Ds3DocSpecEmptyImpl());
    assertThat(booleanResult, is(expectedResultBoolean));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) Test(org.junit.Test)

Example 58 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 59 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 60 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)

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