Search in sources :

Example 6 with Ds3AnnotationElement

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

the class Ds3ElementUtil_Test method getEncapsulatingTagAnnotationElements_FullList_Test.

@Test
public void getEncapsulatingTagAnnotationElements_FullList_Test() {
    final ImmutableList<Ds3AnnotationElement> annotationElements = ImmutableList.of(new Ds3AnnotationElement("CollectionValue", "TestTag", "java.lang.String"), new Ds3AnnotationElement("CollectionValueRenderingMode", "UNDEFINED", "com.test.Collection"), new Ds3AnnotationElement("Value", "object", "java.lang.String"));
    final String result = getEncapsulatingTagAnnotationElements(annotationElements);
    assertThat(result, is("TestTag"));
}
Also used : Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Test(org.junit.Test)

Example 7 with Ds3AnnotationElement

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

Example 8 with Ds3AnnotationElement

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

the class Ds3ElementUtil_Test method hasWrapperAnnotationElements_HasWrapper_Test.

@Test
public void hasWrapperAnnotationElements_HasWrapper_Test() {
    final ImmutableList<Ds3AnnotationElement> annotationElements = ImmutableList.of(new Ds3AnnotationElement("CollectionValue", "Nodes", "java.lang.String"), new Ds3AnnotationElement("CollectionValueRenderingMode", "SINGLE_BLOCK_FOR_ALL_ELEMENTS", "com.spectralogic.util.marshal.CustomMarshaledName$CollectionNameRenderingMode"), new Ds3AnnotationElement("Value", "Node", "java.lang.String"));
    assertThat(hasWrapperAnnotationElements(annotationElements), is(true));
}
Also used : Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Test(org.junit.Test)

Example 9 with Ds3AnnotationElement

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

the class BaseTypeGenerator_Test method toElementList_Jobs_Test.

@Test
public void toElementList_Jobs_Test() {
    final ImmutableList<Ds3AnnotationElement> annotations = ImmutableList.of(new Ds3AnnotationElement("CollectionValue", "Jobs", "java.lang.String"), new Ds3AnnotationElement("CollectionValueRenderingMode", "SINGLE_BLOCK_FOR_ALL_ELEMENTS", "com.spectralogic.util.marshal.CustomMarshaledName$CollectionNameRenderingMode"), new Ds3AnnotationElement("Value", "Job", "java.lang.String"));
    final Ds3Element jobs = new Ds3Element("Jobs", "array", "com.spectralogic.s3.server.domain.Job", ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", annotations)), false);
    final Ds3Type jobApiBean = createDs3TypeTestData("com.spectralogic.s3.server.domain.Job");
    final TypeElementList result = toElementList(jobs, ImmutableMap.of(jobApiBean.getName(), jobApiBean));
    assertThat(result.toPythonCode(), is("('Job', None, Job())"));
}
Also used : Ds3Type(com.spectralogic.ds3autogen.api.models.apispec.Ds3Type) Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) TypeElementList(com.spectralogic.ds3autogen.python.model.type.TypeElementList) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Test(org.junit.Test)

Example 10 with Ds3AnnotationElement

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

the class Ds3ElementUtil_Test method hasWrapperAnnotationElements_NoWrapper_Test.

@Test
public void hasWrapperAnnotationElements_NoWrapper_Test() {
    final ImmutableList<Ds3AnnotationElement> annotationElements = ImmutableList.of(new Ds3AnnotationElement("CollectionValue", "", "java.lang.String"), new Ds3AnnotationElement("CollectionValueRenderingMode", "UNDEFINED", "com.spectralogic.util.marshal.CustomMarshaledName$CollectionNameRenderingMode"), new Ds3AnnotationElement("Value", "object", "java.lang.String"));
    assertThat(hasWrapperAnnotationElements(annotationElements), is(false));
}
Also used : Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Test(org.junit.Test)

Aggregations

Ds3AnnotationElement (com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement)10 Test (org.junit.Test)10 Ds3Annotation (com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation)7 Ds3Element (com.spectralogic.ds3autogen.api.models.apispec.Ds3Element)5 Element (com.spectralogic.ds3autogen.java.models.Element)2 TypeElementList (com.spectralogic.ds3autogen.python.model.type.TypeElementList)2 Ds3Type (com.spectralogic.ds3autogen.api.models.apispec.Ds3Type)1