db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r662920 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi: LDAPAuthenticationTest.java LDAPTests.policy XAJNDITest.java XAJNDITest.policy
Date Tue, 03 Jun 2008 23:47:28 GMT
Author: myrnavl
Date: Tue Jun  3 16:47:27 2008
New Revision: 662920

URL: http://svn.apache.org/viewvc?rev=662920&view=rev
Log:
DERBY-3659 - junit ldap tests - commit minor changes of patch DERBY-3659-3.diff.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy
      - copied, changed from r662643, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.policy
Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.policy
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPAuthenticationTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPAuthenticationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPAuthenticationTest.java?rev=662920&r1=662919&r2=662920&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPAuthenticationTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPAuthenticationTest.java
Tue Jun  3 16:47:27 2008
@@ -58,10 +58,9 @@
     private static String ldapUser; // existing valid user on ldap server
     private static String ldapPassword; // password for existing valid user on ldap server
 
-    // create own policy file, use the one from XAJNDITest so
-    // we can connect to the ldap server
+    // create own policy file, so we can connect to the ldap server
     private static String POLICY_FILE_NAME = 
-        "functionTests/tests/jdbcapi/XAJNDITest.policy";
+        "functionTests/tests/jdbcapi/LDAPTests.policy";
     private static String TARGET_POLICY_FILE_NAME = "derby_tests.policy";
     
     /** Creates a new instance of the Test */

Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy
(from r662643, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.policy)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.policy&r1=662643&r2=662920&rev=662920&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.policy
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy
Tue Jun  3 16:47:27 2008
@@ -21,7 +21,9 @@
 
 //
 // Policy file with minimal set of permissions to run derby's
-// functional tests.
+// functional tests, to be used in tests needing connect/resolve permissions to
+// an LDAPServer as passsed in with property derbyTesting.ldapServer, such as
+// LDAPAuthenticationTest.
 //
 // The test harness sets up four variables used by this policy file
 //
@@ -112,6 +114,9 @@
   permission java.util.PropertyPermission "${emma.active}user.dir", "read";
   permission java.io.FilePermission "${emma.active}${user.dir}${/}coverage.ec", "read, write";
   permission java.lang.RuntimePermission "${emma.active}writeFileDescriptor";
+
+  // resolve is needed to run ldap related tests 
+  permission java.net.SocketPermission "${derbyTesting.ldapServer}", "connect, resolve";
 };
 
 //

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.java?rev=662920&r1=662919&r2=662920&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XAJNDITest.java
Tue Jun  3 16:47:27 2008
@@ -1,6 +1,5 @@
 package org.apache.derbyTesting.functionTests.tests.jdbcapi;
 
-import java.io.File;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Hashtable;
@@ -17,8 +16,6 @@
 import org.apache.derbyTesting.junit.J2EEDataSource;
 import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.JDBCDataSource;
-import org.apache.derbyTesting.junit.SecurityManagerSetup;
-import org.apache.derbyTesting.junit.SupportFilesSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
 public class XAJNDITest extends BaseJDBCTestCase {
@@ -27,12 +24,6 @@
     private static String dnString;
     private InitialDirContext ic = getInitialDirContext();
 
-
-    //to create own policy file
-    private static String POLICY_FILE_NAME = 
-        "functionTests/tests/jdbcapi/XAJNDITest.policy";
-    private static String TARGET_POLICY_FILE_NAME = "derby_tests.policy";
-
     public XAJNDITest(String name) {
         super(name);
     }
@@ -50,59 +41,16 @@
             if (dnString == null || dnString.length() < 1)
                 return new TestSuite("XAJNDITest requires property derbyTesting.dnString
for setting o=, eg: -DderbyTesting.dnString=myJNDIstring");
             
-            Test test = decorateWithPolicy
-            (TestConfiguration.defaultSuite(XAJNDITest.class));
-            return test;            
+            return TestConfiguration.defaultSuite(XAJNDITest.class);
         }
         return new TestSuite("XAJNDITest cannot run without XA support");
     }
     
-    // grant ALL FILES execute, and getPolicy permissions, as well
-    // as resolve/connect for the ldap server identified with the property
-    private static Test decorateWithPolicy(Test test) {
-        String ldapPolicyName = new XAJNDITest("test").makeServerPolicyName();
-        //
-        // Install a security manager using the initial policy file.
-        //
-        test = new SecurityManagerSetup(test,ldapPolicyName );
-        // 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;
-    }
-
-
-    /**
-     * Construct the name of the server policy file.
-     */
-    private 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)
-        {
-            System.out.println( "Unexpected exception caught by makeServerPolicyName(): "
+ e );
-
-            return null;
-        }
-    }
-    
     public void tearDown() throws Exception {
         ldapServer=null;
         ldapPort=null;
         // need to hold on to dnString value and ic as the fixture runs
         // twice (embedded & networkserver) and they're used inside it
-        POLICY_FILE_NAME=null;
-        TARGET_POLICY_FILE_NAME=null;
         super.tearDown();
     }
 



Mime
View raw message