Search in sources :

Example 26 with Ds3Request

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

the class NotificationRequestGenerator_Test method getAllImports_Get_Test.

@Test
public void getAllImports_Get_Test() {
    final Ds3Request request = getRequestGetNotification();
    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.AbstractGetNotificationRequest"));
    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 27 with Ds3Request

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

the class NotificationRequestGenerator_Test method getParentImport_Exception_Test.

@Test(expected = IllegalArgumentException.class)
public void getParentImport_Exception_Test() {
    final Ds3Request request = createSimpleTestDs3Request();
    generator.getParentImport(request);
}
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 28 with Ds3Request

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

the class ObjectsPayloadGenerator_Test method getAdditionalContent_RequiredPartList_Test.

@Test
public void getAdditionalContent_RequiredPartList_Test() {
    final String expected = "if part_list is not None:\n" + "      if not isinstance(part_list, PartList):\n" + "        raise TypeError('com.spectralogic.s3.server.handler.reqhandler.amazons3.CompleteMultiPartUploadRequestHandler should have request payload of type: PartList')\n" + "      self.body = xmldom.tostring(part_list.to_xml())\n";
    final Ds3Request request = getCompleteMultipartUploadRequest();
    final String result = generator.getAdditionalContent(request, request.getName());
    assertThat(result, is(expected));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 29 with Ds3Request

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

the class ObjectsPayloadGenerator_Test method getAdditionalContent_RequiredDeleteObjectList_Test.

@Test
public void getAdditionalContent_RequiredDeleteObjectList_Test() {
    final String expected = "if object_list is not None:\n" + "      if not isinstance(object_list, DeleteObjectList):\n" + "        raise TypeError('com.spectralogic.s3.server.handler.reqhandler.amazons3.DeleteObjectsRequestHandler should have request payload of type: DeleteObjectList')\n" + "      self.body = xmldom.tostring(object_list.to_xml())\n";
    final Ds3Request request = getRequestMultiFileDelete();
    final String result = generator.getAdditionalContent(request, request.getName());
    assertThat(result, is(expected));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 30 with Ds3Request

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

the class PutObjectRequestGenerator method toRequiredConstructorParams.

/**
     * Gets the sorted list of required constructor params, including stream and length
     */
@Override
public ImmutableList<ConstructorParam> toRequiredConstructorParams(final Ds3Request ds3Request) {
    final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
    builder.addAll(getNonVoidArgsFromParamList(ds3Request.getRequiredQueryParams()));
    builder.addAll(getAssignmentArguments(ds3Request));
    builder.add(new Arguments("", "stream"));
    builder.add(new Arguments("", "length"));
    return builder.build().stream().sorted(new CustomArgumentComparator()).map(arg -> new ConstructorParam(camelToUnderscore(arg.getName()), false)).collect(GuavaCollectors.immutableList());
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) RequestConverterUtil.getNonVoidArgsFromParamList(com.spectralogic.ds3autogen.utils.RequestConverterUtil.getNonVoidArgsFromParamList) Helper.camelToUnderscore(com.spectralogic.ds3autogen.utils.Helper.camelToUnderscore) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) GuavaCollectors(com.spectralogic.ds3autogen.utils.collections.GuavaCollectors) ImmutableList(com.google.common.collect.ImmutableList) PythonHelper.pythonIndent(com.spectralogic.ds3autogen.python.helpers.PythonHelper.pythonIndent) ConstructorParam(com.spectralogic.ds3autogen.python.model.request.ConstructorParam) CustomArgumentComparator(com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator) ConstructorParam(com.spectralogic.ds3autogen.python.model.request.ConstructorParam) ImmutableList(com.google.common.collect.ImmutableList) CustomArgumentComparator(com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator) Arguments(com.spectralogic.ds3autogen.api.models.Arguments)

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