This commit is contained in:
Zoltan Haindrich 2024-06-20 14:26:48 +00:00
parent b2be5abdd5
commit 604910cead
5 changed files with 21 additions and 18 deletions

View File

@ -214,7 +214,7 @@ public class ExposedAsBrokerQueryComponentSupplierWrapper implements QueryCompon
return delegate.getPlannerComponentSupplier(); return delegate.getPlannerComponentSupplier();
} }
public class BrokerTestModule extends AbstractModule public static class BrokerTestModule extends AbstractModule
{ {
@Override @Override
protected void configure() protected void configure()

View File

@ -33,9 +33,11 @@ import java.util.Date;
public class QuidemRecorder implements AutoCloseable, DruidHook<String> public class QuidemRecorder implements AutoCloseable, DruidHook<String>
{ {
private PrintStream printStream; private PrintStream printStream;
private File file;
public QuidemRecorder(URI quidemURI, File file) public QuidemRecorder(URI quidemURI, File file)
{ {
this.file = file;
try { try {
this.printStream = new PrintStream(new FileOutputStream(file), true, StandardCharsets.UTF_8.name()); this.printStream = new PrintStream(new FileOutputStream(file), true, StandardCharsets.UTF_8.name());
} }
@ -43,7 +45,7 @@ public class QuidemRecorder implements AutoCloseable, DruidHook<String>
throw new RuntimeException(e); throw new RuntimeException(e);
} }
printStream.println("#started " + new Date()); printStream.println("#started " + new Date());
printStream.println("!use " + quidemURI.toString()); printStream.println("!use " + quidemURI);
printStream.println("!set outputformat mysql"); printStream.println("!set outputformat mysql");
DruidHook.register(DruidHook.SQL, this); DruidHook.register(DruidHook.SQL, this);
} }
@ -64,4 +66,11 @@ public class QuidemRecorder implements AutoCloseable, DruidHook<String>
return; return;
} }
} }
@Override
public String toString()
{
return "QuidemRecorder [file=" + file + "]";
}
} }

View File

@ -32,8 +32,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
public class LauncherSmokeTest public class LauncherSmokeTest
@ -54,7 +52,7 @@ public class LauncherSmokeTest
} }
@Test @Test
public void chkSelectFromFoo() throws IOException, InterruptedException public void chkSelectFromFoo() throws Exception
{ {
CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpClient client = HttpClients.createDefault();
HttpPost request = new HttpPost("http://localhost:12345/druid/v2/sql"); HttpPost request = new HttpPost("http://localhost:12345/druid/v2/sql");
@ -65,7 +63,7 @@ public class LauncherSmokeTest
} }
@Test @Test
public void chkStatusWorks() throws IOException, InterruptedException public void chkStatusWorks() throws Exception
{ {
CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpClient client = HttpClients.createDefault();
HttpGet request = new HttpGet("http://localhost:12345/status"); HttpGet request = new HttpGet("http://localhost:12345/status");

View File

@ -30,7 +30,7 @@ import java.util.Objects;
@FunctionalInterface @FunctionalInterface
public interface DruidHook<T> public interface DruidHook<T>
{ {
static class HookKey<T> class HookKey<T>
{ {
private String label; private String label;
private Class<T> type; private Class<T> type;
@ -65,14 +65,14 @@ public interface DruidHook<T>
} }
public static final HookKey<RelNode> CONVERTED_PLAN = new HookKey<>("converted", RelNode.class); final HookKey<RelNode> CONVERTED_PLAN = new HookKey<>("converted", RelNode.class);
public static final HookKey<RelNode> LOGICAL_PLAN = new HookKey<>("logicalPlan", RelNode.class); final HookKey<RelNode> LOGICAL_PLAN = new HookKey<>("logicalPlan", RelNode.class);
public static final HookKey<RelNode> DRUID_PLAN = new HookKey<>("druidPlan", RelNode.class); final HookKey<RelNode> DRUID_PLAN = new HookKey<>("druidPlan", RelNode.class);
public static final HookKey<String> SQL = new HookKey<>("sql", String.class); final HookKey<String> SQL = new HookKey<>("sql", String.class);
void invoke(HookKey<T> key, T object); void invoke(HookKey<T> key, T object);
static 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)
{ {

View File

@ -27,7 +27,6 @@ import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.inject.Module;
import org.apache.druid.java.util.common.IAE; import org.apache.druid.java.util.common.IAE;
import org.apache.druid.java.util.common.StringUtils; import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.query.topn.TopNQueryConfig; import org.apache.druid.query.topn.TopNQueryConfig;
@ -45,6 +44,7 @@ import org.junit.jupiter.api.extension.ExtensionContext;
import org.reflections.Configuration; import org.reflections.Configuration;
import org.reflections.Reflections; import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner; import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder; import org.reflections.util.ConfigurationBuilder;
import org.reflections.util.FilterBuilder; import org.reflections.util.FilterBuilder;
@ -356,16 +356,12 @@ public class SqlTestFrameworkConfig
ConfigurationInstance(SqlTestFrameworkConfig config, QueryComponentSupplier testHost) ConfigurationInstance(SqlTestFrameworkConfig config, QueryComponentSupplier testHost)
{ {
Module[] modules = {};
SqlTestFramework.Builder builder = new SqlTestFramework.Builder(testHost) SqlTestFramework.Builder builder = new SqlTestFramework.Builder(testHost)
.withConfig(config) .withConfig(config)
.catalogResolver(testHost.createCatalogResolver()) .catalogResolver(testHost.createCatalogResolver())
.minTopNThreshold(config.minTopNThreshold) .minTopNThreshold(config.minTopNThreshold)
.mergeBufferCount(config.numMergeBuffers) .mergeBufferCount(config.numMergeBuffers)
.withOverrideModule(config.resultCache.makeModule()); .withOverrideModule(config.resultCache.makeModule());
for (Module m : modules) {
builder.withOverrideModule(m);
}
framework = builder.build(); framework = builder.build();
} }
@ -515,7 +511,7 @@ public class SqlTestFrameworkConfig
{ {
Configuration cfg = new ConfigurationBuilder() Configuration cfg = new ConfigurationBuilder()
.setScanners(new SubTypesScanner(true)) .setScanners(new SubTypesScanner(true))
.setUrls(org.reflections.util.ClasspathHelper.forJavaClassPath()) .setUrls(ClasspathHelper.forJavaClassPath())
.filterInputsBy( .filterInputsBy(
new FilterBuilder() new FilterBuilder()
.includePackage(pkg) .includePackage(pkg)