But first the question: was it failing before? Tests are often added to the base JDBC*Test classes, and tested on a bunch of them only... like, NOT Oracle :-D
Cheers Andrea On Sat, Apr 25, 2020 at 3:10 AM Jody Garnett <jody.garn...@gmail.com> wrote: > 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 > -- Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- *Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.*
_______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel