@Ignore
@Test
public void threadingStabilityTest() {

    if (logger.isDebugEnabled()) {
        logger.debug("\n\n****************************" + "threadingStabilityTest() entry"
                + "******************************\n\n");
    }
    PolicyDbDaoTransaction t = dbd.getNewTransaction();
    Assert.assertTrue(t.isTransactionOpen());
    try {
        // Add 1000 ms to the timeout just to be sure it actually times out
        int sleepTime =
                Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_TRANS_TIMEOUT)) + 1000;
        if (logger.isDebugEnabled()) {
            Date date = new java.util.Date();
            logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   sleepTime =  " + sleepTime
                    + "\n   TimeStamp = " + date.getTime() + "\n\n");
        }
        Thread.sleep(sleepTime);
    } catch (InterruptedException e) {
        logger.error("Exception Occured" + e);
    }
    if (logger.isDebugEnabled()) {
        Date date = new java.util.Date();
        logger.debug(
                "\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   Assert.assertFalse(t.isTransactionOpen() = "
                        + t.isTransactionOpen() + ")" + "\n   TimeStamp = " + date.getTime() + "\n\n");
    }
    Assert.assertFalse(t.isTransactionOpen());
    if (logger.isDebugEnabled()) {
        Date date = new java.util.Date();
        logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   a = dbd.getNewTransaction() "
                + "\n   TimeStamp = " + date.getTime() + "\n\n");
    }
    PolicyDbDaoTransaction a = dbd.getNewTransaction();
    if (logger.isDebugEnabled()) {
        Date date = new java.util.Date();
        logger.debug(
                "\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   Assert.assertTrue(a.isTransactionOpen() = "
                        + a.isTransactionOpen() + ")" + "\n   TimeStamp = " + date.getTime() + "\n\n");
    }
    Assert.assertTrue(a.isTransactionOpen());
    try {
        // Add 1000 ms to the timeout just to be sure it actually times out
        int sleepTime =
                Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_TRANS_TIMEOUT)) + 1000;
        if (logger.isDebugEnabled()) {
            Date date = new java.util.Date();
            logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   sleepTime =  " + sleepTime
                    + "\n   TimeStamp = " + date.getTime() + "\n\n");
        }
        Thread.sleep(sleepTime);
    } catch (InterruptedException e) {
        logger.error("Exception Occured" + e);
    }
    if (logger.isDebugEnabled()) {
        Date date = new java.util.Date();
        logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   b = dbd.getNewTransaction() "
                + "\n   TimeStamp = " + date.getTime() + "\n\n");
    }
    PolicyDbDaoTransaction b = dbd.getNewTransaction();
    if (logger.isDebugEnabled()) {
        Date date = new java.util.Date();
        logger.debug(
                "\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   Assert.assertFalse(a.isTransactionOpen() = "
                        + a.isTransactionOpen() + ")" + "\n   TimeStamp = " + date.getTime() + "\n\n");
    }
    Assert.assertFalse(a.isTransactionOpen());
    if (logger.isDebugEnabled()) {
        Date date = new java.util.Date();
        logger.debug(
                "\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   Assert.assertTrue(b.isTransactionOpen() = "
                        + b.isTransactionOpen() + ")" + "\n   TimeStamp = " + date.getTime() + "\n\n");
    }
    Assert.assertTrue(b.isTransactionOpen());
    b.close();
    // Now let's test the transaction wait time timeout. Shorten the wait time to 1000 ms
    System.setProperty(XacmlRestProperties.PROP_PAP_TRANS_WAIT, "1000");
    // And let's lengthen the transaction timeout to 5000 ms
    System.setProperty(XacmlRestProperties.PROP_PAP_TRANS_TIMEOUT, "5000");
    // get a transacton
    PolicyDbDaoTransaction t1 = dbd.getNewTransaction();
    if (logger.isDebugEnabled()) {
        Date date = new java.util.Date();
        logger.debug(
                "\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   Assert.assertTrue(t1.isTransactionOpen() = "
                        + t1.isTransactionOpen() + ")" + "\n   TimeStamp = " + date.getTime() + "\n\n");
    }
    Assert.assertTrue(t1.isTransactionOpen());
    // while it is open, get another from a different DB Dao so it will not collide on the synchronized
    // code segment
    // but will collide at the DB. Remember that the wait time is only 1000 ms
    try {
        // Now the 2nd transaction has a wait timeout in 1000 ms
        PolicyDbDaoTransaction t2 = dbd2.getNewTransaction();
        /*
         * Give it plenty of time to time out the second transaction It will actually hang right here until
         * it either gets the lock from the DB or the request for the DB lock times out. The timers are very
         * sloppy so, I have given this plenty of leeway.
         */
        if (logger.isDebugEnabled()) {
            Date date = new java.util.Date();
            logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n   Thread.sleep(3000)"
                    + "\n   TimeStamp = " + date.getTime() + "\n\n");
        }
        Thread.sleep(3000);
        if (logger.isDebugEnabled()) {
            Date date = new java.util.Date();
            logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() "
                    + "\n   Assert.assertTrue(t1.isTransactionOpen() = " + t1.isTransactionOpen() + ")"
                    + "\n   Assert.assertFalse(t2.isTransactionOpen() = " + t2.isTransactionOpen() + ")"
                    + "\n   TimeStamp = " + date.getTime() + "\n\n");
        }
        // Assert.assertTrue(t1.isTransactionOpen());
        // Assert.assertFalse(t2.isTransactionOpen());
        Assert.fail("\n\nTransaction timeout of 1000 ms exceeded without a PersistenceException\n\n");
    } catch (PersistenceException e) {
        // success
        if (logger.isDebugEnabled()) {
            Date date = new java.util.Date();
            logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() "
                    + "\n   SUCCESS! Transaction Wait Timeout worked!" + "\n   Caught PersistenceException = " + e
                    + "\n   TimeStamp = " + date.getTime() + "\n\n");
        }
    } catch (Exception e) {
        // failure due to some other reason
        if (logger.isDebugEnabled()) {
            Date date = new java.util.Date();
            logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() FAILURE" + "\n   Caught Exception = " + e
                    + "\n   TimeStamp = " + date.getTime() + "\n\n");
        }
        logger.error("Exception Occured" + e);
        Assert.fail();
    }
    if (logger.isDebugEnabled()) {
        Date date = new java.util.Date();
        logger.debug("\n\nthreadingStabilityTest() exit" + "\n   TimeStamp = " + date.getTime() + "\n\n");
    }
}