[Geoserver-devel] note on testing

Hi all,

I just spent an hour or so trying to track down a test failure issue, and thought i would share the results with you.

Any test code that initializes the GEOSERVER_DATA_DIR manually will throw off any of the mock tests. The reason being the blasted GeoServerDirectory singleton that holds onto its resource loader. So any future attempts at setting up the data directory are futile.

Morale of the story, don't call GeoServerDataDirectory.init() from test cases.

-Justin

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

Hi all,

I just spent an hour or so trying to track down a test failure issue, and thought i would share the results with you.

Any test code that initializes the GEOSERVER_DATA_DIR manually will throw off any of the mock tests. The reason being the blasted GeoServerDirectory singleton that holds onto its resource loader. So any future attempts at setting up the data directory are futile.

Morale of the story, don't call GeoServerDataDirectory.init() from test cases.

GeoServerDataDir is blasted all right. But I'm wondering why you'd
want to use MockData and set a data dir at the same time.
We have the LiveData class for cases where you are trying to use
a pre-built data directory.

Cheers
Andrea

GeoServerDataDir is blasted all right. But I'm wondering why you'd
want to use MockData and set a data dir at the same time.
We have the LiveData class for cases where you are trying to use
a pre-built data directory.

I am not. The test in question was creating its own data directory for some reason. So I just changed it to extend GEoServerTesSupport, grabbed the data dir root and it worked like a charm, with a lot less code :).

Cheers
Andrea

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:4007,47f65ec878722458217002!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

GeoServerDataDir is blasted all right. But I'm wondering why you'd
want to use MockData and set a data dir at the same time.
We have the LiveData class for cases where you are trying to use
a pre-built data directory.

I am not. The test in question was creating its own data directory for some reason. So I just changed it to extend GEoServerTesSupport, grabbed the data dir root and it worked like a charm, with a lot less code :).

+1000 for simple solutions :slight_smile:
Cheers
Andrea