You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2014/03/27 23:27:16 UTC
svn commit: r1582514 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting:
functionTests/tests/lang/LuceneSuite.java junit/JDBC.java
junit/TestConfiguration.java
Author: rhillegas
Date: Thu Mar 27 22:27:15 2014
New Revision: 1582514
URL: http://svn.apache.org/r1582514
Log:
DERBY-590: Add flag for running tests without the Lucene jar files; commit derby-590-08-aa-omitLuceneFlag.diff.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSuite.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSuite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSuite.java?rev=1582514&r1=1582513&r2=1582514&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSuite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSuite.java Thu Mar 27 22:27:15 2014
@@ -23,9 +23,14 @@ package org.apache.derbyTesting.function
import org.apache.derbyTesting.junit.BaseTestCase;
+import java.util.Properties;
+
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
/**
* Suite holding all of the tests for the Lucene plugin.
*
@@ -41,11 +46,32 @@ public class LuceneSuite extends BaseTes
public static Test suite()
{
TestSuite suite = new TestSuite("LuceneSuite");
+ Properties properties = TestConfiguration.getSystemProperties();
- suite.addTest(LuceneSupportTest.suite());
- suite.addTest(LuceneSupportPermsTest.suite());
- suite.addTest(LuceneCollationTest.suite());
+ //
+ // If we're told to omit the Lucene plugin tests, make sure
+ // that the Lucene jar files aren't on the classpath.
+ //
+ if ( getBooleanProperty( properties, TestConfiguration.KEY_OMIT_LUCENE ) )
+ {
+ assertFalse( "Lucene core jar file should not be on the classpath!", JDBC.HAVE_LUCENE_CORE );
+ assertFalse( "Lucene analyzer jar file should not be on the classpath!", JDBC.HAVE_LUCENE_ANALYZERS );
+ assertFalse( "Lucene query parser jar file should not be on the classpath!", JDBC.HAVE_LUCENE_QUERYPARSER );
+ }
+ else
+ {
+ suite.addTest(LuceneSupportTest.suite());
+ suite.addTest(LuceneSupportPermsTest.suite());
+ suite.addTest(LuceneCollationTest.suite());
+ }
return suite;
}
+
+ /** Return the boolean value of a system property */
+ private static boolean getBooleanProperty( Properties properties, String key )
+ {
+ return Boolean.valueOf( properties.getProperty( key ) ).booleanValue();
+ }
+
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java?rev=1582514&r1=1582513&r2=1582514&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java Thu Mar 27 22:27:15 2014
@@ -113,6 +113,18 @@ public class JDBC {
private static final boolean HAVE_SQLXML
= haveClass("java.sql.SQLXML");
+ /** Is the Lucene core jar file on the classpath */
+ public static final boolean HAVE_LUCENE_CORE =
+ haveClass( "org.apache.lucene.analysis.Analyzer" );
+
+ /** Is the Lucene analyzer jar file on the classpath */
+ public static final boolean HAVE_LUCENE_ANALYZERS =
+ haveClass( "org.apache.lucene.analysis.en.EnglishAnalyzer" );
+
+ /** Is the Lucene queryparser jar file on the classpath */
+ public static final boolean HAVE_LUCENE_QUERYPARSER =
+ haveClass( "org.apache.lucene.queryparser.surround.parser.QueryParser" );
+
/**
* Does java.sql.ResultSet implement java.lang.AutoCloseable?
* Indicates JDBC 4.1.
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=1582514&r1=1582513&r2=1582514&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Thu Mar 27 22:27:15 2014
@@ -1,6 +1,6 @@
/*
*
- * Derby - Class TestConfiguration
+ * Derby - Class org.apache.derbyTesting.junit.TestConfiguration
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -119,6 +119,7 @@ public final class TestConfiguration {
private final static String KEY_VERBOSE = "derby.tests.debug";
private final static String KEY_LOGIN_TIMEOUT = "derby.tests.login.timeout";
private final static String KEY_TRACE = "derby.tests.trace";
+ public final static String KEY_OMIT_LUCENE = "derby.tests.omitLucene";
/**
* derby.tests.stopAfterFirstFail - debugging property to exit after
@@ -1389,7 +1390,7 @@ public final class TestConfiguration {
*
* @return the system properties.
*/
- private static final Properties getSystemProperties() {
+ public static final Properties getSystemProperties() {
// Fetch system properties in a privileged block.
return AccessController.doPrivileged(
new PrivilegedAction<Properties>() {