camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [25/27] git commit: CAMEL-6827 Fixed bunch of CS errors
Date Tue, 15 Jul 2014 11:40:19 GMT
CAMEL-6827 Fixed bunch of CS errors


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7569500c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7569500c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7569500c

Branch: refs/heads/master
Commit: 7569500c6acd3ec931c3839287597ec65619889b
Parents: 21455fc
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Tue Jul 15 17:01:07 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Tue Jul 15 17:01:07 2014 +0800

----------------------------------------------------------------------
 .../camel/component/solr/SolrComponent.java     |  10 +-
 .../camel/component/solr/SolrEndpoint.java      | 133 ++++----
 .../camel/component/solr/SolrProducer.java      |  26 +-
 .../camel/component/solr/JettySolrFactory.java  | 194 ++++++------
 .../camel/component/solr/SolrAddBeanTest.java   |   6 +-
 .../camel/component/solr/SolrCloudFixture.java  | 313 +++++++++----------
 .../solr/SolrComponentTestSupport.java          |  32 +-
 .../camel/component/solr/SolrDeleteTest.java    |  10 +-
 .../camel/component/solr/SolrFixtures.java      | 192 ++++++------
 .../camel/component/solr/SolrTestSupport.java   |   4 +-
 .../component/solr/SolrTransactionsTest.java    |   7 +-
 .../camel/component/solr/SolrUpdateTest.java    |  18 +-
 .../src/test/resources/log4j.properties         |   8 +-
 13 files changed, 486 insertions(+), 467 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java
index 399296d..232ffb0 100644
--- a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java
+++ b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java
@@ -61,11 +61,11 @@ public class SolrComponent extends DefaultComponent {
         }
         
         public CloudSolrServer getCloudSolrServer() {
-        	return cloudSolrServer;
+            return cloudSolrServer;
         }
