use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.
the class Ds3DocSpecEmptyImpl_Test method getParamDocumentation_Test.
@Test
public void getParamDocumentation_Test() {
final Ds3DocSpec docSpec = new Ds3DocSpecEmptyImpl();
assertThat(docSpec.getParamDocumentation(null).isPresent(), is(false));
assertThat(docSpec.getParamDocumentation("").isPresent(), is(false));
assertThat(docSpec.getParamDocumentation("SomeParam").isPresent(), is(false));
}
use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.
the class Ds3DocSpecImpl_Test method getParamDocumentation_Test.
@Test
public void getParamDocumentation_Test() {
final Ds3DocSpec docSpec = getTestDocSpec();
final Optional<String> request1 = docSpec.getParamDocumentation(paramName1);
assertThat(request1.isPresent(), is(true));
assertThat(request1.get(), is(paramDescriptor1));
final Optional<String> request2 = docSpec.getParamDocumentation(paramName2);
assertThat(request2.isPresent(), is(true));
assertThat(request2.get(), is(paramDescriptor2));
assertThat(docSpec.getParamDocumentation(requestName1).isPresent(), is(false));
assertThat(docSpec.getParamDocumentation(requestName2).isPresent(), is(false));
}
use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.
the class Ds3DocSpecParserImpl_Test method getDocSpec_Test.
@Test
public void getDocSpec_Test() throws IOException {
final InputStream inputStream = Ds3DocSpecParserImpl_Test.class.getResourceAsStream(TEST_COMMAND_DOCS_FILE);
final NameMapper nameMapper = new NameMapper(TEST_NAME_MAPPER_FILE);
final Ds3DocSpecParser parser = new Ds3DocSpecParserImpl(nameMapper);
final Ds3DocSpec result = parser.getDocSpec(inputStream);
assertThat(result.getParamDocumentation("Param1").get(), is("This is the effect of Param1"));
assertThat(result.getParamDocumentation("Param2").get(), is("This is the effect of Param2"));
assertThat(result.getParamDocumentation("Param3").get(), is("This is the effect of Param3"));
assertThat(result.getRequestDocumentation("Test1Request").get(), is("This is how you use Request1"));
assertThat(result.getRequestDocumentation("Test2Request").get(), is("This is how you use Request2"));
assertThat(result.getRequestDocumentation("Test3Request").get(), is("This is how you use Amazon Request3"));
assertThat(result.getRequestDocumentation("Test3SpectraS3Request").get(), is("This is how you use SpectraS3 Request3"));
}
use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.
the class CCodeGenerator_Test method testRequestDocumentation.
@Test
public void testRequestDocumentation() throws IOException {
final Ds3DocSpecParser docSpecParser = new Ds3DocSpecParserImpl(new NameMapper());
final Ds3DocSpec docSpec = docSpecParser.getDocSpec(CCodeGenerator_Test.class.getResourceAsStream("/input/testCommandDocumentation.json"));
final Optional<String> testRequestHandlerDescription = docSpec.getRequestDocumentation("Test1Request");
assertTrue(testRequestHandlerDescription.isPresent());
assertEquals(testRequestHandlerDescription.get(), "This is how you use Request1");
}
use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.
the class NetCodeGenerator_Docs_Test method getBucketRequest_Test.
@Test
public void getBucketRequest_Test() throws IOException, TemplateModelException {
final String requestName = "GetBucketRequest";
final FileUtils fileUtils = mock(FileUtils.class);
final TestGenerateCode codeGenerator = new TestGenerateCode(fileUtils, requestName, "./Ds3/Calls/", "ListBucketResult");
final Ds3DocSpec docSpec = new Ds3DocSpecImpl(ImmutableMap.of(requestName, "This is how you use the request"), ImmutableMap.of("Delimiter", "This is how you use delimiter", "Marker", "This is how you use marker", "MaxKeys", "This is how you use max keys", "Prefix", "This is how you use prefix", "BucketName", "This is how you use bucket name"));
codeGenerator.generateCode(fileUtils, "/input/getBucketRequest.xml", docSpec);
//Generate Request code
final String requestCode = codeGenerator.getRequestCode();
CODE_LOGGER.logFile(requestCode, FileTypeToLog.REQUEST);
assertTrue(requestCode.contains(toConstructorDocs(requestName, ImmutableList.of("Delimiter"), docSpec, 2)));
assertTrue(requestCode.contains(toConstructorDocs(requestName, ImmutableList.of("Marker"), docSpec, 2)));
assertTrue(requestCode.contains(toConstructorDocs(requestName, ImmutableList.of("MaxKeys"), docSpec, 2)));
assertTrue(requestCode.contains(toConstructorDocs(requestName, ImmutableList.of("Prefix"), docSpec, 2)));
assertTrue(requestCode.contains(toConstructorDocs(requestName, ImmutableList.of("BucketName"), docSpec, 2)));
//Generate Client code
final String idsClientCode = codeGenerator.getIdsClientCode();
CODE_LOGGER.logFile(idsClientCode, FileTypeToLog.CLIENT);
final String expectedCommandDoc = "/// <summary>\n" + " /// This is how you use the request\n" + " /// </summary>\n" + " /// <param name=\"request\"></param>\n" + " /// <returns></returns>";
assertTrue(idsClientCode.contains(expectedCommandDoc));
}
Aggregations