@Test
public void lifeCycleTest() {
EntityManagerFactory emf = mockEmf();
Coordinator coordinator = new DummyCoordinator();
EMSupplierImpl emSupplier = new EMSupplierImpl("myunit", emf, coordinator);
assertIllegalState(emSupplier);
coordinator.begin("test", 0);
EntityManager em = emSupplier.get();
Assert.assertNotNull("EM should be present after preCall", em);
coordinator.begin("testinner", 0);
Assert.assertSame("Same EM for inner preCall", em, emSupplier.get());
coordinator.pop().end();
Assert.assertSame("EM must still be the same after inner postCall", em, emSupplier.get());
coordinator.pop().end();
assertIllegalState(emSupplier);
boolean clean = emSupplier.close();
Assert.assertTrue("Shutdown should be clean", clean);
}
EmSupplierTest.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:aries-jpa
作者:
评论列表
文章目录