History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: NXP-1584
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Georges Racinet
Reporter: Georges Racinet
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Nuxeo Enterprise Platform

[NXRuntimeTestCase] allow loading of resources with no duplication nor ambiguity

Created: 26/09/07 15:55   Updated: 19/10/07 18:00
Component/s: Runtime
Affects Version/s: None
Fix Version/s: 5.2 M1, 5.1.2

Time Tracking:
Not Specified

File Attachments: 1. Text File runtime-osgi.patch (0.5 kb)


Resolution Date: 19/10/07 18:00
Require Callback: No
Participants: Georges Racinet
Tags:


 Description  « Hide
The current deploy() method looks for xml contributions in the current classpath. First one hence wins. To be sure which resource is actually loaded it led everyone to override basic xml configuration that doesn't need to in their integration JUnit tests.

Here are the use cases NXRuntimeTestCase should implement (summary of discussion with Bogdan S)

     - deploy a whole jar with its OSGI-INF configuration: typical for an integration test: we want e.g, the schema service to be available in the same way it is in the application. Maybe follow dependencies, here, or at least *loudly* stop in case some are missing
     - control which jars are actually deployed: we might have a dependency to core packages to get an interface/class and still not want to construct a full Nuxeo Core instance
     - override the configuration that sits in the jar (we could use test/resources as an equivalent to /config in nuxeo.ear, but this has to stay manual). Typical use-case: fake ram repository,
     - true unit tests can go on using
     - I don't think we need to load test resources from a jar in dependencies: we've always used separated *-test packages for generic helpers; they can provide resources for their test clients in src/main/resources

A good deal of the problems with non nxruntime resources (schemas etc) can be solved, I guess, by the fact that they would be now deployed where they are defined, as normal (non test) resources, if one deploys the whole jar that usually defines them.


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Georges Racinet - 28/09/07 16:57
Done in trunk (rev 25540)
It's almost fully compatible with the previous iteration of NXRuntimeTestCase (see rev 25541)
Sample usage in nuxeo-platform-search-api: rev 25544

There are quite a bunch of new stacktraces in the logs, but that's because the runtime's deployment is a bit too wide,

Georges Racinet - 29/09/07 16:57
There is one remaining source of discrepancies between different types of runs:

BundleImpl.getResource relies on the class loaders, which in case of Eclipse test runs, will peek the resource from the first project (main or test) on the classpath.

I propose to look first strictly in current bundle and fall back to the classloaders. This has potential impact on all NXRuntime based applications. On the other hand, the kind of duplication we have in tests should not occur in any true app. Bogdan, an advice ?

Georges Racinet - 29/09/07 17:01
Attached patch with which I could successfully adapt long-time disabled maven tests from nuxeo-platform-search-core to the new deployBundle() scheme

Georges Racinet - 12/10/07 12:52
Problem of too wide deployment fixed, new depployCOntrib(bundle, contrib) in 5.1 branch [25932]

Georges Racinet - 19/10/07 18:00
[25932] forward-ported [25934]. Time to resolve