use of com.spectralogic.ds3autogen.java.models.RequestConstructor in project ds3_autogen by SpectraLogic.
the class CreateObjectRequestGenerator_Test method createChannelConstructor_Test.
@Test
public void createChannelConstructor_Test() {
final RequestConstructor result = getChannelConstructor(ImmutableList.of(new Arguments("Type", "Arg1")), ImmutableList.of(new Arguments("Type", "Arg2")), ImmutableList.of(new QueryParam("Type", "Arg3")), "", new Ds3DocSpecEmptyImpl());
assertThat(result.isDeprecated(), is(false));
assertThat(result.getAdditionalLines().size(), is(1));
assertThat(result.getAdditionalLines().get(0), is("this.stream = new SeekableByteChannelInputStream(channel);"));
final ImmutableList<Arguments> params = result.getParameters();
assertThat(params.size(), is(3));
assertThat(params.get(0).getName(), is("Arg1"));
assertThat(params.get(1).getName(), is("Arg2"));
assertThat(params.get(2).getName(), is("Channel"));
final ImmutableList<Arguments> assignments = result.getAssignments();
assertThat(assignments.size(), is(3));
assertThat(assignments.get(0).getName(), is("Arg1"));
assertThat(assignments.get(1).getName(), is("Arg2"));
assertThat(assignments.get(2).getName(), is("Channel"));
final ImmutableList<QueryParam> queryParams = result.getQueryParams();
assertThat(queryParams.size(), is(1));
assertThat(queryParams.get(0).getName(), is("Arg3"));
}
use of com.spectralogic.ds3autogen.java.models.RequestConstructor in project ds3_autogen by SpectraLogic.
the class GetObjectRequestGenerator_Test method createOutputStreamConstructor_Test.
@Test
public void createOutputStreamConstructor_Test() {
final RequestConstructor result = createOutputStreamConstructor(ImmutableList.of(new Arguments("Type", "Arg1")), ImmutableList.of(new Arguments("Type", "Arg2")), ImmutableList.of(new QueryParam("Type", "Arg3")), "", new Ds3DocSpecEmptyImpl());
assertThat(result.isDeprecated(), is(false));
assertThat(result.getAdditionalLines().size(), is(1));
assertThat(result.getAdditionalLines().get(0), is("this.channel = Channels.newChannel(stream);"));
final ImmutableList<Arguments> constructorParams = result.getParameters();
assertThat(constructorParams.size(), is(3));
assertThat(constructorParams.get(0).getName(), is("Arg1"));
assertThat(constructorParams.get(1).getName(), is("Arg2"));
assertThat(constructorParams.get(2).getName(), is("Stream"));
final ImmutableList<Arguments> constructorAssignments = result.getAssignments();
assertThat(constructorAssignments.size(), is(2));
assertThat(constructorAssignments.get(0).getName(), is("Arg1"));
assertThat(constructorAssignments.get(1).getName(), is("Arg2"));
final ImmutableList<QueryParam> queryParams = result.getQueryParams();
assertThat(queryParams.size(), is(2));
assertThat(queryParams.get(0).getName(), is("Arg3"));
assertThat(queryParams.get(1).getName(), is("Arg2"));
}
use of com.spectralogic.ds3autogen.java.models.RequestConstructor in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator_Test method splitUuidConstructor_NoUuid_Test.
@Test
public void splitUuidConstructor_NoUuid_Test() {
final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("String", "StringArg"), new Arguments("int", "IntArg"));
final RequestConstructor constructor = new RequestConstructor(args, args, argsToQueryParams(args), "");
final ImmutableList<RequestConstructor> result = splitUuidConstructor(constructor);
assertThat(result.size(), is(1));
}
use of com.spectralogic.ds3autogen.java.models.RequestConstructor in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator_Test method splitAllUuidConstructors_Test.
@Test
public void splitAllUuidConstructors_Test() {
final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("String", "StringArg"), new Arguments("UUID", "UuidArg"), new Arguments("int", "IntArg"));
final RequestConstructor constructor = new RequestConstructor(args, args, argsToQueryParams(args), "");
final ImmutableList<RequestConstructor> result = splitAllUuidConstructors(ImmutableList.of(constructor));
assertThat(result.size(), is(2));
assertThat(getAllArgumentTypes(result.get(0).getParameters()), hasItem("UUID"));
assertThat(getQueryParamTypes(result.get(0).getQueryParams()), hasItem("UUID"));
assertThat(getAllArgumentTypes(result.get(0).getAssignments()), hasItem("UUID"));
assertThat(getAllArgumentTypes(result.get(1).getParameters()), not(hasItem("UUID")));
assertThat(getQueryParamTypes(result.get(1).getQueryParams()), not(hasItem("UUID")));
assertThat(getAllArgumentTypes(result.get(1).getAssignments()), not(hasItem("UUID")));
}
use of com.spectralogic.ds3autogen.java.models.RequestConstructor in project ds3_autogen by SpectraLogic.
the class NotificationRequestGenerator_Test method toConstructorList_Test.
@Test
public void toConstructorList_Test() {
final Ds3Request request = getRequestDeleteNotification();
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(1));
assertThat(constructorParams.get(0).getName(), is("NotificationId"));
assertThat(constructor.getAssignments().size(), is(0));
assertThat(constructor.getQueryParams().size(), is(0));
}
Aggregations