use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator_Test method toNullableArgument_NullableSpectraType_Test.
@Test
public void toNullableArgument_NullableSpectraType_Test() {
final Ds3Param param = new Ds3Param("MyParam", "com.spectra.TestType", true);
final NetNullableVariable result = toNullableArgument(param, ImmutableMap.of());
assertThat(result.getNetType(), is("TestType"));
}
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)));
}
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestConverter method getOptionalQueryParams.
private static ImmutableList<Parameter> getOptionalQueryParams(final Ds3Request ds3Request, final Ds3DocSpec docSpec) {
final ImmutableList.Builder<Parameter> optionalArgsBuilder = ImmutableList.builder();
if (isEmpty(ds3Request.getOptionalQueryParams())) {
return optionalArgsBuilder.build();
}
for (final Ds3Param ds3Param : ds3Request.getOptionalQueryParams()) {
final Parameter optionalQueryParam = ParameterConverter.toParameter(ds3Param, false, toParamDocs(Helper.unqualifiedName(ds3Param.getName()), docSpec));
LOG.debug("\tOptional QueryParam: " + optionalQueryParam.toString());
optionalArgsBuilder.add(optionalQueryParam);
}
return optionalArgsBuilder.build();
}
Aggregations