Search in sources :

Example 41 with Ds3Request

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request 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"));
}
Also used : QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) 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 42 with Ds3Request

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

the class NotificationRequestGenerator_Test method getAllImports_Delete_Test.

@Test
public void getAllImports_Delete_Test() {
    final Ds3Request request = getRequestDeleteNotification();
    final ImmutableList<String> result = generator.getAllImports(request, "com.spectralogic.ds3client.commands.spectrads3.notifications");
    assertThat(result.size(), is(2));
    assertTrue(result.contains("com.spectralogic.ds3client.commands.interfaces.AbstractDeleteNotificationRequest"));
    assertTrue(result.contains("java.util.UUID"));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Test(org.junit.Test)

Example 43 with Ds3Request

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

the class CreateNotificationRequestGenerator_Test method toRequiredArgumentsList_Test.

@Test
public void toRequiredArgumentsList_Test() {
    final Ds3Request request = createSimpleTestDs3Request();
    final ImmutableList<Arguments> result = generator.toRequiredArgumentsList(request);
    assertThat(result.size(), is(1));
    assertThat(result.get(0).getName(), is("Priority"));
}
Also used : 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) Test(org.junit.Test)

Example 44 with Ds3Request

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

the class CreateNotificationRequestGenerator_Test method toClassVariableArguments_Test.

@Test
public void toClassVariableArguments_Test() {
    final Ds3Request request = createSimpleTestDs3Request();
    final ImmutableList<Variable> result = generator.toClassVariableArguments(request);
    assertThat(result.size(), is(5));
    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("RequestType"));
}
Also used : Variable(com.spectralogic.ds3autogen.java.models.Variable) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 45 with Ds3Request

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

the class BaseRequestGenerator_Test method toRequiredArgumentsList_Test.

@Test
public void toRequiredArgumentsList_Test() {
    final ImmutableList<Ds3Param> params = createTestDs3ParamList();
    final Ds3Request request = createDs3RequestTestData(true, null, params);
    final ImmutableList<Arguments> result = generator.toRequiredArgumentsList(request);
    assertThat(result.size(), is(4));
    assertThat(result.get(0).getName(), is("IgnoreNamingConflicts"));
    assertThat(result.get(1).getName(), is("MaxUploadSize"));
    assertThat(result.get(2).getName(), is("Name"));
    assertThat(result.get(3).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

Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)92 Test (org.junit.Test)76 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)37 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)24 Ds3ModelPartialDataFixture.createEmptyDs3Request (com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request)17 ImmutableList (com.google.common.collect.ImmutableList)11 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)11 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)9 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)9 GuavaCollectors (com.spectralogic.ds3autogen.utils.collections.GuavaCollectors)8 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)7 ConstructorParam (com.spectralogic.ds3autogen.python.model.request.ConstructorParam)7 Helper.camelToUnderscore (com.spectralogic.ds3autogen.utils.Helper.camelToUnderscore)7 CustomArgumentComparator (com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator)7 RequestConverterUtil.getNonVoidArgsFromParamList (com.spectralogic.ds3autogen.utils.RequestConverterUtil.getNonVoidArgsFromParamList)6 Ds3ApiSpec (com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec)5 PythonHelper.pythonIndent (com.spectralogic.ds3autogen.python.helpers.PythonHelper.pythonIndent)5 Variable (com.spectralogic.ds3autogen.java.models.Variable)3 Ds3RequestClassificationUtil (com.spectralogic.ds3autogen.utils.Ds3RequestClassificationUtil)3 OutputStream (java.io.OutputStream)3