Search in sources :

Example 21 with Ds3Element

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

the class C_Type_Test method testStructMemberTypeLongToString1.

@Test
public void testStructMemberTypeLongToString1() throws java.text.ParseException {
    final Ds3Element testElement = new Ds3Element("longElement1", "java.lang.Long", null, true);
    final C_Type c_type = C_TypeHelper.convertDs3ElementType(testElement, ImmutableSet.of());
    assertThat(c_type.getTypeName(), is("uint64_t"));
    assertThat(c_type.toString(), is("uint64_t"));
}
Also used : C_Type(com.spectralogic.ds3autogen.c.models.C_Type) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Example 22 with Ds3Element

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

the class ChecksumTypeGenerator_Test method getAllImports_Test.

@Test
public void getAllImports_Test() {
    final ImmutableList<Ds3Element> ds3Elements = ImmutableList.of(new Ds3Element("ElementName1", "com.spectralogic.test.ElementType1", "ElementComponentType1", false), new Ds3Element("ElementName2", "ElementType2", "com.spectralogic.test.ElementComponentType2", false), new Ds3Element("ElementName3", "ElementType3", null, false));
    final Ds3Type ds3Type = new Ds3Type("TypeName", null, ds3Elements, null);
    final ImmutableList<String> result = generator.getAllImports(ds3Type);
    assertThat(result.size(), is(0));
}
Also used : Ds3Type(com.spectralogic.ds3autogen.api.models.apispec.Ds3Type) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Example 23 with Ds3Element

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

the class CommonPrefixGenerator_Test method getAllImports_Test.

@Test
public void getAllImports_Test() {
    final ImmutableList<Ds3Element> ds3Elements = ImmutableList.of(new Ds3Element("ElementName1", "com.spectralogic.test.ElementType1", "ElementComponentType1", false), new Ds3Element("ElementName2", "ElementType2", "com.spectralogic.test.ElementComponentType2", false), new Ds3Element("ElementName3", "ElementType3", null, false));
    final Ds3Type ds3Type = new Ds3Type("TypeName", null, ds3Elements, null);
    final ImmutableList<String> result = generator.getAllImports(ds3Type);
    assertThat(result.size(), is(4));
    assertThat(result, hasItem("java.util.List"));
    assertThat(result, hasItem("java.util.ArrayList"));
    assertThat(result, hasItem("com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper"));
    assertThat(result, hasItem("com.spectralogic.ds3client.models.common.CommonPrefixes"));
}
Also used : Ds3Type(com.spectralogic.ds3autogen.api.models.apispec.Ds3Type) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) Test(org.junit.Test)

Example 24 with Ds3Element

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

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

Ds3Element (com.spectralogic.ds3autogen.api.models.apispec.Ds3Element)54 Test (org.junit.Test)48 Ds3Type (com.spectralogic.ds3autogen.api.models.apispec.Ds3Type)22 C_Type (com.spectralogic.ds3autogen.c.models.C_Type)10 Ds3Annotation (com.spectralogic.ds3autogen.api.models.apispec.Ds3Annotation)9 Element (com.spectralogic.ds3autogen.java.models.Element)6 ImmutableSet (com.google.common.collect.ImmutableSet)5 Ds3AnnotationElement (com.spectralogic.ds3autogen.api.models.apispec.Ds3AnnotationElement)5 ImmutableList (com.google.common.collect.ImmutableList)4 Ds3ApiSpec (com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec)4 Struct (com.spectralogic.ds3autogen.c.models.Struct)4 NetNullableVariable (com.spectralogic.ds3autogen.net.model.common.NetNullableVariable)4 Ds3ModelPartialDataFixture.createEmptyDs3Type (com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Type)4 Ds3SpecParser (com.spectralogic.ds3autogen.api.Ds3SpecParser)3 Ds3EnumConstant (com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant)3 TestFileUtilsImpl (com.spectralogic.ds3autogen.utils.TestFileUtilsImpl)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 Ds3SpecParserImpl (com.spectralogic.ds3autogen.Ds3SpecParserImpl)2 NameMapper (com.spectralogic.ds3autogen.NameMapper)2 Ds3DocSpecParser (com.spectralogic.ds3autogen.api.Ds3DocSpecParser)2