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 rh...@apache.org on 2007/02/22 17:53:09 UTC

svn commit: r510586 - in /db/derby/code/trunk/java: engine/org/apache/derby/loc/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/master/j9_foundation/ testing/org/apache/derbyTesting/functionTests/tes...

Author: rhillegas
Date: Thu Feb 22 08:53:08 2007
New Revision: 510586

URL: http://svn.apache.org/viewvc?view=rev&rev=510586
Log:
DERBY-2264: Committed Dag's DERBY-2264-2.diff patch, which addresses some minor comments on the previous patch.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/users2.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/users2.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?view=diff&rev=510586&r1=510585&r2=510586
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Thu Feb 22 08:53:08 2007
@@ -846,7 +846,7 @@
 
             <msg>
                 <name>2850H</name>
-                <text>User '{0}' cannot shut down database '{1}'. Only database owner can perform this operation.</text>
+                <text>User '{0}' cannot shut down database '{1}'. Only the database owner can perform this operation.</text>
                 <arg>authorizationID</arg>
                 <arg>databaseName</arg>
             </msg>

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/users2.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/users2.out?view=diff&rev=510586&r1=510585&r2=510586
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/users2.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/users2.out Thu Feb 22 08:53:08 2007
@@ -247,7 +247,7 @@
 No connections available.
 ij> -- Database shutdown - check user - should fail, not owner, cf DERBY-2264
 connect 'wombat;user=francois;password=paceesalute;shutdown=true';
-ERROR 2850H: User 'FRANCOIS' cannot shut down database 'wombat'. Only database owner can perform this operation.
+ERROR 2850H: User 'FRANCOIS' cannot shut down database 'wombat'. Only the database owner can perform this operation.
 ij> -- Database shutdown - check owner - should succeed
 connect 'wombat;user=system;password=manager;shutdown=true';
 ERROR 08006: Database 'wombat' shutdown.
@@ -255,7 +255,7 @@
 disconnect all;
 ij> -- Database shutdown - check user - should fail, not owner, cf DERBY-2264
 connect 'myDB;user=jerry;password=SacreBleu;shutdown=true';
-ERROR 2850H: User 'JERRY' cannot shut down database 'myDB'. Only database owner can perform this operation.
+ERROR 2850H: User 'JERRY' cannot shut down database 'myDB'. Only the database owner can perform this operation.
 ij> -- Database shutdown - check owner - should succeed
 connect 'myDB;user=system;password=manager;shutdown=true';
 ERROR 08006: Database 'myDB' shutdown.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/users2.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/users2.out?view=diff&rev=510586&r1=510585&r2=510586
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/users2.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/users2.out Thu Feb 22 08:53:08 2007
@@ -247,7 +247,7 @@
 No connections available.
 ij> -- Database shutdown - check user - should fail, not owner, cf DERBY-2264
 connect 'wombat;user=francois;password=paceesalute;shutdown=true';
-ERROR 2850H: User 'FRANCOIS' cannot shut down database 'wombat'. Only database owner can perform this operation.
+ERROR 2850H: User 'FRANCOIS' cannot shut down database 'wombat'. Only the database owner can perform this operation.
 ij> -- Database shutdown - check owner - should succeed
 connect 'wombat;user=system;password=manager;shutdown=true';
 ERROR 08006: Database 'wombat' shutdown.
@@ -255,7 +255,7 @@
 disconnect all;
 ij> -- Database shutdown - check user - should fail, not owner, cf DERBY-2264
 connect 'myDB;user=jerry;password=SacreBleu;shutdown=true';
-ERROR 2850H: User 'JERRY' cannot shut down database 'myDB'. Only database owner can perform this operation.
+ERROR 2850H: User 'JERRY' cannot shut down database 'myDB'. Only the database owner can perform this operation.
 ij> -- Database shutdown - check owner - should succeed
 connect 'myDB;user=system;password=manager;shutdown=true';
 ERROR 08006: Database 'myDB' shutdown.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java?view=diff&rev=510586&r1=510585&r2=510586
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java Thu Feb 22 08:53:08 2007
@@ -32,7 +32,7 @@
 
 /**
  * This JUnit tests enforcement of dbo (=database owner) powers, cf.
-* DERBY-2264.
+ * DERBY-2264.
  *
  * The tests are run in the cross product (cardinality 10) of contexts:
  *
@@ -43,7 +43,7 @@
  * One could consider removing the client/server suite to speed up
  * this test as it does not add much value given the nature of the changes.
  *
-*/
+ */
 public class DboPowersTest extends BaseJDBCTestCase
 {
     /* test execution security context: one of three below */
@@ -54,7 +54,7 @@
     
     /**
      * Create a new instance of DboPowersTest
-    *
+     *
      * @param name Fixture name
      * @param authLevel authentication level with which test is run
      */
@@ -65,7 +65,7 @@
     }
 
     /**
-    * Construct top level suite in this JUnit test
+     * Construct top level suite in this JUnit test
      *
      * @return A suite containing embedded and client suites
      */
