vdomrachev commented on code in PR #14865:
URL: https://github.com/apache/camel/pull/14865#discussion_r1682422596


##########
components/camel-solr/src/test/java/org/apache/camel/component/solr/JettySolrFactory.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * 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.camel.component.solr;
+
+import java.io.File;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.SortedMap;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.solr.client.solrj.embedded.SSLConfig;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
+import org.apache.solr.embedded.JettyConfig;
+import org.apache.solr.embedded.JettySolrRunner;
+import org.eclipse.jetty.servlet.ServletHolder;
+
+// Create embedded's Solrs for testing,
+// based on SolrJettyTestBase
+public final class JettySolrFactory {
+
+    public static final File TEST_KEYSTORE = new 
File("./target/test-classes/solrtest.keystore");
+    private static final String TEST_KEYSTORE_PATH = 
TEST_KEYSTORE.getAbsolutePath();
+    private static final String TEST_KEYSTORE_PASSWORD = "secret";
+    private static boolean mockedSslClient;
+    private static int dataDirNo;
+
+    private JettySolrFactory() {
+        // Util class
+    }
+
+    private static SSLConfig buildSSLConfig(boolean useSsl, boolean 
sslClientAuth) {
+        SSLConfig sslConfig = new SSLConfig(
+                useSsl, false, TEST_KEYSTORE_PATH, TEST_KEYSTORE_PASSWORD,
+                TEST_KEYSTORE_PATH, TEST_KEYSTORE_PASSWORD);
+        return sslConfig;
+    }
+
+    private static void installAllTrustingClientSsl()
+            throws KeyManagementException,
+            NoSuchAlgorithmException, KeyStoreException {
+        SSLContextBuilder builder = new SSLContextBuilder();
+        builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
+
+        // // Create a trust manager that does not validate certificate chains
+        final TrustManager[] trustAllCerts = new TrustManager[] { new 
X509TrustManager() {
+            @Override
+            public void checkClientTrusted(final X509Certificate[] chain, 
final String authType) {
+            }
+
+            @Override
+            public void checkServerTrusted(final X509Certificate[] chain, 
final String authType) {
+            }
+
+            @Override
+            public X509Certificate[] getAcceptedIssuers() {
+                return null;
+            }
+        } };
+        final SSLContext sslContext = SSLContext.getInstance("TLS");
+        sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
+        SSLContext.setDefault(sslContext);
+
+        // // Install the all-trusting trust manager

Review Comment:
   removed commented code



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to