Search in sources :

Example 1 with Ds3ResponseCode

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

the class BaseResponseParserGenerator_Test method toParseResponse_NullTypesList_Test.

@Test(expected = IllegalArgumentException.class)
public void toParseResponse_NullTypesList_Test() {
    final Ds3ResponseCode responseCode = new Ds3ResponseCode(200, null);
    toParseResponse(responseCode, "TestResponse", false, false);
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Test(org.junit.Test)

Example 2 with Ds3ResponseCode

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

the class BaseResponseGenerator_Test method toParam_SimpleType_Test.

@Test
public void toParam_SimpleType_Test() {
    final Ds3ResponseCode responseCode = new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.test.TestType", null)));
    final Optional<Arguments> result = toParam(responseCode);
    assertTrue(result.isPresent());
    assertThat(result.get().getName(), is("testTypeResult"));
    assertThat(result.get().getType(), is("TestType"));
}
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 3 with Ds3ResponseCode

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode 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 4 with Ds3ResponseCode

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode 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 5 with Ds3ResponseCode

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

Aggregations

Ds3ResponseCode (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode)52 Test (org.junit.Test)43 Ds3ResponseType (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType)30 ResponseCode (com.spectralogic.ds3autogen.java.models.ResponseCode)8 ResponseCode (com.spectralogic.ds3autogen.go.models.response.ResponseCode)6 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)4 ImmutableList (com.google.common.collect.ImmutableList)3 CaseFormat (com.google.common.base.CaseFormat)1 com.spectralogic.ds3autogen.api.models (com.spectralogic.ds3autogen.api.models)1 Action (com.spectralogic.ds3autogen.api.models.enums.Action)1 HttpVerb (com.spectralogic.ds3autogen.api.models.enums.HttpVerb)1 Operation (com.spectralogic.ds3autogen.api.models.enums.Operation)1 Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode (com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode)1 Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode (com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode)1 ResponseAndParserUtils.getDs3ResponseCode (com.spectralogic.ds3autogen.java.utils.ResponseAndParserUtils.getDs3ResponseCode)1 ConverterUtil.isEmpty (com.spectralogic.ds3autogen.utils.ConverterUtil.isEmpty)1 CustomArgumentComparator (com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator)1 java.util (java.util)1 Collectors (java.util.stream.Collectors)1 StringUtils (org.apache.commons.lang3.StringUtils)1