Search in sources :

Example 1 with Ds3Annotation

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

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

the class BaseTypeGenerator_Test method containsOptionalAnnotation_WithOptional_Test.

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

Example 3 with Ds3Annotation

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

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

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

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