Search in sources :

Example 1 with Ds3AnnotationElement

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

the class BaseTypeGenerator_Test method toElementList_CommonPrefixes_Test.

@Test
public void toElementList_CommonPrefixes_Test() {
    final ImmutableList<Ds3AnnotationElement> annotations = ImmutableList.of(new Ds3AnnotationElement("CollectionValue", "CommonPrefixes", "java.lang.String"), new Ds3AnnotationElement("CollectionValueRenderingMode", "BLOCK_FOR_EVERY_ELEMENT", "com.spectralogic.util.marshal.CustomMarshaledName$CollectionNameRenderingMode"), new Ds3AnnotationElement("Value", "Prefix", "java.lang.String"));
    final Ds3Element commonPrefixes = new Ds3Element("CommonPrefixes", "array", "java.lang.String", ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", annotations)), false);
    final TypeElementList result = toElementList(commonPrefixes, ImmutableMap.of());
    assertThat(result.toPythonCode(), is("('CommonPrefixes', None, CommonPrefixes())"));
}
Also used : 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 2 with Ds3AnnotationElement

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

the class JobsApiBeanTypeGenerator_Test method toElement_NotJobsElement_Test.

@Test
public void toElement_NotJobsElement_Test() {
    final ImmutableList<Ds3AnnotationElement> annotationElements = ImmutableList.of(new Ds3AnnotationElement("CollectionValue", "NotJobs", "java.lang.String"), new Ds3AnnotationElement("CollectionValueRenderingMode", "SINGLE_BLOCK_FOR_ALL_ELEMENTS", "com.spectralogic.util.marshal.CustomMarshaledName$CollectionNameRenderingMode"), new Ds3AnnotationElement("Value", "NotJob", "java.lang.String"));
    final ImmutableList<Ds3Annotation> annotations = ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", annotationElements));
    final Ds3Element ds3Element = new Ds3Element("NotJobs", "array", "com.spectralogic.s3.server.domain.JobApiBean", annotations, false);
    final Element result = generator.toElement(ds3Element);
    assertThat(result.hasWrapper(), is(true));
}
Also used : Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Element(com.spectralogic.ds3autogen.java.models.Element) Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Example 3 with Ds3AnnotationElement

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

the class JobsApiBeanTypeGenerator_Test method toElement_JobsElement_Test.

@Test
public void toElement_JobsElement_Test() {
    final ImmutableList<Ds3AnnotationElement> annotationElements = 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 ImmutableList<Ds3Annotation> annotations = ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", annotationElements));
    final Ds3Element ds3Element = new Ds3Element("Jobs", "array", "com.spectralogic.s3.server.domain.JobApiBean", annotations, false);
    final Element result = generator.toElement(ds3Element);
    assertThat(result.hasWrapper(), is(false));
}
Also used : Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Element(com.spectralogic.ds3autogen.java.models.Element) Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Example 4 with Ds3AnnotationElement

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

the class Ds3ElementUtil_Test method hasWrapperAnnotations_HasWrapper_Test.

@Test
public void hasWrapperAnnotations_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"));
    final ImmutableList<Ds3Annotation> annotations = ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", annotationElements));
    assertThat(hasWrapperAnnotations(annotations), is(true));
}
Also used : Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) Test(org.junit.Test)

Example 5 with Ds3AnnotationElement

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

the class Ds3ElementUtil_Test method hasWrapperAnnotations_NoWrapper_Test.

@Test
public void hasWrapperAnnotations_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"));
    final ImmutableList<Ds3Annotation> annotations = ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", annotationElements));
    assertThat(hasWrapperAnnotations(annotations), is(false));
}
Also used : Ds3AnnotationElement(com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement) Ds3Annotation(com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation) 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