Author: kristwaa
Date: Mon Jun 30 06:59:50 2008
New Revision: 672770
URL: http://svn.apache.org/viewvc?rev=672770&view=rev
Log:
DERBY-2031: Convert derbynet/testProtocol.java to JUnit.
Enabled the ProtocolTest JUnit test. It can be run as part of the package private test suite;
ant junit-pptesting
Patch file: derby-2031-3b-enable_test.diff
Added:
db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/_Suite.java (with props)
Modified:
db/derby/code/trunk/java/testing/org/apache/derby/PackagePrivateTestSuite.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
Modified: db/derby/code/trunk/java/testing/org/apache/derby/PackagePrivateTestSuite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derby/PackagePrivateTestSuite.java?rev=672770&r1=672769&r2=672770&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derby/PackagePrivateTestSuite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derby/PackagePrivateTestSuite.java Mon Jun
30 06:59:50 2008
@@ -40,6 +40,7 @@
TestSuite suite = new TestSuite("Package-private tests");
suite.addTest(org.apache.derby.impl.jdbc._Suite.suite());
+ suite.addTest(org.apache.derby.impl.drda._Suite.suite());
suite.addTest(org.apache.derby.client.am._Suite.suite());
return suite;
Added: db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/_Suite.java?rev=672770&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/_Suite.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/_Suite.java Mon Jun 30 06:59:50
2008
@@ -0,0 +1,53 @@
+/*
+
+ Derby - Class org.apache.derby.impl.drda._Suite
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+ */
+package org.apache.derby.impl.drda;
+
+import org.apache.derbyTesting.junit.BaseTestCase;
+import org.apache.derbyTesting.junit.Derby;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class _Suite
+ extends BaseTestCase {
+
+ /**
+ * Use suite method instead.
+ */
+ private _Suite(String name) {
+ super(name);
+ }
+
+ public static Test suite()
+ throws Exception {
+
+ TestSuite suite = new TestSuite("impl.drda package-private");
+
+ // Add tests that explicitly require the network server.
+ if (Derby.hasServer()) {
+ suite.addTest(ProtocolTest.suite());
+ }
+
+ return suite;
+ }
+} // End class _Suite
Propchange: db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/_Suite.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy?rev=672770&r1=672769&r2=672770&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
Mon Jun 30 06:59:50 2008
@@ -355,3 +355,15 @@
permission java.io.FilePermission "${user.dir}${/}coverage.ec", "read, write";
permission java.lang.RuntimePermission "writeFileDescriptor";
};
+
+// Permissions for package-private tests run from 'classes.pptesting'
+grant codeBase "${derbyTesting.ppcodeclasses}" {
+
+ // Needed for ProtocolTest - allows connection to a server
+ permission java.net.SocketPermission "127.0.0.1", "connect,resolve";
+ permission java.net.SocketPermission "localhost", "connect,resolve";
+ permission java.net.SocketPermission "${derbyTesting.serverhost}", "connect,resolve";
+
+ // Allows reading support files in 'extin'
+ permission java.io.FilePermission "${user.dir}${/}extin${/}-", "read";
+};
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?rev=672770&r1=672769&r2=672770&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
Mon Jun 30 06:59:50 2008
@@ -234,6 +234,10 @@
* Classpath:
* <BR>
* derbyTesting.codeclasses set to URL of classes folder
+ * <BR>
+ * derbyTesting.ppcodeclasses set to URL of the 'classes.pptesting' folder
+ * if it exists on the classpath. The existence of the package private tests
+ * is determined via org.apache.derby.PackagePrivateTestSuite
* <P>
* Jar files:
* <BR>
@@ -287,11 +291,18 @@
classPathSet.setProperty("derbyTesting.jaxpjar", jaxp);
URL testing = getURL(SecurityManagerSetup.class);
+ URL ppTesting = getURL("org.apache.derby.PackagePrivateTestSuite");
boolean isClasspath = testing.toExternalForm().endsWith("/");
if (isClasspath) {
classPathSet.setProperty("derbyTesting.codeclasses",
testing.toExternalForm());
+ // ppTesting can be null, for instance if 'classes.pptesting' is
+ // not on the classpath.
+ if (ppTesting != null) {
+ classPathSet.setProperty("derbyTesting.ppcodeclasses",
+ ppTesting.toExternalForm());
+ }
isJars = false;
return false;
}
|