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));
}
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);"));
}
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"));
}
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));
}
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));
}
Aggregations