Myrna van Lunteren (JIRA) wrote:
[ http://issues.apache.org/jira/browse/DERBY-2006?page=comments#action_12448010 ] Myrna van Lunteren commented on DERBY-2006:
-------------------------------------------

I played with this for (quite) a while, but with the current version I use to 
test j2ME on Windows (wctme5.7 jcl foundation class), which has a problem with 
security manager (see: 
http://wiki.apache.org/db-derby/JunitVmIssues#head-0916dd3630b0667e49460439fbd041c720d93eaf),
 I have to jump through quite a few hoops to get things working. In fact, I 
didn't actually get things working.
I've gotten as far as hard-coding in a number of jvmargs in build.xml:
  <target name="junit-oneclass" depends="junit-init">
    <junit printsummary="on"
           fork="yes" forkmode="once"
           jvm="${derby.junit.jvm}"
           showoutput="yes"
           dir="junit_${derby.junit.DSTAMP}_${derby.junit.TSTAMP}/testout">
<jvmarg value="-Dij.dataSource=org.apache.derby.jdbc.EmbeddedSimpleDataSource"/> <jvmarg value="-jcl:foun10"/> <jvmarg value="-Xbootclasspath/a:c:/wctme5.7/ive/lib/jdbc.jar"/> <jvmarg value="-DderbyTesting.serverhost=localhost"/>
        <jvmarg value="-DderbyTesting.clienthost=localhost"/>
        <jvmarg 
value="-DderbyTesting.codeclasses=file:/C:/derby/trunk/classes/"/>
        <jvmarg 
value="-Djava.security.policy=file:/C:/derby/trunk/classes/org/apache/derbyTesting/functionTests/util/derby_tests.policy"/>
        <jvmarg 
value="-Dderby.system.home=c:/derby/trunk/junit_${derby.junit.DSTAMP}_${derby.junit.TSTAMP}"/>
      <formatter type="xml"/>
      <test name="${derby.junit.testname}" 
todir="junit_${derby.junit.DSTAMP}_${derby.junit.TSTAMP}"/>
      <classpath>
        <pathelement path="${out.dir}"/>
        <pathelement path="${junit}"/>
      </classpath>
    </junit>
  </target>

But this results in: [junit] Exception in thread "main" java.security.AccessControlException: Access denied (java.lang.RuntimePermission setIO )
    [junit]     at 
java.security.AccessController.checkPermission(AccessController.java:74)
    [junit]     at 
java.lang.SecurityManager.checkPermission(SecurityManager.java:612)
    [junit]     at java.lang.System.setOut(System.java:76)
    [junit]     at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:309)
    [junit]     at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
    [junit]     at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)
    [junit] Test org.apache.derbyTesting.functionTests.tests.tools._Suite FAILED
  [antcall] Exiting C:\derbyt\svn2\trunk\build.xml.

and the resulting _Suite.xml files are empty.

I suspect my specification of either the policy file or derby.system.home is 
off...
Anyways, this issue is closed, I think for now I'll just conclude that the ant 
target doesn't work well with wctme5.7 - foundation.

The JUnit setup sets some additional properties for the ant and junit jars that you don't seem to have set above.

derbyTesting.antjunit
derbyTesting.junit

You probably need to set those as well.

You can also remove this one: ij.dataSource
Junit does not use ij to get its connections.

Dan.

Reply via email to