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 da...@apache.org on 2011/11/28 18:20:59 UTC
svn commit: r1207471 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting:
functionTests/tests/derbynet/RuntimeInfoTest.java
functionTests/tests/derbynet/SecureServerTest.java junit/BaseTestCase.java
junit/NetworkServerTestSetup.java
Author: dag
Date: Mon Nov 28 17:20:58 2011
New Revision: 1207471
URL: http://svn.apache.org/viewvc?rev=1207471&view=rev
Log:
DERBY-5514 SecureServerTest (and others) don't play nice with EMMA: AccessControlException
Patch derby-5514-2:
- fixes the usa of String#contains,
- adds -Demma.verbosity.level=silent to RuntimeInfoTest
- adds the convenience method runsWithEmma to BaseTestCase
- adds fixes to NetworkServerTestSetup to
a) always use Emma verbosity silent when spawning a server in separate VM, and also
b) refrains from starting the server with the security manager when running with Emma since the default server policy doesn't contain permissions for Emma, and finally
- skips the assertion for the security manager being used in
SecureServerTest (it is not, see preceding item)
With patch d5514-emma-permissions-to-all, Emma now runs OK with "ant
emma-all" and suites.All.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.java?rev=1207471&r1=1207470&r2=1207471&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.java Mon Nov 28 17:20:58 2011
@@ -46,9 +46,11 @@ import org.apache.derbyTesting.junit.Tes
public class RuntimeInfoTest extends BaseJDBCTestCase {
private static String[] RuntimeinfoCmd = new String[] {
+ "-Demma.verbosity.level=silent",
"org.apache.derby.drda.NetworkServerControl", "runtimeinfo",
"-p", String.valueOf(TestConfiguration.getCurrent().getPort()) };
private static String[] RuntimeinfoLocaleCmd = new String[] {
+ "-Demma.verbosity.level=silent",
"-Duser.language=err", "-Duser.country=DE",
"org.apache.derby.drda.NetworkServerControl", "runtimeinfo",
"-p", String.valueOf(TestConfiguration.getCurrent().getPort()) };
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java?rev=1207471&r1=1207470&r2=1207471&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java Mon Nov 28 17:20:58 2011
@@ -329,8 +329,14 @@ public class SecureServerTest extends Ba
boolean outputOK = ( serverOutput.indexOf( _outcome.expectedServerOutput() ) >= 0 );
assertEquals( myName + ": serverCameUp = " + serverCameUp, _outcome.serverShouldComeUp(), serverCameUp );
-
- assertTrue( myName + "\nExpected: " + _outcome.expectedServerOutput() + "\nBut saw: " + serverOutput , outputOK );
+
+ if (!runsWithEmma()) {
+ // With Emma we run without the security manager, so we can't
+ // assert on seeing it.
+ assertTrue( myName + "\nExpected: " +
+ _outcome.expectedServerOutput() +
+ "\nBut saw: " + serverOutput , outputOK );
+ }
//
// make sure that the default policy lets us connect to the server if the hostname was
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=1207471&r1=1207470&r2=1207471&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 Nov 28 17:20:58 2011
@@ -646,6 +646,12 @@ public abstract class BaseTestCase
public static final boolean isJava7() {
return getSystemProperty("java.version").startsWith("1.7");
}
+
+ public static final boolean runsWithEmma() {
+ return getSystemProperty("java.class.path").indexOf("emma.jar") != -1;
+ }
+
+
/**
* Returns the major version of the class specification version supported
* by the running JVM.
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=1207471&r1=1207470&r2=1207471&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java Mon Nov 28 17:20:58 2011
@@ -255,12 +255,16 @@ final public class NetworkServerTestSetu
boolean skipHostName = false;
al.add( BaseTestCase.getJavaExecutableName() );
+ al.add( "-Demma.verbosity.level=silent" );
al.add( "-classpath" );
al.add( classpath );
- // Loading from classes need to work-around the limitation
- // of the default policy file doesn't work with classes.
- if (!TestConfiguration.loadingFromJars())
+ // Loading from classes need to work-around the limitation of the
+ // default policy file doesn't work with classes. Similarly, if we are
+ // running with Emma we don't run with the security manager, as the
+ // default server policy doesn't contain needed permissions and,
+ // additionally, Emma sources do not use doPrivileged blocks anyway.
+ if (!TestConfiguration.loadingFromJars() || BaseTestCase.runsWithEmma())
{
boolean setNoSecurityManager = true;
for (int i = 0; i < systemProperties.length; i++)