Search in sources :

Example 11 with NameMapper

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

the class NormalizeNameUtil_Test method normalizeRequestName_Amazon_Test.

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

Example 12 with NameMapper

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

the class DocSpecConverter_Test method normalizeRequestName_Amazon_Test.

@Test
public void normalizeRequestName_Amazon_Test() throws IOException {
    final NameMapper nameMapper = new NameMapper(TEST_NAME_MAPPER_FILE);
    final String result = normalizeRequestName(createAmazonRequestDescriptor(), nameMapper);
    assertThat(result, is(AMAZON_NAME_AFTER));
}
Also used : NameMapper(com.spectralogic.ds3autogen.NameMapper) Test(org.junit.Test)

Example 13 with NameMapper

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

the class DocSpecConverter_Test method toDs3DocSpec_Test.

@Test
public void toDs3DocSpec_Test() throws IOException {
    final NameMapper nameMapper = new NameMapper(TEST_NAME_MAPPER_FILE);
    final RawDocSpec rawDocSpec = new RawDocSpec();
    rawDocSpec.setRequestDescriptors(ImmutableList.of(createAmazonRequestDescriptor(), createSpectraRequestDescriptor()));
    rawDocSpec.setParamDescriptors(ImmutableList.of(createParamDescriptor("1"), createParamDescriptor("2")));
    final Ds3DocSpec result = toDs3DocSpec(rawDocSpec, nameMapper);
    assertThat(result.getRequestDocumentation(AMAZON_NAME_AFTER).get(), is(AMAZON_DESCRIPTOR));
    assertThat(result.getRequestDocumentation(SPECTRA_NAME_AFTER).get(), is(SPECTRA_DESCRIPTOR));
    assertThat(result.getParamDocumentation("Name1").get(), is("Description1"));
    assertThat(result.getParamDocumentation("Name2").get(), is("Description2"));
    assertThat(result.getRequestDocumentation("DoesNotExistRequest").isPresent(), is(false));
    assertThat(result.getParamDocumentation("DoesNotExistParam").isPresent(), is(false));
}
Also used : RawDocSpec(com.spectralogic.ds3autogen.models.xml.docspec.RawDocSpec) Ds3DocSpec(com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec) NameMapper(com.spectralogic.ds3autogen.NameMapper) Test(org.junit.Test)

Example 14 with NameMapper

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

the class DocSpecConverter_Test method toRequestDocs_Test.

@Test
public void toRequestDocs_Test() throws IOException {
    final NameMapper nameMapper = new NameMapper(TEST_NAME_MAPPER_FILE);
    final ImmutableList<RequestDescriptor> rds = ImmutableList.of(createAmazonRequestDescriptor(), createSpectraRequestDescriptor());
    final ImmutableMap<String, String> result = toRequestDocs(rds, nameMapper);
    assertThat(result.size(), is(2));
    assertThat(result.get(AMAZON_NAME_AFTER), is(AMAZON_DESCRIPTOR));
    assertThat(result.get(SPECTRA_NAME_AFTER), is(SPECTRA_DESCRIPTOR));
}
Also used : NameMapper(com.spectralogic.ds3autogen.NameMapper) RequestDescriptor(com.spectralogic.ds3autogen.models.xml.docspec.RequestDescriptor) Test(org.junit.Test)

Example 15 with NameMapper

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

the class TestPython3GeneratedCode method generateCode.

/**
     * Generates the Python 3 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