TestUtils path resolution via URI
*/
package org.apache.jackrabbit.oak.plugins.index.solr;
-import java.io.File;
-import java.io.IOException;
-
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
+import java.io.File;
+import java.io.IOException;
import org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfiguration;
import org.apache.jackrabbit.oak.plugins.index.solr.configuration.EmbeddedSolrServerConfiguration;
@@ -29,7 +28,6 @@ import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigu
import org.apache.jackrabbit.oak.plugins.index.solr.server.EmbeddedSolrServerProvider;
import org.apache.jackrabbit.oak.plugins.index.solr.server.SolrServerProvider;
import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.SolrServer;
import static org.junit.Assert.assertTrue;
@@ -42,10 +40,12 @@ public class TestUtils
static final String SOLR_HOME_PATH = "/solr";
public static SolrClient createSolrServer() {
+ try {
+ File file = new File(TestUtils.class.getResource(SOLR_HOME_PATH).toURI());
EmbeddedSolrServerConfiguration configuration = new EmbeddedSolrServerConfiguration(
- TestUtils.class.getResource(SOLR_HOME_PATH).getFile(), "oak");
+ file.getAbsolutePath(), "oak");
EmbeddedSolrServerProvider provider = new EmbeddedSolrServerProvider(configuration);
- try {
+
return provider.getSolrServer();
} catch (Exception e) {
throw new RuntimeException(e);
