use of com.spectralogic.ds3autogen.python.model.type.TypeElement in project ds3_autogen by SpectraLogic.
the class PythonFunctionalTests method listMultiPartUploadApiBean.
@Test
public void listMultiPartUploadApiBean() throws TemplateModelException, IOException {
final String modelDescriptorName = "ListMultiPartUploadsResult";
final FileUtils fileUtils = mock(FileUtils.class);
final TestPythonGeneratedCode codeGenerator = new TestPythonGeneratedCode(fileUtils);
codeGenerator.generateCode(fileUtils, "/input/types/listMultiPartUploadApiBean.xml");
final String ds3Code = codeGenerator.getDs3Code();
CODE_LOGGER.logFile(ds3Code, FileTypeToLog.MODEL_PARSERS);
assertTrue(hasContent(ds3Code));
final ImmutableList<TypeContent> modelContents = ImmutableList.of(new TypeElement("Bucket", "None"), new TypeElement("Delimiter", "None"), new TypeElement("KeyMarker", "None"), new TypeElement("MaxUploads", "None"), new TypeElement("NextKeyMarker", "None"), new TypeElement("NextUploadIdMarker", "None"), new TypeElement("Prefix", "None"), new TypeElement("IsTruncated", "None"), new TypeElement("UploadIdMarker", "None"), new TypeElementList("CommonPrefixes", "None", "CommonPrefixes"), new TypeElementList("Upload", "None", "None"));
hasModelDescriptor(modelDescriptorName, modelContents, ds3Code);
}
use of com.spectralogic.ds3autogen.python.model.type.TypeElement 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.TypeElement 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.TypeElement in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method toElement_NullMap_Test.
@Test
public void toElement_NullMap_Test() {
final TypeElement result = toElement(createDs3Element(), null);
assertThat(result.toPythonCode(), is("'Element' : None"));
}
use of com.spectralogic.ds3autogen.python.model.type.TypeElement in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method toElement_EmptyMap_Test.
@Test
public void toElement_EmptyMap_Test() {
final TypeElement result = toElement(createDs3Element(), ImmutableMap.of());
assertThat(result.toPythonCode(), is("'Element' : None"));
}
Aggregations