Derby
  1. Derby
  2. DERBY-2727

convert lang/AggregateClassLoading to JUnit.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.4.1.3
    • Component/s: Test
    • Labels:
      None
    1. DERBY-2727_stat_240607.txt
      0.3 kB
      Ugo Matrangolo
    2. DERBY-2727_stat_120607.txt
      0.3 kB
      Ugo Matrangolo
    3. DERBY-2727_diff_240607.txt
      7 kB
      Ugo Matrangolo
    4. DERBY-2727_diff_120607.txt
      7 kB
      Ugo Matrangolo

      Activity

      Transition Time In Source Status Execution Times Last Executer Last Execution Date
      Open Open In Progress In Progress
      11d 11h 18m 1 Ugo Matrangolo 10/Jun/07 10:43
      In Progress In Progress Open Open
      14d 11h 42m 1 Ugo Matrangolo 24/Jun/07 22:26
      Open Open Resolved Resolved
      5d 18h 31m 1 Myrna van Lunteren 30/Jun/07 16:57
      Resolved Resolved Closed Closed
      3d 16h 50m 1 Ugo Matrangolo 04/Jul/07 09:47
      Gavin made changes -
      Workflow jira [ 12405113 ] Default workflow, editable Closed status [ 12797937 ]
      Dag H. Wanvik made changes -
      Issue Type Test [ 6 ] Improvement [ 4 ]
      Ugo Matrangolo made changes -
      Status Resolved [ 5 ] Closed [ 6 ]
      Myrna van Lunteren made changes -
      Fix Version/s 10.4.0.0 [ 12312540 ]
      Resolution Fixed [ 1 ]
      Status Open [ 1 ] Resolved [ 5 ]
      Hide
      Myrna van Lunteren added a comment -

      It appears to me that this is fixed, now. Leaving to reporter to close.

      Show
      Myrna van Lunteren added a comment - It appears to me that this is fixed, now. Leaving to reporter to close.
      Hide
      Daniel John Debrunner added a comment -

      Renabled converted test with fixes for IBM 1.5. Committed revision 551732

      Show
      Daniel John Debrunner added a comment - Renabled converted test with fixes for IBM 1.5. Committed revision 551732
      Hide
      Daniel John Debrunner added a comment -

      I have a fix for this but cannot apply it because the patch was already reverted

      Show
      Daniel John Debrunner added a comment - I have a fix for this but cannot apply it because the patch was already reverted
      Kathey Marsden made changes -
      Derby Info [Patch Available]
      Hide
      Kathey Marsden added a comment -

      I committed this patch with the following changes.

      • Removed old test files
      • Removed Database/System property setup for usedefaults. usedefaults has no meaning outside the old test harness.

      Thanks Ugo!

      Show
      Kathey Marsden added a comment - I committed this patch with the following changes. Removed old test files Removed Database/System property setup for usedefaults. usedefaults has no meaning outside the old test harness. Thanks Ugo!
      Ugo Matrangolo made changes -
      Status In Progress [ 3 ] Open [ 1 ]
      Ugo Matrangolo made changes -
      Derby Info [Patch Available]
      Ugo Matrangolo made changes -
      Attachment DERBY-2727_diff_240607.txt [ 12360432 ]
      Attachment DERBY-2727_stat_240607.txt [ 12360433 ]
      Hide
      Ugo Matrangolo added a comment -

      Code modified accordingly to the Kathey's comments.

      Please review,
      – Ugo.

      Show
      Ugo Matrangolo added a comment - Code modified accordingly to the Kathey's comments. Please review, – Ugo.
      Hide
      Ugo Matrangolo added a comment -

      Thank you Kathey. I will modify the code asap.

      Bye,
      – Ugo

      Show
      Ugo Matrangolo added a comment - Thank you Kathey. I will modify the code asap. Bye, – Ugo
      Hide
      Kathey Marsden added a comment -

      I see that for the original test there is a AggregateClassLoading_app.properties
      which has:

      1. this test creates a class loader, adding that permission to
      2. derbyTesting.jar would mean that permission was granted all
      3. the way up the stack to the derby engine. Thus increasing
      4. the chance that incorrectly a privileged block could be dropped
      5. but the tests continue to pass.
        noSecurityManager=true

      The equivalant junit decorator is org.apache.derbyTesting.junit.SecurityManagerSetup.noSecurityManager(Test test);
      http://db.apache.org/derby/javadoc/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.html#noSecurityManager(junit.framework.Test)

      Show
      Kathey Marsden added a comment - I see that for the original test there is a AggregateClassLoading_app.properties which has: this test creates a class loader, adding that permission to derbyTesting.jar would mean that permission was granted all the way up the stack to the derby engine. Thus increasing the chance that incorrectly a privileged block could be dropped but the tests continue to pass. noSecurityManager=true The equivalant junit decorator is org.apache.derbyTesting.junit.SecurityManagerSetup.noSecurityManager(Test test); http://db.apache.org/derby/javadoc/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.html#noSecurityManager(junit.framework.Test )
      Hide
      Ugo Matrangolo added a comment -

      Followinf from the previous comment: the code that fails is :

      /*

      • Find the location of the code for the Derby connection. The
      • rest of the engine will be at the same location!
        */
        derbyURL = s.getConnection().getClass().getProtectionDomain().getCodeSource().getLocation();

      borrowed from the old test. I suspect that the context is not the same of the old harness test.

      – Ugo.

      Show
      Ugo Matrangolo added a comment - Followinf from the previous comment: the code that fails is : /* Find the location of the code for the Derby connection. The rest of the engine will be at the same location! */ derbyURL = s.getConnection().getClass().getProtectionDomain().getCodeSource().getLocation(); borrowed from the old test. I suspect that the context is not the same of the old harness test. – Ugo.
      Ugo Matrangolo made changes -
      Attachment DERBY-2727_diff_120607.txt [ 12359548 ]
      Attachment DERBY-2727_stat_120607.txt [ 12359549 ]
      Hide
      Ugo Matrangolo added a comment -

      Initial attempt to convert this test.

      At first sight it seems trivial to convert but, obviously, he doesn't work!

      Running the test I get a security exception:

      java.security.AccessControlException: access denied (java.lang.RuntimePermission getProtectionDomain)
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
      at java.security.AccessController.checkPermission(AccessController.java:401)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
      at java.lang.Class.getProtectionDomain(Class.java:1392)
      at org.apache.derbyTesting.functionTests.tests.lang.AggregateClassLoadingTest$1.decorateSQL(AggregateClassLoadingTest.java:106)
      at org.apache.derbyTesting.junit.CleanDatabaseTestSetup.setUp(CleanDatabaseTestSetup.java:70)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.extensions.TestSetup.run(TestSetup.java:25)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.extensions.TestSetup.run(TestSetup.java:25)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.extensions.TestSetup.run(TestSetup.java:25)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

      Can someone point me toward the solution of this ??

      Thank you in advance,
      – Ugo.

      Show
      Ugo Matrangolo added a comment - Initial attempt to convert this test. At first sight it seems trivial to convert but, obviously, he doesn't work! Running the test I get a security exception: java.security.AccessControlException: access denied (java.lang.RuntimePermission getProtectionDomain) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269) at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:524) at java.lang.Class.getProtectionDomain(Class.java:1392) at org.apache.derbyTesting.functionTests.tests.lang.AggregateClassLoadingTest$1.decorateSQL(AggregateClassLoadingTest.java:106) at org.apache.derbyTesting.junit.CleanDatabaseTestSetup.setUp(CleanDatabaseTestSetup.java:70) at junit.extensions.TestSetup$1.protect(TestSetup.java:20) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.extensions.TestSetup.run(TestSetup.java:25) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) at junit.extensions.TestSetup$1.protect(TestSetup.java:21) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.extensions.TestSetup.run(TestSetup.java:25) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) at junit.extensions.TestSetup$1.protect(TestSetup.java:21) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.extensions.TestSetup.run(TestSetup.java:25) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Can someone point me toward the solution of this ?? Thank you in advance, – Ugo.
      Ugo Matrangolo made changes -
      Status Open [ 1 ] In Progress [ 3 ]
      Ugo Matrangolo made changes -
      Field Original Value New Value
      Assignee Ugo Matrangolo [ matra ]
      Ugo Matrangolo created issue -

        People

        • Assignee:
          Ugo Matrangolo
          Reporter:
          Ugo Matrangolo
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development