use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class CreateObjectRequestGenerator_Test method toConstructorArgumentsList_Test.
@Test
public void toConstructorArgumentsList_Test() {
final Ds3Request request = createSimpleTestDs3Request();
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("Priority"));
assertThat(result.get(4).getName(), is("NotificationEndPoint"));
assertThat(result.get(5).getName(), is("Size"));
assertThat(result.get(5).getType(), is("long"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class CreateObjectRequestGenerator_Test method toConstructorList_Test.
@Test
public void toConstructorList_Test() {
final Ds3Request request = getRequestCreateObject();
final ImmutableList<RequestConstructor> result = generator.toConstructorList(request, "", new Ds3DocSpecEmptyImpl());
assertThat(result.size(), is(3));
//Deprecated Constructor
final RequestConstructor constructor1 = result.get(0);
assertThat(constructor1.isDeprecated(), is(true));
assertThat(constructor1.getAdditionalLines().size(), is(1));
assertThat(constructor1.getAdditionalLines().get(0), is("this.stream = new SeekableByteChannelInputStream(channel);"));
final ImmutableList<Arguments> constructorParams1 = constructor1.getParameters();
assertThat(constructorParams1.size(), is(4));
assertThat(constructorParams1.get(0).getName(), is("BucketName"));
assertThat(constructorParams1.get(1).getName(), is("ObjectName"));
assertThat(constructorParams1.get(2).getName(), is("Size"));
assertThat(constructorParams1.get(3).getName(), is("Channel"));
final ImmutableList<Arguments> constructorAssignments1 = constructor1.getAssignments();
assertThat(constructorAssignments1.size(), is(4));
assertThat(constructorAssignments1.get(0).getName(), is("BucketName"));
assertThat(constructorAssignments1.get(1).getName(), is("ObjectName"));
assertThat(constructorAssignments1.get(2).getName(), is("Size"));
assertThat(constructorAssignments1.get(3).getName(), is("Channel"));
final ImmutableList<QueryParam> queryParams1 = constructor1.getQueryParams();
assertThat(queryParams1.size(), is(0));
//Channel Constructor
final RequestConstructor constructor2 = result.get(1);
assertThat(constructor2.isDeprecated(), is(false));
assertThat(constructor2.getAdditionalLines().size(), is(1));
assertThat(constructor2.getAdditionalLines().get(0), is("this.stream = new SeekableByteChannelInputStream(channel);"));
final ImmutableList<Arguments> constructorParams2 = constructor2.getParameters();
assertThat(constructorParams2.size(), is(6));
assertThat(constructorParams2.get(0).getName(), is("BucketName"));
assertThat(constructorParams2.get(1).getName(), is("ObjectName"));
assertThat(constructorParams2.get(2).getName(), is("Size"));
assertThat(constructorParams2.get(3).getName(), is("Job"));
assertThat(constructorParams2.get(4).getName(), is("Offset"));
assertThat(constructorParams2.get(5).getName(), is("Channel"));
final ImmutableList<Arguments> constructorAssignments2 = constructor2.getAssignments();
assertThat(constructorAssignments2.size(), is(6));
assertThat(constructorAssignments2.get(0).getName(), is("BucketName"));
assertThat(constructorAssignments2.get(1).getName(), is("ObjectName"));
assertThat(constructorAssignments2.get(2).getName(), is("Size"));
assertThat(constructorAssignments2.get(3).getName(), is("Job"));
assertThat(constructorAssignments2.get(4).getName(), is("Offset"));
assertThat(constructorAssignments2.get(5).getName(), is("Channel"));
final ImmutableList<QueryParam> queryParams2 = constructor2.getQueryParams();
assertThat(queryParams2.size(), is(2));
assertThat(queryParams2.get(0).getName(), is("Job"));
assertThat(queryParams2.get(1).getName(), is("Offset"));
//Stream Constructor
final RequestConstructor constructor3 = result.get(2);
assertThat(constructor3.isDeprecated(), is(false));
assertThat(constructor3.getAdditionalLines().size(), is(0));
final ImmutableList<Arguments> constructorParams3 = constructor3.getParameters();
assertThat(constructorParams3.size(), is(6));
assertThat(constructorParams3.get(0).getName(), is("BucketName"));
assertThat(constructorParams3.get(1).getName(), is("ObjectName"));
assertThat(constructorParams3.get(2).getName(), is("Size"));
assertThat(constructorParams3.get(3).getName(), is("Job"));
assertThat(constructorParams3.get(4).getName(), is("Offset"));
assertThat(constructorParams3.get(5).getName(), is("Stream"));
final ImmutableList<Arguments> constructorAssignments3 = constructor3.getAssignments();
assertThat(constructorAssignments3.size(), is(6));
assertThat(constructorAssignments3.get(0).getName(), is("BucketName"));
assertThat(constructorAssignments3.get(1).getName(), is("ObjectName"));
assertThat(constructorAssignments3.get(2).getName(), is("Size"));
assertThat(constructorAssignments3.get(3).getName(), is("Job"));
assertThat(constructorAssignments3.get(4).getName(), is("Offset"));
assertThat(constructorAssignments3.get(5).getName(), is("Stream"));
final ImmutableList<QueryParam> queryParams3 = constructor3.getQueryParams();
assertThat(queryParams3.size(), is(2));
assertThat(queryParams3.get(0).getName(), is("Job"));
assertThat(queryParams3.get(1).getName(), is("Offset"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class RetryAfterResponseGenerator_Test method toParamList_Test.
@Test
public void toParamList_Test() {
final Ds3Request allocateRequest = getAllocateJobChunkRequest();
final ImmutableList<Arguments> result = generator.toParamList(allocateRequest.getDs3ResponseCodes());
assertThat(result.size(), is(3));
assertThat(result.get(0).getName(), is("jobChunkApiBeanResult"));
assertThat(result.get(0).getType(), is("JobChunkApiBean"));
assertThat(result.get(1).getName(), is("RetryAfterSeconds"));
assertThat(result.get(1).getType(), is("int"));
assertThat(result.get(2).getName(), is("Status"));
assertThat(result.get(2).getType(), is("Status"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class GetObjectRequestGenerator_Test method toConstructorList_Test.
@Test
public void toConstructorList_Test() {
final Ds3Request request = getRequestAmazonS3GetObject();
final ImmutableList<RequestConstructor> result = generator.toConstructorList(request, "", new Ds3DocSpecEmptyImpl());
assertThat(result.size(), is(3));
//Deprecated Constructor
final RequestConstructor constructor1 = result.get(0);
assertThat(constructor1.isDeprecated(), is(true));
assertThat(constructor1.getAdditionalLines().size(), is(0));
final ImmutableList<Arguments> constructorParams1 = constructor1.getParameters();
assertThat(constructorParams1.size(), is(3));
assertThat(constructorParams1.get(0).getName(), is("BucketName"));
assertThat(constructorParams1.get(1).getName(), is("ObjectName"));
assertThat(constructorParams1.get(2).getName(), is("Channel"));
final ImmutableList<Arguments> constructorAssignments1 = constructor1.getAssignments();
assertThat(constructorAssignments1.size(), is(3));
assertThat(constructorAssignments1.get(0).getName(), is("BucketName"));
assertThat(constructorAssignments1.get(1).getName(), is("ObjectName"));
assertThat(constructorAssignments1.get(2).getName(), is("Channel"));
final ImmutableList<QueryParam> queryParams1 = constructor1.getQueryParams();
assertThat(queryParams1.size(), is(0));
//Channel Constructor
final RequestConstructor constructor2 = result.get(1);
assertThat(constructor2.isDeprecated(), is(false));
assertThat(constructor2.getAdditionalLines().size(), is(0));
final ImmutableList<Arguments> constructorParams2 = constructor2.getParameters();
assertThat(constructorParams2.size(), is(5));
assertThat(constructorParams2.get(0).getName(), is("BucketName"));
assertThat(constructorParams2.get(1).getName(), is("ObjectName"));
assertThat(constructorParams2.get(2).getName(), is("Job"));
assertThat(constructorParams2.get(3).getName(), is("Offset"));
assertThat(constructorParams2.get(4).getName(), is("Channel"));
final ImmutableList<Arguments> constructorAssignments2 = constructor2.getAssignments();
assertThat(constructorAssignments2.size(), is(5));
assertThat(constructorAssignments2.get(0).getName(), is("BucketName"));
assertThat(constructorAssignments2.get(1).getName(), is("ObjectName"));
assertThat(constructorAssignments2.get(2).getName(), is("Job"));
assertThat(constructorAssignments2.get(3).getName(), is("Offset"));
assertThat(constructorAssignments2.get(4).getName(), is("Channel"));
final ImmutableList<QueryParam> queryParams2 = constructor2.getQueryParams();
assertThat(queryParams2.size(), is(2));
assertThat(queryParams2.get(0).getName(), is("Job"));
assertThat(queryParams2.get(1).getName(), is("Offset"));
//
//Channel Constructor
final RequestConstructor constructor3 = result.get(2);
assertThat(constructor3.isDeprecated(), is(false));
assertThat(constructor3.getAdditionalLines().size(), is(1));
assertThat(constructor3.getAdditionalLines().get(0), is("this.channel = Channels.newChannel(stream);"));
final ImmutableList<Arguments> constructorParams3 = constructor3.getParameters();
assertThat(constructorParams3.size(), is(5));
assertThat(constructorParams3.get(0).getName(), is("BucketName"));
assertThat(constructorParams3.get(1).getName(), is("ObjectName"));
assertThat(constructorParams3.get(2).getName(), is("Job"));
assertThat(constructorParams3.get(3).getName(), is("Offset"));
assertThat(constructorParams3.get(4).getName(), is("Stream"));
final ImmutableList<Arguments> constructorAssignments3 = constructor3.getAssignments();
assertThat(constructorAssignments3.size(), is(4));
assertThat(constructorAssignments3.get(0).getName(), is("BucketName"));
assertThat(constructorAssignments3.get(1).getName(), is("ObjectName"));
assertThat(constructorAssignments3.get(2).getName(), is("Job"));
assertThat(constructorAssignments3.get(3).getName(), is("Offset"));
final ImmutableList<QueryParam> queryParams3 = constructor3.getQueryParams();
assertThat(queryParams3.size(), is(2));
assertThat(queryParams3.get(0).getName(), is("Job"));
assertThat(queryParams3.get(1).getName(), is("Offset"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class NotificationRequestGenerator_Test method getParentImport_Get_Test.
@Test
public void getParentImport_Get_Test() {
final Ds3Request request = getRequestGetNotification();
final String result = generator.getParentImport(request);
assertThat(result, is("com.spectralogic.ds3client.commands.interfaces.AbstractGetNotificationRequest"));
}
Aggregations