use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec in project ds3_autogen by SpectraLogic.
the class CCodeGenerator_Test method testEmbeddedTypesSet.
@Test
public void testEmbeddedTypesSet() {
final Ds3Type type1 = new Ds3Type("Ds3Bucket", ImmutableList.of(new Ds3Element("ChecksumType", "Ds3ChecksumType", null, true), new Ds3Element("Size", "Ds3Size", null, true)));
final Ds3Type type2 = new Ds3Type("Ds3Object", ImmutableList.of(new Ds3Element("Name", "java.lang.String", null, true), new Ds3Element("Size", "Ds3Size", null, true)));
final Ds3ApiSpec embeddedTypesSet = new Ds3ApiSpec(ImmutableList.of(), ImmutableMap.of(type1.getName(), type1, type2.getName(), type2));
final ImmutableSet<String> embeddedTypes = CCodeGenerator.getEmbeddedTypes(embeddedTypesSet, ImmutableSet.of());
assertEquals(embeddedTypes.size(), 2);
assertTrue(embeddedTypes.contains("ds3_size_response"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec in project ds3_autogen by SpectraLogic.
the class CCodeGenerator_Test method testEnumTypesContainsTargetReadPreferenceType.
@Test
public void testEnumTypesContainsTargetReadPreferenceType() throws IOException, ParseException {
final Ds3SpecParser parser = new Ds3SpecParserImpl();
final Ds3ApiSpec spec = parser.getSpec(CCodeGenerator_Test.class.getResourceAsStream("/input/3_2_2_contract.xml"));
final ImmutableList<Enum> allEnums = CCodeGenerator.getAllEnums(spec);
final ImmutableSet<String> enumNames = EnumHelper.getEnumNamesSet(allEnums);
assertTrue(enumNames.contains("ds3_target_read_preference_type"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec in project ds3_autogen by SpectraLogic.
the class TestGeneratedComponentResponseCode method generateCode.
@Override
public void generateCode(final FileUtils fileUtils, final String inputFileName) throws IOException, TemplateModelException {
final Ds3SpecParser parser = new Ds3SpecParserImpl();
final Ds3ApiSpec spec = parser.getSpec(TestGeneratedCode.class.getResourceAsStream(inputFileName));
final CodeGenerator codeGenerator = new JavaCodeGenerator();
codeGenerator.generate(spec, fileUtils, Paths.get("."), new Ds3DocSpecEmptyImpl());
requestGeneratedCode = new String(requestOutputStream.toByteArray());
responseGeneratedCode = new String(responseOutputStream.toByteArray());
responseParserGeneratedCode = new String(responseParserOutputStream.toByteArray());
encapsulatingTypeGeneratedCode = new String(encapsulatingTypeOutputStream.toByteArray());
ds3ClientGeneratedCode = new String(ds3ClientOutputStream.toByteArray());
ds3ClientImplGeneratedCode = new String(ds3ClientImplOutputStream.toByteArray());
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec in project ds3_autogen by SpectraLogic.
the class TestGeneratedModelCode method generateCode.
public void generateCode(final FileUtils fileUtils, final String inputFileName) throws IOException, TemplateModelException {
final Ds3SpecParser parser = new Ds3SpecParserImpl();
final Ds3ApiSpec spec = parser.getSpec(TestGeneratedModelCode.class.getResourceAsStream(inputFileName));
final CodeGenerator codeGenerator = new JavaCodeGenerator();
codeGenerator.generate(spec, fileUtils, Paths.get("."), new Ds3DocSpecEmptyImpl());
modelGeneratedCode = new String(modelOutputStream.toByteArray());
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec in project ds3_autogen by SpectraLogic.
the class TestGeneratedCode method generateCode.
public void generateCode(final FileUtils fileUtils, final String inputFileName, final Ds3DocSpec docSpec) throws IOException, TemplateModelException {
final Ds3SpecParser parser = new Ds3SpecParserImpl();
final Ds3ApiSpec spec = parser.getSpec(TestGeneratedCode.class.getResourceAsStream(inputFileName));
final CodeGenerator codeGenerator = new JavaCodeGenerator();
codeGenerator.generate(spec, fileUtils, Paths.get("."), docSpec);
requestGeneratedCode = new String(requestOutputStream.toByteArray());
responseGeneratedCode = new String(responseOutputStream.toByteArray());
responseParserGeneratedCode = new String(responseParserOutputStream.toByteArray());
ds3ClientGeneratedCode = new String(ds3ClientOutputStream.toByteArray());
ds3ClientImplGeneratedCode = new String(ds3ClientImplOutputStream.toByteArray());
}
Aggregations