Jackie-Jiang commented on a change in pull request #7010:
URL: https://github.com/apache/incubator-pinot/pull/7010#discussion_r645188315
##########
File path:
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
##########
@@ -23,30 +23,49 @@
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.annotation.Nullable;
+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;
+ private final Map<String, String> _headers;
+ private final String _scheme;
+
+ private final AsyncHttpClient _httpClient;
public JsonAsyncHttpPinotClientTransport() {
+ _headers = new HashMap<>();
+ _scheme = CommonConstants.HTTP_PROTOCOL;
+ _httpClient = new AsyncHttpClient();
}
- public JsonAsyncHttpPinotClientTransport(Map<String, String> headers) {
+ public JsonAsyncHttpPinotClientTransport(@Nullable SSLContext sslContext,
Map<String, String> headers,
Review comment:
(nit) Shall we put the nullable `sslContext` as the last parameter?
##########
File path:
pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
##########
@@ -158,8 +159,17 @@ protected void startController(Map<String, Object>
properties) {
ControllerConf config = new ControllerConf(properties);
- _controllerPort = Integer.valueOf(config.getControllerPort());
- _controllerBaseApiUrl = "http://localhost:" + _controllerPort;
+ String controllerScheme = "http";
+ if (StringUtils.isNotBlank(config.getControllerVipProtocol())) {
+ controllerScheme = config.getControllerVipProtocol();
+ }
+
+ _controllerPort = DEFAULT_CONTROLLER_PORT;
+ if (StringUtils.isNotBlank(config.getControllerPort())) {
Review comment:
^^
##########
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:
If the `BasicAuthRealtimeIntegrationTest` is fully covered by this test,
let's at least exclude it from the CI run (check `pom.xml` for
`pinot-integration-tests`) to reduce the run time. We can keep both of them for
debugging purpose
##########
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 see. Then probably add some comments describing why this needs to be
hard-coded to prevent people changing it and running into problems
##########
File path:
pinot-core/src/main/java/org/apache/pinot/server/realtime/ServerSegmentCompletionProtocolHandler.java
##########
@@ -64,6 +65,7 @@ public static void init(PinotConfiguration uploaderConfig) {
_sslContext = new
ClientSSLContextGenerator(httpsConfig.subset(CommonConstants.PREFIX_OF_SSL_SUBSET)).generate();
_controllerHttpsPort =
httpsConfig.getProperty(CONFIG_OF_CONTROLLER_HTTPS_PORT, Integer.class);
}
+ _protocol = uploaderConfig.getProperty(CONFIG_OF_PROTOCOL, HTTP_PROTOCOL);
Review comment:
I don't quite follow the logic here. Is it possible that we don't enable
`CONFIG_OF_CONTROLLER_HTTPS_ENABLED` but config the protocol to be `HTTPS`?
In line 198, when `_controllerHttpsPort` is set, it automatically use `HTTPS`
--
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]