use of com.spectralogic.ds3autogen.net.model.request.RequestConstructor in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator method toConstructorList.
/**
* Creates the request constructors. There will be multiple constructors if there are
* constructor parameters of type Guid
*/
@Override
public ImmutableList<RequestConstructor> toConstructorList(final Ds3Request ds3Request, final String requestName, final Ds3DocSpec docSpec) {
final ImmutableList<Arguments> constructorArgs = Helper.removeVoidArguments(toConstructorArgsList(ds3Request));
final ImmutableList<Arguments> queryParams = toQueryParamsList(ds3Request);
final RequestConstructor standardConstructor = new RequestConstructor(constructorArgs, queryParams, ds3Request.getOperation(), toConstructorDocs(requestName, constructorArgs.stream().map(Arguments::getName).collect(GuavaCollectors.immutableList()), docSpec, 2));
return splitGuidConstructor(standardConstructor);
}
use of com.spectralogic.ds3autogen.net.model.request.RequestConstructor in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator_Test method splitGuidConstructor_WithOutUuid_Test.
@Test
public void splitGuidConstructor_WithOutUuid_Test() {
final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("int", "IntArg"));
final RequestConstructor constructor = new RequestConstructor(args, args, Operation.ALLOCATE, "My Documentation");
final ImmutableList<RequestConstructor> result = splitGuidConstructor(constructor);
assertThat(result.size(), is(1));
assertTrue(containsType(result.get(0).getConstructorArgs(), "int"));
}
use of com.spectralogic.ds3autogen.net.model.request.RequestConstructor in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator_Test method splitGuidConstructor_WithUuid_Test.
@Test
public void splitGuidConstructor_WithUuid_Test() {
final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("UUID", "UuidArg"));
final RequestConstructor constructor = new RequestConstructor(args, args, Operation.ALLOCATE, "My Documentation");
final ImmutableList<RequestConstructor> result = splitGuidConstructor(constructor);
assertThat(result.size(), is(2));
assertTrue(containsType(result.get(0).getConstructorArgs(), "UUID"));
assertFalse(containsType(result.get(1).getConstructorArgs(), "UUID"));
assertTrue(containsType(result.get(1).getConstructorArgs(), "String"));
}
use of com.spectralogic.ds3autogen.net.model.request.RequestConstructor in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator_Test method convertGuidToStringConstructor_Test.
@Test
public void convertGuidToStringConstructor_Test() {
final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("UUID", "UuidArg"), new Arguments("int", "IntArg"));
final RequestConstructor constructor = new RequestConstructor(args, args, Operation.ALLOCATE, "My Documentation");
final RequestConstructor result = convertGuidToStringConstructor(constructor);
assertFalse(containsType(result.getConstructorArgs(), "UUID"));
assertTrue(containsType(result.getConstructorArgs(), "String"));
assertTrue(containsType(result.getConstructorArgs(), "int"));
assertFalse(containsType(result.getQueryParams(), "UUID"));
assertTrue(containsType(result.getQueryParams(), "String"));
assertTrue(containsType(result.getQueryParams(), "int"));
}
Aggregations