Search in sources :

Example 91 with Arguments

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

the class WithConstructorUtil_Test method putQueryParamLine_StringArguments_Test.

@Test
public void putQueryParamLine_StringArguments_Test() {
    final String expected = "this.getQueryParams().put(\"arg_name\", UrlEscapers.urlFragmentEscaper().escape(argName).replace(\"+\", \"%2B\"));";
    final String result = putQueryParamLine(new Arguments("String", "ArgName"));
    assertThat(result, is(expected));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 92 with Arguments

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

the class CommonRequestGeneratorUtils_Test method createChannelConstructor_Test.

@Test
public void createChannelConstructor_Test() {
    final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("Type1", "Arg1"));
    final RequestConstructor result = createChannelConstructor(args, argsToQueryParams(args), "", new Ds3DocSpecEmptyImpl());
    assertThat(result.getParameters().size(), is(2));
    assertThat(result.getParameters().get(0).getName(), is("Arg1"));
    assertThat(result.getParameters().get(1).getName(), is("Channel"));
    assertThat(result.getAssignments().size(), is(2));
    assertThat(result.getAssignments().get(0).getName(), is("Arg1"));
    assertThat(result.getAssignments().get(1).getName(), is("Channel"));
    assertThat(result.getQueryParams().size(), is(1));
    assertThat(result.getQueryParams().get(0).getName(), is("Arg1"));
    assertThat(result.getAdditionalLines().size(), is(1));
    assertThat(result.getAdditionalLines().get(0), is("this.stream = new SeekableByteChannelInputStream(channel);"));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) RequestConstructor(com.spectralogic.ds3autogen.java.models.RequestConstructor) Test(org.junit.Test)

Example 93 with Arguments

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

the class CommonRequestGeneratorUtils_Test method argsToQueryParams_FullList_Test.

@Test
public void argsToQueryParams_FullList_Test() {
    final ImmutableList<Arguments> args = ImmutableList.of(new Arguments("TypeOne", "NameOne"), new Arguments("TypeTwo", "NameTwo"));
    final ImmutableList<QueryParam> result = argsToQueryParams(args);
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("NameOne"));
    assertThat(result.get(0).getType(), is("TypeOne"));
    assertThat(result.get(1).getName(), is("NameTwo"));
    assertThat(result.get(1).getType(), is("TypeTwo"));
}
Also used : QueryParam(com.spectralogic.ds3autogen.java.models.QueryParam) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 94 with Arguments

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

the class WithConstructorUtil_Test method argAssignmentLine_Arguments_Test.

@Test
public void argAssignmentLine_Arguments_Test() {
    final String expected = "this.argName = argName;\n";
    final String result = argAssignmentLine(new Arguments("ArgType", "ArgName"));
    assertThat(result, is(expected));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Example 95 with Arguments

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

the class JavaHelper_Test method constructorArgs_FullList_Test2.

@Test
public void constructorArgs_FullList_Test2() {
    final String expectedResult = "final String bucketName, final String objectName, final SeekableByteChannel channel, final long size";
    final ImmutableList<Arguments> arguments = ImmutableList.of(new Arguments("SeekableByteChannel", "Channel"), new Arguments("long", "Size"), new Arguments("String", "bucketName"), new Arguments("String", "objectName"));
    final String result = constructorArgs(arguments);
    assertThat(result, is(expectedResult));
}
Also used : Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Test(org.junit.Test)

Aggregations

Arguments (com.spectralogic.ds3autogen.api.models.Arguments)188 Test (org.junit.Test)144 FileUtils (com.spectralogic.ds3autogen.api.FileUtils)46 ImmutableList (com.google.common.collect.ImmutableList)40 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)33 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)25 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)25 TestGeneratedCode (com.spectralogic.ds3autogen.java.utils.TestGeneratedCode)25 TestGenerateCode (com.spectralogic.ds3autogen.net.utils.TestGenerateCode)21 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)19 Helper.removeVoidArguments (com.spectralogic.ds3autogen.utils.Helper.removeVoidArguments)15 BaseParseResponse (com.spectralogic.ds3autogen.java.models.parseresponse.BaseParseResponse)14 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)13 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)9 GuavaCollectors (com.spectralogic.ds3autogen.utils.collections.GuavaCollectors)8 CustomArgumentComparator (com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator)8 ConstructorParam (com.spectralogic.ds3autogen.python.model.request.ConstructorParam)7 Helper.camelToUnderscore (com.spectralogic.ds3autogen.utils.Helper.camelToUnderscore)7 RequestConverterUtil.getNonVoidArgsFromParamList (com.spectralogic.ds3autogen.utils.RequestConverterUtil.getNonVoidArgsFromParamList)6 Ds3ResponseType (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType)5