Search in sources :

Example 61 with Arguments

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

the class BaseResponseGenerator_Test method toParamList_FullList_Test.

@Test
public void toParamList_FullList_Test() {
    final ImmutableList<Ds3ResponseCode> responseCodes = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.test.TestTypeB", null))), new Ds3ResponseCode(201, ImmutableList.of(new Ds3ResponseType("null", null))), new Ds3ResponseCode(203, ImmutableList.of(new Ds3ResponseType("com.test.TestTypeA", null))), new Ds3ResponseCode(400, ImmutableList.of(new Ds3ResponseType("com.test.TestTypeC", null))));
    final ImmutableList<Arguments> result = generator.toParamList(responseCodes);
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("testTypeAResult"));
    assertThat(result.get(1).getName(), is("testTypeBResult"));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 62 with Arguments

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

the class BaseResponseGenerator_Test method toParam_NullPayload_Test.

@Test
public void toParam_NullPayload_Test() {
    final Ds3ResponseCode responseCode = new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("null", null)));
    final Optional<Arguments> result = toParam(responseCode);
    assertFalse(result.isPresent());
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 63 with Arguments

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

the class BaseResponseGenerator_Test method toConstructorParams_FullList_Test.

@Test
public void toConstructorParams_FullList_Test() {
    final String expected = "final TypeOne argOne, final TypeTwo argTwo, final TypeThree argThree";
    final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("TypeOne", "ArgOne"), new Arguments("TypeTwo", "ArgTwo"), new Arguments("TypeThree", "ArgThree"));
    final String result = generator.toConstructorParams(args);
    assertThat(result, is(expected));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 64 with Arguments

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

the class BaseResponseGenerator_Test method toParam_ComponentType_Test.

@Test
public void toParam_ComponentType_Test() {
    final Ds3ResponseCode responseCode = new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("array", "com.test.ComponentType")));
    final Optional<Arguments> result = toParam(responseCode);
    assertTrue(result.isPresent());
    assertThat(result.get().getName(), is("componentTypeListResult"));
    assertThat(result.get().getType(), is("List<ComponentType>"));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 65 with Arguments

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

the class GetObjectResponseGenerator_Test method toConstructorParamsWithChecksum_FullList_Test.

@Test
public void toConstructorParamsWithChecksum_FullList_Test() {
    final String expected = "final Metadata metadata, final long objectSize, final String checksum, final ChecksumType.Type checksumType";
    final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("Metadata", "Metadata"), new Arguments("long", "ObjectSize"));
    assertThat(generator.toConstructorParamsWithChecksum(args), is(expected));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Aggregations

Arguments (com.spectralogic.ds3autogen.api.models.Arguments)188 Test (org.junit.Test)144 FileUtils (com.spectralogic.ds3autogen.api.FileUtils)46 ImmutableList (com.google.common.collect.ImmutableList)40 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)33 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)25 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)25 TestGeneratedCode (com.spectralogic.ds3autogen.java.utils.TestGeneratedCode)25 TestGenerateCode (com.spectralogic.ds3autogen.net.utils.TestGenerateCode)21 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)19 Helper.removeVoidArguments (com.spectralogic.ds3autogen.utils.Helper.removeVoidArguments)15 BaseParseResponse (com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse)14 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)13 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)9 GuavaCollectors (com.spectralogic.ds3autogen.utils.collections.GuavaCollectors)8 CustomArgumentComparator (com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator)8 ConstructorParam (com.spectralogic.ds3autogen.python.model.request.ConstructorParam)7 Helper.camelToUnderscore (com.spectralogic.ds3autogen.utils.Helper.camelToUnderscore)7 RequestConverterUtil.getNonVoidArgsFromParamList (com.spectralogic.ds3autogen.utils.RequestConverterUtil.getNonVoidArgsFromParamList)6 Ds3ResponseType (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType)5