Search in sources :

Example 1 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.

the class BaseRequestGenerator_Test method updateDs3ParamListTypes_FullList_Test.

@Test
public void updateDs3ParamListTypes_FullList_Test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("Arg1", "String", false), new Ds3Param("Arg2", "java.util.UUID", false), new Ds3Param("BucketId", "java.util.UUID", false));
    final ImmutableList<Ds3Param> result = updateDs3ParamListTypes(params);
    assertThat(result.size(), is(3));
    assertThat(result.get(0).getName(), is("Arg1"));
    assertThat(result.get(0).getType(), is("String"));
    assertThat(result.get(1).getName(), is("Arg2"));
    assertThat(result.get(1).getType(), is("java.util.UUID"));
    assertThat(result.get(2).getName(), is("BucketId"));
    assertThat(result.get(2).getType(), is("String"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Test(org.junit.Test)

Example 2 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.

the class BaseRequestGenerator_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(3));
    assertThat(constructorParams.get(0).getName(), is("MaxUploadSize"));
    assertThat(constructorParams.get(1).getName(), is("Name"));
    assertThat(constructorParams.get(2).getName(), is("Priority"));
    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"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Ds3ModelPartialDataFixture.createEmptyDs3Request(com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) RequestConstructor(com.spectralogic.ds3autogen.java.models.RequestConstructor) Test(org.junit.Test)

Example 3 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.

the class BaseRequestGenerator_Test method getImportsFromParamList_FullList_Test.

@Test
public void getImportsFromParamList_FullList_Test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("BucketId", "java.util.UUID", false), new Ds3Param("MaxUploadSize", "long", false), new Ds3Param("Operation", "com.spectralogic.s3.server.request.rest.RestOperationType", false), new Ds3Param("Priority", "com.spectralogic.s3.common.dao.domain.ds3.BlobStoreTaskPriority", false), new Ds3Param("Name", "java.lang.String", true));
    final ImmutableSet<String> result = getImportsFromParamList(params);
    assertThat(result.size(), is(3));
    assertTrue(result.contains("java.util.UUID"));
    assertTrue(result.contains("com.spectralogic.ds3client.models.BlobStoreTaskPriority"));
    assertTrue(result.contains("com.google.common.net.UrlEscapers"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Test(org.junit.Test)

Example 4 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param 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"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) ImmutableList(com.google.common.collect.ImmutableList) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) RequestConstructor(com.spectralogic.ds3autogen.java.models.RequestConstructor) Test(org.junit.Test)

Example 5 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param 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"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Ds3ModelPartialDataFixture.createEmptyDs3Request(com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Aggregations

Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)39 Test (org.junit.Test)37 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)10 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)8 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)8 NetNullableVariable (com.spectralogic.ds3autogen.net.model.common.NetNullableVariable)8 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)5 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)5 Ds3ModelPartialDataFixture.createEmptyDs3Request (com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request)5 ImmutableList (com.google.common.collect.ImmutableList)3 Parameter (com.spectralogic.ds3autogen.c.models.Parameter)3 SimpleVariable (com.spectralogic.ds3autogen.go.models.request.SimpleVariable)3 WithConstructor (com.spectralogic.ds3autogen.go.models.request.WithConstructor)3 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)3 Request (com.spectralogic.ds3autogen.c.models.Request)2 Variable (com.spectralogic.ds3autogen.go.models.request.Variable)2 TestFileUtilsImpl (com.spectralogic.ds3autogen.utils.TestFileUtilsImpl)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 HashMap (java.util.HashMap)2 Ds3Type (com.spectralogic.ds3autogen.api.models.apispec.Ds3Type)1