mirror of https://github.com/apache/druid.git
add some validation/etc
This commit is contained in:
parent
e06e54631e
commit
7eccf5b518
|
@ -18,7 +18,9 @@
|
||||||
~ under the License.
|
~ 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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>druid-quidem-it</artifactId>
|
<artifactId>druid-quidem-it</artifactId>
|
||||||
|
@ -420,24 +422,24 @@
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-simple</artifactId>
|
<artifactId>slf4j-simple</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.easymock</groupId>
|
<groupId>org.easymock</groupId>
|
||||||
<artifactId>easymock</artifactId>
|
<artifactId>easymock</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- Tests -->
|
<!-- Tests -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.vintage</groupId>
|
<groupId>org.junit.vintage</groupId>
|
||||||
<artifactId>junit-vintage-engine</artifactId>
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
@ -472,16 +474,16 @@
|
||||||
<artifactId>datasketches-java</artifactId>
|
<artifactId>datasketches-java</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>hamcrest-all</artifactId>
|
<artifactId>hamcrest-all</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>hamcrest-core</artifactId>
|
<artifactId>hamcrest-core</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -500,23 +502,13 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<executable>java</executable>
|
<executable>java</executable>
|
||||||
<arguments>
|
<arguments>
|
||||||
<argument>-classpath</argument>
|
<argument>-classpath</argument>
|
||||||
<classpath/>
|
<classpath />
|
||||||
<argument>-Dquidem.uriXXX=Xa</argument>
|
<argument>-Dquidem.uri=${quidem.uri}</argument>
|
||||||
<!-- <argument>-Xdebug</argument> -->
|
<argument>org.apache.druid.quidem.Launcher</argument>
|
||||||
<!-- <argument>-Xdebug</argument> -->
|
|
||||||
<!-- <argument>-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y</argument> -->
|
|
||||||
<argument>org.apache.druid.quidem.Launcher</argument>
|
|
||||||
</arguments>
|
</arguments>
|
||||||
<systemProperties>
|
|
||||||
<projectProperties />
|
|
||||||
<systemProperty>
|
|
||||||
<key>quidem.uri1</key>
|
|
||||||
<value>myvalue</value>
|
|
||||||
</systemProperty>
|
|
||||||
</systemProperties>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
|
@ -43,7 +43,9 @@ public class Launcher
|
||||||
public Launcher(String uri) throws Exception
|
public Launcher(String uri) throws Exception
|
||||||
{
|
{
|
||||||
SqlTestFrameworkConfig config = SqlTestFrameworkConfig.fromURL(uri);
|
SqlTestFrameworkConfig config = SqlTestFrameworkConfig.fromURL(uri);
|
||||||
|
System.out.println("Config: " + config);
|
||||||
configurationInstance = CONFIG_STORE.getConfigurationInstance(config);
|
configurationInstance = CONFIG_STORE.getConfigurationInstance(config);
|
||||||
|
System.out.println("Configuration instance: " + configurationInstance);
|
||||||
framework = configurationInstance.framework;
|
framework = configurationInstance.framework;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,11 +64,13 @@ 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 (Object string : p.keySet()) {
|
||||||
log.info("[%s] -> %s", string, p.get(string));
|
if (string.toString().startsWith("quidem")) {
|
||||||
|
log.info("[%s] -> %s", string, p.get(string));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.info("Starting Quidem with URI[%s]", quidemUri);
|
log.info("Starting Quidem with URI[%s]", quidemUri);
|
||||||
|
|
||||||
Launcher launcher = new Launcher(quidemUri);
|
Launcher launcher = new Launcher(quidemUri);
|
||||||
|
System.exit(1);
|
||||||
launcher.start();
|
launcher.start();
|
||||||
launcher.lifecycle.join();
|
launcher.lifecycle.join();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class QuidemCaptureResource
|
||||||
stopIfRunning();
|
stopIfRunning();
|
||||||
recorder = new QuidemRecorder(
|
recorder = new QuidemRecorder(
|
||||||
quidemURI,
|
quidemURI,
|
||||||
new FileOutputStream("/tmp/new.iq")
|
new FileOutputStream("new1.iq")
|
||||||
);
|
);
|
||||||
return recorder.toString();
|
return recorder.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,8 @@ public class DruidAvaticaTestDriver implements Driver
|
||||||
new DruidAvaticaTestDriver().register();
|
new DruidAvaticaTestDriver().register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String URI_PREFIX = "druidtest://";
|
public static final String SCHEME = "druidtest";
|
||||||
|
public static final String URI_PREFIX = SCHEME + "://";
|
||||||
public static final String DEFAULT_URI = URI_PREFIX + "/";
|
public static final String DEFAULT_URI = URI_PREFIX + "/";
|
||||||
|
|
||||||
static final SqlTestFrameworkConfigStore CONFIG_STORE = new SqlTestFrameworkConfigStore(
|
static final SqlTestFrameworkConfigStore CONFIG_STORE = new SqlTestFrameworkConfigStore(
|
||||||
|
|
|
@ -31,6 +31,7 @@ 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;
|
||||||
|
import org.apache.druid.quidem.DruidAvaticaTestDriver;
|
||||||
import org.apache.druid.sql.calcite.util.CacheTestHelperModule.ResultCacheMode;
|
import org.apache.druid.sql.calcite.util.CacheTestHelperModule.ResultCacheMode;
|
||||||
import org.apache.druid.sql.calcite.util.SqlTestFramework;
|
import org.apache.druid.sql.calcite.util.SqlTestFramework;
|
||||||
import org.apache.druid.sql.calcite.util.SqlTestFramework.QueryComponentSupplier;
|
import org.apache.druid.sql.calcite.util.SqlTestFramework.QueryComponentSupplier;
|
||||||
|
@ -419,10 +420,20 @@ public class SqlTestFrameworkConfig
|
||||||
|
|
||||||
public static SqlTestFrameworkConfig fromURL(String url) throws SQLException
|
public static SqlTestFrameworkConfig fromURL(String url) throws SQLException
|
||||||
{
|
{
|
||||||
|
|
||||||
Map<String, String> queryParams;
|
Map<String, String> queryParams;
|
||||||
queryParams = new HashMap<>();
|
queryParams = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
List<NameValuePair> params = URLEncodedUtils.parse(new URI(url), StandardCharsets.UTF_8);
|
URI uri = new URI(url);
|
||||||
|
if (!DruidAvaticaTestDriver.SCHEME.equals(uri.getScheme())) {
|
||||||
|
throw new SQLException(
|
||||||
|
StringUtils.format("URI [%s] is invalid ; only scheme [%s] is supported.", url, DruidAvaticaTestDriver.SCHEME)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (uri.getHost() != null || uri.getPort() != -1) {
|
||||||
|
throw new SQLException(StringUtils.format("URI [%s] is invalid ; only query parameters are supported.", url));
|
||||||
|
}
|
||||||
|
List<NameValuePair> params = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8);
|
||||||
for (NameValuePair pair : params) {
|
for (NameValuePair pair : params) {
|
||||||
queryParams.put(pair.getName(), pair.getValue());
|
queryParams.put(pair.getName(), pair.getValue());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue