Package org.smpp

Examples of org.smpp.Session


    public void testInvalidateUnknownSession() throws Exception {
        SessionPoolImpl pool = new TestSessionPool(5, 1, 1);
        assertEquals(1, pool.getNumActive());
        assertEquals(1, pool.getNumIdle());
        Session session = (Session) sessionFactory.makeObject();

        try {
            pool.invalidateObject(session);
            fail("Should throw an exception if attempting to invalidate an " +
                    "object which isn't from this pool");
View Full Code Here


                mockFactory.createOrderedBuilder();
        PoolableSessionFactoryMock sessionFactory =
                new PoolableSessionFactoryMock("sessionFactory",
                        orderedExpectations, ADDRESS, PORT, SMSC_USERNAME,
                        SMSC_PASSWORD, SYNC_BINDTYPE);
        Session badSession = new Session(new TCPIPConnection(ADDRESS, PORT));
        Session goodSession = new Session(new TCPIPConnection(ADDRESS, PORT));
        // Set expectations.
        sessionFactory.expects.validateObject(badSession).returns(false);
        sessionFactory.expects.makeObject().returns(goodSession);
        sessionFactory.expects.validateObject(goodSession).returns(true);
View Full Code Here

                mockFactory.createOrderedBuilder();
        PoolableSessionFactoryMock sessionFactory =
                new PoolableSessionFactoryMock("sessionFactory",
                        orderedExpectations, ADDRESS, PORT, SMSC_USERNAME,
                        SMSC_PASSWORD, SYNC_BINDTYPE);
        Session badSession = new Session(new TCPIPConnection(ADDRESS, PORT));
        Session badSessionTwo = new Session(new TCPIPConnection(ADDRESS, PORT));
        // Set expectations.
        sessionFactory.expects.validateObject(badSession).returns(false);
        sessionFactory.expects.makeObject().returns(badSessionTwo);
        sessionFactory.expects.validateObject(badSessionTwo).returns(false);
View Full Code Here

        HashMap channelInfo = createChannelInfoMap();
        channelInfo.put(LogicaSMSChannelAdapter.BINDTYPE, SYNC_BINDTYPE);
        SessionPoolMock sessionPool =
                new SessionPoolMock("sessionPool", orderedExpectations);
        mockMessage = new MultiChannelMessageMock("mockMessage", orderedExpectations);
        Session badSession = new Session(new TCPIPConnection(ADDRESS, PORT));
        PoolableSessionFactory sessionFactory = new PoolableSessionFactory(
                ADDRESS,  PORT, USERNAME, PASSWORD, SYNC_BINDTYPE);
        Session goodSession = (Session) sessionFactory.makeObject();

        // Set expectations.
        mockMessage.fuzzy.generateTargetMessageAsString(
                mockFactory.expectsInstanceOf(String.class)).
                returns("Test message");
View Full Code Here

        addSendTestExpectations(perThreadExpectations, matcherFive, 11);

        PoolableSessionFactoryMock sessionFactoryMock =
                sessionFactoryWrapper.getMockedObject();

        final Session sessionOne = sessionFactoryWrapper.makeRealSession();
        if (onPoolExhaustion == SessionPoolImpl.WHEN_EXHAUSTED_GROW) {
            // If the pool should grow when exhausted then basically the max
            // size is ignored.
            sessionFactoryMock.expects.makeObject().returns(sessionOne).any();
        } else {
            // Depending on how fast the threads execute, not all of the
            // sessions may be required. However at max three sessions should
            // be created.
            Session sessionTwo = sessionFactoryWrapper.makeRealSession();
            Session sessionThree = sessionFactoryWrapper.makeRealSession();

            sessionFactoryMock.expects.makeObject().returns(sessionOne);
            sessionFactoryMock.expects.makeObject().returns(sessionTwo);
            sessionFactoryMock.expects.makeObject().returns(sessionThree);
            // Never destroy the objects - they stay in the pool
View Full Code Here

TOP

Related Classes of org.smpp.Session

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.