Search in sources :

Example 6 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 7 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)

Example 8 with NameMapper

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

the class TestGenerateCode method generateCode.

/**
     * Generates the .net code associated with an input file. This captures the
     * Request, Client, and IDsClient code. This utilizes the default Ds3DocSpec
     */
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)

Example 9 with NameMapper

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

the class NormalizeNameUtil_Test method toSdkName_WithDollarSign_Test.

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

Example 10 with NameMapper

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

the class NormalizeNameUtil_Test method normalizeRequestName_SpectraS3_Test.

@Test
public void normalizeRequestName_SpectraS3_Test() throws IOException {
    final NameMapper nameMapper = new NameMapper(TEST_NAME_MAPPER_FILE);
    final String expected = "com.test.SpectraAfterSpectraS3Request";
    final String input = "com.test.SpectraBeforeRequestHandler";
    final String result = normalizeRequestName(input, Classification.spectrads3, nameMapper);
    assertThat(result, is(expected));
}
Also used : NameMapper(com.spectralogic.ds3autogen.NameMapper) Test(org.junit.Test)

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