My first thought is the previous driver also had to wrestle with Oracle's representation of Numbers and was able to sort things out.
* Can we find any logic that handled this previously? * Can we step through the old code with a debugger and see how it made the decision to convert from BigDecimal to Integer? (There is obviously some logic as it managed the conversion from BigDecimal to Double) -- Jody Garnett On Thu, 23 Apr 2020 at 02:28, Mark Prins <mc.pr...@gmail.com> wrote: > > > Op di 21 apr. 2020 om 17:51 schreef Mark Prins <mc.pr...@gmail.com>: > >> While working on this PR https://github.com/geotools/geotools/pull/2890 >> to have Online testing of the Oracle JDBC module I'm running into some >> failing tests. >> > >> OracleFeatureSourceOnlineTest>OnlineTestCase.run:112->JDBCFeatureSourceOnlineTest.testMixedEncodeIn:680 >> >> expected:<[zero, two, 1, 2, 0.0]> but was:<[zero, two, 1, 2, 0.0]> >> >> > debugging shows that this test[1] is failing because: > > literals = {ArrayList@4436} size = 5 > 0 = "zero" > 1 = "two" > 2 = {BigDecimal@4442} "1" > 3 = {BigDecimal@4443} "2" > 4 = {Double@4444} 0.0 > > expected = {Arrays$ArrayList@4451} size = 5 > 0 = "zero" > 1 = "two" > 2 = {Integer@4456} 1 > 3 = {Integer@4457} 2 > 4 = {Double@4458} 0.0 > > [1] > https://github.com/geotools/geotools/blob/master/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCFeatureSourceOnlineTest.java#L677 > > This is because Oracle uses BigDecimal for any Number... > > My initial thought was to copy and overide the test into the Oracle > subclass, but that is basically made impossible becasue the test uses the > package private method "splitFilter" ( > https://github.com/geotools/geotools/blob/7925c3f05470aceeab2c2188ea90959466ce0bd2/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCFeatureSource.java#L363 > ) > so that won't fly.. > > My second best option is to extract getting the expected values into a > protected method so dialects can override that, so adding > to JDBCFeatureSourceOnlineTest the following method: > > /** > * @return expected list for {@link #testMixedEncodeIn()} > */ > protected List<Object> getTestMixedEncodeInExpected (){ > return Arrays.asList("zero", "two", 1, 2, 0d); > } > > and adding to OracleFeatureSourceOnlineTest > > /** > * Because Oracle uses "Bigdecimal" for any number we need to change the type > of the objects that are in the list of expected objects. > * > * @return expected list for {@link #testMixedEncodeIn()} > */ > @Override > protected List<Object> getTestMixedEncodeInExpected() { > return Arrays.asList("zero", "two", BigDecimal.valueOf(1), > BigDecimal.valueOf(2), 0d); > } > > > Any other thoughts / ideas? I don't think it would be too useful to reduce > the test to compare two List<String> instead? > > Mark > > -- > Disclaimer; > This message is just a reflection of what I thought at the time of > sending. The message may contain information that is not intended for you > or that you don't understand. > _______________________________________________ > GeoTools-Devel mailing list > GeoTools-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-devel >
_______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel