@@ -0,0 +1,2100 @@
+package beaform;%0A%0Aimport java.util.List;%0A%0Aimport javax.persistence.EntityManager;%0Aimport javax.persistence.Query;%0Aimport javax.transaction.HeuristicMixedException;%0Aimport javax.transaction.HeuristicRollbackException;%0Aimport javax.transaction.NotSupportedException;%0Aimport javax.transaction.RollbackException;%0Aimport javax.transaction.SystemException;%0Aimport javax.transaction.TransactionManager;%0A%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport beaform.dao.GraphDbHandlerForJTA;%0Aimport beaform.debug.DebugUtils;%0Aimport beaform.entities.Formula;%0Aimport junit.framework.TestCase;%0A%0A/**%0A * Test some debugging utilities%0A *%0A * @author Steven Post%0A *%0A */%0Apublic class Debug extends TestCase %7B%0A%0A%09/** a logger */%0A%09private static final Logger LOG = LoggerFactory.getLogger(DebugUtils.class);%0A%0A%09/** The query to list all formulas */%0A%09private static final String ALL_FORMULAS = %22match (n:Formula) return n%22;%0A%0A%09/**%0A%09 * %7B@inheritDoc%7D%0A%09 */%0A%09@Override%0A%09@Before%0A%09public void setUp() %7B%0A%09%09DebugUtils.fillDb();%0A%09%7D%0A%0A%09/**%0A%09 * Test a simple cleanup.%0A%09 */%0A%09@Test%0A%09public static void testCleanupSimple() %7B%0A%09%09DebugUtils.clearDb();%0A%09%09final TransactionManager transactionMgr = GraphDbHandlerForJTA.getTransactionManager();%0A%0A%09%09try %7B%0A%09%09%09transactionMgr.begin();%0A%09%09%7D%0A%09%09catch (NotSupportedException %7C SystemException e1) %7B%0A%09%09%09LOG.error(e1.getMessage(), e1);%0A%09%09%09return;%0A%09%09%7D%0A%0A%09%09final EntityManager entityManager = GraphDbHandlerForJTA.getNewEntityManager();%0A%0A%09%09final Query query = entityManager.createNativeQuery(ALL_FORMULAS, Formula.class);%0A%09%09final List%3CFormula%3E formulas = query.getResultList();%0A%0A%0A%09%09GraphDbHandlerForJTA.tryCloseEntityManager(entityManager);%0A%0A%09%09try %7B%0A%09%09%09transactionMgr.commit();%0A%09%09%7D%0A%09%09catch (SecurityException %7C IllegalStateException %7C RollbackException %7C HeuristicMixedException%0A%09%09%09%09%09%09%7C HeuristicRollbackException %7C SystemException e1) %7B%0A%09%09%09LOG.error(e1.getMessage(), e1);%0A%09%09%7D%0A%0A%09%09LOG.debug(ALL_FORMULAS);%0A%09%09assertEquals(%22Collection is not empty%22, 0, formulas.size());%0A%09%7D%0A%0A%09@Override%0A%09@After%0A%09public void tearDown() %7B%0A%0A%09%7D%0A%0A%7D%0A

Add a new unit test