mirror of https://github.com/apache/druid.git
Merge branch 'quidem-record' into quidem-msq
This commit is contained in:
commit
a9dcb2da46
|
@ -27,7 +27,7 @@ Can be used to write tests against existing test backends (ComponentSupplier) -
|
||||||
### Install java&maven (if needed)
|
### Install java&maven (if needed)
|
||||||
|
|
||||||
If you don't have java&maven - one way to set that up is by using sdkman like this:
|
If you don't have java&maven - one way to set that up is by using sdkman like this:
|
||||||
```
|
```bash
|
||||||
# install sdkman
|
# install sdkman
|
||||||
curl -s "https://get.sdkman.io" | bash
|
curl -s "https://get.sdkman.io" | bash
|
||||||
# at the end of installation either open a new terminal; or follow the instructions at the end
|
# at the end of installation either open a new terminal; or follow the instructions at the end
|
||||||
|
@ -54,16 +54,16 @@ git clone --branch quidem-record https://github.com/kgyrtkirk/druid
|
||||||
### Launching a test generating broker
|
### Launching a test generating broker
|
||||||
|
|
||||||
* make sure to build the project first; one way to do that is:
|
* make sure to build the project first; one way to do that is:
|
||||||
```
|
```bash
|
||||||
mvn install -pl quidem-it/ -am -DskipTests -Pskip-static-checks
|
mvn install -pl quidem-it/ -am -DskipTests -Pskip-static-checks
|
||||||
```
|
```
|
||||||
* launch the broker instance with:
|
* launch the broker instance with:
|
||||||
```
|
```bash
|
||||||
mvn exec:exec -pl quidem-it -Dquidem.record.autostart=true
|
mvn exec:exec -pl quidem-it -Dquidem.record.autostart=true
|
||||||
```
|
```
|
||||||
* the broker will be running at http://localhost:12345
|
* the broker will be running at http://localhost:12345
|
||||||
* the used test configuration backend can configured by supplying `quidem.uri`
|
* the used test configuration backend can configured by supplying `quidem.uri`
|
||||||
```
|
```bash
|
||||||
mvn exec:exec -pl quidem-it -Dquidem.uri=druidtest:///?componentSupplier=ThetaSketchComponentSupplier
|
mvn exec:exec -pl quidem-it -Dquidem.uri=druidtest:///?componentSupplier=ThetaSketchComponentSupplier
|
||||||
```
|
```
|
||||||
* new record files can be started by calling http://localhost:12345/quidem/start
|
* new record files can be started by calling http://localhost:12345/quidem/start
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -82,9 +83,10 @@ public class Launcher
|
||||||
{
|
{
|
||||||
String quidemUri = System.getProperty(QUIDEM_URI, "druidtest:///");
|
String quidemUri = System.getProperty(QUIDEM_URI, "druidtest:///");
|
||||||
Properties p = System.getProperties();
|
Properties p = System.getProperties();
|
||||||
for (Object string : p.keySet()) {
|
for (Entry<Object, Object> entry : p.entrySet()) {
|
||||||
if (string.toString().startsWith("quidem")) {
|
Object key = entry.getKey();
|
||||||
log.info("[%s] -> %s", string, p.get(string));
|
if (key.toString().startsWith("quidem")) {
|
||||||
|
log.info("[%s] -> %s", key, entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("Starting Quidem with URI[%s]", quidemUri);
|
log.info("Starting Quidem with URI[%s]", quidemUri);
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
|
|
||||||
package org.apache.druid.sql.calcite.run;
|
package org.apache.druid.sql.calcite.run;
|
||||||
|
|
||||||
|
import com.google.errorprone.annotations.Immutable;
|
||||||
import org.apache.calcite.rel.RelNode;
|
import org.apache.calcite.rel.RelNode;
|
||||||
|
import org.apache.druid.annotations.SuppressFBWarnings;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -30,10 +33,11 @@ import java.util.Objects;
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface DruidHook<T>
|
public interface DruidHook<T>
|
||||||
{
|
{
|
||||||
|
@Immutable
|
||||||
class HookKey<T>
|
class HookKey<T>
|
||||||
{
|
{
|
||||||
private String label;
|
private final String label;
|
||||||
private Class<T> type;
|
private final Class<T> type;
|
||||||
|
|
||||||
public HookKey(String label, Class<T> type)
|
public HookKey(String label, Class<T> type)
|
||||||
{
|
{
|
||||||
|
@ -73,6 +77,7 @@ public interface DruidHook<T>
|
||||||
|
|
||||||
void invoke(HookKey<T> key, T object);
|
void invoke(HookKey<T> key, T object);
|
||||||
|
|
||||||
|
@SuppressFBWarnings({"MS_OOI_PKGPROTECT"})
|
||||||
Map<HookKey<?>, List<DruidHook<?>>> GLOBAL = new HashMap<>();
|
Map<HookKey<?>, List<DruidHook<?>>> GLOBAL = new HashMap<>();
|
||||||
|
|
||||||
static void register(HookKey<?> label, DruidHook<?> hook)
|
static void register(HookKey<?> label, DruidHook<?> hook)
|
||||||
|
@ -98,6 +103,7 @@ public interface DruidHook<T>
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
static <T> void dispatch(HookKey<T> key, T object)
|
static <T> void dispatch(HookKey<T> key, T object)
|
||||||
{
|
{
|
||||||
List<DruidHook<?>> hooks = GLOBAL.get(key);
|
List<DruidHook<?>> hooks = GLOBAL.get(key);
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.druid.sql.calcite.run;
|
||||||
|
|
||||||
|
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class DruidHookTest
|
||||||
|
{
|
||||||
|
@Test
|
||||||
|
public void testHookKeyEquals()
|
||||||
|
{
|
||||||
|
EqualsVerifier.forClass(DruidHook.HookKey.class)
|
||||||
|
.withNonnullFields("label", "type")
|
||||||
|
.usingGetClass()
|
||||||
|
.verify();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue