SOLR-5771: Add SuppressSSL instead of static boolean in SolrTestCaseJ4

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1571691 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-02-25 13:50:03 +00:00
parent df322c1f28
commit 9c450302e5
8 changed files with 33 additions and 35 deletions

View File

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

View File

@ -45,6 +45,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
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.randomizedtesting.annotations.ThreadLeakZombies.Conseque
@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";

View File

@ -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.AbstractSolrTestCase;
* 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();

View File

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

View File

@ -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 {

View File

@ -47,6 +47,7 @@ import org.apache.lucene.store.SimpleFSDirectory;
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 extends SolrTestCaseJ4 {
// 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() {

View File

@ -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 {

View File

@ -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 extends LuceneTestCase {
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 extends LuceneTestCase {
// clean up static
sslConfig = null;
// reset SSL
ALLOW_SSL = true;
IpTables.unblockAllPorts();
}
@ -211,7 +222,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
private static SSLTestConfig buildSSLConfig() {
// test has been disabled
if (!ALLOW_SSL) {
if (RandomizedContext.current().getTargetClass().isAnnotationPresent(SuppressSSL.class)) {
return new SSLTestConfig();
}