mirror of https://github.com/apache/druid.git
cleanup
This commit is contained in:
parent
f4c73e1499
commit
e2986ae612
|
@ -90,6 +90,7 @@ import org.apache.druid.server.QueryLifecycleFactory;
|
|||
import org.apache.druid.server.QueryScheduler;
|
||||
import org.apache.druid.server.QuerySchedulerProvider;
|
||||
import org.apache.druid.server.SpecificSegmentsQuerySegmentWalker;
|
||||
import org.apache.druid.server.initialization.AuthorizerMapperModule;
|
||||
import org.apache.druid.server.initialization.ExternalStorageAccessSecurityModule;
|
||||
import org.apache.druid.server.initialization.jetty.JettyServerModule;
|
||||
import org.apache.druid.server.log.RequestLogger;
|
||||
|
@ -607,7 +608,7 @@ public class Launcher
|
|||
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0);
|
||||
binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1);
|
||||
binder.bind(AuthenticatorMapper.class).toInstance(CalciteTests.TEST_AUTHENTICATOR_MAPPER);
|
||||
binder.bind(AuthorizerMapper.class).toInstance(CalciteTests.TEST_AUTHORIZER_MAPPER);
|
||||
// binder.bind(AuthorizerMapper.class).toInstance(CalciteTests.TEST_AUTHORIZER_MAPPER);
|
||||
binder.bind(Escalator.class).toInstance(CalciteTests.TEST_AUTHENTICATOR_ESCALATOR);
|
||||
binder.bind(RequestLogger.class).toInstance(testRequestLogger);
|
||||
binder.bind(String.class)
|
||||
|
@ -663,7 +664,7 @@ public class Launcher
|
|||
// new AuthenticatorMapperModule(),
|
||||
// new EscalatorModule(),
|
||||
new AuthorizerModule(),
|
||||
// new AuthorizerMapperModule(),
|
||||
new AuthorizerMapperModule(),
|
||||
new StartupLoggingModule(),
|
||||
new ExternalStorageAccessSecurityModule(),
|
||||
new ServiceClientModule(),
|
||||
|
@ -750,17 +751,9 @@ public class Launcher
|
|||
if(true) {
|
||||
Lifecycle lifecycle = GuiceRunnable.initLifecycle(framework.injector(), log);
|
||||
|
||||
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();
|
||||
System.out.println(request);
|
||||
// request.
|
||||
HttpClient hc = HttpClient.newHttpClient();
|
||||
HttpResponse<String> a = hc.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
System.out.println(a);
|
||||
assertNotEquals(400, a.statusCode());
|
||||
chk1();
|
||||
chkStatus();
|
||||
|
||||
|
||||
lifecycle.stop();
|
||||
}else {
|
||||
|
@ -789,5 +782,35 @@ public class Launcher
|
|||
|
||||
}
|
||||
|
||||
private static void chk1() 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();
|
||||
System.out.println(request);
|
||||
// request.
|
||||
HttpClient hc = HttpClient.newHttpClient();
|
||||
HttpResponse<String> a = hc.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
System.out.println(a);
|
||||
assertNotEquals(400, a.statusCode());
|
||||
}
|
||||
private static void chkStatus() throws IOException, InterruptedException
|
||||
{
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create("http://localhost:12345/status"))
|
||||
.header("Content-Type", "application/json")
|
||||
.GET()
|
||||
.build();
|
||||
System.out.println(request);
|
||||
// request.
|
||||
HttpClient hc = HttpClient.newHttpClient();
|
||||
HttpResponse<String> a = hc.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
System.out.println(a);
|
||||
assertNotEquals(400, a.statusCode());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ public class HttpClientModule implements Module
|
|||
final Binding<SSLContext> sslContextBinding = getSslContextBinding();
|
||||
|
||||
if (sslContextBinding != null) {
|
||||
// builder.withSslContext(sslContextBinding.getProvider().get());
|
||||
builder.withSslContext(sslContextBinding.getProvider().get());
|
||||
}
|
||||
|
||||
HttpClient client = HttpClientInit.createClient(
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
import com.google.common.collect.Maps;
|
||||
import com.sun.jersey.spi.container.ResourceFilters;
|
||||
import org.apache.druid.client.DruidServerConfig;
|
||||
import org.apache.druid.common.guava.GuavaUtils;
|
||||
import org.apache.druid.guice.ExtensionsLoader;
|
||||
import org.apache.druid.initialization.DruidModule;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
|
@ -137,14 +138,14 @@ public class StatusResource
|
|||
|
||||
public Status(Collection<DruidModule> modules)
|
||||
{
|
||||
this.version = "30.0.0-asd1";//getDruidVersion();
|
||||
this.version = getDruidVersion();
|
||||
this.modules = getExtensionVersions(modules);
|
||||
this.memory = new Memory(JvmUtils.getRuntimeInfo());
|
||||
}
|
||||
|
||||
private String getDruidVersion()
|
||||
{
|
||||
return Status.class.getPackage().getImplementationVersion();
|
||||
return GuavaUtils.firstNonNull(Status.class.getPackage().getImplementationVersion(), "unknown");
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* 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.util;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Provides;
|
||||
import org.apache.druid.client.cache.Cache;
|
||||
import org.apache.druid.client.cache.CacheConfig;
|
||||
import org.apache.druid.client.cache.MapCache;
|
||||
import org.apache.druid.server.EtagProvider;
|
||||
|
||||
public class CacheTestHelperModule2 extends AbstractModule
|
||||
{
|
||||
|
||||
public enum ResultCacheMode
|
||||
{
|
||||
DISABLED,
|
||||
ENABLED;
|
||||
|
||||
public Module makeModule()
|
||||
{
|
||||
return new CacheTestHelperModule2(this);
|
||||
}
|
||||
|
||||
public boolean isPopulateResultLevelCache()
|
||||
{
|
||||
return this != DISABLED;
|
||||
}
|
||||
|
||||
public boolean isUseResultLevelCache()
|
||||
{
|
||||
return this != DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
protected final Cache cache;
|
||||
private CacheConfig cacheConfig;
|
||||
private EtagProvider etagProvider;
|
||||
|
||||
static class TestCacheConfig extends CacheConfig
|
||||
{
|
||||
private ResultCacheMode resultLevelCache;
|
||||
|
||||
public TestCacheConfig(ResultCacheMode resultCacheMode)
|
||||
{
|
||||
this.resultLevelCache = resultCacheMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPopulateResultLevelCache()
|
||||
{
|
||||
return resultLevelCache.isPopulateResultLevelCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseResultLevelCache()
|
||||
{
|
||||
return resultLevelCache.isUseResultLevelCache();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CacheTestHelperModule2(ResultCacheMode resultCacheMode)
|
||||
{
|
||||
cacheConfig = new TestCacheConfig(resultCacheMode);
|
||||
|
||||
switch (resultCacheMode) {
|
||||
case ENABLED:
|
||||
etagProvider = new EtagProvider.ProvideEtagBasedOnDatasource();
|
||||
cache = MapCache.create(1_000_000L);
|
||||
break;
|
||||
case DISABLED:
|
||||
etagProvider = new EtagProvider.EmptyEtagProvider();
|
||||
cache = null;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
EtagProvider etagProvider()
|
||||
{
|
||||
return etagProvider;
|
||||
}
|
||||
|
||||
@Provides
|
||||
CacheConfig getCacheConfig()
|
||||
{
|
||||
return cacheConfig;
|
||||
}
|
||||
|
||||
@Provides
|
||||
Cache getCache()
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure()
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue