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/03/28 18:28:36 UTC
svn commit: r523399 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java
Author: rhillegas
Date: Wed Mar 28 09:28:35 2007
New Revision: 523399
URL: http://svn.apache.org/viewvc?view=rev&rev=523399
Log:
DERBY-2466: Add upgrade test for new policy-reloading procedure.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java?view=diff&rev=523399&r1=523398&r2=523399
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java Wed Mar 28 09:28:35 2007
@@ -42,6 +42,8 @@
* 10.3 Upgrade issues
*/
public class Changes10_3 extends UpgradeChange {
+
+ private static final String UNKNOWN_PROCEDURE = "42Y03";
public static Test suite() {
TestSuite suite = new TestSuite("Upgrade changes for 10.3");
@@ -248,4 +250,73 @@
}
}
+ /**
+ * Ensure that the new policy-file-reloading procedure works after
+ * hard upgrade to 10.3 from previous derby versions.
+ */
+ public void testPolicyReloadingProcedure()
+ throws SQLException
+ {
+ int currentPhase = getPhase();
+
+ switch( currentPhase )
+ {
+
+ case PH_CREATE:
+ case PH_SOFT_UPGRADE:
+ case PH_POST_SOFT_UPGRADE:
+ assertPolicyReloaderDoesNotExist();
+ break;
+
+ case PH_HARD_UPGRADE:
+ case PH_POST_HARD_UPGRADE:
+ assertPolicyReloaderExists();
+ break;
+
+ default:
+ throw new SQLException( "Unknown upgrade phase: " + currentPhase );
+
+ }
+ }
+
+ /**
+ * Verify that the policy-reloading procedure exists.
+ */
+ private void assertPolicyReloaderExists()
+ throws SQLException
+ {
+ tryReloading( true, null );
+ }
+
+ /**
+ * Verify whether the policy-reloading procedure exists.
+ */
+ private void assertPolicyReloaderDoesNotExist()
+ throws SQLException
+ {
+ tryReloading( false, UNKNOWN_PROCEDURE );
+ }
+
+ /**
+ * Call the policy reloading procedure.
+ */
+ private void tryReloading( boolean shouldSucceed, String expectedSQLState )
+ throws SQLException
+ {
+ boolean didSucceed = false;
+
+ try {
+ Statement s = createStatement();
+ s.execute("call SYSCS_UTIL.SYSCS_RELOAD_SECURITY_POLICY()");
+
+ didSucceed = true;
+ }
+ catch (SQLException se)
+ {
+ assertSQLState( expectedSQLState, se );
+ }
+
+ assertEquals( "Reloading results.", shouldSucceed, didSucceed );
+ }
+
}