Search in sources :

Example 21 with NetNullableVariable

use of com.spectralogic.ds3autogen.net.model.common.NetNullableVariable in project ds3_autogen by SpectraLogic.

the class BaseRequestGenerator_Test method convertGuidToStringList_FullList_Test.

@Test
public void convertGuidToStringList_FullList_Test() {
    final ImmutableList<NetNullableVariable> vars = ImmutableList.of(new NetNullableVariable("GuidVar", "Guid", true, true), new NetNullableVariable("IntVar", "int", true, true));
    final ImmutableList<NetNullableVariable> result = convertGuidToStringList(vars);
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("GuidVar"));
    assertThat(result.get(0).getType(), is("string"));
    assertThat(result.get(1).getName(), is("IntVar"));
    assertThat(result.get(1).getType(), is("int"));
}
Also used : NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) Test(org.junit.Test)

Example 22 with NetNullableVariable

use of com.spectralogic.ds3autogen.net.model.common.NetNullableVariable in project ds3_autogen by SpectraLogic.

the class BaseRequestGenerator_Test method toNullableArgument_NonNullablePrimitive_Test.

@Test
public void toNullableArgument_NonNullablePrimitive_Test() {
    //Note: optional parameters are always nullable
    final Ds3Param param = new Ds3Param("MyParam", "java.lang.Integer", false);
    final NetNullableVariable result = toNullableArgument(param, ImmutableMap.of());
    assertThat(result.getNetType(), is("int?"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) Test(org.junit.Test)

Example 23 with NetNullableVariable

use of com.spectralogic.ds3autogen.net.model.common.NetNullableVariable in project ds3_autogen by SpectraLogic.

the class BaseRequestGenerator_Test method toNullableArgument_NullableSpectraType_Test.

@Test
public void toNullableArgument_NullableSpectraType_Test() {
    final Ds3Param param = new Ds3Param("MyParam", "com.spectra.TestType", true);
    final NetNullableVariable result = toNullableArgument(param, ImmutableMap.of());
    assertThat(result.getNetType(), is("TestType"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) Test(org.junit.Test)

Example 24 with NetNullableVariable

use of com.spectralogic.ds3autogen.net.model.common.NetNullableVariable in project ds3_autogen by SpectraLogic.

the class BaseTypeGenerator_Test method toElement_EnumElement_Test.

@Test
public void toElement_EnumElement_Test() {
    final Ds3Element ds3Element = new Ds3Element("TestElement", "java.lang.Integer", null, ImmutableList.of(new Ds3Annotation("com.spectralogic.util.bean.lang.Optional", null)), true);
    final NetNullableVariable result = generator.toElement(ds3Element, ImmutableMap.of());
    assertThat(result.getName(), is("TestElement"));
    assertThat(result.getNetType(), is("int?"));
}
Also used : NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Test(org.junit.Test)

Aggregations

NetNullableVariable (com.spectralogic.ds3autogen.net.model.common.NetNullableVariable)24 Test (org.junit.Test)24 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)8 Ds3Element (com.spectralogic.ds3autogen.api.models.apispec.Ds3Element)4 Ds3Annotation (com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation)2 WithConstructorVariable (com.spectralogic.ds3autogen.net.model.request.WithConstructorVariable)2 Ds3Type (com.spectralogic.ds3autogen.api.models.apispec.Ds3Type)1 Ds3DocSpec (com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec)1 Ds3DocSpecImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecImpl)1