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>"));
}
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));
}
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())"));
}
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));
}
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));
}
Aggregations