[seam-dev] Arquillian questions
Jason Porter
lightguard.jp at gmail.com
Tue Nov 29 11:16:23 EST 2011
Mark, I think Aslak watches this list loosely, you're probably best off to ask on the Arquillian forums at community.jboss.org.
Sent from my iPhone
On Nov 29, 2011, at 8:59, Mark Struberg <struberg at yahoo.de> wrote:
> Hi folks!
>
> I'm not sure if this is the right list, but I have some Arquillian questions.
>
> I have a testng test for services which use a @RequestScoped EntityManager:
>
>
> MyTest extends Arquillian {
>
> private @Inject EntityManager em;
> private @Inject MyService mySvc;
>
> @BeforeClass
> public void setupTests() {
> em.getTransaction().begin();
> em.delete(em.find(MyEntity.class, TEST_ID));
> em.getTransaction().commit();
> }
>
> @Test
> public void test1() {
> mySvc.doDbStuff1();
> }
>
> @Test
> public void test2() {
> mySvc.doDbStuff2();
> }
> }
>
> Since my service methods in the tests and @BeforeClass @AfterClass, etc all use the @RequestScoped EntityManager, each of those methods needs to get treated like an own Request.
>
> Also: is there some way to manually restart the RequestContext? This is e.g. needed to simulate some issues with detached entities. I basically need full programmatical control over the various Context start/stop in my unit tests!
>
> LieGrue,
> strub
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
More information about the seam-dev
mailing list