use of com.spectralogic.ds3autogen.python.model.client.BaseClient in project ds3_autogen by SpectraLogic.
the class PythonCodeGenerator_Test method toClientCommands_EmptyList_Test.
@Test
public void toClientCommands_EmptyList_Test() {
final ImmutableList<BaseClient> result = toClientCommands(ImmutableList.of(), new Ds3DocSpecEmptyImpl());
assertThat(result.size(), is(0));
}
use of com.spectralogic.ds3autogen.python.model.client.BaseClient in project ds3_autogen by SpectraLogic.
the class PythonCodeGenerator method generateCommands.
/**
* Generates the ds3.py python code which includes: request handlers, response handlers,
* response payload descriptors, and the client
*/
@Override
public void generateCommands(final ImmutableList<Ds3Request> ds3Requests, final ImmutableMap<String, Ds3Type> typeMap, final Ds3DocSpec docSpec) throws IOException, TemplateException {
if (isEmpty(ds3Requests)) {
LOG.info("There are no requests to generate");
return;
}
final ImmutableList<BaseRequest> baseRequests = toRequestModelList(ds3Requests, docSpec);
final ImmutableList<BaseResponse> baseResponses = toResponseModelList(ds3Requests);
final ImmutableList<TypeDescriptor> baseTypes = toTypeDescriptorList(typeMap);
final ImmutableList<BaseClient> clientCommands = toClientCommands(ds3Requests, docSpec);
final CommandSet commandSet = new CommandSet(baseRequests, baseResponses, baseTypes, clientCommands);
final Template tmpl = getCommandTemplate(config);
final Path path = toBaseProjectPath("ds3.py");
LOG.info("Getting OutputStream for file: " + path.toString());
try (final OutputStream outStream = fileUtils.getOutputFile(path);
final Writer writer = new OutputStreamWriter(outStream)) {
tmpl.process(commandSet, writer);
}
}
use of com.spectralogic.ds3autogen.python.model.client.BaseClient in project ds3_autogen by SpectraLogic.
the class PythonCodeGenerator_Test method toClientCommand_Test.
@Test
public void toClientCommand_Test() {
final BaseClient result = toClientCommand(createDs3RequestTestData("com.test.GetCompleteMultiPartUploadRequest", Classification.spectrads3), getTestDocSpec());
assertThat(result.getCommandName(), is("get_complete_multi_part_upload"));
assertThat(result.getResponseName(), is("GetCompleteMultiPartUploadResponse"));
}
use of com.spectralogic.ds3autogen.python.model.client.BaseClient in project ds3_autogen by SpectraLogic.
the class PythonCodeGenerator_Test method toClientCommands_NullList_Test.
@Test
public void toClientCommands_NullList_Test() {
final ImmutableList<BaseClient> result = toClientCommands(null, new Ds3DocSpecEmptyImpl());
assertThat(result.size(), is(0));
}
Aggregations