Search in sources :

Example 1 with NetNullableVariable

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

the class BaseTypeGenerator_Test method toElement_ComponentElement_Test.

@Test
public void toElement_ComponentElement_Test() {
    final Ds3Element ds3Element = new Ds3Element("TestElement", "array", "java.lang.Integer", true);
    final NetNullableVariable result = generator.toElement(ds3Element, ImmutableMap.of());
    assertThat(result.getName(), is("TestElement"));
    assertThat(result.getNetType(), is("IEnumerable<int>"));
}
Also used : NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Example 2 with NetNullableVariable

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

the class BaseTypeGenerator_Test method toElementsList_FullList_Test.

@Test
public void toElementsList_FullList_Test() {
    final ImmutableList<Ds3Annotation> optionalAnnotation = ImmutableList.of(new Ds3Annotation("com.spectralogic.util.bean.lang.Optional", null));
    final ImmutableList<Ds3Element> ds3Elements = ImmutableList.of(new Ds3Element("Element1", "java.lang.Integer", null, false), new Ds3Element("Element2", "java.lang.Integer", null, optionalAnnotation, true), new Ds3Element("Element3", "array", "java.lang.Integer", false));
    final ImmutableList<NetNullableVariable> result = generator.toElementsList(ds3Elements, ImmutableMap.of());
    assertThat(result.size(), is(3));
    assertThat(result.get(0).getName(), is("Element1"));
    assertThat(result.get(0).getNetType(), is("int"));
    assertThat(result.get(1).getName(), is("Element2"));
    assertThat(result.get(1).getNetType(), is("int?"));
    assertThat(result.get(2).getName(), is("Element3"));
    assertThat(result.get(2).getNetType(), is("IEnumerable<int>"));
}
Also used : NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Example 3 with NetNullableVariable

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

the class BaseTypeGenerator_Test method toElement_SimpleElement_Test.

@Test
public void toElement_SimpleElement_Test() {
    final Ds3Element ds3Element = new Ds3Element("TestElement", "java.lang.Integer", null, false);
    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) Test(org.junit.Test)

Example 4 with NetNullableVariable

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

the class NetNullableVariableUtils_Test method createNullableVariable_NullableEnum_Test.

@Test
public void createNullableVariable_NullableEnum_Test() {
    final NetNullableVariable var = createNullableVariable("Name", "TestEnumType", true, getTestTypeMap());
    assertThat(var.getNetType(), is("TestEnumType?"));
}
Also used : NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) Test(org.junit.Test)

Example 5 with NetNullableVariable

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

the class NetNullableVariableUtils_Test method createNullableVariable_NullableSpectraType_Test.

@Test
public void createNullableVariable_NullableSpectraType_Test() {
    final NetNullableVariable var = createNullableVariable("Name", "TestElementType", true, getTestTypeMap());
    assertThat(var.getNetType(), is("TestElementType"));
}
Also used : NetNullableVariable(com.spectralogic.ds3autogen.net.model.common.NetNullableVariable) 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