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"));
}
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"));
}
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));
}
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"));
}
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"));
}
Aggregations