-        
+
         public void setCloudSolrServer(CloudSolrServer cloudServer) {
-        	cloudSolrServer = cloudServer;
+            cloudSolrServer = cloudServer;
         }
 
         public int addReference() {
@@ -105,10 +105,10 @@ public class SolrComponent extends DefaultComponent {
     }
     
     private void shutdownServer(SolrServer server) {
-    	if (server != null) {
+        if (server != null) {
             LOG.info("Shutting down solr server: {}", server);
             server.shutdown();
-        }    	
+        }
     }
 
     void shutdownServers(SolrServerReference ref, boolean remove) {

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
index 5383aba..0605885 100644
--- a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
+++ b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
@@ -46,13 +46,13 @@ public class SolrEndpoint extends DefaultEndpoint {
     private Boolean followRedirects;
     private Boolean allowCompression;
     private String scheme = "http://";
-	private String zkHost = null;
-	private String collection = null;
+    private String zkHost;
+    private String collection;
 
     public SolrEndpoint(String endpointUri, SolrComponent component, String address) throws Exception {
         super(endpointUri, component);
         if (endpointUri.startsWith("solrs")) {
-        	scheme = "https://";
+            scheme = "https://";
         }
         URL url = new URL(scheme + address);
         this.url = url.toString();
@@ -60,36 +60,35 @@ public class SolrEndpoint extends DefaultEndpoint {
     
     
     private SolrServer createSolrServer() {
-		SolrServer server = null;
-		String zkHost = this.getZkHost();
-		if (zkHost == null) {
-			server = new HttpSolrServer(this.url);
-		} else {
-			CloudSolrServer cServer = new CloudSolrServer(zkHost);
-			cServer.setDefaultCollection(this.getCollection());
-			server = cServer;
-		}
-		return server;
-	}
+        SolrServer server = null;
+        String zkHost = this.getZkHost();
+        if (zkHost == null) {
+            server = new HttpSolrServer(this.url);
+        } else {
+            CloudSolrServer cServer = new CloudSolrServer(zkHost);
+            cServer.setDefaultCollection(this.getCollection());
+            server = cServer;
+        }
+        return server;
+    }
 
     
-	public void setZkHost(String zkHost) throws UnsupportedEncodingException {
-		String decoded = URLDecoder.decode(zkHost, "UTF-8");
-		this.zkHost = decoded;
-	}
-
-	public String getZkHost() {
-		return this.zkHost;
-	}
-	
-	
-	public void setCollection(String collection) {
-		this.collection = collection;
-	}
-	
-	public String getCollection() {
-		return this.collection;
-	}
+    public void setZkHost(String zkHost) throws UnsupportedEncodingException {
+        String decoded = URLDecoder.decode(zkHost, "UTF-8");
+        this.zkHost = decoded;
+    }
+
+    public String getZkHost() {
+        return this.zkHost;
+    }
+
+    public void setCollection(String collection) {
+        this.collection = collection;
+    }
+
+    public String getCollection() {
+        return this.collection;
+    }
 
     @Override
     public SolrComponent getComponent() {
@@ -97,12 +96,12 @@ public class SolrEndpoint extends DefaultEndpoint {
     }
     
     private CloudSolrServer getCloudServer() {
-    	CloudSolrServer rVal = null;
-    	if (this.getZkHost() != null && this.getCollection() != null) {
-			rVal = new CloudSolrServer(zkHost);
-			rVal.setDefaultCollection(this.getCollection());
-    	}
-    	return rVal;
+        CloudSolrServer rVal = null;
+        if (this.getZkHost() != null && this.getCollection() != null) {
+            rVal = new CloudSolrServer(zkHost);
+            rVal.setDefaultCollection(this.getCollection());
+        }
+        return rVal;
     }
     
     @Override
@@ -112,36 +111,36 @@ public class SolrEndpoint extends DefaultEndpoint {
         if (ref == null) {
             // no then create new servers
             ref = new SolrComponent.SolrServerReference();
-        	CloudSolrServer cloudServer = getCloudServer();
-        	if (cloudServer == null) {
-	            HttpSolrServer solrServer = new HttpSolrServer(url);
-	            ConcurrentUpdateSolrServer solrStreamingServer = new ConcurrentUpdateSolrServer(url, streamingQueueSize, streamingThreadCount);
-	
-	            // set the properties on the solr server
-	            if (maxRetries != null) {
-	                solrServer.setMaxRetries(maxRetries);
-	            }
-	            if (soTimeout != null) {
-	                solrServer.setSoTimeout(soTimeout);
-	            }
-	            if (connectionTimeout != null) {
-	                solrServer.setConnectionTimeout(connectionTimeout);
-	            }
-	            if (defaultMaxConnectionsPerHost != null) {
-	                solrServer.setDefaultMaxConnectionsPerHost(defaultMaxConnectionsPerHost);
-	            }
-	            if (maxTotalConnections != null) {
-	                solrServer.setMaxTotalConnections(maxTotalConnections);
-	            }
-	            if (followRedirects != null) {
-	                solrServer.setFollowRedirects(followRedirects);
-	            }
-	            if (allowCompression != null) {
-	                solrServer.setAllowCompression(allowCompression);
-	            }
-	            ref.setSolrServer(solrServer);
-	            ref.setUpdateSolrServer(solrStreamingServer);
-        	}
+            CloudSolrServer cloudServer = getCloudServer();
+            if (cloudServer == null) {
+                HttpSolrServer solrServer = new HttpSolrServer(url);
+                ConcurrentUpdateSolrServer solrStreamingServer = new ConcurrentUpdateSolrServer(url, streamingQueueSize, streamingThreadCount);
+
+                // set the properties on the solr server
+                if (maxRetries != null) {
+                    solrServer.setMaxRetries(maxRetries);
+                }
+                if (soTimeout != null) {
+                    solrServer.setSoTimeout(soTimeout);
+                }
+                if (connectionTimeout != null) {
+                    solrServer.setConnectionTimeout(connectionTimeout);
+                }
+                if (defaultMaxConnectionsPerHost != null) {
+                    solrServer.setDefaultMaxConnectionsPerHost(defaultMaxConnectionsPerHost);
+                }
+                if (maxTotalConnections != null) {
+                    solrServer.setMaxTotalConnections(maxTotalConnections);
+                }
+                if (followRedirects != null) {
+                    solrServer.setFollowRedirects(followRedirects);
+                }
+                if (allowCompression != null) {
+                    solrServer.setAllowCompression(allowCompression);
+                }
+                ref.setSolrServer(solrServer);
+                ref.setUpdateSolrServer(solrStreamingServer);
+            }
             ref.setCloudSolrServer(cloudServer);
 
             getComponent().addSolrServers(this, ref);

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
index ae47e19..330a639 100644
--- a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
+++ b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
@@ -50,13 +50,13 @@ public class SolrProducer extends DefaultProducer {
     }
     
     private SolrServer getBestSolrServer(String operation) {
-    	if (this.cloudSolrServer != null) {
-    		return this.cloudSolrServer;
-    	} else if (operation == SolrConstants.OPERATION_INSERT_STREAMING) {
-    		return this.concSolrServer;
-    	} else {
-    		return this.httpServer;
-    	}
+        if (this.cloudSolrServer != null) {
+            return this.cloudSolrServer;
+        } else if (operation == SolrConstants.OPERATION_INSERT_STREAMING) {
+            return this.concSolrServer;
+        } else {
+            return this.httpServer;
+        }
     }
 
     @Override
@@ -75,17 +75,17 @@ public class SolrProducer extends DefaultProducer {
         } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_INSERT_STREAMING)) {
             insert(exchange, serverToUse);
         } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_DELETE_BY_ID)) {
-        	serverToUse.deleteById(exchange.getIn().getBody(String.class));
+            serverToUse.deleteById(exchange.getIn().getBody(String.class));
         } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_DELETE_BY_QUERY)) {
-        	serverToUse.deleteByQuery(exchange.getIn().getBody(String.class));
+            serverToUse.deleteByQuery(exchange.getIn().getBody(String.class));
         } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ADD_BEAN)) {
-        	serverToUse.addBean(exchange.getIn().getBody());
+            serverToUse.addBean(exchange.getIn().getBody());
         } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_COMMIT)) {
-        	serverToUse.commit();
+            serverToUse.commit();
         } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ROLLBACK)) {
-        	serverToUse.rollback();
+            serverToUse.rollback();
         } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_OPTIMIZE)) {
-        	serverToUse.optimize();
+            serverToUse.optimize();
         } else {
             throw new IllegalArgumentException(SolrConstants.OPERATION + " header value '" + operation + "' is not supported");
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/JettySolrFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/JettySolrFactory.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/JettySolrFactory.java
index b8aac40..466ebbf 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/JettySolrFactory.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/JettySolrFactory.java
@@ -1,3 +1,19 @@
+/**
+ * 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;
@@ -7,16 +23,13 @@ import java.security.NoSuchAlgorithmException;
 import java.security.cert.X509Certificate;
 import java.util.SortedMap;
 
-import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
 
 import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.conn.ssl.SSLContextBuilder;
 import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
-import org.apache.lucene.util.Constants;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.embedded.SSLConfig;
 import org.apache.solr.client.solrj.impl.HttpClientConfigurer;
@@ -24,98 +37,101 @@ import org.eclipse.jetty.servlet.ServletHolder;
 
 // Create embedded's Solrs for testing,
 // based on SolrJettyTestBase
-public class JettySolrFactory {
-
-	public static File TEST_KEYSTORE = new File("./target/test-classes/solrtest.keystore");
-	private static boolean mockedSslClient = false;
-	private static int data_dir_no = 0;
-
-	private static String TEST_KEYSTORE_PATH = TEST_KEYSTORE.getAbsolutePath();
-	private static String TEST_KEYSTORE_PASSWORD = "secret";
-	private static HttpClientConfigurer DEFAULT_CONFIGURER = new HttpClientConfigurer();
-
-	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());
-	    SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
-	            builder.build());
-	    
-//		// 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
-//	    final SSLContext sslContext = SSLContext.getInstance( "SSL" );
-//	    sslContext.init( null, trustAllCerts, new java.security.SecureRandom() );
-//	    // Create an ssl socket factory with our all-trusting manager
-//	    final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
-//        HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
-	}
-
-	private static JettySolrRunner createJetty(String solrHome,
-			String configFile, String schemaFile, String context,
-			boolean stopAtShutdown,
-			SortedMap<ServletHolder, String> extraServlets, boolean ssl) throws Exception {
-		if (!mockedSslClient) {
-			installAllTrustingClientSsl();
-			mockedSslClient = true;
-		}
-		// Set appropriate paths for Solr to use.
+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 final HttpClientConfigurer DEFAULT_CONFIGURER = new HttpClientConfigurer();
+    private static boolean mockedSslClient;
+    private static int dataDirNo;
+    
+    private JettySolrFactory() {
+        // Util classs
+    }
+
+    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());
+        SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build());
+
+        // // 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
+        // final SSLContext sslContext = SSLContext.getInstance( "SSL" );
+        // sslContext.init( null, trustAllCerts, new
+        // java.security.SecureRandom() );
+        // // Create an ssl socket factory with our all-trusting manager
+        // final SSLSocketFactory sslSocketFactory =
+        // sslContext.getSocketFactory();
+        // HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
+    }
+
+    private static JettySolrRunner createJetty(String solrHome, String configFile, String schemaFile,
+                                               String context, boolean stopAtShutdown,
+                                               SortedMap<ServletHolder, String> extraServlets, boolean ssl)
+        throws Exception {
+        if (!mockedSslClient) {
+            installAllTrustingClientSsl();
+            mockedSslClient = true;
+        }
+        // Set appropriate paths for Solr to use.
         System.setProperty("solr.solr.home", solrHome);
         System.setProperty("jetty.testMode", "true");
-        System.setProperty("solr.data.dir", "target/test-classes/solr/data" + (data_dir_no++));
+        System.setProperty("solr.data.dir", "target/test-classes/solr/data" + (dataDirNo++));
 
         // Instruct Solr to keep the index in memory, for faster testing.
         System.setProperty("solr.directoryFactory", "solr.RAMDirectoryFactory");
 
+        SSLConfig sslConfig = buildSSLConfig(ssl, false);
+
+        context = context == null ? "/solr" : context;
+        JettySolrRunner jetty = new JettySolrRunner(solrHome, context, 0, configFile, schemaFile,
+                                                    stopAtShutdown, extraServlets, sslConfig);
+
+        jetty.start();
+        int port = jetty.getLocalPort();
+        return jetty;
+    }
+
+    public static JettySolrRunner createJettyTestFixture(boolean useSsl) throws Exception {
+        String solrHome = "src/test/resources/solr";
+        String configFile = null;
+        String schemaFile = null;
+        String context = "/solr";
+        boolean stopAtShutdown = true;
+        SortedMap<ServletHolder, String> extraServlets = null;
+
+        if (!useSsl) {
+            System.setProperty("tests.jettySsl", "false");
+        }
+
+        return createJetty(solrHome, configFile, schemaFile, context, stopAtShutdown, extraServlets, useSsl);
 
-		SSLConfig sslConfig = buildSSLConfig(ssl, false); 
-		
-		context = context == null ? "/solr" : context;
-		JettySolrRunner jetty = new JettySolrRunner(solrHome, context, 0, configFile,
-				schemaFile, stopAtShutdown, extraServlets, sslConfig);
-
-		jetty.start();
-		int port = jetty.getLocalPort();
-		return jetty;
-	}
-	
-	public static JettySolrRunner createJettyTestFixture(boolean useSsl) throws Exception {
-		String solrHome ="src/test/resources/solr";
-		String configFile = null;
-		String schemaFile = null;
-		String context = "/solr";
-		boolean stopAtShutdown = true;
-		SortedMap<ServletHolder, String> extraServlets = null;
-		
-		if (!useSsl) {
-	        System.setProperty("tests.jettySsl", "false");
-		} 
-		
-		return createJetty(solrHome, configFile, schemaFile, context, stopAtShutdown, extraServlets, useSsl);
-		
-	}
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrAddBeanTest.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrAddBeanTest.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrAddBeanTest.java
index 139c8f0..242abe0 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrAddBeanTest.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrAddBeanTest.java
@@ -22,10 +22,10 @@ import org.junit.Test;
 public class SolrAddBeanTest extends SolrComponentTestSupport {
 
     public SolrAddBeanTest(SolrFixtures.TestServerType serverToTest) {
-		super(serverToTest);
-	}
+        super(serverToTest);
+    }
 
-	@Test
+    @Test
     public void testAddBean() throws Exception {
 
         //add bean

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrCloudFixture.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrCloudFixture.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrCloudFixture.java
index 3e15320..64aa4f0 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrCloudFixture.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrCloudFixture.java
@@ -1,182 +1,181 @@
+/**
+ * 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.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.log4j.Logger;
-import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrServer;
 import org.apache.solr.client.solrj.request.QueryRequest;
-import org.apache.solr.cloud.AbstractZkTestCase;
 import org.apache.solr.cloud.MiniSolrCloudCluster;
-import org.apache.solr.cloud.ZkController;
-import org.apache.solr.cloud.ZkTestServer;
 import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.common.cloud.ClusterState;
-import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.cloud.ZkNodeProps;
-import org.apache.solr.common.cloud.ZkStateReader;
+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.params.CollectionParams.CollectionAction;
 import org.apache.solr.common.util.NamedList;
-import org.apache.solr.servlet.SolrDispatchFilter;
-import org.apache.zookeeper.CreateMode;
 
 /**
  * 
  */
 public class SolrCloudFixture {
-
-	MiniSolrCloudCluster miniCluster;
-	File testDir;
-	SolrZkClient zkClient = null;
-
-	CloudSolrServer solrClient = null;
-
-	static Logger log = Logger.getLogger(SolrCloudFixture.class);
-	// /** create indexes in this directory, optimally use a subdir, named after
-	// the test */
-	/**
-	 * Create indexes in this directory, optimally use a subdir, named after the
-	 * test
-	 */
-	public static final File TEMP_DIR;
-	static {
-		String s = System.getProperty("tempDir",
-				System.getProperty("java.io.tmpdir"));
-		if (s == null)
-			throw new RuntimeException(
-					"To run tests, you need to define system property 'tempDir' or 'java.io.tmpdir'.");
-		TEMP_DIR = new File(s);
-		TEMP_DIR.mkdirs();
-		System.out.println("Created: " + TEMP_DIR.getAbsolutePath());
-	}
-
-	public static void putConfig(String confName, SolrZkClient zkClient,
-			File solrhome, final String name) throws Exception {
-		putConfig(confName, zkClient, solrhome, name, name);
-	}
-
-	protected NamedList<Object> createCollection(CloudSolrServer server,
-			String name, int numShards, int replicationFactor, String configName)
-			throws Exception {
-		ModifiableSolrParams modParams = new ModifiableSolrParams();
-		modParams.set(CoreAdminParams.ACTION, CollectionAction.CREATE.name());
-		modParams.set("name", name);
-		modParams.set("numShards", numShards);
-		modParams.set("replicationFactor", replicationFactor);
-		modParams.set("collection.configName", configName);
-		QueryRequest request = new QueryRequest(modParams);
-		request.setPath("/admin/collections");
-		return server.request(request);
-	}
-
-	public static void putConfig(String confName, SolrZkClient zkClient,
-			File solrhome, final String srcName, String destName)
-			throws Exception {
-		File file = new File(solrhome, "collection1" + File.separator + "conf"
-				+ File.separator + srcName);
-		if (!file.exists()) {
-			log.info("zk skipping " + file.getAbsolutePath()
-					+ " because it doesn't exist");
-			return;
-		}
-
-		String destPath = "/configs/" + confName + "/" + destName;
-		log.info("zk put " + file.getAbsolutePath() + " to " + destPath);
-		zkClient.makePath(destPath, file, false, true);
-	}
-
-	// static to share with distrib test
-	public void buildZooKeeper(String zkHost, String zkAddress, File solrhome,
-			String config, String schema) throws Exception {
-		zkClient = new SolrZkClient(zkAddress, 60000);
-
-		Map<String, Object> props = new HashMap<String, Object>();
-		props.put("configName", "conf1");
-		final ZkNodeProps zkProps = new ZkNodeProps(props);
-
-		// zkClient.makePath("/collections/collection1",
-		// ZkStateReader.toJSON(zkProps), CreateMode.PERSISTENT, true);
-		// zkClient.makePath("/collections/collection1/shards",
-		// CreateMode.PERSISTENT, true);
-		// zkClient.makePath("/collections/control_collection",
-		// ZkStateReader.toJSON(zkProps), CreateMode.PERSISTENT, true);
-		// zkClient.makePath("/collections/control_collection/shards",
-		// CreateMode.PERSISTENT, true);
-
-		// for now, always upload the config and schema to the canonical names
-		putConfig("conf1", zkClient, solrhome, config, "solrconfig.xml");
-		putConfig("conf1", zkClient, solrhome, schema, "schema.xml");
-
-		// putConfig("conf1", zkClient, solrhome,
-		// "solrconfig.snippet.randomindexconfig.xml");
-		putConfig("conf1", zkClient, solrhome, "stopwords.txt");
-		putConfig("conf1", zkClient, solrhome, "stopwords_en.txt");
-		putConfig("conf1", zkClient, solrhome, "protwords.txt");
-		putConfig("conf1", zkClient, solrhome, "currency.xml");
-		putConfig("conf1", zkClient, solrhome, "enumsConfig.xml");
-		putConfig("conf1", zkClient, solrhome, "open-exchange-rates.json");
-		putConfig("conf1", zkClient, solrhome, "mapping-ISOLatin1Accent.txt");
-		putConfig("conf1", zkClient, solrhome, "old_synonyms.txt");
-		putConfig("conf1", zkClient, solrhome, "synonyms.txt");
-		putConfig("conf1", zkClient, solrhome, "elevate.xml");
-		zkClient.close();
-	}
-
-	public SolrCloudFixture(String solrHome) throws Exception {
-
-		// String testHome = SolrTestCaseJ4.TEST_HOME();
-		// miniCluster = new MiniSolrCloudCluster(NUM_SERVERS, null, new
-		// File(testHome, "solr-no-core.xml"),
-		// null, null);
-		miniCluster = new MiniSolrCloudCluster(1, "/solr", new File(solrHome,
-				"solr-no-core.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()) {
-				System.out.println("JETTY NOT RUNNING!");
-			} else {
-				// jetty.stop();
-				// jetty.start();
-				System.out.println("JETTY RUNNING");
-				System.out.println("AT:  " + jetty.getBaseUrl());
-				System.out.println("PORTT" + jetty.getLocalPort());
-			}
-		}
-		
-
-		solrClient = new CloudSolrServer(zkAddr, true);
-		solrClient.connect();
-
-		createCollection(solrClient, "collection1", 1, 1, "conf1");
-		Thread.sleep(1000); // takes some time to setup the collection... otherwise you'll get no live solr servers		
-		solrClient.setDefaultCollection("collection1");
-
-		SolrInputDocument doc = new SolrInputDocument();
-		doc.setField("id", "1");
-
-		solrClient.add(doc);
-		solrClient.commit();
-	}
-
-	public void teardown() throws Exception {
-		solrClient.shutdown();
-		miniCluster.shutdown();
-		
-		solrClient = null;
-		miniCluster = null;
-	}
+    
+    /**
+     * Create indexes in this directory, optimally use a subdir, named after the
+     * test
+     */
+    public static final File TEMP_DIR;
+    static {
+        String s = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
+        if (s == null) {
+            throw new RuntimeException("To run tests, you need to define system property 'tempDir' or 'java.io.tmpdir'.");
+        }
+        TEMP_DIR = new File(s);
+        TEMP_DIR.mkdirs();
+        System.out.println("Created: " + TEMP_DIR.getAbsolutePath());
+    }
+    
+    static Logger log = Logger.getLogger(SolrCloudFixture.class);
+    
+
+    MiniSolrCloudCluster miniCluster;
+    File testDir;
+    SolrZkClient zkClient;
+
+    CloudSolrServer solrClient;
+    
+    public SolrCloudFixture(String solrHome) throws Exception {
+
+        // String testHome = SolrTestCaseJ4.TEST_HOME();
+        // miniCluster = new MiniSolrCloudCluster(NUM_SERVERS, null, new
+        // File(testHome, "solr-no-core.xml"),
+        // null, null);
+        miniCluster = new MiniSolrCloudCluster(1, "/solr", new File(solrHome, "solr-no-core.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()) {
+                System.out.println("JETTY NOT RUNNING!");
+            } else {
+                // jetty.stop();
+                // jetty.start();
+                System.out.println("JETTY RUNNING");
+                System.out.println("AT:  " + jetty.getBaseUrl());
+                System.out.println("PORTT" + jetty.getLocalPort());
+            }
+        }
+
+        solrClient = new CloudSolrServer(zkAddr, true);
+        solrClient.connect();
+
+        createCollection(solrClient, "collection1", 1, 1, "conf1");
+        Thread.sleep(1000); // takes some time to setup the collection...
+                            // otherwise you'll get no live solr servers
+        solrClient.setDefaultCollection("collection1");
+
+        SolrInputDocument doc = new SolrInputDocument();
+        doc.setField("id", "1");
+
+        solrClient.add(doc);
+        solrClient.commit();
+    }
+
+    public static void putConfig(String confName, SolrZkClient zkClient, File solrhome, final String name)
+        throws Exception {
+        putConfig(confName, zkClient, solrhome, name, name);
+    }
+
+    protected NamedList<Object> createCollection(CloudSolrServer server, String name, int numShards,
+                                                 int replicationFactor, String configName) throws Exception {
+        ModifiableSolrParams modParams = new ModifiableSolrParams();
+        modParams.set(CoreAdminParams.ACTION, CollectionAction.CREATE.name());
+        modParams.set("name", name);
+        modParams.set("numShards", numShards);
+        modParams.set("replicationFactor", replicationFactor);
+        modParams.set("collection.configName", configName);
+        QueryRequest request = new QueryRequest(modParams);
+        request.setPath("/admin/collections");
+        return server.request(request);
+    }
+
+    public static void putConfig(String confName, SolrZkClient zkClient, File solrhome, final String srcName,
+                                 String destName) throws Exception {
+        File file = new File(solrhome, "collection1" + File.separator + "conf" + File.separator + srcName);
+        if (!file.exists()) {
+            log.info("zk skipping " + file.getAbsolutePath() + " because it doesn't exist");
+            return;
+        }
+
+        String destPath = "/configs/" + confName + "/" + destName;
+        log.info("zk put " + file.getAbsolutePath() + " to " + destPath);
+        zkClient.makePath(destPath, file, false, true);
+    }
+
+    // static to share with distrib test
+    public void buildZooKeeper(String zkHost, String zkAddress, File solrhome, String config, String schema)
+        throws Exception {
+        zkClient = new SolrZkClient(zkAddress, 60000);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("configName", "conf1");
+        final ZkNodeProps zkProps = new ZkNodeProps(props);
+
+        // zkClient.makePath("/collections/collection1",
+        // ZkStateReader.toJSON(zkProps), CreateMode.PERSISTENT, true);
+        // zkClient.makePath("/collections/collection1/shards",
+        // CreateMode.PERSISTENT, true);
+        // zkClient.makePath("/collections/control_collection",
+        // ZkStateReader.toJSON(zkProps), CreateMode.PERSISTENT, true);
+        // zkClient.makePath("/collections/control_collection/shards",
+        // CreateMode.PERSISTENT, true);
+
+        // for now, always upload the config and schema to the canonical names
+        putConfig("conf1", zkClient, solrhome, config, "solrconfig.xml");
+        putConfig("conf1", zkClient, solrhome, schema, "schema.xml");
+
+        // putConfig("conf1", zkClient, solrhome,
+        // "solrconfig.snippet.randomindexconfig.xml");
+        putConfig("conf1", zkClient, solrhome, "stopwords.txt");
+        putConfig("conf1", zkClient, solrhome, "stopwords_en.txt");
+        putConfig("conf1", zkClient, solrhome, "protwords.txt");
+        putConfig("conf1", zkClient, solrhome, "currency.xml");
+        putConfig("conf1", zkClient, solrhome, "enumsConfig.xml");
+        putConfig("conf1", zkClient, solrhome, "open-exchange-rates.json");
+        putConfig("conf1", zkClient, solrhome, "mapping-ISOLatin1Accent.txt");
+        putConfig("conf1", zkClient, solrhome, "old_synonyms.txt");
+        putConfig("conf1", zkClient, solrhome, "synonyms.txt");
+        putConfig("conf1", zkClient, solrhome, "elevate.xml");
+        zkClient.close();
+    }
+
+    public void teardown() throws Exception {
+        solrClient.shutdown();
+        miniCluster.shutdown();
+
+        solrClient = null;
+        miniCluster = null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
index 931069f..b0b4355 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
@@ -20,20 +20,15 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.SortedMap;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -44,22 +39,23 @@ public abstract class SolrComponentTestSupport extends SolrTestSupport {
     protected static final String TEST_ID2 = "test2";
    
     private SolrFixtures solrFixtures;
-   
+
+    public SolrComponentTestSupport(SolrFixtures.TestServerType serverToTest) {
+        this.solrFixtures = new SolrFixtures(serverToTest);
+    }
+    
 
     protected void solrInsertTestEntry() {
         solrInsertTestEntry(TEST_ID);
     }
     
     protected static Collection secureOrNot() {
-    	return Arrays.asList(new Object[][] {{true}, {false}});
-    }
-    
-    public SolrComponentTestSupport(SolrFixtures.TestServerType serverToTest) {
-    	this.solrFixtures = new SolrFixtures(serverToTest);
+        return Arrays.asList(new Object[][] {{true}, {false}});
     }
+
     
     String solrRouteUri() {
-    	return solrFixtures.solrRouteUri();
+        return solrFixtures.solrRouteUri();
     }
 
     protected void solrInsertTestEntry(String id) {
@@ -87,7 +83,7 @@ public abstract class SolrComponentTestSupport extends SolrTestSupport {
  
     @AfterClass
     public static void afterClass() throws Exception {
-    	SolrFixtures.teardownSolrFixtures();
+        SolrFixtures.teardownSolrFixtures();
     }
 
     @Override
@@ -108,14 +104,14 @@ public abstract class SolrComponentTestSupport extends SolrTestSupport {
     
     @Parameters
     public static Collection<Object[]> serverTypes() {
-    	Object[][] serverTypes = {{SolrFixtures.TestServerType.USE_CLOUD},
-    							  {SolrFixtures.TestServerType.USE_HTTPS},
-    							  {SolrFixtures.TestServerType.USE_HTTP}};
-    	return Arrays.asList(serverTypes);
+        Object[][] serverTypes = {{SolrFixtures.TestServerType.USE_CLOUD},
+                                  {SolrFixtures.TestServerType.USE_HTTPS},
+                                  {SolrFixtures.TestServerType.USE_HTTP}};
+        return Arrays.asList(serverTypes);
     }
 
     @Before
     public void clearIndex() throws Exception {
-    	SolrFixtures.clearIndex();	
+        SolrFixtures.clearIndex();
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrDeleteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrDeleteTest.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrDeleteTest.java
index a6526ce..5f29a4f 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrDeleteTest.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrDeleteTest.java
@@ -16,17 +16,17 @@
  */
 package org.apache.camel.component.solr;
 
-import java.util.*;
+import java.util.Arrays;
+
 import org.junit.Test;
 
 public class SolrDeleteTest extends SolrComponentTestSupport {
 
     public SolrDeleteTest(SolrFixtures.TestServerType serverToTest) {
-		super(serverToTest);
-		// TODO Auto-generated constructor stub
-	}
+        super(serverToTest);
+    }
 
-	@Test
+    @Test
     public void testDeleteById() throws Exception {
 
         //insert, commit and verify

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrFixtures.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrFixtures.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrFixtures.java
index 3c805c1..ebc761d 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrFixtures.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrFixtures.java
@@ -1,103 +1,115 @@
+/**
+ * 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.IOException;
 
-import org.apache.camel.test.AvailablePortFinder;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.CloudSolrServer;
 import org.apache.solr.client.solrj.impl.HttpSolrServer;
 
-;
 
 public class SolrFixtures {
-	static Logger log = Logger.getLogger(SolrFixtures.class);
-
-	private static JettySolrRunner solrRunner;
-	private static JettySolrRunner solrHttpsRunner;
-	private static HttpSolrServer solrServer;
-	private static HttpSolrServer solrHttpsServer;
-	private static SolrCloudFixture cloudFixture;
-
-	private static int port;
-	private static int httpsPort;
-
-	public enum TestServerType {
-		USE_HTTP, USE_HTTPS, USE_CLOUD
-	}
-
-	TestServerType serverType;
-
-	SolrFixtures(TestServerType serverType) {
-		this.serverType = serverType;
-	}
-
-	String solrRouteUri() {
-		if (serverType == TestServerType.USE_HTTPS) {
-			return "solrs://localhost:" + httpsPort + "/solr";
-		} else if (serverType == TestServerType.USE_CLOUD) {
-			String zkAddrStr = cloudFixture.miniCluster.getZkServer().getZkAddress();
-			return "solrCloud://localhost:" + httpsPort + "/solr?zkHost="
-					+ zkAddrStr + "&collection=collection1";
-		} else {
-			return "solr://localhost:" + port + "/solr";
-		}
-	}
-
-	SolrServer getServer() {
-		if (serverType == TestServerType.USE_HTTPS) {
-			return this.solrHttpsServer;
-		} else if (serverType == TestServerType.USE_CLOUD) {
-			return this.cloudFixture.solrClient;
-		} else {
-			return this.solrServer;
-		}
-	}
-
-	static void createSolrFixtures() throws Exception {
-		solrHttpsRunner = JettySolrFactory.createJettyTestFixture(true);
-		httpsPort = solrHttpsRunner.getLocalPort();
-		log.info("Started Https Test Server: " + solrHttpsRunner.getBaseUrl());
-		solrHttpsServer = new HttpSolrServer("https://localhost:" + httpsPort
-				+ "/solr");
-		solrHttpsServer.setConnectionTimeout(60000);
-
-		solrRunner = JettySolrFactory.createJettyTestFixture(false);
-		port = solrRunner.getLocalPort();
-
-		solrServer = new HttpSolrServer("http://localhost:" + port + "/solr");
-
-		log.info("Started Test Server: " + solrRunner.getBaseUrl());
-		cloudFixture = new SolrCloudFixture("src/test/resources/solr");
-	}
-
-	public static void teardownSolrFixtures() throws Exception {
-		if (solrRunner != null) {
-			solrRunner.stop();
-		}
-		if (solrHttpsRunner != null) {
-			solrHttpsRunner.stop();
-		}
-		if (cloudFixture != null) {
-			cloudFixture.teardown();
-		}
-	}
-
-	public static void clearIndex() throws SolrServerException, IOException {
-		if (solrServer != null) {
-			// Clear the Solr index.
-			solrServer.deleteByQuery("*:*");
-			solrServer.commit();
-		}
-		if (solrHttpsServer != null) {
-			solrHttpsServer.deleteByQuery("*:*");
-			solrHttpsServer.commit();
-		}
-		if (cloudFixture != null) {
-			cloudFixture.solrClient.deleteByQuery("*:*");
-			cloudFixture.solrClient.commit();
-		}
-	}
+    static Logger log = Logger.getLogger(SolrFixtures.class);
+
+    private static JettySolrRunner solrRunner;
+    private static JettySolrRunner solrHttpsRunner;
+    private static HttpSolrServer solrServer;
+    private static HttpSolrServer solrHttpsServer;
+    private static SolrCloudFixture cloudFixture;
+
+    private static int port;
+    private static int httpsPort;
+
+    public enum TestServerType {
+        USE_HTTP, USE_HTTPS, USE_CLOUD
+    }
+
+    TestServerType serverType;
+
+    SolrFixtures(TestServerType serverType) {
+        this.serverType = serverType;
+    }
+
+    String solrRouteUri() {
+        if (serverType == TestServerType.USE_HTTPS) {
+            return "solrs://localhost:" + httpsPort + "/solr";
+        } else if (serverType == TestServerType.USE_CLOUD) {
+            String zkAddrStr = cloudFixture.miniCluster.getZkServer().getZkAddress();
+            return "solrCloud://localhost:" + httpsPort + "/solr?zkHost=" + zkAddrStr
+                   + "&collection=collection1";
+        } else {
+            return "solr://localhost:" + port + "/solr";
+        }
+    }
+
+    SolrServer getServer() {
+        if (serverType == TestServerType.USE_HTTPS) {
+            return solrHttpsServer;
+        } else if (serverType == TestServerType.USE_CLOUD) {
+            return cloudFixture.solrClient;
+        } else {
+            return solrServer;
+        }
+    }
+
+    static void createSolrFixtures() throws Exception {
+        solrHttpsRunner = JettySolrFactory.createJettyTestFixture(true);
+        httpsPort = solrHttpsRunner.getLocalPort();
+        log.info("Started Https Test Server: " + solrHttpsRunner.getBaseUrl());
+        solrHttpsServer = new HttpSolrServer("https://localhost:" + httpsPort + "/solr");
+        solrHttpsServer.setConnectionTimeout(60000);
+
+        solrRunner = JettySolrFactory.createJettyTestFixture(false);
+        port = solrRunner.getLocalPort();
+
+        solrServer = new HttpSolrServer("http://localhost:" + port + "/solr");
+
+        log.info("Started Test Server: " + solrRunner.getBaseUrl());
+        cloudFixture = new SolrCloudFixture("src/test/resources/solr");
+    }
+
+    public static void teardownSolrFixtures() throws Exception {
+        if (solrRunner != null) {
+            solrRunner.stop();
+        }
+        if (solrHttpsRunner != null) {
+            solrHttpsRunner.stop();
+        }
+        if (cloudFixture != null) {
+            cloudFixture.teardown();
+        }
+    }
+
+    public static void clearIndex() throws SolrServerException, IOException {
+        if (solrServer != null) {
+            // Clear the Solr index.
+            solrServer.deleteByQuery("*:*");
+            solrServer.commit();
+        }
+        if (solrHttpsServer != null) {
+            solrHttpsServer.deleteByQuery("*:*");
+            solrHttpsServer.commit();
+        }
+        if (cloudFixture != null) {
+            cloudFixture.solrClient.deleteByQuery("*:*");
+            cloudFixture.solrClient.commit();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTestSupport.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTestSupport.java
index 58e0800..de48a90 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTestSupport.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTestSupport.java
@@ -23,8 +23,8 @@ import org.junit.BeforeClass;
 
 public abstract class SolrTestSupport extends CamelTestSupport {
 
-	private static int port;
-	private static int httpsPort;
+    private static int port;
+    private static int httpsPort;
 
     @BeforeClass
     public static void initPort() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTransactionsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTransactionsTest.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTransactionsTest.java
index 27a27f1..2abd862 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTransactionsTest.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrTransactionsTest.java
@@ -21,11 +21,10 @@ import org.junit.Test;
 public class SolrTransactionsTest extends SolrComponentTestSupport {
 
     public SolrTransactionsTest(SolrFixtures.TestServerType serverToTest) {
-		super(serverToTest);
-		// TODO Auto-generated constructor stub
-	}
+        super(serverToTest);
+    }
 
-	@Test
+    @Test
     public void testCommit() throws Exception {
 
         //insert and verify

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
index abcb97c..dfb41d8 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
@@ -16,6 +16,10 @@
  */
 package org.apache.camel.component.solr;
 
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.camel.Exchange;
 import org.apache.solr.client.solrj.impl.HttpSolrServer;
 import org.apache.solr.client.solrj.response.QueryResponse;
@@ -27,19 +31,13 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-
 public class SolrUpdateTest extends SolrComponentTestSupport {
+    private SolrEndpoint solrEndpoint;
 
     public SolrUpdateTest(SolrFixtures.TestServerType serverToTest) {
-		super(serverToTest);
-		// TODO Auto-generated constructor stub
-	}
-
-	private SolrEndpoint solrEndpoint;
-
+        super(serverToTest);
+    }
+    
     @Override
     @Before
     public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/7569500c/components/camel-solr/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/resources/log4j.properties b/components/camel-solr/src/test/resources/log4j.properties
index a06fb90..3938045 100644
--- a/components/camel-solr/src/test/resources/log4j.properties
+++ b/components/camel-solr/src/test/resources/log4j.properties
@@ -18,13 +18,13 @@
 #
 # The logging properties used during tests
 #
-log4j.rootLogger=INFO, stdout
+log4j.rootLogger=INFO, file
 log4j.logger.org.springframework=WARN
 
 # uncomment this to turn on debug of camel
-log4j.logger.org.apache.camel=DEBUG
-log4j.logger.org.apache.camel.component.solr=TRACE
-log4j.logger.org.apache.solr=DEBUG
+#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel.component.solr=TRACE
+#log4j.logger.org.apache.solr=DEBUG
 
 # CONSOLE appender not used by default
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender


Mime
View raw message