The EndToEnd test, which is an embedded jetty server will test the
Rest interface, you just need to provide the replacement Guice module.
If the Entity manager is not thread safe, then you probably need some
sort of EntityManager pool that binds to the request thread on first
use, and unbinds when the request ends. Typically this can be done by
binding to a thread local and a request attribute, and then listening
to the unbind on the request attribute (or use a Filter to unbind.)
Yes, all patches gratefully accepted. (after review obviously, but
you have a 100% hit rate so far:) )
Ian
On 12 Nov 2008, at 09:59, Ben Smith wrote:
That seems to do the trick. Cheers!
The only other thing I needed was a provider for an EntityManager.
I guess I'll get on with writing more JPA tests. Are there any
existing functional tests for the REST interface that can be run?
Would you like me to submit the Guice module and
EntityManagerProvider? I'm not sure this is the best approach as I
don't think the EntityManager is thread-safe. Let me know.
Cheers,
Ben
On 11 Nov 2008, at 22:19, Ian Boston wrote:
So you will need to add bundle the samples jar with its
persistance.xml into the webapp, and then you will need to create
a new module eg JPASPIModule that contains bindings for all the
SPI implementations. These should be off the form
bind(spiclass.class).to(spiimplementationclass.class).inScope
(Scopes.SINGLETON);
eg
bind(PersonService.class).to(PersonServiceDb.class).inScope
(Scopes.SINGLETOM);
then add the full classname of the JPASPIModule at the end of the
other modules in web.xml
That *should* be all you need to do.
If you want to see an example of taking the the Shindig jars and
build a set of custom webapps, there is an example I did a few
days ago at
https://source.sakaiproject.org/contrib/tfd/trunk/shindigadapter/
This only replaces the AuthenticationHandlers, but I gives you an
idea of how to package and extend Shindig. I am bundling 2
separate webapps in this example.
HTH
Ian
On 11 Nov 2008, at 18:08, Ben Smith wrote:
Hi,
I've been playing around with the sample JPA layer, tying it into
hibernate and submitting patches.
I realise that this is less complete than the rest of the Shindig
sections and I'm looking to bulk up the functional tests that are
already provided.
However, I'm really keen to get this working and have Shindig run
off the persistence layer so I'd really appreciate any help you
can give me. I'm assuming I want to add a new Guice module to the
web.xml but I'm a bit lost when it comes to knowing what
implementations need to be injected where and how do I bootstrap
the app to pick up the appropriate persistence.xml configuration.
Please help!
Ben