Search in sources :

Example 1 with TypeElement

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);
}
Also used : FileUtils(com.spectralogic.ds3autogen.api.FileUtils) TypeElement(com.spectralogic.ds3autogen.python.model.type.TypeElement) TypeContent(com.spectralogic.ds3autogen.python.model.type.TypeContent) TestPythonGeneratedCode(com.spectralogic.ds3autogen.python.utils.TestPythonGeneratedCode) TypeElementList(com.spectralogic.ds3autogen.python.model.type.TypeElementList) Test(org.junit.Test)

Example 2 with TypeElement

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);
}
Also used : TypeAttribute(com.spectralogic.ds3autogen.python.model.type.TypeAttribute) FileUtils(com.spectralogic.ds3autogen.api.FileUtils) TypeElement(com.spectralogic.ds3autogen.python.model.type.TypeElement) TypeContent(com.spectralogic.ds3autogen.python.model.type.TypeContent) TestPythonGeneratedCode(com.spectralogic.ds3autogen.python.utils.TestPythonGeneratedCode) TypeElementList(com.spectralogic.ds3autogen.python.model.type.TypeElementList) Test(org.junit.Test)

Example 3 with TypeElement

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);
}
Also used : FileUtils(com.spectralogic.ds3autogen.api.FileUtils) TypeElement(com.spectralogic.ds3autogen.python.model.type.TypeElement) TypeContent(com.spectralogic.ds3autogen.python.model.type.TypeContent) TestPythonGeneratedCode(com.spectralogic.ds3autogen.python.utils.TestPythonGeneratedCode) TypeElementList(com.spectralogic.ds3autogen.python.model.type.TypeElementList) Test(org.junit.Test)

Example 4 with TypeElement

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"));
}
Also used : TypeElement(com.spectralogic.ds3autogen.python.model.type.TypeElement) Test(org.junit.Test)

Example 5 with TypeElement

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"));
}
Also used : TypeElement(com.spectralogic.ds3autogen.python.model.type.TypeElement) Test(org.junit.Test)

Aggregations

TypeElement (com.spectralogic.ds3autogen.python.model.type.TypeElement)6 Test (org.junit.Test)6 FileUtils (com.spectralogic.ds3autogen.api.FileUtils)3 TypeContent (com.spectralogic.ds3autogen.python.model.type.TypeContent)3 TypeElementList (com.spectralogic.ds3autogen.python.model.type.TypeElementList)3 TestPythonGeneratedCode (com.spectralogic.ds3autogen.python.utils.TestPythonGeneratedCode)3 TypeAttribute (com.spectralogic.ds3autogen.python.model.type.TypeAttribute)1