Search in sources :

Example 81 with Ds3Request

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

the class PaginationResponseGenerator_Test method toParseResponsePayload_GetObjects_Test.

@Test
public void toParseResponsePayload_GetObjects_Test() {
    final String expected = "if self.response.status == 200:\n" + "      self.result = parseModel(xmldom.fromstring(response.read()), array())\n" + "      self.paging_truncated = self.parse_int_header('page-truncated', response.getheaders())\n" + "      self.paging_total_result_count = self.parse_int_header('total-result-count', response.getheaders())";
    final Ds3Request ds3Request = getObjectsDetailsRequest();
    assertThat(generator.toParseResponsePayload(ds3Request), is(expected));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 82 with Ds3Request

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

the class BaseResponseGenerator_Test method toParseResponsePayload_NoPayload_Test.

@Test
public void toParseResponsePayload_NoPayload_Test() {
    final Ds3Request request = createDs3RequestTestData("com.test.Request", Classification.amazons3);
    assertThat(generator.toParseResponsePayload(request), is(""));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 83 with Ds3Request

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

the class BaseResponseGenerator_Test method toParseResponsePayload_NoNameToMarshal_Test.

@Test
public void toParseResponsePayload_NoNameToMarshal_Test() {
    final String expected = "if self.response.status == 200:\n" + "      self.result = parseModel(xmldom.fromstring(response.read()), ListBucketResult())";
    final Ds3Request request = getBucketRequest();
    assertThat(generator.toParseResponsePayload(request), is(expected));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 84 with Ds3Request

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

the class BaseResponseGenerator_Test method toParseResponsePayload_WithNameToMarshal_Test.

@Test
public void toParseResponsePayload_WithNameToMarshal_Test() {
    final String expected = "if self.response.status == 200:\n" + "      self.result = parseModel(xmldom.fromstring(response.read()), JobWithChunksApiBean())";
    final Ds3Request request = getRequestGetJob();
    assertThat(generator.toParseResponsePayload(request), is(expected));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 85 with Ds3Request

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

the class HeadResponseGenerator_Test method getStatusCodes_HeadObject_Test.

@Test
public void getStatusCodes_HeadObject_Test() {
    final Ds3Request headObject = getHeadObjectRequest();
    final ImmutableList<Integer> result = generator.getStatusCodes(headObject.getDs3ResponseCodes(), headObject.getName());
    assertThat(result.size(), is(3));
    assertThat(result, hasItem(200));
    assertThat(result, hasItem(403));
    assertThat(result, hasItem(404));
}
Also used : Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) 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