use of org.apache.calcite.avatica.remote.JsonHandler in project calcite-avatica by apache.
the class JsonHandlerTest method testExecuteRequestWithNumberParameter.
@Test
public void testExecuteRequestWithNumberParameter() {
final List<TypedValue> expectedParameterValues = new ArrayList<>();
final Service service = new ParameterValuesCheckingService(expectedParameterValues);
final JsonService jsonService = new LocalJsonService(service);
final JsonHandler jsonHandler = new JsonHandler(jsonService, NoopMetricsSystem.getInstance());
final List<TypedValue> parameterValues = Arrays.asList(TypedValue.create("NUMBER", new BigDecimal("123")), TypedValue.create("STRING", "calcite"));
jsonHandler.apply("{'request':'execute'," + "'parameterValues':[{'type':'NUMBER','value':123}," + "{'type':'STRING','value':'calcite'}]}");
assertThat(expectedParameterValues.size(), is(2));
assertThat(expectedParameterValues.get(0), is(parameterValues.get(0)));
assertThat(expectedParameterValues.get(1), is(parameterValues.get(1)));
}
Aggregations