Merge branch 'quidem-record' into quidem-msq

This commit is contained in:
Zoltan Haindrich 2024-07-24 10:59:41 +00:00
commit a9dcb2da46
4 changed files with 52 additions and 9 deletions

View File

@ -27,7 +27,7 @@ Can be used to write tests against existing test backends (ComponentSupplier) -
### Install java&maven (if needed)
If you don't have java&maven - one way to set that up is by using sdkman like this:
```
```bash
# install sdkman
curl -s "https://get.sdkman.io" | bash
# 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
* make sure to build the project first; one way to do that is:
```
```bash
mvn install -pl quidem-it/ -am -DskipTests -Pskip-static-checks
```
* launch the broker instance with:
```
```bash
mvn exec:exec -pl quidem-it -Dquidem.record.autostart=true
```
* the broker will be running at http://localhost:12345
* the used test configuration backend can configured by supplying `quidem.uri`
```
```bash
mvn exec:exec -pl quidem-it -Dquidem.uri=druidtest:///?componentSupplier=ThetaSketchComponentSupplier
```
* new record files can be started by calling http://localhost:12345/quidem/start

View File

@ -31,6 +31,7 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
@ -82,9 +83,10 @@ public class Launcher
{
String quidemUri = System.getProperty(QUIDEM_URI, "druidtest:///");
Properties p = System.getProperties();
for (Object string : p.keySet()) {
if (string.toString().startsWith("quidem")) {
log.info("[%s] -> %s", string, p.get(string));
for (Entry<Object, Object> entry : p.entrySet()) {
Object key = entry.getKey();
if (key.toString().startsWith("quidem")) {
log.info("[%s] -> %s", key, entry.getValue());
}
}
log.info("Starting Quidem with URI[%s]", quidemUri);

View File

@ -19,7 +19,10 @@
package org.apache.druid.sql.calcite.run;
import com.google.errorprone.annotations.Immutable;
import org.apache.calcite.rel.RelNode;
import org.apache.druid.annotations.SuppressFBWarnings;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.HashMap;
@ -30,10 +33,11 @@ import java.util.Objects;
@FunctionalInterface
public interface DruidHook<T>
{
@Immutable
class HookKey<T>
{
private String label;
private Class<T> type;
private final String label;
private final 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);
@SuppressFBWarnings({"MS_OOI_PKGPROTECT"})
Map<HookKey<?>, List<DruidHook<?>>> GLOBAL = new HashMap<>();
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)
{
List<DruidHook<?>> hooks = GLOBAL.get(key);

View File

@ -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();
}
}