Search in sources :

Example 26 with Arguments

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

Example 27 with Arguments

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

the class BaseRequestGenerator_Test method toConstructorArgumentsList_Test.

@Test
public void toConstructorArgumentsList_Test() {
    final ImmutableList<Ds3Param> params = createTestDs3ParamList();
    final Ds3Request request = new Ds3Request("RequestName", HttpVerb.DELETE, Classification.spectrads3, Requirement.REQUIRED, Requirement.REQUIRED, Action.BULK_DELETE, Resource.JOB, ResourceType.NON_SINGLETON, Operation.START_BULK_GET, true, null, null, params);
    final ImmutableList<Arguments> result = generator.toConstructorArgumentsList(request);
    assertThat(result.size(), is(6));
    assertThat(result.get(0).getName(), is("BucketName"));
    assertThat(result.get(1).getName(), is("ObjectName"));
    assertThat(result.get(2).getName(), is("JobId"));
    assertThat(result.get(3).getName(), is("MaxUploadSize"));
    assertThat(result.get(4).getName(), is("Name"));
    assertThat(result.get(5).getName(), is("Priority"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) 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) Test(org.junit.Test)

Example 28 with Arguments

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

the class BaseRequestGenerator_Test method toWithConstructor_Test.

@Test
public void toWithConstructor_Test() {
    final String expectedResult = "    public RequestName withArgName(final ArgType argName) {\n" + "        this.argName = argName;\n" + "        this.updateQueryParam(\"arg_name\", argName);\n" + "        return this;\n" + "    }\n";
    final Arguments argument = new Arguments("ArgType", "ArgName");
    final String result = generator.toWithConstructor(argument, "RequestName", 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 29 with Arguments

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

the class BaseRequestGenerator_Test method toOptionalArgumentsList_List_Test.

@Test
public void toOptionalArgumentsList_List_Test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ArgOne", "TypeOne", true), new Ds3Param("ArgTwo", "TypeTwo", false));
    final ImmutableList<Arguments> result = generator.toOptionalArgumentsList(params);
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("ArgOne"));
    assertThat(result.get(0).getType(), is("TypeOne"));
    assertThat(result.get(1).getName(), is("ArgTwo"));
    assertThat(result.get(1).getType(), is("TypeTwo"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 30 with Arguments

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

the class BaseRequestGenerator_Test method toQueryParam_VoidParam_Test.

@Test
public void toQueryParam_VoidParam_Test() {
    final Arguments arg = new Arguments("void", "VoidArg");
    final QueryParam result = toQueryParam(arg);
    assertThat(result, instanceOf(VoidQueryParam.class));
    assertThat(result.getName(), is("void_arg"));
    assertThat(result.getAssignment(), is("None"));
}
Also used : BaseQueryParam(com.spectralogic.ds3autogen.python.model.request.queryparam.BaseQueryParam) VoidQueryParam(com.spectralogic.ds3autogen.python.model.request.queryparam.VoidQueryParam) OperationQueryParam(com.spectralogic.ds3autogen.python.model.request.queryparam.OperationQueryParam) QueryParam(com.spectralogic.ds3autogen.python.model.request.queryparam.QueryParam) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) VoidQueryParam(com.spectralogic.ds3autogen.python.model.request.queryparam.VoidQueryParam) 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