mirror of https://github.com/apache/druid.git
This commit is contained in:
parent
88da8d9659
commit
d1b4587eae
|
@ -562,6 +562,21 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<executable>java</executable>
|
||||||
|
<arguments>
|
||||||
|
<argument>-classpath</argument>
|
||||||
|
<classpath/>
|
||||||
|
<argument>org.apache.druid.quidem.Launcher</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.apache.druid.quidem;
|
package org.apache.druid.quidem;
|
||||||
|
|
||||||
|
import org.apache.druid.sql.calcite.run.DruidHook;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
public class QuidemRecorder implements AutoCloseable, DruidHook
|
public class QuidemRecorder implements AutoCloseable, DruidHook
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -72,7 +72,8 @@
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<java.version>8</java.version>
|
<!-- UNDO THIS :D -->
|
||||||
|
<java.version>11</java.version>
|
||||||
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
|
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
|
||||||
<aether.version>0.9.0.M2</aether.version>
|
<aether.version>0.9.0.M2</aether.version>
|
||||||
<apache.curator.version>5.3.0</apache.curator.version>
|
<apache.curator.version>5.3.0</apache.curator.version>
|
||||||
|
@ -243,6 +244,7 @@
|
||||||
<module>integration-tests-ex/tools</module>
|
<module>integration-tests-ex/tools</module>
|
||||||
<module>integration-tests-ex/image</module>
|
<module>integration-tests-ex/image</module>
|
||||||
<module>integration-tests-ex/cases</module>
|
<module>integration-tests-ex/cases</module>
|
||||||
|
<module>quidem-it</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|
|
@ -0,0 +1,499 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>druid-quidem-it</artifactId>
|
||||||
|
<name>druid-quidem-it</name>
|
||||||
|
<description>druid-quidem-it</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid</artifactId>
|
||||||
|
<version>31.0.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>confluent</id>
|
||||||
|
<url>https://packages.confluent.io/maven/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.amazonaws</groupId>
|
||||||
|
<artifactId>amazon-kinesis-producer</artifactId>
|
||||||
|
<version>0.13.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.avro</groupId>
|
||||||
|
<artifactId>avro</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.opencsv</groupId>
|
||||||
|
<artifactId>opencsv</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.rvesse</groupId>
|
||||||
|
<artifactId>airline</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.amazonaws</groupId>
|
||||||
|
<artifactId>aws-java-sdk-kinesis</artifactId>
|
||||||
|
<version>${aws.sdk.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<!-- aws-java-sdk-core is provided by Druid core. -->
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.amazonaws</groupId>
|
||||||
|
<artifactId>aws-java-sdk-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.amazonaws</groupId>
|
||||||
|
<artifactId>aws-java-sdk-core</artifactId>
|
||||||
|
<version>${aws.sdk.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.amazonaws</groupId>
|
||||||
|
<artifactId>aws-java-sdk-s3</artifactId>
|
||||||
|
<version>${aws.sdk.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-orc-extensions</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.squareup.okhttp</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-parquet-extensions</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-avro-extensions</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-protobuf-extensions</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-s3-extensions</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-kinesis-indexing-service</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-azure-extensions</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-google-extensions</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-hdfs-storage</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.amazonaws</groupId>
|
||||||
|
<artifactId>aws-java-sdk-bundle</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-datasketches</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-histogram</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-aws-common</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-processing</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-sql</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-indexing-service</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>mysql-metadata-storage</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-kafka-indexing-service</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.kafka</groupId>
|
||||||
|
<artifactId>kafka-clients</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-basic-security</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-lookups-cached-global</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-testing-tools</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>simple-client-sslcontext</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid.extensions</groupId>
|
||||||
|
<artifactId>druid-multi-stage-query</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-services</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-server</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.inject</groupId>
|
||||||
|
<artifactId>guice</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.inject.extensions</groupId>
|
||||||
|
<artifactId>guice-multibindings</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.kafka</groupId>
|
||||||
|
<artifactId>kafka-clients</artifactId>
|
||||||
|
<version>${apache.kafka.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>jsr311-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-smile-provider</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.validation</groupId>
|
||||||
|
<artifactId>jakarta.validation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.docker-java</groupId>
|
||||||
|
<artifactId>docker-java</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.github.docker-java</groupId>
|
||||||
|
<artifactId>docker-java-transport-jersey</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.docker-java</groupId>
|
||||||
|
<artifactId>docker-java-transport-netty</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.docker-java</groupId>
|
||||||
|
<artifactId>docker-java-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.docker-java</groupId>
|
||||||
|
<artifactId>docker-java-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-transport-native-kqueue</artifactId>
|
||||||
|
<classifier>osx-x86_64</classifier>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-transport-native-kqueue</artifactId>
|
||||||
|
<classifier>osx-aarch_64</classifier>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-servlet</artifactId>
|
||||||
|
<version>${jetty.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-server</artifactId>
|
||||||
|
<version>${jetty.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.inject.extensions</groupId>
|
||||||
|
<artifactId>guice-servlet</artifactId>
|
||||||
|
<version>${guice.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.confluent</groupId>
|
||||||
|
<artifactId>kafka-schema-registry-client</artifactId>
|
||||||
|
<version>6.2.12</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.avro</groupId>
|
||||||
|
<artifactId>avro</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>javax.ws.rs-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>javax.ws.rs-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>jsr311-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>jakarta.ws.rs</groupId>
|
||||||
|
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.confluent</groupId>
|
||||||
|
<artifactId>kafka-protobuf-provider</artifactId>
|
||||||
|
<version>6.2.12</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.protobuf</groupId>
|
||||||
|
<artifactId>protobuf-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-sql</artifactId>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-processing</artifactId>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.druid</groupId>
|
||||||
|
<artifactId>druid-server</artifactId>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.easymock</groupId>
|
||||||
|
<artifactId>easymock</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Tests -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.calcite.avatica</groupId>
|
||||||
|
<artifactId>avatica</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.calcite.avatica</groupId>
|
||||||
|
<artifactId>avatica-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.os72</groupId>
|
||||||
|
<artifactId>protobuf-dynamic</artifactId>
|
||||||
|
<version>0.9.3</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.amazonaws</groupId>
|
||||||
|
<artifactId>aws-java-sdk-sts</artifactId>
|
||||||
|
<version>${aws.sdk.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.datasketches</groupId>
|
||||||
|
<artifactId>datasketches-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.owasp</groupId>
|
||||||
|
<artifactId>dependency-check-maven</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<executable>java</executable>
|
||||||
|
<arguments>
|
||||||
|
<argument>-classpath</argument>
|
||||||
|
<classpath/>
|
||||||
|
<argument>org.apache.druid.quidem.Launcher</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,373 @@
|
||||||
|
/*
|
||||||
|
* 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.quidem;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
import com.google.inject.Key;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.name.Names;
|
||||||
|
import org.apache.druid.cli.CliBroker;
|
||||||
|
import org.apache.druid.cli.QueryJettyServerInitializer;
|
||||||
|
import org.apache.druid.client.BrokerSegmentWatcherConfig;
|
||||||
|
import org.apache.druid.client.BrokerServerView;
|
||||||
|
import org.apache.druid.client.InternalQueryConfig;
|
||||||
|
import org.apache.druid.client.TimelineServerView;
|
||||||
|
import org.apache.druid.client.selector.CustomTierSelectorStrategyConfig;
|
||||||
|
import org.apache.druid.client.selector.ServerSelectorStrategy;
|
||||||
|
import org.apache.druid.client.selector.TierSelectorStrategy;
|
||||||
|
import org.apache.druid.curator.CuratorModule;
|
||||||
|
import org.apache.druid.curator.discovery.DiscoveryModule;
|
||||||
|
import org.apache.druid.discovery.DruidNodeDiscoveryProvider;
|
||||||
|
import org.apache.druid.guice.AnnouncerModule;
|
||||||
|
import org.apache.druid.guice.BrokerProcessingModule;
|
||||||
|
import org.apache.druid.guice.BrokerServiceModule;
|
||||||
|
import org.apache.druid.guice.CoordinatorDiscoveryModule;
|
||||||
|
import org.apache.druid.guice.DruidInjectorBuilder;
|
||||||
|
import org.apache.druid.guice.ExpressionModule;
|
||||||
|
import org.apache.druid.guice.ExtensionsModule;
|
||||||
|
import org.apache.druid.guice.FirehoseModule;
|
||||||
|
import org.apache.druid.guice.JacksonConfigManagerModule;
|
||||||
|
import org.apache.druid.guice.JavaScriptModule;
|
||||||
|
import org.apache.druid.guice.Jerseys;
|
||||||
|
import org.apache.druid.guice.JoinableFactoryModule;
|
||||||
|
import org.apache.druid.guice.JsonConfigProvider;
|
||||||
|
import org.apache.druid.guice.LazySingleton;
|
||||||
|
import org.apache.druid.guice.LifecycleModule;
|
||||||
|
import org.apache.druid.guice.LocalDataStorageDruidModule;
|
||||||
|
import org.apache.druid.guice.MetadataConfigModule;
|
||||||
|
import org.apache.druid.guice.NestedDataModule;
|
||||||
|
import org.apache.druid.guice.QueryRunnerFactoryModule;
|
||||||
|
import org.apache.druid.guice.SegmentWranglerModule;
|
||||||
|
import org.apache.druid.guice.ServerModule;
|
||||||
|
import org.apache.druid.guice.ServerTypeConfig;
|
||||||
|
import org.apache.druid.guice.ServerViewModule;
|
||||||
|
import org.apache.druid.guice.StartupLoggingModule;
|
||||||
|
import org.apache.druid.guice.StorageNodeModule;
|
||||||
|
import org.apache.druid.guice.annotations.Client;
|
||||||
|
import org.apache.druid.guice.annotations.EscalatedClient;
|
||||||
|
import org.apache.druid.guice.annotations.Json;
|
||||||
|
import org.apache.druid.guice.http.HttpClientModule;
|
||||||
|
import org.apache.druid.guice.security.AuthenticatorModule;
|
||||||
|
import org.apache.druid.guice.security.AuthorizerModule;
|
||||||
|
import org.apache.druid.guice.security.DruidAuthModule;
|
||||||
|
import org.apache.druid.initialization.CoreInjectorBuilder;
|
||||||
|
import org.apache.druid.initialization.Log4jShutterDownerModule;
|
||||||
|
import org.apache.druid.initialization.ServerInjectorBuilder;
|
||||||
|
import org.apache.druid.initialization.TombstoneDataStorageModule;
|
||||||
|
import org.apache.druid.java.util.common.io.Closer;
|
||||||
|
import org.apache.druid.java.util.emitter.service.ServiceEmitter;
|
||||||
|
import org.apache.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule;
|
||||||
|
import org.apache.druid.query.QueryRunnerFactoryConglomerate;
|
||||||
|
import org.apache.druid.query.QuerySegmentWalker;
|
||||||
|
import org.apache.druid.query.RetryQueryRunnerConfig;
|
||||||
|
import org.apache.druid.query.lookup.LookupExtractorFactoryContainerProvider;
|
||||||
|
import org.apache.druid.rpc.guice.ServiceClientModule;
|
||||||
|
import org.apache.druid.segment.join.JoinableFactoryWrapper;
|
||||||
|
import org.apache.druid.segment.writeout.SegmentWriteOutMediumModule;
|
||||||
|
import org.apache.druid.server.BrokerQueryResource;
|
||||||
|
import org.apache.druid.server.ClientInfoResource;
|
||||||
|
import org.apache.druid.server.DruidNode;
|
||||||
|
import org.apache.druid.server.QueryLifecycleFactory;
|
||||||
|
import org.apache.druid.server.QuerySchedulerProvider;
|
||||||
|
import org.apache.druid.server.ResponseContextConfig;
|
||||||
|
import org.apache.druid.server.SpecificSegmentsQuerySegmentWalker;
|
||||||
|
import org.apache.druid.server.SubqueryGuardrailHelper;
|
||||||
|
import org.apache.druid.server.SubqueryGuardrailHelperProvider;
|
||||||
|
import org.apache.druid.server.coordination.ServerType;
|
||||||
|
import org.apache.druid.server.http.BrokerResource;
|
||||||
|
import org.apache.druid.server.http.SelfDiscoveryResource;
|
||||||
|
import org.apache.druid.server.initialization.AuthorizerMapperModule;
|
||||||
|
import org.apache.druid.server.initialization.ExternalStorageAccessSecurityModule;
|
||||||
|
import org.apache.druid.server.initialization.jetty.JettyServerInitializer;
|
||||||
|
import org.apache.druid.server.initialization.jetty.JettyServerModule;
|
||||||
|
import org.apache.druid.server.log.NoopRequestLogger;
|
||||||
|
import org.apache.druid.server.log.RequestLogger;
|
||||||
|
import org.apache.druid.server.metrics.NoopServiceEmitter;
|
||||||
|
import org.apache.druid.server.metrics.QueryCountStatsProvider;
|
||||||
|
import org.apache.druid.server.metrics.SubqueryCountStatsProvider;
|
||||||
|
import org.apache.druid.server.router.TieredBrokerConfig;
|
||||||
|
import org.apache.druid.server.security.AuthenticatorMapper;
|
||||||
|
import org.apache.druid.server.security.Escalator;
|
||||||
|
import org.apache.druid.server.security.TLSCertificateCheckerModule;
|
||||||
|
import org.apache.druid.sql.calcite.planner.CalciteRulesManager;
|
||||||
|
import org.apache.druid.sql.calcite.planner.CatalogResolver;
|
||||||
|
import org.apache.druid.sql.calcite.run.NativeSqlEngine;
|
||||||
|
import org.apache.druid.sql.calcite.run.SqlEngine;
|
||||||
|
import org.apache.druid.sql.calcite.schema.BrokerSegmentMetadataCache;
|
||||||
|
import org.apache.druid.sql.calcite.schema.DruidSchemaName;
|
||||||
|
import org.apache.druid.sql.calcite.util.CalciteTests;
|
||||||
|
import org.apache.druid.sql.calcite.util.SqlTestFramework;
|
||||||
|
import org.apache.druid.sql.calcite.util.SqlTestFramework.Builder;
|
||||||
|
import org.apache.druid.sql.calcite.util.SqlTestFramework.PlannerComponentSupplier;
|
||||||
|
import org.apache.druid.sql.calcite.util.SqlTestFramework.QueryComponentSupplier;
|
||||||
|
import org.apache.druid.sql.guice.SqlModule;
|
||||||
|
import org.apache.druid.storage.StorageConnectorModule;
|
||||||
|
import org.apache.druid.timeline.PruneLoadSpec;
|
||||||
|
import org.eclipse.jetty.server.Server;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A wrapper class to expose a {@link QueryComponentSupplier} as a Broker service.
|
||||||
|
*/
|
||||||
|
public class ExposedAsBrokerQueryComponentSupplierWrapper implements QueryComponentSupplier
|
||||||
|
{
|
||||||
|
private QueryComponentSupplier delegate;
|
||||||
|
|
||||||
|
public ExposedAsBrokerQueryComponentSupplierWrapper(QueryComponentSupplier delegate)
|
||||||
|
{
|
||||||
|
this.delegate = delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gatherProperties(Properties properties)
|
||||||
|
{
|
||||||
|
delegate.gatherProperties(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureGuice(DruidInjectorBuilder builder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureGuice(CoreInjectorBuilder builder, List<Module> overrideModules)
|
||||||
|
{
|
||||||
|
delegate.configureGuice(builder);
|
||||||
|
|
||||||
|
installForServerModules(builder);
|
||||||
|
|
||||||
|
overrideModules.addAll(ExposedAsBrokerQueryComponentSupplierWrapper.brokerModules());
|
||||||
|
overrideModules.add(new BrokerTestModule());
|
||||||
|
builder.add(QuidemCaptureModule.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryRunnerFactoryConglomerate createCongolmerate(Builder builder, Closer closer)
|
||||||
|
{
|
||||||
|
return delegate.createCongolmerate(builder, closer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpecificSegmentsQuerySegmentWalker createQuerySegmentWalker(QueryRunnerFactoryConglomerate conglomerate,
|
||||||
|
JoinableFactoryWrapper joinableFactory, Injector injector)
|
||||||
|
{
|
||||||
|
return delegate.createQuerySegmentWalker(conglomerate, joinableFactory, injector);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqlEngine createEngine(QueryLifecycleFactory qlf, ObjectMapper objectMapper, Injector injector)
|
||||||
|
{
|
||||||
|
return delegate.createEngine(qlf, objectMapper, injector);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureJsonMapper(ObjectMapper mapper)
|
||||||
|
{
|
||||||
|
delegate.configureJsonMapper(mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JoinableFactoryWrapper createJoinableFactoryWrapper(LookupExtractorFactoryContainerProvider lookupProvider)
|
||||||
|
{
|
||||||
|
return delegate.createJoinableFactoryWrapper(lookupProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finalizeTestFramework(SqlTestFramework sqlTestFramework)
|
||||||
|
{
|
||||||
|
delegate.finalizeTestFramework(sqlTestFramework);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException
|
||||||
|
{
|
||||||
|
delegate.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlannerComponentSupplier getPlannerComponentSupplier()
|
||||||
|
{
|
||||||
|
return delegate.getPlannerComponentSupplier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BrokerTestModule extends AbstractModule
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void configure()
|
||||||
|
{
|
||||||
|
bind(AuthenticatorMapper.class).toInstance(CalciteTests.TEST_AUTHENTICATOR_MAPPER);
|
||||||
|
bind(Escalator.class).toInstance(CalciteTests.TEST_AUTHENTICATOR_ESCALATOR);
|
||||||
|
bind(RequestLogger.class).toInstance(new NoopRequestLogger());
|
||||||
|
bind(String.class)
|
||||||
|
.annotatedWith(DruidSchemaName.class)
|
||||||
|
.toInstance(CalciteTests.DRUID_SCHEMA_NAME);
|
||||||
|
bind(ServiceEmitter.class).to(NoopServiceEmitter.class);
|
||||||
|
bind(QuerySchedulerProvider.class).in(LazySingleton.class);
|
||||||
|
bind(CalciteRulesManager.class).toInstance(new CalciteRulesManager(ImmutableSet.of()));
|
||||||
|
bind(CatalogResolver.class).toInstance(CatalogResolver.NULL_RESOLVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@LazySingleton
|
||||||
|
public BrokerSegmentMetadataCache provideCache()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@LazySingleton
|
||||||
|
public Properties getProps()
|
||||||
|
{
|
||||||
|
Properties localProps = new Properties();
|
||||||
|
localProps.put("druid.enableTlsPort", "false");
|
||||||
|
localProps.put("druid.zk.service.enabled", "false");
|
||||||
|
localProps.put("druid.plaintextPort", "12345");
|
||||||
|
localProps.put("druid.host", "localhost");
|
||||||
|
localProps.put("druid.broker.segment.awaitInitializationOnStart", "false");
|
||||||
|
return localProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@LazySingleton
|
||||||
|
public SqlEngine createMockSqlEngine(
|
||||||
|
final QuerySegmentWalker walker,
|
||||||
|
final QueryRunnerFactoryConglomerate conglomerate,
|
||||||
|
@Json ObjectMapper jsonMapper)
|
||||||
|
{
|
||||||
|
return new NativeSqlEngine(CalciteTests.createMockQueryLifecycleFactory(walker, conglomerate), jsonMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@LazySingleton
|
||||||
|
DruidNodeDiscoveryProvider getDruidNodeDiscoveryProvider()
|
||||||
|
{
|
||||||
|
final DruidNode coordinatorNode = CalciteTests.mockCoordinatorNode();
|
||||||
|
return CalciteTests.mockDruidNodeDiscoveryProvider(coordinatorNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closely related to {@link CoreInjectorBuilder#forServer()}
|
||||||
|
*/
|
||||||
|
private void installForServerModules(CoreInjectorBuilder builder)
|
||||||
|
{
|
||||||
|
builder.add(
|
||||||
|
new Log4jShutterDownerModule(),
|
||||||
|
new LifecycleModule(),
|
||||||
|
ExtensionsModule.SecondaryModule.class,
|
||||||
|
new DruidAuthModule(),
|
||||||
|
TLSCertificateCheckerModule.class,
|
||||||
|
// EmitterModule.class,
|
||||||
|
HttpClientModule.global(),
|
||||||
|
HttpClientModule.escalatedGlobal(),
|
||||||
|
new HttpClientModule("druid.broker.http", Client.class, true),
|
||||||
|
new HttpClientModule("druid.broker.http", EscalatedClient.class, true),
|
||||||
|
new CuratorModule(),
|
||||||
|
new AnnouncerModule(),
|
||||||
|
new SegmentWriteOutMediumModule(),
|
||||||
|
new ServerModule(),
|
||||||
|
new StorageNodeModule(),
|
||||||
|
new JettyServerModule(),
|
||||||
|
new ExpressionModule(),
|
||||||
|
new NestedDataModule(),
|
||||||
|
new DiscoveryModule(),
|
||||||
|
new ServerViewModule(),
|
||||||
|
new MetadataConfigModule(),
|
||||||
|
new DerbyMetadataStorageDruidModule(),
|
||||||
|
new JacksonConfigManagerModule(),
|
||||||
|
new CoordinatorDiscoveryModule(),
|
||||||
|
new LocalDataStorageDruidModule(),
|
||||||
|
new TombstoneDataStorageModule(),
|
||||||
|
new FirehoseModule(),
|
||||||
|
new JavaScriptModule(),
|
||||||
|
new AuthenticatorModule(),
|
||||||
|
new AuthorizerModule(),
|
||||||
|
new AuthorizerMapperModule(),
|
||||||
|
new StartupLoggingModule(),
|
||||||
|
new ExternalStorageAccessSecurityModule(),
|
||||||
|
new ServiceClientModule(),
|
||||||
|
new StorageConnectorModule(),
|
||||||
|
new SqlModule(),
|
||||||
|
ServerInjectorBuilder.registerNodeRoleModule(ImmutableSet.of())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closely related to {@link CliBroker#getModules}.
|
||||||
|
*/
|
||||||
|
static List<? extends Module> brokerModules()
|
||||||
|
{
|
||||||
|
return ImmutableList.of(
|
||||||
|
new BrokerProcessingModule(),
|
||||||
|
new QueryRunnerFactoryModule(),
|
||||||
|
new SegmentWranglerModule(),
|
||||||
|
new JoinableFactoryModule(),
|
||||||
|
new BrokerServiceModule(),
|
||||||
|
binder -> {
|
||||||
|
|
||||||
|
binder.bindConstant().annotatedWith(Names.named("serviceName")).to(
|
||||||
|
TieredBrokerConfig.DEFAULT_BROKER_SERVICE_NAME
|
||||||
|
);
|
||||||
|
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(8082);
|
||||||
|
binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(8282);
|
||||||
|
binder.bindConstant().annotatedWith(PruneLoadSpec.class).to(true);
|
||||||
|
binder.bind(ResponseContextConfig.class).toInstance(ResponseContextConfig.newConfig(false));
|
||||||
|
|
||||||
|
binder.bind(TimelineServerView.class).to(BrokerServerView.class).in(LazySingleton.class);
|
||||||
|
|
||||||
|
JsonConfigProvider.bind(binder, "druid.broker.select", TierSelectorStrategy.class);
|
||||||
|
JsonConfigProvider.bind(binder, "druid.broker.select.tier.custom", CustomTierSelectorStrategyConfig.class);
|
||||||
|
JsonConfigProvider.bind(binder, "druid.broker.balancer", ServerSelectorStrategy.class);
|
||||||
|
JsonConfigProvider.bind(binder, "druid.broker.retryPolicy", RetryQueryRunnerConfig.class);
|
||||||
|
JsonConfigProvider.bind(binder, "druid.broker.segment", BrokerSegmentWatcherConfig.class);
|
||||||
|
JsonConfigProvider.bind(binder, "druid.broker.internal.query.config", InternalQueryConfig.class);
|
||||||
|
binder.bind(JettyServerInitializer.class).to(QueryJettyServerInitializer.class).in(LazySingleton.class);
|
||||||
|
|
||||||
|
binder.bind(BrokerQueryResource.class).in(LazySingleton.class);
|
||||||
|
Jerseys.addResource(binder, BrokerQueryResource.class);
|
||||||
|
binder.bind(SubqueryGuardrailHelper.class).toProvider(SubqueryGuardrailHelperProvider.class);
|
||||||
|
binder.bind(QueryCountStatsProvider.class).to(BrokerQueryResource.class).in(LazySingleton.class);
|
||||||
|
binder.bind(SubqueryCountStatsProvider.class).toInstance(new SubqueryCountStatsProvider());
|
||||||
|
Jerseys.addResource(binder, BrokerResource.class);
|
||||||
|
Jerseys.addResource(binder, ClientInfoResource.class);
|
||||||
|
|
||||||
|
LifecycleModule.register(binder, BrokerQueryResource.class);
|
||||||
|
|
||||||
|
LifecycleModule.register(binder, Server.class);
|
||||||
|
binder.bind(ServerTypeConfig.class).toInstance(new ServerTypeConfig(ServerType.BROKER));
|
||||||
|
|
||||||
|
binder.bind(String.class)
|
||||||
|
.annotatedWith(DruidSchemaName.class)
|
||||||
|
.toInstance(CalciteTests.DRUID_SCHEMA_NAME);
|
||||||
|
|
||||||
|
Jerseys.addResource(binder, SelfDiscoveryResource.class);
|
||||||
|
LifecycleModule.registerKey(binder, Key.get(SelfDiscoveryResource.class));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* 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.quidem;
|
||||||
|
|
||||||
|
import org.apache.druid.cli.GuiceRunnable;
|
||||||
|
import org.apache.druid.java.util.common.lifecycle.Lifecycle;
|
||||||
|
import org.apache.druid.java.util.common.logger.Logger;
|
||||||
|
import org.apache.druid.sql.calcite.SqlTestFrameworkConfig;
|
||||||
|
import org.apache.druid.sql.calcite.SqlTestFrameworkConfig.ConfigurationInstance;
|
||||||
|
import org.apache.druid.sql.calcite.SqlTestFrameworkConfig.SqlTestFrameworkConfigStore;
|
||||||
|
import org.apache.druid.sql.calcite.util.SqlTestFramework;
|
||||||
|
|
||||||
|
public class Launcher
|
||||||
|
{
|
||||||
|
static final SqlTestFrameworkConfigStore CONFIG_STORE = new SqlTestFrameworkConfigStore(
|
||||||
|
x -> new ExposedAsBrokerQueryComponentSupplierWrapper(x)
|
||||||
|
);
|
||||||
|
private static final String QUIDEM_URI = "quidem.uri";
|
||||||
|
private static Logger log = new Logger(Launcher.class);
|
||||||
|
private final SqlTestFramework framework;
|
||||||
|
private final ConfigurationInstance configurationInstance;
|
||||||
|
private Lifecycle lifecycle;
|
||||||
|
|
||||||
|
public Launcher(String uri) throws Exception
|
||||||
|
{
|
||||||
|
SqlTestFrameworkConfig config = SqlTestFrameworkConfig.fromURL(uri);
|
||||||
|
configurationInstance = CONFIG_STORE.getConfigurationInstance(config);
|
||||||
|
framework = configurationInstance.framework;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start()
|
||||||
|
{
|
||||||
|
lifecycle = GuiceRunnable.initLifecycle(framework.injector(), log);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown()
|
||||||
|
{
|
||||||
|
lifecycle.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception
|
||||||
|
{
|
||||||
|
String quidemUri = System.getProperty(QUIDEM_URI, "druidtest:///");
|
||||||
|
|
||||||
|
Launcher launcher = new Launcher(quidemUri );
|
||||||
|
launcher.start();
|
||||||
|
launcher.lifecycle.join();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* 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.quidem;
|
||||||
|
|
||||||
|
import com.google.inject.Binder;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
import org.apache.druid.guice.Jerseys;
|
||||||
|
|
||||||
|
public class QuidemCaptureModule implements Module
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(Binder binder)
|
||||||
|
{
|
||||||
|
Jerseys.addResource(binder, QuidemCaptureResource.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* 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.quidem;
|
||||||
|
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
@Path("/quidem")
|
||||||
|
public class QuidemCaptureResource
|
||||||
|
{
|
||||||
|
private QuidemRecorder recorder = null;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/")
|
||||||
|
@Produces(MediaType.TEXT_PLAIN)
|
||||||
|
public String getSome()
|
||||||
|
{
|
||||||
|
return "Asd";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/start")
|
||||||
|
@Produces(MediaType.TEXT_PLAIN)
|
||||||
|
public synchronized String getSome1() throws IOException
|
||||||
|
{
|
||||||
|
stopIfRunning();
|
||||||
|
start();
|
||||||
|
return recorder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void start() throws IOException
|
||||||
|
{
|
||||||
|
recorder = new QuidemRecorder(new PrintStream("/tmp/new.iq"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopIfRunning()
|
||||||
|
{
|
||||||
|
if (recorder != null) {
|
||||||
|
recorder.close();
|
||||||
|
recorder = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* 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.quidem;
|
||||||
|
|
||||||
|
import org.apache.druid.sql.calcite.run.DruidHook;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public class QuidemRecorder implements AutoCloseable, DruidHook
|
||||||
|
{
|
||||||
|
private PrintStream printStream;
|
||||||
|
|
||||||
|
public QuidemRecorder(PrintStream printStream)
|
||||||
|
{
|
||||||
|
this.printStream = printStream;
|
||||||
|
printStream.println("#started");
|
||||||
|
printStream.println("!connect druidtest:///");
|
||||||
|
DruidHook.register(DruidHook.SQL, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
DruidHook.unregister(DruidHook.SQL, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> void invoke(HookKey<T> key, T object)
|
||||||
|
{
|
||||||
|
if (DruidHook.SQL.equals(key)) {
|
||||||
|
printStream.print(object);
|
||||||
|
printStream.println(";");
|
||||||
|
printStream.println("!ok");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* 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.quidem;
|
||||||
|
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpRequest.BodyPublishers;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class LauncherSmokeTest
|
||||||
|
{
|
||||||
|
private static Launcher launcher;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUp() throws Exception
|
||||||
|
{
|
||||||
|
launcher = new Launcher("druidtest:///");
|
||||||
|
launcher.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void tearDown()
|
||||||
|
{
|
||||||
|
launcher.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void chkSelectFromFoo() throws IOException, InterruptedException
|
||||||
|
{
|
||||||
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create("http://localhost:12345/druid/v2/sql"))
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.POST(BodyPublishers.ofString("{\"query\":\"Select * from foo\"}"))
|
||||||
|
.build();
|
||||||
|
HttpClient hc = HttpClient.newHttpClient();
|
||||||
|
HttpResponse<String> a = hc.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
assertEquals(200, a.statusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void chkStatusWorks() throws IOException, InterruptedException
|
||||||
|
{
|
||||||
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create("http://localhost:12345/status"))
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.GET()
|
||||||
|
.build();
|
||||||
|
HttpClient hc = HttpClient.newHttpClient();
|
||||||
|
HttpResponse<String> a = hc.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
assertEquals(200, a.statusCode());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue