apucher commented on a change in pull request #7010:
URL: https://github.com/apache/incubator-pinot/pull/7010#discussion_r645170179
##########
File path:
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ConnectionFactory.java
##########
@@ -40,20 +37,20 @@ private ConnectionFactory() {
* @return A connection that connects to the brokers in the given Helix
cluster
*/
public static Connection fromZookeeper(String zkUrl) {
- return fromZookeeper(zkUrl, null);
+ return fromZookeeper(zkUrl, new
JsonAsyncHttpPinotClientTransportFactory().buildTransport());
Review comment:
done. lazy default instance
##########
File path:
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
##########
@@ -23,30 +23,47 @@
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.ning.http.client.AsyncHttpClient;
+import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.Response;
+import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import javax.net.ssl.SSLContext;
+import org.apache.pinot.spi.utils.CommonConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* JSON encoded Pinot client transport over AsyncHttpClient.
*/
-class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
+public class JsonAsyncHttpPinotClientTransport implements PinotClientTransport
{
private static final Logger LOGGER =
LoggerFactory.getLogger(JsonAsyncHttpPinotClientTransport.class);
private static final ObjectReader OBJECT_READER = new
ObjectMapper().reader();
- AsyncHttpClient _httpClient = new AsyncHttpClient();
- Map<String, String> _headers;
+ AsyncHttpClient _httpClient;
+
+ Map<String, String> _headers = new HashMap<>();
+ String _scheme = CommonConstants.HTTP_PROTOCOL;
+ SSLContext _sslContext = null;
Review comment:
done. all final
##########
File path:
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
##########
@@ -18,19 +18,46 @@
*/
package org.apache.pinot.client;
+import java.util.HashMap;
import java.util.Map;
+import javax.net.ssl.SSLContext;
+import org.apache.pinot.spi.utils.CommonConstants;
+
/**
* Pinot client transport factory for JSON encoded BrokerResults through HTTP.
*/
-class JsonAsyncHttpPinotClientTransportFactory implements
PinotClientTransportFactory {
+public class JsonAsyncHttpPinotClientTransportFactory implements
PinotClientTransportFactory {
+ Map<String, String> _headers = new HashMap<>();
+ String _scheme = CommonConstants.HTTP_PROTOCOL;
+ SSLContext _sslContext = null;
Review comment:
done
##########
File path:
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
##########
@@ -23,30 +23,47 @@
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.ning.http.client.AsyncHttpClient;
+import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.Response;
+import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import javax.net.ssl.SSLContext;
+import org.apache.pinot.spi.utils.CommonConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* JSON encoded Pinot client transport over AsyncHttpClient.
*/
-class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
+public class JsonAsyncHttpPinotClientTransport implements PinotClientTransport
{
private static final Logger LOGGER =
LoggerFactory.getLogger(JsonAsyncHttpPinotClientTransport.class);
private static final ObjectReader OBJECT_READER = new
ObjectMapper().reader();
- AsyncHttpClient _httpClient = new AsyncHttpClient();
- Map<String, String> _headers;
+ AsyncHttpClient _httpClient;
+
+ Map<String, String> _headers = new HashMap<>();
+ String _scheme = CommonConstants.HTTP_PROTOCOL;
+ SSLContext _sslContext = null;
public JsonAsyncHttpPinotClientTransport() {
+ _httpClient = new AsyncHttpClient();
}
- public JsonAsyncHttpPinotClientTransport(Map<String, String> headers) {
+ public JsonAsyncHttpPinotClientTransport(SSLContext sslContext, Map<String,
String> headers, String scheme) {
Review comment:
added annotation to sslContext
##########
File path:
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
##########
@@ -23,30 +23,47 @@
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.ning.http.client.AsyncHttpClient;
+import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.Response;
+import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import javax.net.ssl.SSLContext;
+import org.apache.pinot.spi.utils.CommonConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* JSON encoded Pinot client transport over AsyncHttpClient.
*/
-class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
+public class JsonAsyncHttpPinotClientTransport implements PinotClientTransport
{
private static final Logger LOGGER =
LoggerFactory.getLogger(JsonAsyncHttpPinotClientTransport.class);
private static final ObjectReader OBJECT_READER = new
ObjectMapper().reader();
- AsyncHttpClient _httpClient = new AsyncHttpClient();
- Map<String, String> _headers;
+ AsyncHttpClient _httpClient;
+
+ Map<String, String> _headers = new HashMap<>();
+ String _scheme = CommonConstants.HTTP_PROTOCOL;
+ SSLContext _sslContext = null;
public JsonAsyncHttpPinotClientTransport() {
+ _httpClient = new AsyncHttpClient();
}
- public JsonAsyncHttpPinotClientTransport(Map<String, String> headers) {
+ public JsonAsyncHttpPinotClientTransport(SSLContext sslContext, Map<String,
String> headers, String scheme) {
_headers = headers;
+ _scheme = scheme;
Review comment:
now requires explicit non-null value
##########
File path:
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/BasicAuthTlsRealtimeIntegrationTest.java
##########
@@ -0,0 +1,260 @@
+/**
+ * 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.pinot.integration.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Preconditions;
+import groovy.lang.IntRange;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.pinot.client.Connection;
+import org.apache.pinot.client.ConnectionFactory;
+import org.apache.pinot.client.JsonAsyncHttpPinotClientTransportFactory;
+import org.apache.pinot.client.Request;
+import org.apache.pinot.client.ResultSetGroup;
+import org.apache.pinot.common.utils.FileUploadDownloadClient;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableTaskConfig;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.env.PinotConfiguration;
+import org.apache.pinot.spi.utils.JsonUtils;
+import org.apache.pinot.spi.utils.builder.TableNameBuilder;
+import org.apache.pinot.util.TestUtils;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import static
org.apache.pinot.integration.tests.BasicAuthTestUtils.AUTH_HEADER;
+
+
+public class BasicAuthTlsRealtimeIntegrationTest extends
BaseClusterIntegrationTest {
Review comment:
imo since this is a cross-integration test we should at least be able to
tell which aspect broke.
Pinot isn't very helpful debugging these issues. If we remove the auth
realtime test, we'll end up trouble shooting two enormous aspects - tls AND
auth - when a breaking change happens.
##########
File path:
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/ClusterTest.java
##########
@@ -131,6 +131,27 @@ protected void startBrokers(int numBrokers, int basePort,
String zkStr)
_brokerBaseApiUrl = "http://localhost:" + _brokerPorts.get(0);
}
+ protected void startBrokerHttps()
+ throws Exception {
+ _brokerStarters = new ArrayList<>();
+ _brokerPorts = new ArrayList<>();
+
+ Map<String, Object> properties = getDefaultBrokerConfiguration().toMap();
+ properties.put(Broker.CONFIG_OF_BROKER_TIMEOUT_MS, 60 * 1000L);
+ properties.put(Broker.CONFIG_OF_DELAY_SHUTDOWN_TIME_MS, 0);
+
+ PinotConfiguration configuration = new PinotConfiguration(properties);
+ overrideBrokerConf(configuration);
+
+ HelixBrokerStarter brokerStarter =
+ new HelixBrokerStarter(configuration, getHelixClusterName(),
getZkUrl(), LOCAL_HOST);
+ brokerStarter.start();
+ _brokerStarters.add(brokerStarter);
+
+ _brokerPorts.add(DEFAULT_BROKER_PORT);
Review comment:
I get your point, however, the broker's TLS listener spec requires
hard-coding port numbers anyways
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]