Пример #1
0
 @Before
 public void setUp() throws Exception {
   super.setUp();
   EntityManagerFactory entityManagerFactory =
       applicationContext.getBean("entityManagerFactory", EntityManagerFactory.class);
   transactionTemplate =
       applicationContext.getBean("transactionTemplate", TransactionTemplate.class);
   entityManager = entityManagerFactory.createEntityManager();
   cleanupRepository();
 }
Пример #2
0
 @Override
 protected CamelContext createCamelContext() throws Exception {
   setThreadContextClassLoader();
   applicationContext =
       new OsgiBundleXmlApplicationContext(
           new String[] {"org/apache/camel/itest/osgi/jpa/springJpaRouteContext.xml"});
   if (bundleContext != null) {
     applicationContext.setBundleContext(bundleContext);
     applicationContext.refresh();
   }
   return SpringCamelContext.springCamelContext(applicationContext);
 }
Пример #3
0
 @After
 public void tearDown() {
   try {
     super.tearDown();
     if (applicationContext != null) {
       if (applicationContext.isActive()) {
         IOHelper.close(applicationContext);
       }
       applicationContext = null;
     }
   } catch (Exception exception) {
     // Don't throw the exception in the tearDown method
   }
 }