Hi,
as you probably know the current blue state of the geotools online build is
due, among other
things, to the postgis tests switching to offline mode mid way because the
jndi test fails the
onlin test, causing all other tests to be skipped:
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.318
sec - in org.geotools.data.postgis.PostgisGeometrylessOnlineTest
Running org.geotools.data.postgis.PostgisJNDIDataSourceOnlineTest
javax.naming.ContextNotEmptyException
at
org.osjava.sj.jndi.AbstractContext.destroySubcontext(AbstractContext.java:551)
at
org.osjava.sj.jndi.AbstractContext.destroySubcontext(AbstractContext.java:561)
at
javax.naming.InitialContext.destroySubcontext(InitialContext.java:475)
at
org.osjava.sj.jndi.DelegatingContext.destroySubcontext(DelegatingContext.java:116)
at org.osjava.sj.loader.JndiLoader.jndiPut(JndiLoader.java:316)
at org.osjava.sj.loader.JndiLoader.load(JndiLoader.java:277)
at org.osjava.sj.loader.JndiLoader.loadDirectory(JndiLoader.java:156)
at org.osjava.sj.loader.JndiLoader.loadDirectory(JndiLoader.java:104)
at org.osjava.sj.SimpleContext.<init>(SimpleContext.java:98)
at
org.osjava.sj.SimpleContextFactory.getInitialContext(SimpleContextFactory.java:69)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:192)
at
org.geotools.jdbc.JDBCJNDITestSetup.createDataSource(JDBCJNDITestSetup.java:92)
at org.geotools.jdbc.JDBCTestSetup.getDataSource(JDBCTestSetup.java:85)
at org.geotools.jdbc.JDBCTestSupport.isOnline(JDBCTestSupport.java:100)
at
org.geotools.test.OnlineTestCase.checkAvailable(OnlineTestCase.java:144)
at org.geotools.test.OnlineTestCase.run(OnlineTestCase.java:122)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Error occurred tearing down the test setup
Skipping postgis tests, resources not available: java.lang.NullPointerException
java.lang.RuntimeException: java.lang.NullPointerException
at org.geotools.jdbc.JDBCTestSupport.isOnline(JDBCTestSupport.java:106)
at
org.geotools.test.OnlineTestCase.checkAvailable(OnlineTestCase.java:144)
at org.geotools.test.OnlineTestCase.run(OnlineTestCase.java:122)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: java.lang.NullPointerException
at org.geotools.jdbc.JDBCTestSupport.isOnline(JDBCTestSupport.java:101)
... 11 more
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.036
sec - in org.geotools.data.postgis.PostgisJNDIDataSourceOnlineTest
Running org.geotools.data.postgis.PostgisJoinOnlineTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004
sec - in org.geotools.data.postgis.PostgisJoinOnlineTest
Running org.geotools.data.postgis.PostgisLobOnlineTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001
sec - in org.geotools.data.postgis.PostgisLobOnlineTest
Running org.geotools.data.postgis.PostgisNGCreateDatabaseOnlineTest
Skipping postgis-createdrop tests. Fixture file
/var/lib/jenkins/.geotools/postgis-createdrop.properties not found.
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
- in org.geotools.data.postgis.PostgisNGCreateDatabaseOnlineTest
Running org.geotools.data.postgis.PostgisNGDataStoreFactoryOnlineTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001
sec - in org.geotools.data.postgis.PostgisNGDataStoreFactoryOnlineTest
Running org.geotools.data.postgis.PostgisNoPrimaryKeyOnlineTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001
sec - in org.geotools.data.postgis.PostgisNoPrimaryKeyOnlineTes
Now, I was thinking, a simple way to avoid this issue is to stop
re-checking online status once we established
we are online, in OnlineTestCase.checkAvailable:
boolean checkAvailable() {
configureFixture();
if (fixture == null) {
return false;
} else {
String fixtureId = getFixtureId();
// do an online/offline check
Boolean available = (Boolean) online.get(fixtureId);
if (available == null || available.booleanValue()) { << here!
// test the connection
try {
available = isOnline();
} catch (Throwable t) {
System.out.println("Skipping " + fixtureId
+ " tests, resources not available: " +
t.getMessage());
t.printStackTrace();
available = Boolean.FALSE;
}
online.put(fixtureId, available);
}
return available;
}
}
Basically I would switch the test to simply:
if (available == null || available.booleanValue()) { << here!
This way once "available" has been set, we stay that way for the rest of
the test.
One downside, the fixture ids must be really unique across modules (test
JVMs
are reused among modules)... which well, they should already be
Opinions?
Cheers
Andrea
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
-------------------------------------------------------
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel