Author: myrnavl
Date: Thu Aug 14 08:40:44 2008
New Revision: 685946
URL: http://svn.apache.org/viewvc?rev=685946&view=rev
Log:
DERBY-3717; convert derbynet/getCurrentProperties to junit
Patch contributed by Manjula Kutty
Added:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.java
(with props)
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy
(with props)
Removed:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/getCurrentProperties.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties.policy
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties_app.properties
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties_sed.properties
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude?rev=685946&r1=685945&r2=685946&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
Thu Aug 14 08:40:44 2008
@@ -9,8 +9,6 @@
# the server machine
# derbynet/dblook_test_net_territory because it tries to search derby.log, which is on
# the server machine
-# derbynet/getCurrentProperties for it exercises NetworkServerControl statements
-# that are only supported on localhost
# derbynet/maxthreads - tries to use NetworkServerControl statements
# derbynet/runtimeinfo - tries to use NetworkServerControl statements
# derbynet/sysinfo - tries to use NetworkServerControl statements
@@ -26,7 +24,6 @@
store/bootLock.java
derbynet/dblook_test_net.java
derbynet/dblook_test_net_territory.java
-derbynet/getCurrentProperties.java
derbynet/maxthreads.java
derbynet/runtimeinfo.java
derbynet/sysinfo.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude?rev=685946&r1=685945&r2=685946&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
Thu Aug 14 08:40:44 2008
@@ -7,7 +7,6 @@
# derbynet/dblook_test_net.java - expects different dir structure
# derbynet/dblook_test_net_territory.java - expects different dir structure
# stress/stress.multi - exits suite
-# derbynet/getCurrentProperties.java - fails, different sessions
# derbynet/runtimeinfo.java - different sessions
# derbynet/sysinfo.java - needs other properties
# derbynet/sysinfo_withproperties.java - needs other properties
@@ -21,7 +20,6 @@
derbynet/DerbyNetAutoStart.java
derbynet/dblook_test_net.java
derbynet/dblook_test_net_territory.java
-derbynet/getCurrentProperties.java
derbynet/runtimeinfo.java
derbynet/sysinfo.java
derbynet/sysinfo_withproperties.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude?rev=685946&r1=685945&r2=685946&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
Thu Aug 14 08:40:44 2008
@@ -9,8 +9,6 @@
# the server machine
# derbynet/dblook_test_net_territory because it tries to search derby.log, which is on
# the server machine
-# derbynet/getCurrentProperties for it exercises NetworkServerControl statements
-# that are only supported on localhost
# derbynet/maxthreads - tries to use NetworkServerControl statements
# derbynet/runtimeinfo - tries to use NetworkServerControl statements
# derbynet/sysinfo - tries to use NetworkServerControl statements
@@ -25,7 +23,6 @@
store/bootLock.java
derbynet/dblook_test_net.java
derbynet/dblook_test_net_territory.java
-derbynet/getCurrentProperties.java
derbynet/maxthreads.java
derbynet/runtimeinfo.java
derbynet/sysinfo.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude?rev=685946&r1=685945&r2=685946&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
Thu Aug 14 08:40:44 2008
@@ -4,7 +4,6 @@
# jdbcapi/HoldabilityTest.junit - causes subsequent tests to fail because of missing
# File permissions
# derbynet/DerbyNetAutoStart.java - exits suite...
-# derbynet/getCurrentProperties.java - fails with different sessions
# derbynet/dblook_test_net.java - fails, test misses properties
# derbynet/dblook_test_net_territory.java - fails, test misses properties
# derbynet/runtimeinfo.java - fails with already existing threads (maybe intermittent)
@@ -16,7 +15,6 @@
jdbcapi/maxfieldsize.java
jdbcapi/HoldabilityTest.junit
derbynet/DerbyNetAutoStart.java
-derbynet/getCurrentProperties.java
derbynet/dblook_test_net.java
derbynet/dblook_test_net_territory.java
derbynet/runtimeinfo.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall?rev=685946&r1=685945&r2=685946&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
Thu Aug 14 08:40:44 2008
@@ -1,7 +1,6 @@
derbynet/dblook_test_net.java
derbynet/dblook_test_net_territory.java
derbynet/DerbyNetAutoStart.java
-derbynet/getCurrentProperties.java
derbynet/runtimeinfo.java
derbynet/sysinfo.java
derbynet/sysinfo_withproperties.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall?rev=685946&r1=685945&r2=685946&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
Thu Aug 14 08:40:44 2008
@@ -1,6 +1,5 @@
derbynet/dblook_test_net.java
derbynet/dblook_test_net_territory.java
-derbynet/getCurrentProperties.java
derbynet/runtimeinfo.java
lang/holdCursorIJ.sql
store/holdCursorExternalSortJDBC30.sql
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.java?rev=685946&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.java
Thu Aug 14 08:40:44 2008
@@ -0,0 +1,211 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.derbynet.GetCurrentPropertiesTest
+
+ 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.derbyTesting.functionTests.tests.derbynet;
+
+import java.io.File;
+import java.util.Properties;
+import java.util.Enumeration;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derby.drda.NetworkServerControl;
+import org.apache.derbyTesting.junit.NetworkServerTestSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
+import org.apache.derbyTesting.junit.SecurityManagerSetup;
+import org.apache.derbyTesting.junit.SupportFilesSetup;
+
+/**
+ * This tests getCurrentProperties
+ *
+ */
+public class GetCurrentPropertiesTest extends BaseJDBCTestCase {
+ // create own policy file
+ private static String POLICY_FILE_NAME =
+ "functionTests/tests/derbynet/GetCurrentPropertiesTest.policy";
+ private static String TARGET_POLICY_FILE_NAME = "server.policy";
+
+ public GetCurrentPropertiesTest(String name) {
+ super(name);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("GetCurrentPropertiesTest");
+ Test test = TestConfiguration
+ .clientServerSuite(GetCurrentPropertiesTest.class);
+ // Install a security manager using the special policy file.
+ test = decorateWithPolicy(test);
+ suite.addTest(test);
+ // return suite; to ensure that nothing interferes with setting of
+ // properties, wrap in singleUseDatabaseDecorator
+ return TestConfiguration.singleUseDatabaseDecorator(suite);
+ }
+ /**
+ * Construct the name of the server policy file.
+ */
+ private static String makeServerPolicyName()
+ {
+ try {
+
+ String userDir = getSystemProperty( "user.dir" );
+ String fileName = userDir + File.separator + SupportFilesSetup.EXTINOUT + File.separator
+ TARGET_POLICY_FILE_NAME;
+ File file = new File( fileName );
+ String urlString = file.toURL().toExternalForm();
+
+ return urlString;
+ }
+ catch (Exception e)
+ {
+ fail("Exception in REading Server policy file",e);
+ return null;
+ }
+ }
+ // grant ALL FILES execute, and getPolicy permissions,
+ // as well as write for the trace files.
+ private static Test decorateWithPolicy(Test test) {
+ String serverPolicyName = makeServerPolicyName();
+ //
+ // Install a security manager using the initial policy file.
+ //
+ test = new SecurityManagerSetup(test,serverPolicyName );
+ // Copy over the policy file we want to use.
+ //
+ test = new SupportFilesSetup(
+ test, null, new String[] {POLICY_FILE_NAME},
+ null, new String[] {TARGET_POLICY_FILE_NAME}
+ );
+ return test;
+
+ }
+ /**
+ * Testing the properties before connecting to a database
+ *
+ * @throws Exception
+ */
+ public void testPropertiesBeforeConnection() throws Exception {
+ Properties p = null;
+ String userDir = getSystemProperty( "user.dir" );
+ String traceDir = userDir + File.separator + "system";
+ Properties expectedValues = new Properties();
+ expectedValues.setProperty("derby.drda.traceDirectory",traceDir);
+ expectedValues.setProperty("derby.drda.maxThreads","0");
+ expectedValues.setProperty("derby.drda.sslMode","off");
+ expectedValues.setProperty("derby.drda.keepAlive","true");
+ expectedValues.setProperty("derby.drda.minThreads","0");
+ expectedValues.setProperty("derby.drda.portNumber","1527");
+ expectedValues.setProperty("derby.drda.logConnections","false");
+ expectedValues.setProperty("derby.drda.timeSlice","0");
+ expectedValues.setProperty("derby.drda.startNetworkServer","false");
+ expectedValues.setProperty("derby.drda.host","127.0.0.1");
+ expectedValues.setProperty("derby.drda.traceAll","false");
+ p = NetworkServerTestSetup.getNetworkServerControl().getCurrentProperties();
+
+ Enumeration expectedProps = expectedValues.propertyNames();
+ for ( expectedProps = expectedValues.propertyNames(); expectedProps.hasMoreElements();)
{
+ String propName = (String)expectedProps.nextElement();
+ String propVal = (String)p.get(propName);
+ //for debug
+ println(expectedValues.getProperty(propName));
+ println(propVal);
+ assertEquals(expectedValues.getProperty(propName), propVal);
+
+ }
+ }
+ /**
+ * Testing the properties after connecting to a database
+ *
+ * @throws Exception
+ */
+ public void testPropertiesAfterConnection() throws Exception {
+ Properties p = null;
+ String userDir = getSystemProperty( "user.dir" );
+ String traceDir = userDir + File.separator + "system";
+ Properties expectedValues = new Properties();
+ expectedValues.setProperty("derby.drda.traceDirectory",traceDir);
+ expectedValues.setProperty("derby.drda.maxThreads","0");
+ expectedValues.setProperty("derby.drda.sslMode","off");
+ expectedValues.setProperty("derby.drda.trace.4","true");
+ expectedValues.setProperty("derby.drda.keepAlive","true");
+ expectedValues.setProperty("derby.drda.minThreads","0");
+ expectedValues.setProperty("derby.drda.portNumber","1527");
+ expectedValues.setProperty("derby.drda.logConnections","true");
+ expectedValues.setProperty("derby.drda.timeSlice","0");
+ expectedValues.setProperty("derby.drda.startNetworkServer","false");
+ expectedValues.setProperty("derby.drda.host","127.0.0.1");
+ expectedValues.setProperty("derby.drda.traceAll","false");
+ getConnection().setAutoCommit(false);
+ NetworkServerControl nsctrl = NetworkServerTestSetup.getNetworkServerControl();
+ nsctrl.trace(4,true);
+ nsctrl.logConnections(true);
+ p = NetworkServerTestSetup.getNetworkServerControl().getCurrentProperties();
+ Enumeration expectedProps = expectedValues.propertyNames();
+ for ( expectedProps = expectedValues.propertyNames(); expectedProps.hasMoreElements();)
{
+ String propName = (String) expectedProps.nextElement();
+ String propVal = (String)p.get(propName);
+ //for debug
+ println(expectedValues.getProperty(propName));
+ println(propVal);
+ assertEquals(expectedValues.getProperty(propName), propVal);
+
+ }
+ }
+ /**
+ * Testing the properties after setting the trace dir and tracing on
+ *
+ * @throws Exception
+ */
+ public void testPropertiesTraceOn() throws Exception {
+ Properties p = null;
+
+ NetworkServerControl nsctrl = NetworkServerTestSetup.getNetworkServerControl();
+ nsctrl.trace(true);
+ String derbySystemHome = getSystemProperty("derby.system.home");
+ nsctrl.setTraceDirectory(derbySystemHome);
+ Properties expectedValues = new Properties();
+ expectedValues.setProperty("derby.drda.traceDirectory",derbySystemHome);
+ expectedValues.setProperty("derby.drda.maxThreads","0");
+ expectedValues.setProperty("derby.drda.sslMode","off");
+ expectedValues.setProperty("derby.drda.keepAlive","true");
+ expectedValues.setProperty("derby.drda.minThreads","0");
+ expectedValues.setProperty("derby.drda.portNumber","1527");
+ expectedValues.setProperty("derby.drda.logConnections","true");
+ expectedValues.setProperty("derby.drda.timeSlice","0");
+ expectedValues.setProperty("derby.drda.startNetworkServer","false");
+ expectedValues.setProperty("derby.drda.host","127.0.0.1");
+ expectedValues.setProperty("derby.drda.traceAll","true");
+ p = NetworkServerTestSetup.getNetworkServerControl().getCurrentProperties();
+ Enumeration expectedProps = expectedValues.propertyNames();
+ for ( expectedProps = expectedValues.propertyNames(); expectedProps.hasMoreElements();)
{
+ String propName = (String) expectedProps.nextElement();
+ String propVal = (String)p.get(propName);
+ //for debug
+ println(expectedValues.getProperty(propName));
+ println(propVal);
+ assertEquals(expectedValues.getProperty(propName), propVal);
+
+
+ }
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy?rev=685946&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy
Thu Aug 14 08:40:44 2008
@@ -0,0 +1,266 @@
+//
+// * Derby - Class org.apache.derbyTesting.functionTests.tests.derbynet.GetCurrentPropertiesTest
+// *
+// * 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.
+// *
+
+//
+// Policy file with minimal set of permissions to run derby's
+// functional tests.
+//
+// The test harness sets up four variables used by this policy file
+//
+// derbyTesting.codejar - URL to the jar files when they are in the classpath
+// derbyTesting.codeclasses - URL to the classes directory when it is in the classpath
+//
+// Only one of derbyTesting.codejar and derbyTesting.codeclasses will be valid, the
+// other will be set to a bogus URL like file://unused
+//
+// derbyTesting.codedir - File location of either derbyTesting.codejar or derbyTesting.codeclasses.
+// Only required due to a BUG (see below for more info).
+//
+// derbyTesting.jaxpjar - URL to the jar file containing the JAXP implementation
+// for XML-based tests (ex. lang/XMLBindingTest.java).
+//
+// derbyTesting.serverhost - Host name or ip where network server is started
+// derbyTesting.clienthost - specifies the clients ip address/hostName.
+// when testing with networkserver on a remote host, this needs to be passed in
+// with the NetworkServerControl start command
+//
+// Permissions for the embedded engine (derby.jar)
+//
+grant codeBase "${derbyTesting.codejar}derby.jar" {
+ permission java.util.PropertyPermission "derby.*", "read";
+ permission java.util.PropertyPermission "derby.storage.jvmInstanceId",
+ "write";
+ permission java.util.PropertyPermission "java.class.path", "read";//sysinfo
+
+ // unit tests (e.g. store/T_RecoverFullLog) set this property
+ // (called from derbyTesting.jar through code in derby.jar)
+ permission java.util.PropertyPermission "derbyTesting.unittest.*", "write";
+
+ permission java.lang.RuntimePermission "createClassLoader";
+ permission java.security.SecurityPermission "getPolicy";
+
+ permission java.io.FilePermission "${derby.system.home}${/}derby.properties", "read";
+ permission java.io.FilePermission "${derby.system.home}${/}derby.log", "read, write, delete";
+ // [DERBY-2000] The write permission was added to allow creation of the
+ // derby.system.home directory when running tests under a security manager.
+ permission java.io.FilePermission "${derby.system.home}", "read, write";
+
+ // all databases under derby.system.home
+ permission java.io.FilePermission "${derby.system.home}${/}-", "read, write, delete";
+
+ // Import/export and other support files from these locations in tests
+ permission java.io.FilePermission "${user.dir}${/}extin${/}-", "read";
+ permission java.io.FilePermission "${user.dir}${/}extinout${/}-", "read, write, delete";
+ permission java.io.FilePermission "${user.dir}${/}extout${/}-", "read,write";
+ permission java.io.FilePermission "${user.dir}${/}extinout", "read,write";
+
+ // These permissions are needed to load the JCE for encryption with Sun and IBM JDK131.
+ // JDK14 has the JCE preloaded
+ permission java.security.SecurityPermission "insertProvider.SunJCE";
+ permission java.security.SecurityPermission "insertProvider.IBMJCE";
+
+ // This permission is needed to avoid test failures in subsequent tests that
+ // may be testing JMX functionality. Without this permission, old MBeans
+ // might not be unregistered from the MBean server. See DERBY-3561.
+ permission javax.management.MBeanPermission "org.apache.derby.*#[org.apache.derby:*]","unregisterMBean";
+
+};
+
+//
+// Permissions for the network server (derbynet.jar)
+//
+grant codeBase "${derbyTesting.codejar}derbynet.jar" {
+ permission java.util.PropertyPermission "java.class.path", "read";//sysinfo
+
+ // accept is needed for the server accepting connections
+ // connect is needed for ping command (which is in the server jar)
+ permission java.net.SocketPermission "127.0.0.1", "accept,connect";
+ permission java.net.SocketPermission "localhost", "accept,connect";
+ permission java.net.SocketPermission "${derbyTesting.clienthost}", "accept,connect";
+ permission java.net.SocketPermission "${derbyTesting.serverhost}", "accept,connect";
+
+ // for testToggleTrace:
+ permission java.io.FilePermission "${derby.system.home}", "write";
+ permission java.io.FilePermission "${derby.system.home}${/}-", "write";
+};
+
+//
+// Permissions for the network client (derbyclient.jar)
+//
+grant codeBase "${derbyTesting.clientjar}derbyclient.jar" {
+ 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";
+
+ // DERBY-1883: Since some classes that are included in both derby.jar and
+ // derbyclient.jar read properties, derbyclient.jar needs permission to read
+ // derby.* properties to avoid failures when it is listed before derby.jar in
+ // the classpath.
+ permission java.util.PropertyPermission "derby.*", "read";
+
+ // DERBY-2302: derbyclient.jar needs to be able to read the user.dir property in order
to
+ // do tracing in that directory. Also, it needs read/write permissions in user.dir in order
+ // to create the trace files in that directory.
+ permission java.util.PropertyPermission "user.dir", "read";
+ permission java.io.FilePermission "${user.dir}${/}-", "read, write";
+
+};
+
+//
+// Permissions for the tools (derbytools.jar)
+// Ideally this would be more secure, for now the
+// focus is on getting the engine & network server secure.
+//
+grant codeBase "${derbyTesting.codejar}derbytools.jar" {
+ // Access all properties using System.getProperties -
+ // ij enumerates the properties in order to open connections
+ // for any property set in ij.connection.* and set protocols
+ // for any property in ij.protocol.*
+ permission java.util.PropertyPermission "*", "read, write";
+
+ // Read all files under ${user.dir}
+ permission java.io.FilePermission "${user.dir}${/}-", "read";
+
+ // IjTestCases read, write, and delete ij's output in the extinout dir
+ permission java.io.FilePermission "${user.dir}${/}extinout${/}-", "read, write, delete";
+
+ // ij needs permission to read the sql files in this jar
+ permission java.io.FilePermission "${derbyTesting.testjarpath}", "read";
+
+};
+
+//
+// Permissions for the tests (derbyTesting.jar)
+// We are liberal here, it's not a goal to make the test harness
+// or tests secure.
+//
+grant codeBase "${derbyTesting.testjar}derbyTesting.jar" {
+
+ // just add the complete gross policy change for ServerPropertiesTest
+ // execute permission is for 'java', but this can be at a variety of locations.
+ permission java.io.FilePermission "<<ALL FILES>>", "execute";
+ permission java.security.SecurityPermission "getPolicy";
+
+ // Access all properties using System.getProperties
+ permission java.util.PropertyPermission "*", "read, write";
+
+ // Access all files under ${user.dir}to write the test directory structure
+ permission java.io.FilePermission "${user.dir}${/}-", "read,write,delete";
+
+ // When running with useprocess=false need to install and uninstall
+ // the security manager and allow setIO to change the system err and out
+ // streams. Currently the nist suite runs with useprocess=false.
+ permission java.lang.RuntimePermission "setSecurityManager";
+ permission java.security.SecurityPermission "getPolicy";
+ permission java.lang.RuntimePermission "setIO";
+};
+
+//
+// super-set of the jar permissions for running out of the classes directory
+//
+grant codeBase "${derbyTesting.codeclasses}" {
+
+ // just add the complete gross policy change for ServerPropertiesTest
+ // execute permission is for 'java', but this can be at a variety of locations.
+ permission java.io.FilePermission "<<ALL FILES>>", "execute";
+ permission java.security.SecurityPermission "getPolicy";
+
+ // Access all properties using System.getProperties
+ permission java.util.PropertyPermission "*", "read, write";
+
+ permission java.util.PropertyPermission "derby.*", "read";
+ permission java.lang.RuntimePermission "createClassLoader";
+ permission java.security.SecurityPermission "getPolicy";
+
+ permission java.io.FilePermission "${derby.system.home}${/}derby.properties", "read";
+ permission java.io.FilePermission "${derby.system.home}${/}derby.log", "read, write, delete";
+ permission java.io.FilePermission "${derby.system.home}", "read";
+ permission java.io.FilePermission "${derby.system.home}${/}-", "read, write, delete";
+
+ // combination of client and server side.
+ permission java.net.SocketPermission "127.0.0.1", "accept,connect,resolve";
+ permission java.net.SocketPermission "localhost", "accept,connect,resolve";
+ permission java.net.SocketPermission "${derbyTesting.clienthost}", "accept,connect";
+ permission java.net.SocketPermission "${derbyTesting.serverhost}", "connect,resolve";
+
+ // Access all files under ${user.dir}to write the test directory structure
+ // Also covers extin, extout and extinout locations
+ permission java.io.FilePermission "${user.dir}${/}-", "read,write,delete";
+
+ // These permissions are needed to load the JCE for encryption with Sun and IBM JDK131.
+ // JDK14 has the JCE preloaded
+ permission java.security.SecurityPermission "insertProvider.SunJCE";
+ permission java.security.SecurityPermission "insertProvider.IBMJCE";
+
+ // When running with useprocess=false need to install and uninstall
+ // the security manager and allow setIO to change the system err and out
+ // streams. Currently the nist suite runs with useprocess=false.
+ permission java.lang.RuntimePermission "setSecurityManager";
+ permission java.lang.RuntimePermission "setIO";
+};
+
+// JUnit jar file tries to read junit.properties in the user's
+// home directory and seems to require permission to read the
+// property user.home as well.
+// junit.swingui.TestRunner writes to .junitsession on exit.
+grant codeBase "${derbyTesting.junit}" {
+ permission java.util.PropertyPermission "user.home", "read";
+ permission java.io.FilePermission "${user.home}${/}junit.properties", "read";
+ permission java.io.FilePermission "${user.home}${/}.junitsession", "write";
+
+ // This permission is needed when running the tests using ant 1.7
+ permission java.io.FilePermission "${user.dir}${/}*", "write";
+};
+
+// Due to a problem running tests/derbynet/CompatibilityTest in the old test
+// harness, permission to read junit.properties is granted to all. This can be
+// removed when CompatibilityTest is rewritten to conform to our current Junit
+// usage. See DERBY-2076.
+grant {
+ permission java.io.FilePermission "${user.home}${/}junit.properties", "read";
+};
+
+// Ant's junit runner requires setOut to redirect the System output streams
+// to the forked JVM used when running junit tests inside Ant. Ant requires
+// forking the JVM if you want to run tests in a different directory than the
+// current one.
+grant codeBase "${derbyTesting.antjunit}" {
+ permission java.lang.RuntimePermission "setIO";
+
+ // This permission is needed when running the tests using ant 1.7
+ permission java.io.FilePermission "${user.dir}${/}*", "write";
+};
+
+// functionTests.tests.lang.RoutineSecurityTest requires this grant
+// to check to see if permissions are granted through generated code
+// through this mechanism.
+grant {
+ permission java.util.PropertyPermission "derbyRoutineSecurityTest.yes", "read";
+};
+
+// When inserting XML values that use external DTD's, the JAXP parser
+// needs permission to read the DTD files. We assume that all DTD
+// files will be copied to extin/ by whichever tests need them. So
+// grant the JAXP parser permissions to read that directory.
+grant codeBase "${derbyTesting.jaxpjar}" {
+ permission java.io.FilePermission "${user.dir}${/}extin${/}-", "read";
+};
+
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java?rev=685946&r1=685945&r2=685946&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
Thu Aug 14 08:40:44 2008
@@ -60,6 +60,7 @@
suite.addTest(ServerPropertiesTest.suite());
suite.addTest(LOBLocatorReleaseTest.suite());
suite.addTest(OutBufferedStreamTest.suite());
+ suite.addTest(GetCurrentPropertiesTest.suite());
// Disabled due to "java.sql.SQLSyntaxErrorException: The class
|