use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestConverter_Test method testConvertDs3ParameterWithDocumentation.
@Test
public void testConvertDs3ParameterWithDocumentation() {
final Ds3DocSpec docSpec = getTestDocSpec();
final String paramName = "BucketName";
final Ds3Param testDs3Param = new Ds3Param(paramName, "Ds3Bucket", false);
final Parameter testParameter = ParameterConverter.toParameter(testDs3Param, true, RequestConverter.toParamDocs(paramName, docSpec));
assertEquals(testParameter.getDocumentation(), "This is how you use bucket name");
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestConverterUtil_Test method toArgument_Test.
@Test
public void toArgument_Test() {
final Ds3Param simpleParam = new Ds3Param("ArgName", "SimpleType", false);
final Arguments simpleArg = toArgument(simpleParam);
assertThat(simpleArg.getName(), is("ArgName"));
assertThat(simpleArg.getType(), is("SimpleType"));
final Ds3Param pathParam = new Ds3Param("ArgName", "com.spectralogic.test.TypeWithPath", false);
final Arguments pathArg = toArgument(pathParam);
assertThat(pathArg.getName(), is("ArgName"));
assertThat(pathArg.getType(), is("TypeWithPath"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method removeVoidParams_FullList_Test.
@Test
public void removeVoidParams_FullList_Test() {
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("Param1", "Type1", false), new Ds3Param("Param2", "void", false), new Ds3Param("Param3", "int", false), new Ds3Param("Param4", "VOID", false));
final ImmutableList<Ds3Param> result = removeVoidDs3Params(params);
assertThat(result.size(), is(2));
result.forEach(param -> assertThat(param.getType(), not("void")));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method toQueryParamVar_Test.
@Test
public void toQueryParamVar_Test() {
final ImmutableList<Variable> expected = ImmutableList.of(new Variable("param_one", "strconv.Itoa(paramOne)"), new Variable("param_two", "strconv.FormatFloat(paramTwo, 'f', -1, 64)"), new Variable("param_three", "paramThree"), new Variable("param_four", "\"\""));
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ParamOne", "int", false), new Ds3Param("ParamTwo", "float64", false), new Ds3Param("ParamThree", "string", false), new Ds3Param("ParamFour", "void", false));
assertThat(expected.size(), is(params.size()));
for (int i = 0; i < params.size(); i++) {
final Variable result = toQueryParamVar(params.get(i));
assertThat(result, is(expected.get(i)));
}
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method toQueryParamVarList_FullList_Test.
@Test
public void toQueryParamVarList_FullList_Test() {
final ImmutableList<Variable> expected = ImmutableList.of(new Variable("param_one", "strconv.Itoa(paramOne)"), new Variable("param_two", "strconv.FormatFloat(paramTwo, 'f', -1, 64)"), new Variable("param_three", "paramThree"), new Variable("param_four", "\"\""), new Variable("type", "typeName.String()"));
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ParamOne", "int", false), new Ds3Param("ParamTwo", "float64", false), new Ds3Param("ParamThree", "string", false), new Ds3Param("ParamFour", "void", false), new Ds3Param("Operation", "RestOperationType", false), new Ds3Param("Type", "com.test.TypeName", false));
final ImmutableList<Variable> result = toQueryParamVarList(params);
assertThat(result.size(), is(expected.size()));
for (int i = 0; i < result.size(); i++) {
assertThat(result.get(i), is(expected.get(i)));
}
}
Aggregations