Package de.netseeker.ejoe.test

Source Code of de.netseeker.ejoe.test.PersistentConnectionTest

/*********************************************************************
* SimpleObjectStreamTest.java
* created on 15.08.2004 by netseeker
* $Source: /cvsroot/ejoe/EJOE/test/de/netseeker/ejoe/test/PersistentConnectionTest.java,v $
* $Date: 2006/11/05 16:59:50 $
* $Revision: 1.12 $
*********************************************************************/

package de.netseeker.ejoe.test;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

import de.netseeker.ejoe.EJClient;

/**
* @author netseeker aka Michael Manske
*/
public class PersistentConnectionTest extends BaseClientTest
{
    private static final Logger log = Logger.getLogger( PersistentConnectionTest.class.getName() );

    /*
     * (non-Javadoc)
     *
     * @see junit.framework.TestCase#setUp()
     */
    protected void setUp() throws Exception
    {
        persistent = true;
        super.setUp();
    }

    public void testExecute()
    {
        EJClient client = getNewClient();
        client.enablePersistentConnection( true );

        try
        {
            Map result = null, input = null;
            String key = null;

            for ( int i = 0; i < 5; i++ )
            {
                input = new HashMap();
                input.put( "KEY1", "Hello" + i );
                input.put( "KEY2", Integer.valueOf( 101 ) );
                input.put( "KEY3", BigDecimal.valueOf( 102 ) );
                input.put( "KEY4", new ObjectBean() );

                result = (Map) client.execute( input );
                assertNotNull( result );
                // Map result = (Map) client.execute( new ObjectBean() );
                for ( Iterator it = result.keySet().iterator(); it.hasNext(); )
                {
                    key = (String) it.next();
                    log.log( Level.INFO, key + ": " + result.get( key ) );
                }
            }

            client.close();
        }
        catch ( IOException e )
        {
            e.printStackTrace();
            fail( e.getMessage() );
        }
    }
}
TOP

Related Classes of de.netseeker.ejoe.test.PersistentConnectionTest

TOP
Copyright © 2018 www.massapi.com. 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.