GeoTools
  1. GeoTools
  2. GEOT-2109

JDBCFeatureSourceTest cannot work with DB2 Spatial Extender

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6-M0
    • Fix Version/s: 2.6-M1
    • Component/s: jdbc
    • Labels:
      None

      Description

      Reason 1) no rounding

      JDBCFeatureSourceTest>>testBoundary

      assertEquals(0d, bounds.getMinX());
      assertEquals(0d, bounds.getMinY());
      assertEquals(2d, bounds.getMaxX());
      assertEquals(2d, bounds.getMaxY());

      should check with rounding, the following would work:

      assertEquals(0d, new Double(Math.round(bounds.getMinX())));
      assertEquals(0d, new Double(Math.round(bounds.getMinY())));
      assertEquals(2d, new Double(Math.round(bounds.getMaxX())));
      assertEquals(2d, new Double(Math.round(bounds.getMaxY())));

      The same holds true for

      JDBCFeatureSourceTest>>testBoundsWithQuery

      assertEquals(1d, new Double(Math.round(bounds.getMinX())));
      assertEquals(1d, new Double(Math.round(bounds.getMinY())));
      assertEquals(1d, new Double(Math.round(bounds.getMaxX())));
      assertEquals(1d, new Double(Math.round(bounds.getMaxY())));

      Reason 2) CRS check in

      JDBCFeatureSourceTest>>testSchema
      JDBCFeatureSourceTest>>testBoundary
      JDBCFeatureSourceTest>>testBoundaryWithQuery

      The line

      assertEquals(CRS.decode("EPSG:4326"), bounds.getCoordinateReferenceSystem());

      is hard stuff. DB2 Spatial Extender has his WGS 84 CRS , but it is not equal as implemented in geotools.

      A good idea would be to introduce a protected method

      protected boolean areCRSEqual(crs1, csr2) {
      return crs1.equals(crs2);
      }

      und use it

      assertTrue(areCRSEqual(CRS.decode("EPSG:4326"), bounds.getCoordinateReferenceSystem()));

      This would give me the possiblity to do my own special equal check in my Test class.

        Activity

        Hide
        Christian Mueller added a comment -
        Simple correction of JDBCFeatureSourceTest to work with DB2 Spatial Extender.

        Added protected Mehtod areCRSEqual(crs1,crs2) to JDBCTestSupport.java giving all subclasses the possiblity for comparing coordinate reference systems and giving the special test cases for a particular dbms
        the possibility to implement the proper compare logic for their own CRS definitions.
        Show
        Christian Mueller added a comment - Simple correction of JDBCFeatureSourceTest to work with DB2 Spatial Extender. Added protected Mehtod areCRSEqual(crs1,crs2) to JDBCTestSupport.java giving all subclasses the possiblity for comparing coordinate reference systems and giving the special test cases for a particular dbms the possibility to implement the proper compare logic for their own CRS definitions.
        Hide
        Andrea Aime added a comment -
        Mass closing all issues that have been in "resolved" state for 2 months or more without any feedback or update
        Show
        Andrea Aime added a comment - Mass closing all issues that have been in "resolved" state for 2 months or more without any feedback or update

          People

          • Assignee:
            Christian Mueller
            Reporter:
            Christian Mueller
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: