Search in sources :

Example 16 with Ds3DocSpec

use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec 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 17 with Ds3DocSpec

use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.

the class Ds3DocSpecEmptyImpl_Test method getRequestDocumentation_Test.

@Test
public void getRequestDocumentation_Test() {
    final Ds3DocSpec docSpec = new Ds3DocSpecEmptyImpl();
    assertThat(docSpec.getRequestDocumentation(null).isPresent(), is(false));
    assertThat(docSpec.getRequestDocumentation("").isPresent(), is(false));
    assertThat(docSpec.getRequestDocumentation("SomeRequest").isPresent(), is(false));
}
Also used : Ds3DocSpec(com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec) Test(org.junit.Test)

Example 18 with Ds3DocSpec

use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.

the class Ds3DocSpecImpl_Test method getRequestDocumentation_Test.

@Test
public void getRequestDocumentation_Test() {
    final Ds3DocSpec docSpec = getTestDocSpec();
    final Optional<String> request1 = docSpec.getRequestDocumentation(requestName1);
    assertThat(request1.isPresent(), is(true));
    assertThat(request1.get(), is(requestDescriptor1));
    final Optional<String> request2 = docSpec.getRequestDocumentation(requestName2);
    assertThat(request2.isPresent(), is(true));
    assertThat(request2.get(), is(requestDescriptor2));
    assertThat(docSpec.getRequestDocumentation(paramName1).isPresent(), is(false));
    assertThat(docSpec.getRequestDocumentation(paramName2).isPresent(), is(false));
}
Also used : Ds3DocSpec(com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec) Test(org.junit.Test)

Example 19 with Ds3DocSpec

use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.

the class Ds3DocSpecParserImpl_Test method defaultConstructor_Test.

@Test
public void defaultConstructor_Test() throws IOException {
    final InputStream inputStream = Ds3DocSpecParserImpl_Test.class.getResourceAsStream(TEST_COMMAND_DOCS_FILE);
    final Ds3DocSpecParser parser = new Ds3DocSpecParserImpl();
    final Ds3DocSpec result = parser.getDocSpec(inputStream);
    assertThat(result.getRequestDocumentation("GetBucketsRequest").isPresent(), is(false));
    assertThat(result.getRequestDocumentation("GetServiceRequest").isPresent(), is(true));
    assertThat(result.getRequestDocumentation("GetServiceRequest").get(), is("This is how you use get service"));
}
Also used : InputStream(java.io.InputStream) Ds3DocSpec(com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec) Ds3DocSpecParser(com.spectralogic.ds3autogen.api.Ds3DocSpecParser) Test(org.junit.Test)

Example 20 with Ds3DocSpec

use of com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec in project ds3_autogen by SpectraLogic.

the class Ds3DocSpecParserImpl_Test method getDocSpec_Default_Test.

@Test
public void getDocSpec_Default_Test() throws IOException {
    final Ds3DocSpecParser parser = new Ds3DocSpecParserImpl();
    final Ds3DocSpec result = parser.getDocSpec();
    assertThat(result, is(notNullValue()));
}
Also used : Ds3DocSpec(com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec) Ds3DocSpecParser(com.spectralogic.ds3autogen.api.Ds3DocSpecParser) Test(org.junit.Test)

Aggregations

Ds3DocSpec (com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec)23 Test (org.junit.Test)20 Ds3DocSpecParser (com.spectralogic.ds3autogen.api.Ds3DocSpecParser)7 NameMapper (com.spectralogic.ds3autogen.NameMapper)6 Ds3DocSpecImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecImpl)5 Ds3SpecParserImpl (com.spectralogic.ds3autogen.Ds3SpecParserImpl)4 Ds3SpecParser (com.spectralogic.ds3autogen.api.Ds3SpecParser)4 FileUtils (com.spectralogic.ds3autogen.api.FileUtils)4 Ds3ApiSpec (com.spectralogic.ds3autogen.api.models.apispec.Ds3ApiSpec)4 Ds3DocSpecParserImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecParserImpl)4 Enum (com.spectralogic.ds3autogen.c.models.Enum)3 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 CodeGenerator (com.spectralogic.ds3autogen.api.CodeGenerator)2 GoCodeGenerator (com.spectralogic.ds3autogen.go.GoCodeGenerator)2 TestFileUtilsImpl (com.spectralogic.ds3autogen.utils.TestFileUtilsImpl)2 InputStream (java.io.InputStream)2 Pattern (java.util.regex.Pattern)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1