Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F02341120E for ; Mon, 11 Aug 2014 10:37:00 +0000 (UTC) Received: (qmail 5614 invoked by uid 500); 11 Aug 2014 10:37:00 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 5586 invoked by uid 500); 11 Aug 2014 10:37:00 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 5577 invoked by uid 99); 11 Aug 2014 10:37:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Aug 2014 10:37:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Aug 2014 10:36:36 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D83BD23889E1; Mon, 11 Aug 2014 10:36:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1617240 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/lang/DBOAccessTest.java junit/BaseTestCase.java unitTests/junit/MissingPermissionsTest2.policy Date: Mon, 11 Aug 2014 10:36:34 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140811103634.D83BD23889E1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kahatlen Date: Mon Aug 11 10:36:34 2014 New Revision: 1617240 URL: http://svn.apache.org/r1617240 Log: DERBY-6697: Failures when running tests with JaCoCo Add permissions needed by JaCoCo to MissingPermissionTest's custom policy file. Make BaseTestCase.execJavaCmd() propagate the empty jacoco.active property to sub-processes if the tests are running with JaCoCo. Adjust dummy arguments given to procedures in DBOAccessTest so that they fail with an error that is not affected by the broader permissions granted when running with JaCoCo. Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBOAccessTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBOAccessTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBOAccessTest.java?rev=1617240&r1=1617239&r2=1617240&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBOAccessTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBOAccessTest.java Mon Aug 11 10:36:34 2014 @@ -21,7 +21,6 @@ package org.apache.derbyTesting.functionTests.tests.lang; -import java.security.AccessControlException; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.SQLException; @@ -59,6 +58,7 @@ public class DBOAccessTest extends Gener private static final String MISSING_TABLE = "42X05"; private static final String NO_SUCH_TABLE = "XIE0M"; private static final String UNKNOWN_USER = "XK001"; + private static final String SQLJ_INVALID_JAR = "46001"; private static final String SYSCS_SET_DATABASE_PROPERTY = "SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY"; private static final String SYSCS_GET_DATABASE_PROPERTY = "SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY"; @@ -379,7 +379,10 @@ public class DBOAccessTest extends Gener } catch (SQLException se) { - if ( shouldSucceed ) { fail( routineName + " should have succeeded: " + se.getSQLState() + " " + se.getMessage() ); } + if ( shouldSucceed ) + { + fail( routineName + " should have succeeded", se ); + } else { assertSQLState( LACK_EXECUTE_PRIV, se ); @@ -424,6 +427,7 @@ public class DBOAccessTest extends Gener { try { SystemProcedures.SYSCS_BACKUP_DATABASE( null ); + fail(); } catch (SQLException se) { vetError( NULL_BACKUP_DIRECTORY, se ); } } @@ -431,6 +435,7 @@ public class DBOAccessTest extends Gener { try { SystemProcedures.SYSCS_BACKUP_DATABASE_NOWAIT( null ); + fail(); } catch (SQLException se) { vetError( NULL_BACKUP_DIRECTORY, se ); } } @@ -438,6 +443,7 @@ public class DBOAccessTest extends Gener { try { SystemProcedures.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE( null, (short) 0 ); + fail(); } catch (SQLException se) { vetError( NULL_BACKUP_DIRECTORY, se ); } } @@ -445,6 +451,7 @@ public class DBOAccessTest extends Gener { try { SystemProcedures.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT( null, (short) 0 ); + fail(); } catch (SQLException se) { vetError( NULL_BACKUP_DIRECTORY, se ); } } @@ -459,35 +466,50 @@ public class DBOAccessTest extends Gener else if (INSTALL_JAR.equals( routineName ) ) { try { - SystemProcedures.INSTALL_JAR( "foo", "bar", 1 ); + SystemProcedures.INSTALL_JAR( SupportFilesSetup.getReadOnlyFileName("foo"), "bar", 1 ); + fail(); + } + catch (SQLException se) { + vetError(SQLJ_INVALID_JAR, se); } - catch (AccessControlException se) { println( "Caught expected AccessControlException" ); } } else if (REPLACE_JAR.equals( routineName ) ) { try { - SystemProcedures.REPLACE_JAR( "foo", "bar" ); + SystemProcedures.REPLACE_JAR( SupportFilesSetup.getReadOnlyFileName("foo"), "bar" ); + fail(); + } + catch (SQLException se) { + vetError(SQLJ_INVALID_JAR, se); } - catch (AccessControlException se) { println( "Caught expected AccessControlException" ); } } else if (REMOVE_JAR.equals( routineName ) ) { try { SystemProcedures.REMOVE_JAR( "test_dbo.foo", 0 ); + fail(); } catch (SQLException se) { vetError( MISSING_OBJECT, se ); } } else if ( SYSCS_EXPORT_TABLE.equals( routineName ) ) { try { - SystemProcedures.SYSCS_EXPORT_TABLE( "TEST_DBO", "BAR", "WIBBLE", null, null, null ); + SystemProcedures.SYSCS_EXPORT_TABLE( + "TEST_DBO", "BAR", + SupportFilesSetup.getReadWriteFileName("WIBBLE"), + null, null, null); + fail(); } - catch (SQLException se) { vetError( JAVA_EXCEPTION, se ); } + catch (SQLException se) { vetError( MISSING_TABLE, se ); } } else if ( SYSCS_IMPORT_TABLE.equals( routineName ) ) { try { - SystemProcedures.SYSCS_IMPORT_TABLE( "TEST_DBO", "BAR", "WIBBLE", null, null, null, (short) 1 ); + SystemProcedures.SYSCS_IMPORT_TABLE( + "TEST_DBO", "BAR", + SupportFilesSetup.getReadWriteFileName("WIBBLE"), + null, null, null, (short) 1); + fail(); } catch (SQLException se) { vetError( NO_SUCH_TABLE, se ); } } @@ -495,6 +517,7 @@ public class DBOAccessTest extends Gener { try { SystemProcedures.SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE( "TEST_DBO", "BAR", "WIBBLE", null, null, null, (short) 1 ); + fail(); } catch (SQLException se) { vetError( NO_SUCH_TABLE, se ); } } @@ -503,6 +526,7 @@ public class DBOAccessTest extends Gener try { SystemProcedures.SYSCS_IMPORT_DATA ( "TEST_DBO", "BAR", null, "1,3,4", "WIBBLE", null, null, null, (short) 1 ); + fail(); } catch (SQLException se) { vetError( NO_SUCH_TABLE, se ); } } @@ -511,6 +535,7 @@ public class DBOAccessTest extends Gener try { SystemProcedures.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE ( "TEST_DBO", "BAR", null, "1,3,4", "WIBBLE", null, null, null, (short) 1 ); + fail(); } catch (SQLException se) { vetError( NO_SUCH_TABLE, se ); } } @@ -519,6 +544,7 @@ public class DBOAccessTest extends Gener try { SystemProcedures.SYSCS_BULK_INSERT ( "TEST_DBO", "BAR", "WIBBLE", "wombat" ); + fail(); } catch (SQLException se) { vetError( SYNTAX_ERROR, se ); } } @@ -562,6 +588,7 @@ public class DBOAccessTest extends Gener { try { SystemProcedures.SYSCS_CREATE_USER( "foo", "bar" ); + fail(); } catch (SQLException se) { vetError( FIRST_CREDENTIALS, se ); } } @@ -569,6 +596,7 @@ public class DBOAccessTest extends Gener { try { SystemProcedures.SYSCS_RESET_PASSWORD( "foo", "bar" ); + fail(); } catch (SQLException se) { vetError( UNKNOWN_USER, se ); } } @@ -576,6 +604,7 @@ public class DBOAccessTest extends Gener { try { SystemProcedures.SYSCS_DROP_USER( "foo" ); + fail(); } catch (SQLException se) { vetError( UNKNOWN_USER, se ); } } Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1617240&r1=1617239&r2=1617240&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Mon Aug 11 10:36:34 2014 @@ -691,6 +691,7 @@ public abstract class BaseTestCase String agent = getSystemProperty(JACOCO_AGENT_PROP); cmdlist.add(agent + (agent.endsWith("=") ? "": ",") + "destfile=" + getJaCoCoOutFile()); + cmdlist.add("-Djacoco.active="); } if (isSunJVM() && Boolean.valueOf( Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy?rev=1617240&r1=1617239&r2=1617240&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy Mon Aug 11 10:36:34 2014 @@ -158,3 +158,9 @@ grant codeBase "${derbyTesting.antjunit} // This permission is needed when running the tests using ant 1.7 permission java.io.FilePermission "${user.dir}${/}*", "write"; }; + +// Grant the required permissions for JaCoCo (code coverage tool). +grant { + permission java.io.FilePermission "${jacoco.active}${user.dir}${/}*", "read, write"; + permission java.lang.RuntimePermission "${jacoco.active}shutdownHooks"; +};