@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 { 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 { 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(); System.setProperty(XacmlRestProperties.PROP_PAP_TRANS_WAIT, "1000"); System.setProperty(XacmlRestProperties.PROP_PAP_TRANS_TIMEOUT, "5000"); 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()); try { PolicyDbDaoTransaction t2 = dbd2.getNewTransaction(); 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.fail("\n\nTransaction timeout of 1000 ms exceeded without a PersistenceException\n\n"); } catch (PersistenceException e) { 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) { 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"); } }
public PolicyDbDaoTransaction getNewTransaction() { logger.debug("getNewTransaction() as getNewTransaction() called"); return new PolicyDbDaoTransactionInstance("init"); }
PolicyDbDao { public PolicyDbDaoTransaction getNewTransaction() { logger.debug("getNewTransaction() as getNewTransaction() called"); return new PolicyDbDaoTransactionInstance("init"); } }
PolicyDbDao { public PolicyDbDaoTransaction getNewTransaction() { logger.debug("getNewTransaction() as getNewTransaction() called"); return new PolicyDbDaoTransactionInstance("init"); } @Autowired  PolicyDbDao(SessionFactory sessionFactory);  PolicyDbDao();  PolicyDbDao(String init); }
PolicyDbDao { public PolicyDbDaoTransaction getNewTransaction() { logger.debug("getNewTransaction() as getNewTransaction() called"); return new PolicyDbDaoTransactionInstance("init"); } @Autowired  PolicyDbDao(SessionFactory sessionFactory);  PolicyDbDao();  PolicyDbDao(String init); static PolicyDbDao getPolicyDbDaoInstance(); void setPapEngine(PAPPolicyEngine papEngine2); @SuppressWarnings("deprecation") void startTransactionSynced(Session session, int waitTime); PolicyDbDaoTransaction getNewTransaction(); PolicyDbDaoTransaction getNewAuditTransaction(); static boolean stringEquals(String one, String two); String[] getPapUrlUserPass(); String[] splitPapUrlUserPass(String url); StdPDPGroup synchronizeGroupPoliciesInFileSystem(StdPDPGroup pdpGroup, GroupEntity groupentity); String removeExtensionAndVersionFromPolicyName(String originalPolicyName); String[] getPolicyNameAndVersionFromPolicyFileName(String originalPolicyName); String getPdpPolicyName(String name, String scope); void auditLocalDatabase(PAPPolicyEngine papEngine2); StdPDPGroup auditLocalFileSystem(StdPDPGroup group); void synchronizeConfigDataInFileSystem(); void deleteAllGroupTables(); @SuppressWarnings("unchecked") void auditGroups(PAPPolicyEngine papEngine2); String getConfigFile(String filename, PolicyRestAdapter policy); String getConfigFile(String inputFilename, String configType); String[] getNameScopeAndVersionFromPdpPolicy(String fileName); static String createNewPdpGroupId(String name); static boolean isNullOrEmpty(String... strings); List<?> getOtherServers(); void setOtherServers(List<?> otherServers); PAPPolicyEngine getPapEngine(); static boolean isJunit(); static void setJunit(boolean isJunit); static PolicyDbDaoTestClass getPolicyDbDaoTestClass(); }
PolicyDbDao { public PolicyDbDaoTransaction getNewTransaction() { logger.debug("getNewTransaction() as getNewTransaction() called"); return new PolicyDbDaoTransactionInstance("init"); } @Autowired  PolicyDbDao(SessionFactory sessionFactory);  PolicyDbDao();  PolicyDbDao(String init); static PolicyDbDao getPolicyDbDaoInstance(); void setPapEngine(PAPPolicyEngine papEngine2); @SuppressWarnings("deprecation") void startTransactionSynced(Session session, int waitTime); PolicyDbDaoTransaction getNewTransaction(); PolicyDbDaoTransaction getNewAuditTransaction(); static boolean stringEquals(String one, String two); String[] getPapUrlUserPass(); String[] splitPapUrlUserPass(String url); StdPDPGroup synchronizeGroupPoliciesInFileSystem(StdPDPGroup pdpGroup, GroupEntity groupentity); String removeExtensionAndVersionFromPolicyName(String originalPolicyName); String[] getPolicyNameAndVersionFromPolicyFileName(String originalPolicyName); String getPdpPolicyName(String name, String scope); void auditLocalDatabase(PAPPolicyEngine papEngine2); StdPDPGroup auditLocalFileSystem(StdPDPGroup group); void synchronizeConfigDataInFileSystem(); void deleteAllGroupTables(); @SuppressWarnings("unchecked") void auditGroups(PAPPolicyEngine papEngine2); String getConfigFile(String filename, PolicyRestAdapter policy); String getConfigFile(String inputFilename, String configType); String[] getNameScopeAndVersionFromPdpPolicy(String fileName); static String createNewPdpGroupId(String name); static boolean isNullOrEmpty(String... strings); List<?> getOtherServers(); void setOtherServers(List<?> otherServers); PAPPolicyEngine getPapEngine(); static boolean isJunit(); static void setJunit(boolean isJunit); static PolicyDbDaoTestClass getPolicyDbDaoTestClass(); static final String JSON_CONFIG; static final String XML_CONFIG; static final String PROPERTIES_CONFIG; static final String OTHER_CONFIG; static final String AUDIT_USER; static final String CONFIG; static final String ACTION; static final String GROUP_ID; static final String DELETED; static final String GROUPENTITY_SELECT; static final String PDPENTITY_SELECT; static final String GROUP_NOT_FOUND; static final String FOUND_IN_DB_NOT_DEL; static final String MORE_THAN_ONE_PDP; static final String DELETED_STATUS_FOUND; static final String DUPLICATE_GROUPID; static final String PDP_ID; static final String QUERY_FAILED_FOR_GROUP; static final String QUERY_FAILED_GET_GROUP; static final String SCOPE; static final String POLICYDBDAO_VAR; static final String DUP_POLICYID; static final String FOUND_IN_DB; }