Search in sources :

Example 6 with Element

use of com.spectralogic.ds3autogen.java.models.Element 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 7 with Element

use of com.spectralogic.ds3autogen.java.models.Element 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 8 with Element

use of com.spectralogic.ds3autogen.java.models.Element in project ds3_autogen by SpectraLogic.

the class JavaHelper_Test method getModelVariable_NonArrayComponentType_Test.

@Test(expected = IllegalArgumentException.class)
public void getModelVariable_NonArrayComponentType_Test() {
    final Element element = new Element("testName", "map", "com.spectralogic.s3.common.platform.domain.BlobApiBean");
    getModelVariable(element);
}
Also used : Element(com.spectralogic.ds3autogen.java.models.Element) Test(org.junit.Test)

Example 9 with Element

use of com.spectralogic.ds3autogen.java.models.Element in project ds3_autogen by SpectraLogic.

the class BaseTypeGenerator_Test method toElementList_FullList_Test.

@Test
public void toElementList_FullList_Test() {
    final ImmutableList<Ds3Element> ds3Elements = ImmutableList.of(new Ds3Element("Name1", "Type1", "ComponentType1", false), new Ds3Element("Name2", "Type2", "ComponentType2", false));
    final ImmutableList<Element> result = generator.toElementList(ds3Elements);
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("Name1"));
    assertThat(result.get(1).getName(), is("Name2"));
}
Also used : Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Element(com.spectralogic.ds3autogen.java.models.Element) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Example 10 with Element

use of com.spectralogic.ds3autogen.java.models.Element in project ds3_autogen by SpectraLogic.

the class BaseTypeGenerator_Test method toElement_Test.

@Test
public void toElement_Test() {
    final Ds3Element ds3Element = new Ds3Element("Name", "Type", "ComponentType", false);
    final Element result = generator.toElement(ds3Element);
    assertThat(result.getName(), is("Name"));
    assertThat(result.getType(), is("Type"));
    assertThat(result.getComponentType(), is("ComponentType"));
}
Also used : Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Element(com.spectralogic.ds3autogen.java.models.Element) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Aggregations

Element (com.spectralogic.ds3autogen.java.models.Element)19 Test (org.junit.Test)18 Ds3Element (com.spectralogic.ds3autogen.api.models.apispec.Ds3Element)6 FileUtils (com.spectralogic.ds3autogen.api.FileUtils)4 TestGeneratedModelCode (com.spectralogic.ds3autogen.java.utils.TestGeneratedModelCode)4 Ds3Annotation (com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation)2 Ds3AnnotationElement (com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement)2 ImmutableList (com.google.common.collect.ImmutableList)1