Search in sources :

Example 11 with Ds3Annotation

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

the class NullableVariableUtil_Test method isNullableElement_NoOptionalAnnotation_Test.

@Test
public void isNullableElement_NoOptionalAnnotation_Test() {
    final ImmutableList<Ds3Annotation> annotations = ImmutableList.of(new Ds3Annotation("com.spectralogic.util.db.lang.References", null), new Ds3Annotation("com.spectralogic.util.db.lang.CascadeDelete", null));
    assertFalse(isNullableElement("MyType", annotations));
    assertTrue(isNullableElement("java.lang.Integer", annotations));
}
Also used : Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Test(org.junit.Test)

Example 12 with Ds3Annotation

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

the class Element method toDs3Element.

public Ds3Element toDs3Element() {
    final ImmutableList<Ds3Annotation> ds3Annotations = toDs3Annotations();
    final Ds3Element ds3Element = new Ds3Element(name, type, componentType, ds3Annotations, isNullableElement(type, ds3Annotations));
    return ds3Element;
}
Also used : Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element)

Example 13 with Ds3Annotation

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

Example 14 with Ds3Annotation

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

the class BaseTypeGenerator_Test method containsOptionalAnnotation_WithoutOptional_Test.

@Test
public void containsOptionalAnnotation_WithoutOptional_Test() {
    final ImmutableList<Ds3Annotation> annotations = ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", null), new Ds3Annotation("com.spectralogic.util.marshal.ExcludeFromMarshaler", null));
    assertFalse(containsOptionalAnnotation(annotations));
}
Also used : Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Test(org.junit.Test)

Example 15 with Ds3Annotation

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

the class BaseTypeGenerator_Test method toXmlNotation_LowerCasedAnnotations_Test.

@Test
public void toXmlNotation_LowerCasedAnnotations_Test() {
    final Ds3Element lowerCasedElement = new Ds3Element("lowerCasedElement", "Type", "", ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", ImmutableList.of(new Ds3AnnotationElement("CollectionValue", "lowerCasedOuterTag", "java.lang.String"), new Ds3AnnotationElement("Value", "lowerCasedInnerTag", "java.lang.String")))), false);
    final String result = generator.toXmlNotation(lowerCasedElement);
    assertThat(result, is("xml:\"LowerCasedOuterTag>LowerCasedInnerTag\""));
}
Also used : Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Test(org.junit.Test)

Aggregations

Ds3Annotation (com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation)20 Test (org.junit.Test)18 Ds3Element (com.spectralogic.ds3autogen.api.models.apispec.Ds3Element)9 Ds3AnnotationElement (com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement)7 Element (com.spectralogic.ds3autogen.java.models.Element)2 NetNullableVariable (com.spectralogic.ds3autogen.net.model.common.NetNullableVariable)2 TypeElementList (com.spectralogic.ds3autogen.python.model.type.TypeElementList)2 ImmutableList (com.google.common.collect.ImmutableList)1 Ds3Type (com.spectralogic.ds3autogen.api.models.apispec.Ds3Type)1