Search in sources :

Example 21 with Ds3Request

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

the class BaseRequestGenerator_Test method getSpectraDs3RequestPath_Test.

@Test
public void getSpectraDs3RequestPath_Test() {
    final Ds3Request deleteNotification = getRequestDeleteNotification();
    assertThat(getSpectraDs3RequestPath(deleteNotification), is("\"/_rest_/job_created_notification_registration/\" + this.getNotificationId().toString()"));
    final Ds3Request createNotification = getRequestCreateNotification();
    assertThat(getSpectraDs3RequestPath(createNotification), is("\"/_rest_/job_created_notification_registration\""));
    final Ds3Request getNotification = getRequestGetNotification();
    assertThat(getSpectraDs3RequestPath(getNotification), is("\"/_rest_/job_completed_notification_registration/\" + this.getNotificationId().toString()"));
    final Ds3Request verifyPhysicalPlacement = getRequestVerifyPhysicalPlacement();
    assertThat(getSpectraDs3RequestPath(verifyPhysicalPlacement), is("\"/_rest_/bucket/\" + this.bucketName"));
    final Ds3Request bulkRequest = getRequestBulkGet();
    assertThat(getSpectraDs3RequestPath(bulkRequest), is("\"/_rest_/bucket/\" + this.bucketName"));
    final Ds3Request spectraS3GetObject = getRequestSpectraS3GetObject();
    assertThat(getSpectraDs3RequestPath(spectraS3GetObject), is("\"/_rest_/object/\" + objectName"));
    //Non-Spectra Request
    final Ds3Request multiFileDelete = getRequestMultiFileDelete();
    assertThat(getSpectraDs3RequestPath(multiFileDelete), is(""));
}
Also used : 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) Test(org.junit.Test)

Example 22 with Ds3Request

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request 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)

Example 23 with Ds3Request

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

the class BaseRequestGenerator_Test method getRequestPath_SpectraS3ResourceWithJobChunkId_NotInclude_Test.

@Test
public void getRequestPath_SpectraS3ResourceWithJobChunkId_NotInclude_Test() {
    final String expectedPath = "\"/_rest_/job_chunk\"";
    final Ds3Request request = createDs3RequestTestData("RequestName", Classification.spectrads3, Resource.JOB_CHUNK, ResourceType.NON_SINGLETON, false);
    final String requestPath = getRequestPath(request);
    assertThat(requestPath, is(expectedPath));
}
Also used : 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) Test(org.junit.Test)

Example 24 with Ds3Request

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

the class NotificationRequestGenerator_Test method getParentImport_Delete_Test.

@Test
public void getParentImport_Delete_Test() {
    final Ds3Request request = getRequestDeleteNotification();
    final String result = generator.getParentImport(request);
    assertThat(result, is("com.spectralogic.ds3client.commands.interfaces.AbstractDeleteNotificationRequest"));
}
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 25 with Ds3Request

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

the class NotificationRequestGenerator_Test method getAllImports_Exception_Test.

@Test(expected = IllegalArgumentException.class)
public void getAllImports_Exception_Test() {
    final Ds3Request request = createSimpleTestDs3Request();
    generator.getAllImports(request, "com.spectralogic.ds3client.commands.spectrads3.notifications");
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) 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