You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/02/25 14:50:04 UTC

svn commit: r1571691 - in /lucene/dev/trunk/solr: ./ contrib/map-reduce/src/test/org/apache/solr/hadoop/ core/src/test/org/apache/solr/cloud/ core/src/test/org/apache/solr/handler/ core/src/test/org/apache/solr/request/ test-framework/src/java/org/apac...

Author: rmuir
Date: Tue Feb 25 13:50:03 2014
New Revision: 1571691

URL: http://svn.apache.org/r1571691
Log:
SOLR-5771: Add SuppressSSL instead of static boolean in SolrTestCaseJ4

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1571691&r1=1571690&r2=1571691&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Tue Feb 25 13:50:03 2014
@@ -116,6 +116,9 @@ Other Changes
 * SOLR-5613: Upgrade to commons-codec 1.9 for better BeiderMorseFilter performance.
   (Thomas Champagne, Shawn Heisey via shalin)
 
+* SOLR-5771: Add SolrTestCaseJ4.SuppressSSL annotation to disable SSL (instead of static boolean).
+  (Robert Muir)
+
 ==================  4.7.0 ==================
 
 Versions of Major Components

Modified: lucene/dev/trunk/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.java?rev=1571691&r1=1571690&r2=1571691&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.java (original)
+++ lucene/dev/trunk/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.java Tue Feb 25 13:50:03 2014
@@ -45,6 +45,7 @@ import org.apache.hadoop.yarn.conf.YarnC
 import org.apache.lucene.util.Constants;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrQuery.ORDER;
 import org.apache.solr.client.solrj.SolrServer;
@@ -88,13 +89,10 @@ import com.carrotsearch.randomizedtestin
 @ThreadLeakZombies(Consequence.CONTINUE)
 @ThreadLeakScope(Scope.NONE)
 @SuppressCodecs({"Lucene3x", "Lucene40"})
+@SuppressSSL
 @Slow
 public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
   
-  static {
-    ALLOW_SSL = false;
-  }
-  
   private static final int RECORD_COUNT = 2104;
   private static final String RESOURCES_DIR = getFile("morphlines-core.marker").getParent();  
   private static final String DOCUMENTS_DIR = RESOURCES_DIR + "/test-documents";

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java?rev=1571691&r1=1571690&r2=1571691&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java Tue Feb 25 13:50:03 2014
@@ -26,6 +26,7 @@ import java.util.regex.Pattern;
 
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.BasicResponseHandler;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
@@ -49,16 +50,13 @@ import org.apache.solr.util.AbstractSolr
  * This test simply does a bunch of basic things in solrcloud mode and asserts things
  * work as expected.
  */
+// disable SSL until this test is hardened more to deal with the 
+// consequences of how slow it can make some things
+@SuppressSSL
 public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
   private static final String SHARD2 = "shard2";
   private static final String SHARD1 = "shard1";
   private static final String ONE_NODE_COLLECTION = "onenodecollection";
-
-  static {
-    // disable SSL until this test is hardened more to deal with the 
-    // consequences of how slow it can make some things
-    ALLOW_SSL = false;
-  }
   
   public BasicDistributedZk2Test() {
     super();

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java?rev=1571691&r1=1571690&r2=1571691&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java Tue Feb 25 13:50:03 2014
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
@@ -47,13 +48,9 @@ import org.junit.BeforeClass;
  * Super basic testing, no shard restarting or anything.
  */
 @Slow
+@SuppressSSL     // No SSL for now - it can be too slow
 public class FullSolrCloudDistribCmdsTest extends AbstractFullDistribZkTestBase {
   
-  static {
-    // No SSL for now - it can be too slow
-    ALLOW_SSL = false;
-  }
-  
   @BeforeClass
   public static void beforeSuperClass() {
     schemaString = "schema15.xml";      // we need a string id

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java?rev=1571691&r1=1571690&r2=1571691&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java Tue Feb 25 13:50:03 2014
@@ -34,6 +34,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrServer;
@@ -45,13 +46,9 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
 @LuceneTestCase.Slow
+@SuppressSSL     // SSL does not work with this feature for some reason
 public class OverseerRolesTest  extends AbstractFullDistribZkTestBase{
   private CloudSolrServer client;
-
-  static {
-    // SSL does not work with this feature for some reason
-    ALLOW_SSL = false;
-  }
   
   @BeforeClass
   public static void beforeThisClass2() throws Exception {

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1571691&r1=1571690&r2=1571691&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Tue Feb 25 13:50:03 2014
@@ -47,6 +47,7 @@ import org.apache.lucene.store.SimpleFSD
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.BaseDistributedSearchTestCase;
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
@@ -83,6 +84,7 @@ import org.junit.Test;
  * @since 1.4
  */
 @Slow
+@SuppressSSL     // does not work yet with SSL
 public class TestReplicationHandler extends SolrTestCaseJ4 {
 
 
@@ -99,11 +101,6 @@ public class TestReplicationHandler exte
   // number of docs to index... decremented for each test case to tell if we accidentally reuse
   // index from previous test method
   static int nDocs = 500;
-
-  static {
-    // does not yet work with ssl
-    ALLOW_SSL = false;
-  }
   
   @BeforeClass
   public static void beforeClass() {

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java?rev=1571691&r1=1571690&r2=1571691&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java Tue Feb 25 13:50:03 2014
@@ -19,6 +19,7 @@ package org.apache.solr.request;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.solr.SolrJettyTestBase;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
@@ -45,14 +46,10 @@ import java.net.URLEncoder;
 /**
  * See SOLR-2854.
  */
+@SuppressSSL     // does not yet work with ssl - uses raw URL
 public class TestRemoteStreaming extends SolrJettyTestBase {
 
   private static final File solrHomeDirectory = new File(TEMP_DIR, "TestRemoteStreaming");
-
-  static {
-    // does not yet work with ssl - uses raw URL
-    ALLOW_SSL = false;
-  }
   
   @BeforeClass
   public static void beforeTest() throws Exception {

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1571691&r1=1571690&r2=1571691&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Tue Feb 25 13:50:03 2014
@@ -24,6 +24,12 @@ import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -116,9 +122,17 @@ public abstract class SolrTestCaseJ4 ext
   private static String coreName = ConfigSolrXmlOld.DEFAULT_DEFAULT_CORE_NAME;
   public static int DEFAULT_CONNECTION_TIMEOUT = 60000;  // default socket connection timeout in ms
 
+  /**
+   * Annotation for test classes that want to disable SSL
+   */
+  @Documented
+  @Inherited
+  @Retention(RetentionPolicy.RUNTIME)
+  @Target(ElementType.TYPE)
+  public @interface SuppressSSL {}
+  
   // these are meant to be accessed sequentially, but are volatile just to ensure any test
   // thread will read the latest value
-  protected static volatile boolean ALLOW_SSL = true;
   protected static volatile SSLTestConfig sslConfig;
 
   @ClassRule
@@ -173,9 +187,6 @@ public abstract class SolrTestCaseJ4 ext
     // clean up static
     sslConfig = null;
     
-    // reset SSL
-    ALLOW_SSL = true;
-    
     IpTables.unblockAllPorts();
   }
   
@@ -211,7 +222,7 @@ public abstract class SolrTestCaseJ4 ext
 
   private static SSLTestConfig buildSSLConfig() {
     // test has been disabled
-    if (!ALLOW_SSL) {
+    if (RandomizedContext.current().getTargetClass().isAnnotationPresent(SuppressSSL.class)) {
       return new SSLTestConfig();
     }