@@ -76,7 +76,7 @@
         suite.addTest(TestConfiguration.clientServerDecorator(
                           dboSuite("client")));
         return suite;
-   }
+    }
         
     /**
      *
@@ -87,7 +87,7 @@
      * security levels no authentication, authentication, and
      * authentication plus sqlAuthorization, 
      * The latter two has an instance for dbo, and one for ordinary user,
-    * in all five incarnations of tests.
+     * in all five incarnations of tests.
      */
     private static Test dboSuite(String framework) 
     {
@@ -98,7 +98,7 @@
              * work after DERBY-2264(!).
              */
             {"APP", "U1"}, 
-           /* authLevel == SQLAUTHORIZATION: sqlAuthorizationDecorator
+            /* authLevel == SQLAUTHORIZATION: sqlAuthorizationDecorator
              * decorator presumes TEST_DBO as dbo, so add it to set of
              * valid users. Uses a fresh db 'dbsqlauth', not 'wombat'.
              */
@@ -106,11 +106,11 @@
         
         final String pwSuffix = "pwSuffix";
 
-        Test tests[] = new Test[3]; // one per authLevel
+        Test tests[] = new Test[SQLAUTHORIZATION+1]; // one per authLevel
 
         tests[NOAUTHENTICATION] = collectFixtures(NOAUTHENTICATION);
 
-        /** First decorate with users, then with authentication. Do this
+        /* First decorate with users, then with authentication. Do this
          * twice, once for authentication only, and once for
          * authentication and sqlAuthorization (see extra decorator
          * added below).
@@ -121,7 +121,7 @@
             // add decorator for different users authenticated
             TestSuite userSuite =  new TestSuite(
                 "userSuite:"+ (autLev == AUTHENTICATION ? "authentication"
-                              : "sqlAuthorization"));
+                               : "sqlAuthorization"));
 
             for (int userNo = 0; userNo < users.length; userNo++) {
                 userSuite.addTest
@@ -132,7 +132,7 @@
             }
         
             tests[autLev] = DatabasePropertyTestSetup.
-               builtinAuthentication(userSuite, users[autLev-1], pwSuffix);
+                builtinAuthentication(userSuite, users[autLev-1], pwSuffix);
         }
 
         TestSuite suite = new TestSuite("dboPowers:"+framework);
@@ -143,7 +143,7 @@
         /* run test for all users with only authentication enabled */
         suite.addTest(tests[AUTHENTICATION]);
 
-       /* run test for all users with authentication and
+        /* run test for all users with authentication and
          * sqlAuthorization enabled
          */
         suite.addTest(
@@ -154,8 +154,10 @@
     }
 
     /**
-    * Picks up individual test fixtures explicitly, since we need to
+     * Pick up individual test fixtures explicitly, since we need to
      * provide the context.
+     *
+     * @param authLevel tests to be run with this security level
      */
     private static TestSuite collectFixtures(int authLevel)
     {
@@ -165,7 +167,9 @@
     }
 
     /**
-    * Test database shutdown power enforcement
+     * Test database shutdown power enforcement
+     *
+     * @throws SQLException
      */
     public void testShutDown() throws SQLException
     {
@@ -187,7 +191,7 @@
             if ("08006".equals(e.getSQLState())) {
                 // reboot if shutdown succeeded
                 JDBCDataSource.setBeanProperty(ds, "connectionAttributes", "");
-               ds.getConnection().close();
+                ds.getConnection().close();
             }
 
             vetShutdownException(user, e);
@@ -197,8 +201,10 @@
     /**
      * Decide if the result of trying to shut down the database is
      * compliant with the semantics introduced by DERBY-2264.
+     *
+     * @throws SQLException
      */
-   private void vetShutdownException (String user, SQLException e)
+    private void vetShutdownException (String user, SQLException e)
     {
         switch (authLevel) {
         case NOAUTHENTICATION:
@@ -209,7 +215,7 @@
             if ("APP".equals(user)) {
                 assertSQLState("database shutdown, authentication, db owner", 
                                "08006", e);
-           } else {
+            } else {
                 assertSQLState("database shutdown restriction, authentication," +
                                " not db owner", "2850H", e);
             }
@@ -220,7 +226,7 @@
                                "08006", e);
             } else {
                 assertSQLState("database shutdown restriction, " + 
-                              "SQL authorization, not db owner",
+                               "SQL authorization, not db owner",
                                "2850H", e);
             }
             break;
@@ -230,4 +236,3 @@
         }
     }
 }
-