Skip to content

Commit

Permalink
Merge branch 'quidem-record' into quidem-msq
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed Jul 24, 2024
2 parents 31e9732 + d227029 commit a9dcb2d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 9 deletions.
8 changes: 4 additions & 4 deletions quidem-it/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions quidem-it/src/main/java/org/apache/druid/quidem/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;

Expand Down Expand Up @@ -82,9 +83,10 @@ public static void main(String[] args) throws Exception
{
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,10 +33,11 @@
@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)
{
Expand Down Expand Up @@ -73,6 +77,7 @@ public boolean equals(Object obj)

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)
Expand All @@ -98,6 +103,7 @@ public void close()
};
}

@SuppressWarnings({"rawtypes", "unchecked"})
static <T> void dispatch(HookKey<T> key, T object)
{
List<DruidHook<?>> hooks = GLOBAL.get(key);
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit a9dcb2d

Please sign in to comment.