Package org.smpp

Examples of org.smpp.Session$UnbindServerPDUEventListener


        SessionPoolImpl pool = new TestSessionPool(10, 3, 7);
        Iterator i = pool.iterator();
        int count = 0;
        // Should invalidate the available sessions (not any currently active).
        while (i.hasNext()) {
            Session session = (Session) i.next();
            pool.invalidateObject(session);
            count++;
        }
        assertEquals(7, count);
    }
View Full Code Here


    public void testBorrowObjectWhenEmpty() throws Exception {
        SessionPoolImpl pool = new TestSessionPool(5, 0, 0);
        assertEquals(0, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
        Session session = (Session) pool.borrowObject();
        assertEquals(1, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
    }
View Full Code Here

    public void testBorrowObjectWhenSessionIsAvailable() throws Exception {
        SessionPoolImpl pool = new TestSessionPool(5, 0, 1);
        assertEquals(0, pool.getNumActive());
        assertEquals(1, pool.getNumIdle());
        Session session = (Session) pool.borrowObject();
        assertEquals(1, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
    }
View Full Code Here

        assertEquals(0, pool.getNumActive());
        assertEquals(3, pool.getNumIdle());

        // Should ignore the first invalid element and return the second valid
        // session.
        Session session = (Session) pool.borrowObject();

        // Can't check the number of idle Sessions at this point, because the
        // objects in the set could be returned in any order.
        assertEquals(1, pool.getNumActive());

        // There was only one valid session in the pool, so when a second one
        // is requested this should guarantee that the invalid ones are removed
        // and a new one is created (because we still have room).
        Session sessionTwo = (Session) pool.borrowObject();
        assertNotEquals(invalidObject, sessionTwo);
        assertNotEquals(invalidObjectTwo, sessionTwo);
        assertNotEquals(session, sessionTwo);
        assertEquals(2, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
View Full Code Here

        assertEquals(0, pool.getNumActive());
        assertEquals(3, pool.getNumIdle());

        // Should ignore the first invalid element and return the second valid
        // session.
        Session session = (Session) pool.borrowObject();

        // Can't check the number of idle Sessions at this point, because the
        // objects in the set could be returned in any order.
        assertEquals(1, pool.getNumActive());

        // There was only one valid session in the pool, so when a second one
        // is requested this should guarantee that the invalid ones are removed
        // and a new one is created (because we still have room).
        Session sessionTwo = (Session) pool.borrowObject();
        assertNotEquals(invalidObject, sessionTwo);
        assertNotEquals(invalidObjectTwo, sessionTwo);
        assertNotEquals(session, sessionTwo);
        assertEquals(2, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
View Full Code Here

        assertEquals(0, pool.getNumIdle());
    }

    public void testReturnObjectWhenFromPool() throws Exception {
        SessionPoolImpl pool = new TestSessionPool(5, 0, 0);
        Session session = (Session) pool.borrowObject();
        assertEquals(1, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
        pool.returnObject(session);
        assertEquals(0, pool.getNumActive());
        assertEquals(1, pool.getNumIdle());
View Full Code Here

    public void testReturnObjectWhenNotFromPool() throws Exception {
        SessionPoolImpl pool = new TestSessionPool(5, 0, 0);
        pool.borrowObject();
        assertEquals(1, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
        Session session = (Session) sessionFactory.makeObject();
        try {
            pool.returnObject(session);
            fail("Should throw an exception if attempting to return an " +
                    "object to a pool which wasn't in it.");
        } catch (SessionException e) {
View Full Code Here

    public void testReturnObjectWhenNoneActive() throws Exception {
        SessionPoolImpl pool = new TestSessionPool(5, 0, 0);
        // Try to return an object that did come from this pool, but is not
        // active at present (returning objects that didn't come from this pool
        // is captured in #testBorrowObjectWhenNotFromPool)
        Session session = (Session) pool.borrowObject();
        pool.returnObject(session);
        try {
            pool.returnObject(session);
            fail("Should throw an exception if attempting to return an " +
                    "object to a pool which wasn't in it.");
View Full Code Here

        }
    }

    public void testInvalidateActiveSession() throws Exception {
        SessionPoolImpl pool = new TestSessionPool(5, 0, 0);
        Session session = (Session) pool.borrowObject();
        assertEquals(1, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
        pool.invalidateObject(session);
        assertEquals(0, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
View Full Code Here

    }

    public void testInvalidateAvailableSession() throws Exception {
        SessionPoolImpl pool = new TestSessionPool(5, 0, 1);
        assertEquals(1, pool.available.size());
        Session session = (Session)pool.available.iterator().next();
        assertEquals(0, pool.getNumActive());
        assertEquals(1, pool.getNumIdle());
        pool.invalidateObject(session);
        assertEquals(0, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
View Full Code Here

TOP

Related Classes of org.smpp.Session$UnbindServerPDUEventListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.