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


##########
components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrCloudFixture.java:
##########
@@ -0,0 +1,179 @@
+/*
+ * 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.io.FileInputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import org.apache.camel.util.IOHelper;
+import org.apache.solr.client.solrj.impl.CloudHttp2SolrClient;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.cloud.MiniSolrCloudCluster;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.cloud.SolrZkClient;
+import org.apache.solr.common.params.CollectionParams.CollectionAction;
+import org.apache.solr.common.params.CoreAdminParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.embedded.JettySolrRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SolrCloudFixture {
+
+    private static final Logger LOG;
+    private static final Path TEMP_DIR;
+
+    /**
+     * Create a temp dir under the maven target folder
+     */
+    static {
+        LOG = LoggerFactory.getLogger(SolrCloudFixture.class);
+        TEMP_DIR = Paths.get("target", "tmp");
+        try {
+            Files.createDirectories(TEMP_DIR);
+            LOG.info("Created: " + TEMP_DIR);
+        } catch (IOException e) {
+            LOG.error("Unable to create " + TEMP_DIR, e);
+        }
+
+    }
+
+    MiniSolrCloudCluster miniCluster;
+    File testDir;
+    SolrZkClient zkClient;
+
+    CloudSolrClient solrClient;
+
+    public SolrCloudFixture(String solrHome) throws Exception {
+        String xml = IOHelper.loadText(new FileInputStream(new File(solrHome, 
"solr-no-core.xml")));
+        miniCluster = new MiniSolrCloudCluster(1, "/solr", TEMP_DIR, xml, 
null, null);
+        String zkAddr = miniCluster.getZkServer().getZkAddress();
+        String zkHost = miniCluster.getZkServer().getZkHost();
+
+        buildZooKeeper(zkHost, zkAddr, new File(solrHome), "solrconfig.xml", 
"schema.xml");
+        List<JettySolrRunner> jettys = miniCluster.getJettySolrRunners();
+        for (JettySolrRunner jetty : jettys) {
+            if (!jetty.isRunning()) {
+                LOG.warn("JETTY NOT RUNNING!");
+            } else {
+                LOG.info("JETTY RUNNING AT " + jetty.getBaseUrl() + " PORT " + 
jetty.getLocalPort());

Review Comment:
   Use log placeholders, please. `LOG.info("JETTY RUNNING AT {}:{}", 
jetty.getBaseUrl(), jetty.getLocalPort());`



-- 
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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to