public void testLookupByName() { this.log("to test lookupByName() ..."); IConnectionProvider provider = null; try { String sName = "Local"; System.out.println("\n\n to find connection provider " + sName + "..."); provider = ConnectionProviderFactory.lookupByName(sName); if (provider == null) { fail("connection provider " + sName + " is not found"); } // else System.out.println("connection provider " + sName + " is found"); System.out.println(provider.toString()); long lStartTime, lEndTime; Connection connection; for (int i = 0; i < 8; i++) { try { lStartTime = System.currentTimeMillis(); connection = provider.getConnection(); lEndTime = System.currentTimeMillis(); System.out.println( "[" + (i + 1) + "] connection is fetched using time " + (lEndTime - lStartTime) + "ms"); if ((i / 4) % 2 == 1) { provider.closeConnection(connection); } } catch (Exception ex) { ex.printStackTrace(System.out); } System.out.println("\nto sleep 1s..."); Thread.sleep(1000); } assertTrue(true); } catch (Exception ex) { ex.printStackTrace(System.out); fail(ex.getMessage()); } finally { if (provider != null) { provider.clear(); } } }