Search in sources :

Example 16 with Ds3Param

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

the class BaseRequestGenerator_Test method updateDs3RequestParamTypes_Test.

@Test
public void updateDs3RequestParamTypes_Test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("Arg1", "String", false), new Ds3Param("Arg2", "java.util.UUID", false), new Ds3Param("BucketId", "java.util.UUID", false));
    final Ds3Request request = createDs3RequestTestData(false, params, params);
    final Ds3Request result = updateDs3RequestParamTypes(request);
    final ImmutableList<Ds3Param> requiredParams = result.getRequiredQueryParams();
    assertThat(requiredParams.size(), is(3));
    assertThat(requiredParams.get(0).getName(), is("Arg1"));
    assertThat(requiredParams.get(0).getType(), is("String"));
    assertThat(requiredParams.get(1).getName(), is("Arg2"));
    assertThat(requiredParams.get(1).getType(), is("java.util.UUID"));
    assertThat(requiredParams.get(2).getName(), is("BucketId"));
    assertThat(requiredParams.get(2).getType(), is("String"));
    final ImmutableList<Ds3Param> optionalParams = result.getOptionalQueryParams();
    assertThat(optionalParams.size(), is(3));
    assertThat(optionalParams.get(0).getName(), is("Arg1"));
    assertThat(optionalParams.get(0).getType(), is("String"));
    assertThat(optionalParams.get(1).getName(), is("Arg2"));
    assertThat(optionalParams.get(1).getType(), is("java.util.UUID"));
    assertThat(optionalParams.get(2).getName(), is("BucketId"));
    assertThat(optionalParams.get(2).getType(), is("String"));
}
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) Test(org.junit.Test)

Example 17 with Ds3Param

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

the class RequestConverterUtil_Test method getVoidArgsFromParamList_FullList_Test.

@Test
public void getVoidArgsFromParamList_FullList_Test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("SimpleArg", "SimpleType", false), new Ds3Param("VoidArg", "void", false));
    final ImmutableList<Arguments> result = getVoidArgsFromParamList(params);
    assertThat(result.size(), is(1));
    assertThat(result.get(0).getType(), is("void"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Test(org.junit.Test)

Example 18 with Ds3Param

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

the class RequestConverterUtil_Test method getNonVoidArgsFromParamList_FullList_Test.

@Test
public void getNonVoidArgsFromParamList_FullList_Test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("SimpleArg", "SimpleType", false), new Ds3Param("VoidArg", "void", false));
    final ImmutableList<Arguments> result = getNonVoidArgsFromParamList(params);
    assertThat(result.size(), is(1));
    assertThat(result.get(0).getType(), is(not("void")));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Test(org.junit.Test)

Example 19 with Ds3Param

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

the class Ds3RequestClassificationUtil_Test method paramListContainsParam_test.

@Test
public void paramListContainsParam_test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("Name1", "Type1", false), new Ds3Param("Name2", "Type2", false));
    assertTrue(paramListContainsParam(params, "Name1", "Type1"));
    assertTrue(paramListContainsParam(params, "Name2", "Type2"));
    assertFalse(paramListContainsParam(params, "Name1", "Type2"));
    assertFalse(paramListContainsParam(params, "Name2", "Type1"));
    assertFalse(paramListContainsParam(null, "Name1", "Type1"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Test(org.junit.Test)

Example 20 with Ds3Param

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

the class BaseRequestGenerator_Test method toOptionalArgumentsList_FullList_Test.

@Test
public void toOptionalArgumentsList_FullList_Test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("SimpleArg", "SimpleType", false), new Ds3Param("ArgWithPath", "com.test.TypeWithPath", false));
    final ImmutableList<NetNullableVariable> result = generator.toOptionalArgumentsList(params, ImmutableMap.of());
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("SimpleArg"));
    assertThat(result.get(0).getNetType(), is("SimpleType"));
    assertThat(result.get(1).getName(), is("ArgWithPath"));
    assertThat(result.get(1).getNetType(), is("TypeWithPath"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) Test(org.junit.Test)

Aggregations

Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)39 Test (org.junit.Test)37 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)10 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)8 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)8 NetNullableVariable (com.spectralogic.ds3autogen.net.model.common.NetNullableVariable)8 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)5 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)5 Ds3ModelPartialDataFixture.createEmptyDs3Request (com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request)5 ImmutableList (com.google.common.collect.ImmutableList)3 Parameter (com.spectralogic.ds3autogen.c.models.Parameter)3 SimpleVariable (com.spectralogic.ds3autogen.go.models.request.SimpleVariable)3 WithConstructor (com.spectralogic.ds3autogen.go.models.request.WithConstructor)3 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)3 Request (com.spectralogic.ds3autogen.c.models.Request)2 Variable (com.spectralogic.ds3autogen.go.models.request.Variable)2 TestFileUtilsImpl (com.spectralogic.ds3autogen.utils.TestFileUtilsImpl)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 HashMap (java.util.HashMap)2 Ds3Type (com.spectralogic.ds3autogen.api.models.apispec.Ds3Type)1