use of com.spectralogic.ds3autogen.python.model.type.TypeElementList in project ds3_autogen by SpectraLogic.
the class PythonFunctionalTests method simpleType.
@Test
public void simpleType() throws TemplateModelException, IOException {
final String modelDescriptorName = "TestElementsType";
final FileUtils fileUtils = mock(FileUtils.class);
final TestPythonGeneratedCode codeGenerator = new TestPythonGeneratedCode(fileUtils);
codeGenerator.generateCode(fileUtils, "/input/types/simpleType.xml");
final String ds3Code = codeGenerator.getDs3Code();
CODE_LOGGER.logFile(ds3Code, FileTypeToLog.MODEL_PARSERS);
assertTrue(hasContent(ds3Code));
final ImmutableList<TypeContent> modelContents = ImmutableList.of(new TypeAttribute("InCache"), new TypeElement("MyBucket", "BucketDetails"), new TypeElement("ByteOffset", "None"), new TypeElementList("MyBucketList", "None", "BucketDetails"), new TypeElementList("Pool", "Pools", "None"));
hasModelDescriptor(modelDescriptorName, modelContents, ds3Code);
}
use of com.spectralogic.ds3autogen.python.model.type.TypeElementList in project ds3_autogen by SpectraLogic.
the class PythonFunctionalTests method bucketObjectsApiBean.
@Test
public void bucketObjectsApiBean() throws TemplateModelException, IOException {
final String modelDescriptorName = "ListBucketResult";
final FileUtils fileUtils = mock(FileUtils.class);
final TestPythonGeneratedCode codeGenerator = new TestPythonGeneratedCode(fileUtils);
codeGenerator.generateCode(fileUtils, "/input/types/bucketObjectsApiBean.xml");
final String ds3Code = codeGenerator.getDs3Code();
CODE_LOGGER.logFile(ds3Code, FileTypeToLog.MODEL_PARSERS);
assertTrue(hasContent(ds3Code));
final ImmutableList<TypeContent> modelContents = ImmutableList.of(new TypeElement("CreationDate", "None"), new TypeElement("Delimiter", "None"), new TypeElement("Marker", "None"), new TypeElement("MaxKeys", "None"), new TypeElement("Name", "None"), new TypeElement("NextMarker", "None"), new TypeElement("Prefix", "None"), new TypeElement("IsTruncated", "None"), new TypeElementList("CommonPrefixes", "None", "CommonPrefixes"), new TypeElementList("Contents", "None", "Contents"));
hasModelDescriptor(modelDescriptorName, modelContents, ds3Code);
}
use of com.spectralogic.ds3autogen.python.model.type.TypeElementList in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method toElementList_Jobs_Test.
@Test
public void toElementList_Jobs_Test() {
final ImmutableList<Ds3AnnotationElement> annotations = 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 Ds3Element jobs = new Ds3Element("Jobs", "array", "com.spectralogic.s3.server.domain.Job", ImmutableList.of(new Ds3Annotation("com.spectralogic.util.marshal.CustomMarshaledName", annotations)), false);
final Ds3Type jobApiBean = createDs3TypeTestData("com.spectralogic.s3.server.domain.Job");
final TypeElementList result = toElementList(jobs, ImmutableMap.of(jobApiBean.getName(), jobApiBean));
assertThat(result.toPythonCode(), is("('Job', None, Job())"));
}
use of com.spectralogic.ds3autogen.python.model.type.TypeElementList in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method toElementList_Test.
@Test
public void toElementList_Test() {
final TypeElementList result = toElementList(createListDs3Element(), createTestTypeMap());
assertThat(result.toPythonCode(), is("('ListElement', None, ListType())"));
}
use of com.spectralogic.ds3autogen.python.model.type.TypeElementList in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method toElementList_EncapsulatedList_Test.
@Test
public void toElementList_EncapsulatedList_Test() {
final TypeElementList result = toElementList(createEncapsulatedListDs3Element(), createTestTypeMap());
assertThat(result.toPythonCode(), is("('ListType', 'ListTypes', ListType())"));
}
Aggregations