use of com.spectralogic.ds3autogen.java.models.RequestConstructor in project ds3_autogen by SpectraLogic.
the class MultiFileDeleteRequestGenerator_Test method toConstructorList_Test.
@Test
public void toConstructorList_Test() {
final Ds3Request request = getRequestMultiFileDelete();
final ImmutableList<RequestConstructor> result = generator.toConstructorList(request, "", new Ds3DocSpecEmptyImpl());
assertThat(result.size(), is(2));
//Create Objects
final RequestConstructor constructor1 = result.get(0);
assertThat(constructor1.isDeprecated(), is(false));
assertThat(constructor1.getAdditionalLines().size(), is(0));
final ImmutableList<Arguments> constructorParams1 = constructor1.getParameters();
assertThat(constructorParams1.size(), is(2));
assertThat(constructorParams1.get(0).getName(), is("BucketName"));
assertThat(constructorParams1.get(1).getName(), is("Objects"));
final ImmutableList<Arguments> constructorAssignments1 = constructor1.getAssignments();
assertThat(constructorAssignments1.size(), is(2));
assertThat(constructorAssignments1.get(0).getName(), is("BucketName"));
assertThat(constructorAssignments1.get(1).getName(), is("Objects"));
final ImmutableList<QueryParam> queryParams1 = constructor1.getQueryParams();
assertThat(queryParams1.size(), is(1));
assertThat(queryParams1.get(0).getName(), is("Delete"));
//Create Iterable
final RequestConstructor constructor2 = result.get(1);
assertThat(constructor2.isDeprecated(), is(false));
assertThat(constructor2.getAdditionalLines().size(), is(1));
assertThat(constructor2.getAdditionalLines().get(0), is("this.objects = contentsToString(objs);"));
final ImmutableList<Arguments> constructorParams2 = constructor2.getParameters();
assertThat(constructorParams2.size(), is(2));
assertThat(constructorParams2.get(0).getName(), is("BucketName"));
assertThat(constructorParams2.get(1).getName(), is("Objs"));
final ImmutableList<Arguments> constructorAssignments2 = constructor2.getAssignments();
assertThat(constructorAssignments2.size(), is(1));
assertThat(constructorAssignments2.get(0).getName(), is("BucketName"));
final ImmutableList<QueryParam> queryParams2 = constructor2.getQueryParams();
assertThat(queryParams2.size(), is(1));
assertThat(queryParams2.get(0).getName(), is("Delete"));
}
use of com.spectralogic.ds3autogen.java.models.RequestConstructor in project ds3_autogen by SpectraLogic.
the class BulkRequestGenerator_Test method toConstructorList_Test.
@Test
public void toConstructorList_Test() {
final ImmutableList<Ds3Param> params = createTestDs3ParamList();
final Ds3Request request = createDs3RequestTestData(true, null, params);
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("Objects"));
final ImmutableList<Arguments> constructorAssignments = constructor.getAssignments();
assertThat(constructorAssignments.size(), is(2));
assertThat(constructorAssignments.get(0).getName(), is("MaxUploadSize"));
assertThat(constructorAssignments.get(1).getName(), is("Name"));
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.java.models.RequestConstructor in project ds3_autogen by SpectraLogic.
the class CreateObjectRequestGenerator_Test method createDeprecatedConstructor_Test.
@Test
public void createDeprecatedConstructor_Test() {
final RequestConstructor result = createDeprecatedConstructor(ImmutableList.of(new Arguments("Type", "Arg1")), "", new Ds3DocSpecEmptyImpl());
assertThat(result.isDeprecated(), is(true));
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(2));
assertThat(params.get(0).getName(), is("Arg1"));
assertThat(params.get(1).getName(), is("Channel"));
final ImmutableList<Arguments> assignments = result.getAssignments();
assertThat(assignments.size(), is(2));
assertThat(assignments.get(0).getName(), is("Arg1"));
assertThat(assignments.get(1).getName(), is("Channel"));
final ImmutableList<QueryParam> queryParams = result.getQueryParams();
assertThat(queryParams.size(), is(0));
}
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"));
}
Aggregations