Derby
  1. Derby
  2. DERBY-5496

The JUnit infrastructure package should be compiled against the small device classpath, not the JDK 1.4 classpath

    Details

    • Urgency:
      Normal

      Description

      The org.apache.derbyTesting.junit package currently compiles against the JDK 1.4 classpath. Since these classes need to run on CDC/FP 1.1 platforms, they should be compiled against the small device classpath. That will make the compiler raise an error when the JUnit infrastructure references methods which are not present on small devices.

        Activity

        Hide
        Rick Hillegas added a comment -

        Attaching derby-5496-01-ab-identify14classes.diff. This patch attempts to reduce the uncertainty about which test classes really will run on small devices.

        The following classes still need to be built using the JDK 1.4 libraries. These classes may raise method invocation errors at run time if they are used on small devices:

        JAXPFinder.java
        ConnectionPoolDataSourceConnector.java
        J2EEDataSource.java
        DriverManagerConnector.java
        XADataSourceConnector.java
        XATestUtil.java
        BigDecimalHandler.java

        It may make sense to move these classes into a separate package so that it is clear that they require JDK 1.4.

        I am not sure what to do with BigDecimalHandler. From header comments in that class, it seems that people expect to use that class on small devices. But it calls ResultSet.getBigDecimal(), which is not a JSR 169 method. Maybe BigDecimalHandler should be re-coded to use reflection.

        The org.apache.derbyTesting.junit package is built in two phases now:

        1) First we build all of the classes which WILL compile against JSR 169 and CDC/FP 1.1.

        2) Then we build the classes listed above, which require JDK 1.4 or later.

        Touches the following files:

        ----------------

        M build.xml

        Added a diagnostic message to describe the setting of compile.classpath.

        ----------------

        M java/testing/org/apache/derbyTesting/junit/build.xml

        Re-arranged the build of org.apache.derbyTesting.junit as described above.

        ----------------

        M java/testing/org/apache/derbyTesting/junit/JDBC.java

        Removed call to String.matches() which is not in CDC/FP 1.1. Recoded assertParameterTypes() to use reflection and to raise an error if you invoke it on a small device.

        ----------------

        M java/testing/org/apache/derbyTesting/junit/XML.java

        Used reflection to access JAXPFinder.

        ----------------

        M java/testing/org/apache/derbyTesting/junit/JAXPFinder.java
        M java/testing/org/apache/derbyTesting/junit/J2EEDataSource.java
        M java/testing/org/apache/derbyTesting/junit/XATestUtil.java

        Corrected the names of these classes in their Apache license headers.

        ----------------

        M java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java

        Removed the calls to String.split(), which doesn't appear in CDC/FP 1.1.

        ----------------

        M java/testing/org/apache/derbyTesting/functionTests/tests/lang/UnaryArithmeticParameterTest.java

        Accounted for the additional Exceptions which JDBC.assertParameterTypes() can raise now.

        Show
        Rick Hillegas added a comment - Attaching derby-5496-01-ab-identify14classes.diff. This patch attempts to reduce the uncertainty about which test classes really will run on small devices. The following classes still need to be built using the JDK 1.4 libraries. These classes may raise method invocation errors at run time if they are used on small devices: JAXPFinder.java ConnectionPoolDataSourceConnector.java J2EEDataSource.java DriverManagerConnector.java XADataSourceConnector.java XATestUtil.java BigDecimalHandler.java It may make sense to move these classes into a separate package so that it is clear that they require JDK 1.4. I am not sure what to do with BigDecimalHandler. From header comments in that class, it seems that people expect to use that class on small devices. But it calls ResultSet.getBigDecimal(), which is not a JSR 169 method. Maybe BigDecimalHandler should be re-coded to use reflection. The org.apache.derbyTesting.junit package is built in two phases now: 1) First we build all of the classes which WILL compile against JSR 169 and CDC/FP 1.1. 2) Then we build the classes listed above, which require JDK 1.4 or later. Touches the following files: ---------------- M build.xml Added a diagnostic message to describe the setting of compile.classpath. ---------------- M java/testing/org/apache/derbyTesting/junit/build.xml Re-arranged the build of org.apache.derbyTesting.junit as described above. ---------------- M java/testing/org/apache/derbyTesting/junit/JDBC.java Removed call to String.matches() which is not in CDC/FP 1.1. Recoded assertParameterTypes() to use reflection and to raise an error if you invoke it on a small device. ---------------- M java/testing/org/apache/derbyTesting/junit/XML.java Used reflection to access JAXPFinder. ---------------- M java/testing/org/apache/derbyTesting/junit/JAXPFinder.java M java/testing/org/apache/derbyTesting/junit/J2EEDataSource.java M java/testing/org/apache/derbyTesting/junit/XATestUtil.java Corrected the names of these classes in their Apache license headers. ---------------- M java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java Removed the calls to String.split(), which doesn't appear in CDC/FP 1.1. ---------------- M java/testing/org/apache/derbyTesting/functionTests/tests/lang/UnaryArithmeticParameterTest.java Accounted for the additional Exceptions which JDBC.assertParameterTypes() can raise now.
        Hide
        Rick Hillegas added a comment -

        Tests passed for me after building with this patch, except for the problems in the upgrade tests.

        Show
        Rick Hillegas added a comment - Tests passed for me after building with this patch, except for the problems in the upgrade tests.
        Hide
        Rick Hillegas added a comment -

        Committed derby-5496-01-ab-identify14classes.diff at subversion revision 1199234.

        Show
        Rick Hillegas added a comment - Committed derby-5496-01-ab-identify14classes.diff at subversion revision 1199234.
        Hide
        Rick Hillegas added a comment -

        I think that more work could be done on clarifying which JUnit infrastructure classes are allowed to run on small platforms and which aren't. However, the problem identified by this JIRA has been addressed.

        Show
        Rick Hillegas added a comment - I think that more work could be done on clarifying which JUnit infrastructure classes are allowed to run on small platforms and which aren't. However, the problem identified by this JIRA has been addressed.

          People

          • Assignee:
            Rick Hillegas
            Reporter:
            Rick Hillegas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development