Search in sources :

Example 1 with NameMapper

use of com.spectralogic.ds3autogen.NameMapper in project ds3_autogen by SpectraLogic.

the class NormalizeNameUtil_Test method toSdkName_NoPath_Test.

@Test
public void toSdkName_NoPath_Test() throws IOException {
    final NameMapper nameMapper = new NameMapper(TEST_NAME_MAPPER_FILE);
    final String expectedResult = "TEST_BlobStoreTaskPriority";
    final String input = "BlobStoreTaskPriority";
    final String result = toSdkName(input, nameMapper);
    assertThat(result, is(expectedResult));
}
Also used : NameMapper(com.spectralogic.ds3autogen.NameMapper) Test(org.junit.Test)

Example 2 with NameMapper

use of com.spectralogic.ds3autogen.NameMapper in project ds3_autogen by SpectraLogic.

the class NormalizeNameUtil_Test method toSdkName_WithPath_Test.

@Test
public void toSdkName_WithPath_Test() throws IOException {
    final NameMapper nameMapper = new NameMapper(TEST_NAME_MAPPER_FILE);
    final String expectedResult = "com.spectralogic.s3.common.dao.domain.ds3.TEST_BlobStoreTaskPriority";
    final String input = "com.spectralogic.s3.common.dao.domain.ds3.BlobStoreTaskPriority";
    final String result = toSdkName(input, nameMapper);
    assertThat(result, is(expectedResult));
}
Also used : NameMapper(com.spectralogic.ds3autogen.NameMapper) Test(org.junit.Test)

Example 3 with NameMapper

use of com.spectralogic.ds3autogen.NameMapper 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"));
}
Also used : InputStream(java.io.InputStream) Ds3DocSpec(com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec) NameMapper(com.spectralogic.ds3autogen.NameMapper) Ds3DocSpecParser(com.spectralogic.ds3autogen.api.Ds3DocSpecParser) Test(org.junit.Test)

Example 4 with NameMapper

use of com.spectralogic.ds3autogen.NameMapper 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");
}
Also used : Ds3DocSpecParserImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecParserImpl) Ds3DocSpec(com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec) NameMapper(com.spectralogic.ds3autogen.NameMapper) Ds3DocSpecParser(com.spectralogic.ds3autogen.api.Ds3DocSpecParser) Test(org.junit.Test)

Example 5 with NameMapper

use of com.spectralogic.ds3autogen.NameMapper in project ds3_autogen by SpectraLogic.

the class TestPythonGeneratedCode method generateCode.

/**
     * Generates the python code associated with an input file. This utilizes the
     * default Ds3DocSpec.
     * Captured code: ds3.py
     */
public void generateCode(final FileUtils fileUtils, final String inputFileName) throws IOException, TemplateModelException {
    final Ds3DocSpecParser docSpecParser = new Ds3DocSpecParserImpl(new NameMapper());
    generateCode(fileUtils, inputFileName, docSpecParser.getDocSpec());
}
Also used : Ds3DocSpecParserImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecParserImpl) NameMapper(com.spectralogic.ds3autogen.NameMapper) Ds3DocSpecParser(com.spectralogic.ds3autogen.api.Ds3DocSpecParser)

Aggregations

NameMapper (com.spectralogic.ds3autogen.NameMapper)17 Test (org.junit.Test)13 Ds3DocSpecParser (com.spectralogic.ds3autogen.api.Ds3DocSpecParser)7 Ds3DocSpecParserImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecParserImpl)7 Ds3DocSpec (com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec)6 Ds3SpecParserImpl (com.spectralogic.ds3autogen.Ds3SpecParserImpl)3 Ds3SpecParser (com.spectralogic.ds3autogen.api.Ds3SpecParser)3 Ds3ApiSpec (com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec)3 Enum (com.spectralogic.ds3autogen.c.models.Enum)2 TestFileUtilsImpl (com.spectralogic.ds3autogen.utils.TestFileUtilsImpl)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 CodeGenerator (com.spectralogic.ds3autogen.api.CodeGenerator)1 FileUtils (com.spectralogic.ds3autogen.api.FileUtils)1 CCodeGenerator (com.spectralogic.ds3autogen.c.CCodeGenerator)1 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)1 GoCodeGenerator (com.spectralogic.ds3autogen.go.GoCodeGenerator)1 JavaCodeGenerator (com.spectralogic.ds3autogen.java.JavaCodeGenerator)1 RawDocSpec (com.spectralogic.ds3autogen.models.xml.docspec.RawDocSpec)1 RequestDescriptor (com.spectralogic.ds3autogen.models.xml.docspec.RequestDescriptor)1 NetCodeGenerator (com.spectralogic.ds3autogen.net.NetCodeGenerator)1