org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem Java Examples

The following examples show how to use org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JsonHandlerTest.java    From calcite-avatica with Apache License 2.0 6 votes vote down vote up
@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)));
}
 
Example #2
Source File: MetricsSystemLoaderTest.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
@Test public void testMultipleInstances() {
  // The type of the factories doesn't matter (we can send duplicates for testing purposes)
  final List<MetricsSystemFactory> factories =
      Arrays.<MetricsSystemFactory>asList(new MarkedNoopMetricsSystemFactory(),
          new MarkedNoopMetricsSystemFactory());
  MetricsSystemLoader loader = Mockito.mock(MetricsSystemLoader.class);

  Mockito.when(loader.getFactories()).thenReturn(factories);
  Mockito.when(loader._load(Mockito.any(MetricsSystemConfiguration.class))).thenCallRealMethod();

  // We had two factories loaded, therefore we'll fall back to the NoopMetricsSystem
  MetricsSystem system = loader._load(NoopMetricsSystemConfiguration.getInstance());
  assertEquals(NoopMetricsSystem.getInstance(), system);
}
 
Example #3
Source File: MetricsSystemLoaderTest.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
@Test public void testNoInstances() {
  // The type of the factories doesn't matter (we can send duplicates for testing purposes)
  final List<MetricsSystemFactory> factories = Collections.emptyList();
  MetricsSystemLoader loader = Mockito.mock(MetricsSystemLoader.class);

  Mockito.when(loader.getFactories()).thenReturn(factories);
  Mockito.when(loader._load(Mockito.any(MetricsSystemConfiguration.class))).thenCallRealMethod();

  // We had no factories loaded, therefore we'll fall back to the NoopMetricsSystem
  MetricsSystem system = loader._load(NoopMetricsSystemConfiguration.getInstance());
  assertEquals(NoopMetricsSystem.getInstance(), system);
}
 
Example #4
Source File: ProtobufHandlerTest.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
@Before
public void setupMocks() {
  // Mocks
  service = Mockito.mock(Service.class);
  translation = Mockito.mock(ProtobufTranslation.class);

  // Real objects
  handler = new ProtobufHandler(service, translation, NoopMetricsSystem.getInstance());
}
 
Example #5
Source File: DynamicAvaticaJsonHandler.java    From kareldb with Apache License 2.0 4 votes vote down vote up
public DynamicAvaticaJsonHandler(KarelDbConfig config, AvaticaHandler localHandler, UrlProvider urlProvider) {
    this(config, localHandler, urlProvider, NoopMetricsSystem.getInstance(), null);
}
 
Example #6
Source File: QuicksqlServerMeta.java    From Quicksql with MIT License 4 votes vote down vote up
public QuicksqlServerMeta(String url, Properties info) throws SQLException {
    this(url, info, NoopMetricsSystem.getInstance());
}
 
Example #7
Source File: JdbcMeta.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public JdbcMeta(String url, Properties info) throws SQLException {
  this(url, info, NoopMetricsSystem.getInstance());
}
 
Example #8
Source File: AvaticaProtobufHandler.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public AvaticaProtobufHandler(Service service) {
  this(service, NoopMetricsSystem.getInstance());
}
 
Example #9
Source File: AvaticaJsonHandler.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public AvaticaJsonHandler(Service service) {
  this(service, NoopMetricsSystem.getInstance(), null);
}
 
Example #10
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public LocalService(Meta meta) {
  this(meta, NoopMetricsSystem.getInstance());
}