You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2007/02/14 21:02:22 UTC

svn commit: r507672 [11/16] - in /incubator/qpid/branches/qpid.0-9: gentools/src/org/apache/qpid/gentools/ gentools/templ.java/ gentools/templ.net/ java/ java/broker/ java/broker/bin/ java/broker/distribution/ java/broker/distribution/src/ java/broker/...

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java Wed Feb 14 12:02:03 2007
@@ -21,10 +21,13 @@
 package org.apache.qpid.client.protocol;
 
 import org.apache.qpid.AMQException;
+import org.apache.qpid.AMQDisconnectedException;
+import org.apache.qpid.AMQTimeoutException;
 import org.apache.qpid.framing.AMQMethodBody;
 import org.apache.qpid.protocol.AMQMethodEvent;
 import org.apache.qpid.protocol.AMQMethodListener;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
+import org.apache.qpid.client.failover.FailoverException;
 
 public abstract class BlockingMethodFrameListener implements AMQMethodListener
 {
@@ -52,6 +55,7 @@
     /**
      * This method is called by the MINA dispatching thread. Note that it could
      * be called before blockForFrame() has been called.
+     *
      * @param evt the frame event
      * @return true if the listener has dealt with this frame
      * @throws AMQException
@@ -89,7 +93,7 @@
     /**
      * This method is called by the thread that wants to wait for a frame.
      */
-    public AMQMethodEvent blockForFrame() throws AMQException
+    public AMQMethodEvent blockForFrame(long timeout) throws AMQException
     {
         synchronized (_lock)
         {
@@ -97,11 +101,29 @@
             {
                 try
                 {
-                    _lock.wait();
+                    if (timeout == -1)
+                    {
+                        _lock.wait();
+                    }
+                    else
+                    {
+
+                        _lock.wait(timeout);
+                        if (!_ready)
+                        {
+                            _error = new AMQTimeoutException("Server did not respond in a timely fashion");
+                            _ready = true;
+                        }
+                    }
                 }
                 catch (InterruptedException e)
                 {
-                    // IGNORE
+                    // IGNORE    -- //fixme this isn't ideal as being interrupted isn't equivellant to sucess
+//                    if (!_ready && timeout != -1)
+//                    {
+//                        _error = new AMQException("Server did not respond timely");
+//                        _ready = true;
+//                    }
                 }
             }
         }
@@ -109,11 +131,16 @@
         {
             if (_error instanceof AMQException)
             {
-                throw (AMQException)_error;
+                throw(AMQException) _error;
+            }
+            else if (_error instanceof FailoverException)
+            {
+                // This should ensure that FailoverException is not wrapped and can be caught.                
+                throw(FailoverException) _error;  // needed to expose FailoverException.
             }
             else
             {
-                throw new AMQException("Woken up due to " + _error.getClass(), _error); // FIXME: This will wrap FailoverException and prevent it being caught.
+                throw new AMQException("Woken up due to " + _error.getClass(), _error);
             }
         }
 
@@ -123,6 +150,7 @@
     /**
      * This is a callback, called by the MINA dispatcher thread only. It is also called from within this
      * class to avoid code repetition but again is only called by the MINA dispatcher thread.
+     *
      * @param e
      */
     public void error(Exception e)

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/security/amqplain/AmqPlainSaslClient.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/security/amqplain/AmqPlainSaslClient.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/security/amqplain/AmqPlainSaslClient.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/security/amqplain/AmqPlainSaslClient.java Wed Feb 14 12:02:03 2007
@@ -73,8 +73,8 @@
             throw new SaslException("Error handling SASL callbacks: " + e, e);
         }
         FieldTable table = FieldTableFactory.newFieldTable();
-        table.put("LOGIN", nameCallback.getName());
-        table.put("PASSWORD", pwdCallback.getPassword());
+        table.setString("LOGIN", nameCallback.getName());
+        table.setString("PASSWORD", new String(pwdCallback.getPassword()));
         return table.getDataAsBytes();
     }
 

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java Wed Feb 14 12:02:03 2007
@@ -55,11 +55,15 @@
     private final Map _state2HandlersMap = new HashMap();
 
     private final CopyOnWriteArraySet _stateListeners = new CopyOnWriteArraySet();
- 
+
+    private final Object _stateLock = new Object();
+    private static final long MAXIMUM_STATE_WAIT_TIME = 30000l;
+
     public AMQStateManager()
     {
         this(null);
     }
+    
 
     public AMQStateManager(AMQProtocolSession protocolSession)
     {
@@ -133,17 +137,11 @@
     public void changeState(AMQState newState) throws AMQException
     {
         _logger.debug("State changing to " + newState + " from old state " + _currentState);
-        final AMQState oldState = _currentState;
-        _currentState = newState;
 
-        synchronized (_stateListeners)
+        synchronized (_stateLock)
         {
-            final Iterator it = _stateListeners.iterator();
-            while (it.hasNext())
-            {
-                final StateListener l = (StateListener) it.next();
-                l.stateChanged(oldState, newState);
-            }
+            _currentState = newState;
+            _stateLock.notifyAll();
         }
     }
 
@@ -161,7 +159,7 @@
         }
     }
 
-    public boolean methodReceived(AMQMethodEvent evt) throws AMQException
+    public <B extends AMQMethodBody> boolean methodReceived(AMQMethodEvent<B> evt) throws AMQException
     {
         StateAwareMethodListener handler = findStateTransitionHandler(_currentState, evt.getMethod());
         if (handler != null)
@@ -210,36 +208,35 @@
         }
     }
 
-    public void addStateListener(StateListener listener)
-    {
-        _logger.debug("Adding state listener");
-        _stateListeners.add(listener);
-    }
-
-    public void removeStateListener(StateListener listener)
-    {
-        _stateListeners.remove(listener);
-    }
 
-    public void attainState(AMQState s) throws AMQException
+    public void attainState(final AMQState s) throws AMQException
     {
-        boolean needToWait = false;
-        StateWaiter sw = null;
-        synchronized (_stateListeners)
+        synchronized(_stateLock)
         {
-            if (_currentState != s)
+            final long waitUntilTime = System.currentTimeMillis() + MAXIMUM_STATE_WAIT_TIME;
+            long waitTime = MAXIMUM_STATE_WAIT_TIME;
+
+            while(_currentState != s && waitTime > 0)
             {
-                _logger.debug("Adding state wait to reach state " + s);
-                sw = new StateWaiter(s);
-                addStateListener(sw);
-                // we use a boolean since we must release the lock before starting to wait
-                needToWait = true;
+                try
+                {
+                    _stateLock.wait(MAXIMUM_STATE_WAIT_TIME);
+                }
+                catch (InterruptedException e)
+                {
+                    _logger.warn("Thread interrupted");
+                }
+                if(_currentState != s)
+                {
+                    waitTime = waitUntilTime - System.currentTimeMillis();
+                }
+            }
+            if(_currentState != s)
+            {
+                throw new AMQException("State not achieved within permitted time.  Current state " + _currentState + ", desired state: " + s);
             }
         }
-        if (needToWait)
-        {
-            sw.waituntilStateHasChanged();
-        }
+
         // at this point the state will have changed.
     }
 

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java Wed Feb 14 12:02:03 2007
@@ -25,7 +25,6 @@
 
 /**
  * Waits for a particular state to be reached.
- *
  */
 public class StateWaiter implements StateListener
 {
@@ -38,6 +37,7 @@
     private volatile Throwable _throwable;
 
     private final Object _monitor = new Object();
+    private static final long TIME_OUT = 1000 * 60 * 2;
 
     public StateWaiter(AMQState state)
     {
@@ -46,7 +46,7 @@
 
     public void waituntilStateHasChanged() throws AMQException
     {
-        synchronized(_monitor)
+        synchronized (_monitor)
         {
             //
             // The guard is required in case we are woken up by a spurious
@@ -57,7 +57,7 @@
                 try
                 {
                     _logger.debug("State " + _state + " not achieved so waiting...");
-                    _monitor.wait();
+                    _monitor.wait(TIME_OUT);
                 }
                 catch (InterruptedException e)
                 {
@@ -82,7 +82,7 @@
 
     public void stateChanged(AMQState oldState, AMQState newState)
     {
-        synchronized(_monitor)
+        synchronized (_monitor)
         {
             if (_logger.isDebugEnabled())
             {
@@ -103,7 +103,7 @@
 
     public void error(Throwable t)
     {
-        synchronized(_monitor)
+        synchronized (_monitor)
         {
             if (_logger.isDebugEnabled())
             {

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java Wed Feb 14 12:02:03 2007
@@ -71,7 +71,7 @@
         boolean readWriteThreading = Boolean.getBoolean("amqj.shared_read_write_pool");
         if (readWriteThreading)
         {
-            cfg.setThreadModel(new ReadWriteThreadModel());
+            cfg.setThreadModel(ReadWriteThreadModel.getInstance());
         }
 
         SocketSessionConfig scfg = (SocketSessionConfig) cfg.getSessionConfig();

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java Wed Feb 14 12:02:03 2007
@@ -70,7 +70,7 @@
 
         IoServiceConfig config = _acceptor.getDefaultConfig();
 
-        config.setThreadModel(new ReadWriteThreadModel());
+        config.setThreadModel(ReadWriteThreadModel.getInstance());
     }
 
     public static ITransportConnection getInstance() throws AMQTransportConnectionException

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java Wed Feb 14 12:02:03 2007
@@ -49,10 +49,10 @@
         final VmPipeConnector ioConnector = new VmPipeConnector();
         final IoServiceConfig cfg = ioConnector.getDefaultConfig();
         ReferenceCountingExecutorService executorService = ReferenceCountingExecutorService.getInstance();
-        PoolingFilter asyncRead = new PoolingFilter(executorService, PoolingFilter.READ_EVENTS,
+        PoolingFilter asyncRead = PoolingFilter.createAynschReadPoolingFilter(executorService,
                                                     "AsynchronousReadFilter");
         cfg.getFilterChain().addFirst("AsynchronousReadFilter", asyncRead);
-        PoolingFilter asyncWrite = new PoolingFilter(executorService, PoolingFilter.WRITE_EVENTS,
+        PoolingFilter asyncWrite = PoolingFilter.createAynschWritePoolingFilter(executorService, 
                                                      "AsynchronousWriteFilter");
         cfg.getFilterChain().addLast("AsynchronousWriteFilter", asyncWrite);
         

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java Wed Feb 14 12:02:03 2007
@@ -29,6 +29,7 @@
 import org.apache.qpid.url.AMQBindingURL;
 import org.apache.qpid.url.BindingURL;
 import org.apache.qpid.url.URLSyntaxException;
+import org.apache.qpid.framing.AMQShortString;
 
 import javax.jms.ConnectionFactory;
 import javax.jms.Destination;
@@ -63,7 +64,7 @@
         {
 
             String file = null;
-            if (environment.contains(Context.PROVIDER_URL))
+            if (environment.containsKey(Context.PROVIDER_URL))
             {
                 file = (String) environment.get(Context.PROVIDER_URL);
             }
@@ -85,7 +86,7 @@
             }
             else
             {
-                _logger.warn("No Provider URL specified.");
+                _logger.info("No Provider URL specified.");
             }
         }
         catch (IOException ioe)
@@ -232,10 +233,14 @@
      */
     protected Queue createQueue(Object value)
     {
-        if (value instanceof String)
+        if(value instanceof AMQShortString)
+        {
+            return new AMQQueue((AMQShortString) value);
+        }
+        else if (value instanceof String)
 
         {
-            return new AMQQueue((String) value);
+            return new AMQQueue(new AMQShortString((String) value));
         }
         else if (value instanceof BindingURL)
 
@@ -251,9 +256,13 @@
      */
     protected Topic createTopic(Object value)
     {
-        if (value instanceof String)
+        if(value instanceof AMQShortString)
+        {
+            return new AMQTopic((AMQShortString)value);
+        }
+        else if (value instanceof String)
         {
-            return new AMQTopic((String) value);
+            return new AMQTopic(new AMQShortString((String) value));
         }
         else if (value instanceof BindingURL)
 

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/codec/BasicDeliverTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/codec/BasicDeliverTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/codec/BasicDeliverTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/codec/BasicDeliverTest.java Wed Feb 14 12:02:03 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -64,15 +64,21 @@
         long min = Long.MAX_VALUE;
         long max = 0;
         long total = 0;
-        for(int i = 0; i < iterations; i++)
+        for (int i = 0; i < iterations; i++)
         {
             long time = decode(size, count);
             total += time;
-            if(time < min) min = time;
-            if(time > max) max = time;
+            if (time < min)
+            {
+                min = time;
+            }
+            if (time > max)
+            {
+                max = time;
+            }
         }
         System.out.println("Decoded " + count + " messages of " + size +
-                " bytes: avg=" + (total / iterations) + ", min=" + min + ", max=" + max) ;
+                " bytes: avg=" + (total / iterations) + ", min=" + min + ", max=" + max);
     }
 
 
@@ -84,7 +90,7 @@
         data.flip();
         AMQDecoder decoder = new AMQDecoder(false);
         long start = System.currentTimeMillis();
-        for(int i = 0; i < count; i++)
+        for (int i = 0; i < count; i++)
         {
             decoder.decode(session, data, decoderOutput);
             data.rewind();
@@ -97,15 +103,21 @@
         long min = Long.MAX_VALUE;
         long max = 0;
         long total = 0;
-        for(int i = 0; i < iterations; i++)
+        for (int i = 0; i < iterations; i++)
         {
             long time = encode(size, count);
             total += time;
-            if(time < min) min = time;
-            if(time > max) max = time;
+            if (time < min)
+            {
+                min = time;
+            }
+            if (time > max)
+            {
+                max = time;
+            }
         }
         System.out.println("Encoded " + count + " messages of " + size +
-                " bytes: avg=" + (total / iterations) + ", min=" + min + ", max=" + max) ;
+                " bytes: avg=" + (total / iterations) + ", min=" + min + ", max=" + max);
     }
 
     long encode(int size, int count) throws Exception
@@ -114,14 +126,15 @@
         AMQDataBlock block = getDataBlock(size);
         AMQEncoder encoder = new AMQEncoder();
         long start = System.currentTimeMillis();
-        for(int i = 0; i < count; i++)
+        for (int i = 0; i < count; i++)
         {
             encoder.encode(session, block, encoderOutput);
         }
         return System.currentTimeMillis() - start;
     }
 
-    private final ProtocolEncoderOutput encoderOutput = new ProtocolEncoderOutput(){
+    private final ProtocolEncoderOutput encoderOutput = new ProtocolEncoderOutput()
+    {
 
         public void write(ByteBuffer byteBuffer)
         {
@@ -137,7 +150,8 @@
         }
     };
 
-    private final ProtocolDecoderOutput decoderOutput = new ProtocolDecoderOutput(){
+    private final ProtocolDecoderOutput decoderOutput = new ProtocolDecoderOutput()
+    {
         public void write(Object object)
         {
         }
@@ -147,7 +161,8 @@
         }
     };
 
-    private final IoSession session = new BaseIoSession(){
+    private final IoSession session = new BaseIoSession()
+    {
 
         protected void updateTrafficMask()
         {
@@ -216,19 +231,16 @@
     {
         //create a frame representing message delivery
         AMQFrame[] frames = new AMQFrame[3];
-        frames[0] = wrapBody( createBasicDeliverBody() );
-        frames[1] = wrapBody( createContentHeaderBody() );
-        frames[2] = wrapBody( createContentBody(size) );
+        frames[0] = wrapBody(createBasicDeliverBody());
+        frames[1] = wrapBody(createContentHeaderBody());
+        frames[2] = wrapBody(createContentBody(size));
 
         return new CompositeAMQDataBlock(frames);
     }
 
     static AMQFrame wrapBody(AMQBody body)
     {
-        AMQFrame frame = new AMQFrame();
-        frame.bodyFrame = body;
-        frame.channel = 1;
-
+        AMQFrame frame = new AMQFrame(1, body);
         return frame;
     }
 
@@ -236,7 +248,7 @@
     {
         ContentBody body = new ContentBody();
         body.payload = ByteBuffer.allocate(size);
-        for(int i = 0; i < size; i++)
+        for (int i = 0; i < size; i++)
         {
             body.payload.put((byte) DATA[i % DATA.length]);
         }
@@ -254,12 +266,12 @@
 
     static BasicDeliverBody createBasicDeliverBody()
     {
-        BasicDeliverBody body = new BasicDeliverBody();
-        body.consumerTag = "myConsumerTag";
-        body.deliveryTag = 1;
-        body.exchange = "myExchange";
-        body.redelivered = false;
-        body.routingKey = "myRoutingKey";
+        BasicDeliverBody body = new BasicDeliverBody((byte) 8, (byte) 0,
+                                                     BasicDeliverBody.getClazz((byte) 8, (byte) 0),
+                                                     BasicDeliverBody.getMethod((byte) 8, (byte) 0),                                                     
+                                                     new AMQShortString("myConsumerTag"), 1,
+                                                     new AMQShortString("myExchange"), false,
+                                                     new AMQShortString("myRoutingKey"));
         return body;
     }
 }

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/codec/Client.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/codec/Client.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/codec/Client.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/codec/Client.java Wed Feb 14 12:02:03 2007
@@ -106,12 +106,12 @@
 
     private static boolean isDeliver(Object o)
     {
-        return o instanceof AMQFrame && ((AMQFrame) o).bodyFrame instanceof BasicDeliverBody;
+        return o instanceof AMQFrame && ((AMQFrame) o).getBodyFrame() instanceof BasicDeliverBody;
     }
 
     private static boolean isContent(Object o)
     {
-        return o instanceof AMQFrame && ((AMQFrame) o).bodyFrame instanceof ContentBody;
+        return o instanceof AMQFrame && ((AMQFrame) o).getBodyFrame() instanceof ContentBody;
     }
 
     public static void main(String[] argv) throws Exception

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/framing/FieldTableTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/framing/FieldTableTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/framing/FieldTableTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/framing/FieldTableTest.java Wed Feb 14 12:02:03 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,6 +20,7 @@
  */
 package org.apache.qpid.framing;
 
+import junit.framework.TestCase;
 import org.apache.mina.common.ByteBuffer;
 
 import java.io.BufferedReader;
@@ -29,8 +30,6 @@
 import java.util.Enumeration;
 import java.util.Properties;
 
-import junit.framework.TestCase;
-
 public class FieldTableTest extends TestCase
 {
 
@@ -40,17 +39,17 @@
 
         String key = "String";
         String value = "Hello";
-        table.put(key, value);
+        table.setString(key, value);
 
         //Add one for the type encoding
         int size = EncodingUtils.encodedShortStringLength(key) + 1 +
                    EncodingUtils.encodedLongStringLength(value);
 
         assertEquals(table.getEncodedSize(), size);
-        
+
         key = "Integer";
         Integer number = new Integer(60);
-        table.put(key, number);
+        table.setInteger(key, number);
 
         //Add one for the type encoding
         size += EncodingUtils.encodedShortStringLength(key) + 1 + 4;
@@ -87,22 +86,22 @@
         doTestEncoding(load("FieldTableTest2.properties"));
     }
     */
-    void doTestEncoding(FieldTable table) throws AMQFrameDecodingException
+    void doTestEncoding(FieldTable table) throws AMQFrameDecodingException, AMQProtocolVersionException
     {
         assertEquivalent(table, encodeThenDecode(table));
     }
 
     public void assertEquivalent(FieldTable table1, FieldTable table2)
     {
-        for (Object o : table1.keySet())
+        for (String  key : table1.keys())
         {
-            String key = (String) o;
-            assertEquals("Values for " + key + " did not match", table1.get(key), table2.get(key));
+
+            assertEquals("Values for " + key + " did not match", table1.getObject(key), table2.getObject(key));
             //System.out.println("Values for " + key + " matched (" + table1.get(key) + ")");
         }
     }
 
-    FieldTable encodeThenDecode(FieldTable table) throws AMQFrameDecodingException
+    FieldTable encodeThenDecode(FieldTable table) throws AMQFrameDecodingException, AMQProtocolVersionException
     {
         ContentHeaderBody header = new ContentHeaderBody();
         header.classId = 6;
@@ -153,11 +152,11 @@
             try
             {
                 int ival = Integer.parseInt(value);
-                table.put(key, (long) ival);
+                table.setLong(key, (long) ival);
             }
             catch (NumberFormatException e)
             {
-                table.put(key, value);
+                table.setObject(key, value);
             }
         }
         return table;

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/Listener.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/Listener.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/Listener.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/Listener.java Wed Feb 14 12:02:03 2007
@@ -23,7 +23,7 @@
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.jms.Session;
-import org.apache.qpid.testutil.Config;
+//import org.apache.qpid.testutil.Config;
 
 import javax.jms.MessageListener;
 import javax.jms.Message;
@@ -31,9 +31,9 @@
 import javax.jms.MessageProducer;
 import javax.jms.JMSException;
 
-public class Listener implements MessageListener
+public class Listener //implements MessageListener
 {
-    private final AMQConnection _connection;
+/*    private final AMQConnection _connection;
     private final MessageProducer _controller;
     private final AMQSession _session;
     private final MessageFactory _factory;
@@ -113,5 +113,5 @@
         config.setName("test_headers_exchange");
         config.setOptions(argv);
         new Listener((AMQConnection) config.getConnection(), config.getDestination());
-    }
+    }*/
 }

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/MessageFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/MessageFactory.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/MessageFactory.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/MessageFactory.java Wed Feb 14 12:02:03 2007
@@ -129,14 +129,14 @@
     FieldTable getConsumerBinding()
     {
         FieldTable binding = FieldTableFactory.newFieldTable();
-        binding.put("SF0000", "value");
+        binding.setString("SF0000", "value");
         return binding;
     }
 
     FieldTable getControllerBinding()
     {
         FieldTable binding = FieldTableFactory.newFieldTable();
-        binding.put("SCONTROL", "value");
+        binding.setString("SCONTROL", "value");
         return binding;
     }
 

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/Publisher.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/Publisher.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/Publisher.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/headers/Publisher.java Wed Feb 14 12:02:03 2007
@@ -22,13 +22,13 @@
 
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.testutil.Config;
+//import org.apache.qpid.testutil.Config;
 
 import javax.jms.*;
 
-public class Publisher implements MessageListener
+public class Publisher // implements MessageListener
 {
-    private final Object _lock = new Object();
+/*   private final Object _lock = new Object();
     private final AMQConnection _connection;
     private final AMQSession _session;
     private final Destination _exchange;
@@ -129,5 +129,5 @@
             new Publisher(config).test(msgCount, consumerCount);
         }
 
-    }
+    }*/
 }

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/mina/AcceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/mina/AcceptorTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/mina/AcceptorTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/mina/AcceptorTest.java Wed Feb 14 12:02:03 2007
@@ -82,7 +82,7 @@
         sc.setSendBufferSize(32768);
         sc.setReceiveBufferSize(32768);
 
-        config.setThreadModel(new ReadWriteThreadModel());
+        config.setThreadModel(ReadWriteThreadModel.getInstance());
 
         acceptor.bind(new InetSocketAddress(PORT),
                       new TestHandler());

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/test/unit/client/connection/TestManyConnections.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/test/unit/client/connection/TestManyConnections.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/test/unit/client/connection/TestManyConnections.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/test/unit/client/connection/TestManyConnections.java Wed Feb 14 12:02:03 2007
@@ -46,7 +46,7 @@
         long startTime = System.currentTimeMillis();
         for (int i = 0; i < count; i++)
         {
-            createConnection(i, "vm://:1", "myClient" + i, "guest", "guest", "/test");
+            createConnection(i, "vm://:1", "myClient" + i, "guest", "guest", "test");
         }
         long endTime = System.currentTimeMillis();
         _log.info("Time to create " + count + " connections: " + (endTime - startTime) +

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java Wed Feb 14 12:02:03 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,15 +20,12 @@
  */
 package org.apache.qpid.test.unit.jndi.referenceabletest;
 
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
-import org.apache.qpid.test.VMBrokerSetup;
+import junit.framework.TestCase;
+//import org.apache.qpid.testutil.VMBrokerSetup;
 
 import javax.naming.NameAlreadyBoundException;
 import javax.naming.NoInitialContextException;
 
-import junit.framework.TestCase;
-
 /**
  * Usage: To run these you need to have the sun JNDI SPI for the FileSystem.
  * This can be downloaded from sun here:
@@ -41,7 +38,7 @@
  */
 public class JNDIReferenceableTest extends TestCase
 {
-    // FIXME FSContext has been removed from repository. This needs redone with the PropertiesFileInitialContextFactory. QPID-84
+/*    // FIXME FSContext has been removed from repository. This needs redone with the PropertiesFileInitialContextFactory. QPID-84
     public void testReferenceable()
     {
         Bind b = null;
@@ -101,4 +98,5 @@
     {
         return new VMBrokerSetup(new junit.framework.TestSuite(JNDIReferenceableTest.class));
     }
+    */
 }

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/weblogic/ServiceRequestingClient.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/weblogic/ServiceRequestingClient.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/weblogic/ServiceRequestingClient.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/old_test/java/org/apache/qpid/weblogic/ServiceRequestingClient.java Wed Feb 14 12:02:03 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,20 +20,13 @@
  */
 package org.apache.qpid.weblogic;
 
-import org.apache.qpid.jms.*;
 import org.apache.log4j.Logger;
 
-import javax.naming.NamingException;
-import javax.naming.InitialContext;
-import javax.naming.Context;
 import javax.jms.*;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import java.util.Hashtable;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.Reader;
-import java.io.FileReader;
 
 /**
  * Created by IntelliJ IDEA.

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java Wed Feb 14 12:02:03 2007
@@ -25,37 +25,46 @@
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.exchange.ExchangeDefaults;
 
 import javax.jms.*;
+import java.util.concurrent.atomic.AtomicInteger;
 
 public class RecoverTest extends TestCase
 {
     private static final Logger _logger = Logger.getLogger(RecoverTest.class);
 
+    private Exception _error;
+    private AtomicInteger count;
+
     protected void setUp() throws Exception
     {
         super.setUp();
         TransportConnection.createVMBroker(1);
+        _error = null;
+        count = new AtomicInteger();
     }
 
     protected void tearDown() throws Exception
     {
         super.tearDown();
         TransportConnection.killAllVMBrokers();
+        count = null;
     }
 
 
     public void testRecoverResendsMsgs() throws Exception
     {
-        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "test");
 
         Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-        Queue queue = new AMQQueue("someQ", "someQ", false, true);
+        Queue queue = new AMQQueue(new AMQShortString("someQ"), new AMQShortString("someQ"), false, true);
         MessageConsumer consumer = consumerSession.createConsumer(queue);
         //force synch to ensure the consumer has resulted in a bound queue
-        ((AMQSession) consumerSession).declareExchangeSynch("amq.direct", "direct");
+        ((AMQSession) consumerSession).declareExchangeSynch(ExchangeDefaults.DIRECT_EXCHANGE_NAME, ExchangeDefaults.DIRECT_EXCHANGE_CLASS);
 
-        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
+        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "test");
         Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageProducer producer = producerSession.createProducer(queue);
 
@@ -104,15 +113,15 @@
 
     public void testRecoverResendsMsgsAckOnEarlier() throws Exception
     {
-        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "test");
 
         Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-        Queue queue = new AMQQueue("someQ", "someQ", false, true);
+        Queue queue = new AMQQueue(new AMQShortString("someQ"), new AMQShortString("someQ"), false, true);
         MessageConsumer consumer = consumerSession.createConsumer(queue);
         //force synch to ensure the consumer has resulted in a bound queue
-        ((AMQSession) consumerSession).declareExchangeSynch("amq.direct", "direct");
+        ((AMQSession) consumerSession).declareExchangeSynch(ExchangeDefaults.DIRECT_EXCHANGE_NAME, ExchangeDefaults.DIRECT_EXCHANGE_CLASS);
 
-        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
+        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "test");
         Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageProducer producer = producerSession.createProducer(queue);
 
@@ -168,15 +177,15 @@
 
     public void testAcknowledgePerConsumer() throws Exception
     {
-        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "test");
 
         Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-        Queue queue = new AMQQueue("Q1", "Q1", false, true);
-        Queue queue2 = new AMQQueue("Q2", "Q2", false, true);
+        Queue queue = new AMQQueue(new AMQShortString("Q1"), new AMQShortString("Q1"), false, true);
+        Queue queue2 = new AMQQueue(new AMQShortString("Q2"), new AMQShortString("Q2"), false, true);
         MessageConsumer consumer = consumerSession.createConsumer(queue);
         MessageConsumer consumer2 = consumerSession.createConsumer(queue2);
 
-        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
+        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "test");
         Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageProducer producer = producerSession.createProducer(queue);
         MessageProducer producer2 = producerSession.createProducer(queue2);
@@ -207,41 +216,96 @@
 
     public void testRecoverInAutoAckListener() throws Exception
     {
-        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "test");
 
         final Session consumerSession = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        Queue queue = new AMQQueue("Q1", "Q1", false, true);
+        Queue queue = new AMQQueue(new AMQShortString("Q3"), new AMQShortString("Q3"), false, true);
+        MessageConsumer consumer = consumerSession.createConsumer(queue);
         MessageProducer producer = consumerSession.createProducer(queue);
         producer.send(consumerSession.createTextMessage("hello"));
-        MessageConsumer consumer = consumerSession.createConsumer(queue);
+
+
+        final Object lock = new Object();
+
         consumer.setMessageListener(new MessageListener()
         {
-            private int count = 0;
+
+
 
             public void onMessage(Message message)
             {
                 try
                 {
-                    if (count++ == 0)
+                    count.incrementAndGet();
+                    if (count.get() == 1)
                     {
-                        assertFalse(message.getJMSRedelivered());
+                        if(message.getJMSRedelivered())
+                        {
+                            setError(new Exception("Message marked as redilvered on what should be first delivery attempt"));
+                        }
                         consumerSession.recover();
                     }
-                    else if (count++ == 1)
+                    else if (count.get() == 2)
                     {
-                        assertTrue(message.getJMSRedelivered());
+                        if(!message.getJMSRedelivered())
+                        {
+                            setError(new Exception("Message not marked as redilvered on what should be second delivery attempt"));
+                        }
                     }
                     else
                     {
-                        fail("Message delivered too many times!");
+                        System.err.println(message);
+                        fail("Message delivered too many times!: " + count);
                     }
                 }
                 catch (JMSException e)
                 {
                     _logger.error("Error recovering session: " + e, e);
+                    setError(e);
+                }
+                synchronized(lock)
+                {
+                    lock.notify();
                 }
             }
         });
+
+        con.start();
+
+        long waitTime = 300000L;
+        long waitUntilTime = System.currentTimeMillis() + waitTime;
+
+        synchronized(lock)
+        {
+            while((count.get() <= 1) && (waitTime > 0))
+            {
+                lock.wait(waitTime);
+                if(count.get() <= 1)
+                {
+                    waitTime = waitUntilTime - System.currentTimeMillis();
+                }
+            }
+        }
+
+        Thread.sleep(1000);
+
+        if(count.get() != 2)
+        {
+            System.err.println("Count != 2 : " + count);
+        }
+            assertTrue(count.get() == 2);
+
+        con.close();
+
+        if(_error != null)
+        {
+            throw _error;
+        }
+    }
+
+    private void setError(Exception e)
+    {
+        _error = e;
     }
 
     public static junit.framework.Test suite()

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java Wed Feb 14 12:02:03 2007
@@ -48,7 +48,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
+        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test"));
     }
 
     protected void tearDown() throws Exception

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableKeyEnumeratorTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableKeyEnumeratorTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableKeyEnumeratorTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableKeyEnumeratorTest.java Wed Feb 14 12:02:03 2007
@@ -35,16 +35,20 @@
 
 public class FieldTableKeyEnumeratorTest extends TestCase
 {
+    public void testTrue()
+    {
+        
+    }
     public void testKeyEnumeration()
     {
         FieldTable result = FieldTableFactory.newFieldTable();
-        result.put("one", 1L);
-        result.put("two", 2L);
-        result.put("three", 3L);
-        result.put("four", 4L);
-        result.put("five", 5L);
+        result.setObject("one", 1L);
+        result.setObject("two", 2L);
+        result.setObject("three", 3L);
+        result.setObject("four", 4L);
+        result.setObject("five", 5L);
 
-        Iterator iterator = result.keySet().iterator();
+        Iterator iterator = result.keys().iterator();
 
         try
         {

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java Wed Feb 14 12:02:03 2007
@@ -54,7 +54,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
+        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test"));
     }
 
     protected void tearDown() throws Exception
@@ -85,11 +85,11 @@
     private FieldTable load() throws IOException
     {
         FieldTable result = FieldTableFactory.newFieldTable();
-        result.put("one", 1L);
-        result.put("two", 2L);
-        result.put("three", 3L);
-        result.put("four", 4L);
-        result.put("five", 5L);
+        result.setLong("one", 1L);
+        result.setLong("two", 2L);
+        result.setLong("three", 3L);
+        result.setLong("four", 4L);
+        result.setLong("five", 5L);
 
         return result;
     }
@@ -133,10 +133,9 @@
         {
             ByteBuffer buffer = ((JMSBytesMessage) m).getData();
             FieldTable actual = FieldTableFactory.newFieldTable(buffer, buffer.remaining());
-            for (Object o : _expected.keySet())
-            {
-                String key = (String) o;
-                assertEquals("Values for " + key + " did not match", _expected.get(key), actual.get(key));
+            for (String key : _expected.keys())
+            {                
+                assertEquals("Values for " + key + " did not match", _expected.getObject(key), actual.getObject(key));
             }
         }
     }

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java Wed Feb 14 12:02:03 2007
@@ -56,7 +56,7 @@
         try
         {
             TransportConnection.createVMBroker(1);
-            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
+            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test"));
         }
         catch (Exception e)
         {
@@ -144,13 +144,29 @@
 
     }
 
-    void waitFor(int count) throws InterruptedException
+    void waitFor(int count) throws Exception
     {
+        long waitTime = 30000L;
+        long waitUntilTime = System.currentTimeMillis() + 30000L;
+
+
         synchronized(received)
         {
-            while (received.size() < count)
+            while(received.size() < count && waitTime>0)
+            {
+                if (received.size() < count)
+                {
+                    received.wait(waitTime);
+                }
+
+                if (received.size() < count)
+                {
+                    waitTime = waitUntilTime - System.currentTimeMillis();
+                }
+            }
+            if (received.size() < count)
             {
-                received.wait();
+                throw new Exception("Timed-out.  Waiting for " + count + " only got " + received.size());
             }
         }
     }

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java Wed Feb 14 12:02:03 2007
@@ -41,7 +41,7 @@
 
         Receiver(String broker, AMQDestination dest, int sessions) throws Exception
         {
-            this(new AMQConnection(broker, "guest", "guest", randomize("Client"), "/test_path"), dest, sessions);
+            this(new AMQConnection(broker, "guest", "guest", randomize("Client"), "test"), dest, sessions);
         }
 
         Receiver(AMQConnection connection, AMQDestination dest, int sessions) throws Exception
@@ -72,7 +72,7 @@
 
         Publisher(String broker, AMQDestination dest) throws Exception
         {
-            this(new AMQConnection(broker, "guest", "guest", randomize("Client"), "/test_path"), dest);
+            this(new AMQConnection(broker, "guest", "guest", randomize("Client"), "test"), dest);
         }
 
         Publisher(AMQConnection connection, AMQDestination dest) throws Exception

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java Wed Feb 14 12:02:03 2007
@@ -50,7 +50,7 @@
         TransportConnection.createVMBroker(1);
         try
         {
-            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
+            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test"));
         }
         catch (Exception e)
         {

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java Wed Feb 14 12:02:03 2007
@@ -29,12 +29,7 @@
 import org.apache.qpid.client.message.JMSTextMessage;
 import org.apache.qpid.testutil.VMBrokerSetup;
 
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
+import javax.jms.*;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -58,7 +53,7 @@
         super.setUp();
         try
         {
-            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
+            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test"));
         }
         catch (Exception e)
         {
@@ -81,7 +76,7 @@
     {
         _connection = connection;
         _destination = destination;
-        _session = (AMQSession) connection.createSession(false, AMQSession.AUTO_ACKNOWLEDGE);
+        _session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
         //set up a slow consumer
         _session.createConsumer(destination).setMessageListener(this);

Added: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionRefTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionRefTest.java?view=auto&rev=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionRefTest.java (added)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionRefTest.java Wed Feb 14 12:02:03 2007
@@ -0,0 +1,81 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.test.unit.basic;
+
+import junit.framework.TestCase;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.client.AMQTopic;
+import org.apache.qpid.client.BasicMessageProducer;
+
+import javax.jms.*;
+
+/**
+ * @author Apache Software Foundation
+ */
+public class PubSubTwoConnectionRefTest extends TestCase
+{
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        TransportConnection.createVMBroker(1);
+    }
+
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+
+    /**
+     * This tests that a consumer is set up synchronously
+     * @throws Exception
+     */
+    public void testTwoConnections() throws Exception
+    {
+        AMQTopic topic = new AMQTopic("MyTopic");
+        AMQConnection con1 = new AMQConnection("vm://:1", "guest", "guest", "Client1", "test");
+        AMQSession session1 = con1.createAMQSession(false, AMQSession.NO_ACKNOWLEDGE);
+        BasicMessageProducer producer = session1.createBasicProducer(topic);
+
+        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "Client2", "test");
+        Session session2 = con2.createSession(false, AMQSession.NO_ACKNOWLEDGE);
+        MessageConsumer consumer = session2.createConsumer(topic);
+        con2.start();        
+        producer.sendRef(session1.createTextMessage("Hello ref"));
+//        producer.sendRef(session1.createTextMessage("Goodbye ref"));
+        TextMessage tm1 = (TextMessage) consumer.receive(2000);
+        assertNotNull(tm1);
+        assertEquals("Hello ref", tm1.getText());
+//        assertEquals("Goodbye ref", tm1.getText());
+    }
+    
+    public static void main(String[] args){
+    	PubSubTwoConnectionRefTest test = new PubSubTwoConnectionRefTest();
+    	try {
+			test.setUp();
+			test.testTwoConnections();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+    }
+}

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java Wed Feb 14 12:02:03 2007
@@ -51,11 +51,11 @@
     public void testTwoConnections() throws Exception
     {
         Topic topic = new AMQTopic("MyTopic");
-        Connection con1 = new AMQConnection("vm://:1", "guest", "guest", "Client1", "/test_path");
+        Connection con1 = new AMQConnection("vm://:1", "guest", "guest", "Client1", "test");
         Session session1 = con1.createSession(false, AMQSession.NO_ACKNOWLEDGE);
         MessageProducer producer = session1.createProducer(topic);
 
-        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "Client2", "/test_path");
+        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "Client2", "test");
         Session session2 = con2.createSession(false, AMQSession.NO_ACKNOWLEDGE);
         MessageConsumer consumer = session2.createConsumer(topic);
         con2.start();        

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java Wed Feb 14 12:02:03 2007
@@ -48,7 +48,7 @@
         {
             createVMBroker();
             String broker = _connectionString;
-            init(new AMQConnection(broker, "guest", "guest", "ReceiveTestClient", "/test_path"));
+            init(new AMQConnection(broker, "guest", "guest", "ReceiveTestClient", "test"));
         }
     }
 

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java Wed Feb 14 12:02:03 2007
@@ -51,7 +51,7 @@
     {
         super.setUp();
         TransportConnection.createVMBroker(1);
-        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
+        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test"));
     }
 
     protected void tearDown() throws Exception

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java Wed Feb 14 12:02:03 2007
@@ -43,7 +43,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
+        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test"));
     }
 
     protected void tearDown() throws Exception

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java Wed Feb 14 12:02:03 2007
@@ -52,7 +52,7 @@
         super.setUp();
         try
         {
-            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
+            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test"));
         }
         catch (Exception e)
         {
@@ -75,7 +75,7 @@
     {
         _connection = connection;
         _destination = destination;
-        _session = (AMQSession) connection.createSession(false, AMQSession.AUTO_ACKNOWLEDGE);
+        _session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
         //set up a slow consumer
         _session.createConsumer(destination).setMessageListener(this);

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java Wed Feb 14 12:02:03 2007
@@ -24,7 +24,7 @@
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.testutil.VMBrokerSetup;
+import org.apache.qpid.client.transport.TransportConnection;
 
 import javax.jms.*;
 
@@ -41,13 +41,15 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        _connection = new AMQConnection("vm://:1", "guest", "guest", "fred", "/test");
+        TransportConnection.createVMBroker(1);
+        _connection = new AMQConnection("vm://:1", "guest", "guest", "fred", "test");
         _topic = new AMQTopic("mytopic");
         _queue = new AMQQueue("myqueue");
     }
 
     protected void tearDown() throws Exception
     {
+        super.tearDown();
         try
         {
             _connection.close();
@@ -55,8 +57,8 @@
         catch (JMSException e)
         {
             //ignore 
-        }
-        super.tearDown();
+        }        
+        TransportConnection.killAllVMBrokers();
     }
 
     /**
@@ -195,6 +197,6 @@
 
     public static junit.framework.Test suite()
     {
-        return new VMBrokerSetup(new junit.framework.TestSuite(AMQConnectionTest.class));
+        return new junit.framework.TestSuite(AMQConnectionTest.class);
     }
 }

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java Wed Feb 14 12:02:03 2007
@@ -46,7 +46,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        _connection = new AMQConnection("vm://:1", "guest", "guest", "fred", "/test");
+        _connection = new AMQConnection("vm://:1", "guest", "guest", "fred", "test");
         _topic = new AMQTopic("mytopic");
         _queue = new AMQQueue("myqueue");
         _session = (AMQSession) _connection.createSession(false, AMQSession.NO_ACKNOWLEDGE);

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java Wed Feb 14 12:02:03 2007
@@ -20,17 +20,17 @@
  */
 package org.apache.qpid.test.unit.client.channelclose;
 
+import junit.framework.TestCase;
+import junit.textui.TestRunner;
+import org.apache.log4j.Logger;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.testutil.VMBrokerSetup;
-import org.apache.log4j.Logger;
+import org.apache.qpid.client.transport.TransportConnection;
 
 import javax.jms.*;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
-import junit.textui.TestRunner;
 
 /**
  * Due to bizarre exception handling all sessions are closed if you get
@@ -64,7 +64,8 @@
     {
         super.setUp();
 
-        _connection = new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path");
+        TransportConnection.createVMBroker(1);
+        _connection = new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test");
 
         _destination1 = new AMQQueue("q1", true);
         _destination2 = new AMQQueue("q2", true);
@@ -192,7 +193,15 @@
         {
             while (received.size() < count)
             {
-                received.wait();
+                try
+                {
+                    received.wait();
+                }
+                catch (InterruptedException e)
+                {
+                    _log.info("Interrupted: " + e);
+                    throw e;
+                }
             }
         }
     }
@@ -209,6 +218,6 @@
 
     public static junit.framework.Test suite()
     {
-        return new VMBrokerSetup(new junit.framework.TestSuite(ChannelCloseOkTest.class));
+        return new junit.framework.TestSuite(ChannelCloseOkTest.class);
     }
 }

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java Wed Feb 14 12:02:03 2007
@@ -49,7 +49,7 @@
     public void testReceiveReturnsNull() throws Exception
     {
         final Connection connection = new AMQConnection("vm://:1", "guest", "guest",
-                                                  "fred", "/test");
+                                                  "fred", "test");
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer consumer = session.createConsumer(new AMQTopic("banana"));
         connection.start();

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java Wed Feb 14 12:02:03 2007
@@ -26,6 +26,7 @@
 import org.apache.qpid.AMQException;
 import org.apache.qpid.AMQConnectionFailureException;
 import org.apache.qpid.AMQUnresolvedAddressException;
+import org.apache.qpid.AMQConnectionFailureException;
 
 import javax.jms.Connection;
 
@@ -47,14 +48,15 @@
 
     protected void tearDown() throws Exception
     {
-        TransportConnection.killAllVMBrokers();
+        TransportConnection.killVMBroker(1);
     }
 
     public void testSimpleConnection()
     {
         try
         {
-            new AMQConnection(_broker, "guest", "guest", "fred", "/test");
+            AMQConnection conn  = new AMQConnection(_broker, "guest", "guest", "fred", "test");
+            conn.close();
         }
         catch (Exception e)
         {
@@ -93,6 +95,7 @@
                 fail("Correct exception not thrown. Excpected 'AMQConnectionFailureException' got: " + amqe);
             }
         }
+
     }
 
     public void testUnresolvedHostFailure() throws Exception
@@ -114,7 +117,7 @@
     public void testClientIdCannotBeChanged() throws Exception
     {
         Connection connection = new AMQConnection(_broker, "guest", "guest",
-                                                  "fred", "/test");
+                                                  "fred", "test");
         try
         {
             connection.setClientID("someClientId");
@@ -129,7 +132,7 @@
     public void testClientIdIsPopulatedAutomatically() throws Exception
     {
         Connection connection = new AMQConnection(_broker, "guest", "guest",
-                                                  null, "/test");
+                                                  null, "test");
         assertNotNull(connection.getClientID());
     }
 

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java?view=diff&rev=507672&r1=507671&r2=507672
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java Wed Feb 14 12:02:03 2007
@@ -33,14 +33,14 @@
 
     public void testFailoverURL() throws URLSyntaxException
     {
-        String url = "amqp://ritchiem:bob@/temp?brokerlist='tcp://localhost:5672;tcp://fancyserver:3000/',failover='roundrobin'";
+        String url = "amqp://ritchiem:bob@/test?brokerlist='tcp://localhost:5672;tcp://fancyserver:3000/',failover='roundrobin'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
         assertTrue(connectionurl.getFailoverMethod().equals("roundrobin"));
         assertTrue(connectionurl.getUsername().equals("ritchiem"));
         assertTrue(connectionurl.getPassword().equals("bob"));
-        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
 
         assertTrue(connectionurl.getBrokerCount() == 2);
 
@@ -60,14 +60,14 @@
 
     public void testSingleTransportUsernamePasswordURL() throws URLSyntaxException
     {
-        String url = "amqp://ritchiem:bob@/temp?brokerlist='tcp://localhost:5672'";
+        String url = "amqp://ritchiem:bob@/test?brokerlist='tcp://localhost:5672'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
         assertTrue(connectionurl.getFailoverMethod() == null);
         assertTrue(connectionurl.getUsername().equals("ritchiem"));
         assertTrue(connectionurl.getPassword().equals("bob"));
-        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
 
         assertTrue(connectionurl.getBrokerCount() == 1);
 
@@ -80,14 +80,14 @@
 
     public void testSingleTransportUsernameBlankPasswordURL() throws URLSyntaxException
     {
-        String url = "amqp://ritchiem:@/temp?brokerlist='tcp://localhost:5672'";
+        String url = "amqp://ritchiem:@/test?brokerlist='tcp://localhost:5672'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
         assertTrue(connectionurl.getFailoverMethod() == null);
         assertTrue(connectionurl.getUsername().equals("ritchiem"));
         assertTrue(connectionurl.getPassword().equals(""));
-        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
 
         assertTrue(connectionurl.getBrokerCount() == 1);
 
@@ -100,7 +100,7 @@
 
     public void testFailedURLNullPassword()
     {
-        String url = "amqp://ritchiem@/temp?brokerlist='tcp://localhost:5672'";
+        String url = "amqp://ritchiem@/test?brokerlist='tcp://localhost:5672'";
 
         try
         {
@@ -140,7 +140,7 @@
 
     public void testSingleTransportWithClientURLURL() throws URLSyntaxException
     {
-        String url = "amqp://guest:guest@clientname/temp?brokerlist='tcp://localhost:5672'";
+        String url = "amqp://guest:guest@clientname/test?brokerlist='tcp://localhost:5672'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
@@ -148,7 +148,7 @@
         assertTrue(connectionurl.getFailoverMethod() == null);
         assertTrue(connectionurl.getUsername().equals("guest"));
         assertTrue(connectionurl.getPassword().equals("guest"));
-        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
         assertTrue(connectionurl.getClientName().equals("clientname"));
 
 
@@ -164,14 +164,14 @@
 
     public void testSingleTransport1OptionURL() throws URLSyntaxException
     {
-        String url = "amqp://guest:guest@/temp?brokerlist='tcp://localhost:5672',routingkey='jim'";
+        String url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672',routingkey='jim'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
         assertTrue(connectionurl.getFailoverMethod() == null);
         assertTrue(connectionurl.getUsername().equals("guest"));
         assertTrue(connectionurl.getPassword().equals("guest"));
-        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
 
 
         assertTrue(connectionurl.getBrokerCount() == 1);
@@ -187,14 +187,36 @@
 
     public void testSingleTransportDefaultedBroker() throws URLSyntaxException
     {
-        String url = "amqp://guest:guest@/temp?brokerlist='localhost'";
+        String url = "amqp://guest:guest@/test?brokerlist='localhost'";
+
+        ConnectionURL connectionurl = new AMQConnectionURL(url);
+
+        assertTrue(connectionurl.getFailoverMethod() == null);
+        assertTrue(connectionurl.getUsername().equals("guest"));
+        assertTrue(connectionurl.getPassword().equals("guest"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
+
+
+        assertTrue(connectionurl.getBrokerCount() == 1);
+
+        BrokerDetails service = connectionurl.getBrokerDetails(0);
+
+        assertTrue(service.getTransport().equals("tcp"));
+
+        assertTrue(service.getHost().equals("localhost"));
+        assertTrue(service.getPort() == 5672);
+    }
+
+    public void testSingleTransportDefaultedBrokerWithPort() throws URLSyntaxException
+    {
+        String url = "amqp://guest:guest@/test?brokerlist='localhost:1234'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
         assertTrue(connectionurl.getFailoverMethod() == null);
         assertTrue(connectionurl.getUsername().equals("guest"));
         assertTrue(connectionurl.getPassword().equals("guest"));
-        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
 
 
         assertTrue(connectionurl.getBrokerCount() == 1);
@@ -204,20 +226,64 @@
         assertTrue(service.getTransport().equals("tcp"));
 
         assertTrue(service.getHost().equals("localhost"));
+        assertTrue(service.getPort() == 1234);
+    }
+
+    public void testSingleTransportDefaultedBrokerWithIP() throws URLSyntaxException
+    {
+        String url = "amqp://guest:guest@/test?brokerlist='127.0.0.1'";
+
+        ConnectionURL connectionurl = new AMQConnectionURL(url);
+
+        assertTrue(connectionurl.getFailoverMethod() == null);
+        assertTrue(connectionurl.getUsername().equals("guest"));
+        assertTrue(connectionurl.getPassword().equals("guest"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
+
+
+        assertTrue(connectionurl.getBrokerCount() == 1);
+
+        BrokerDetails service = connectionurl.getBrokerDetails(0);
+
+        assertTrue(service.getTransport().equals("tcp"));
+
+        assertTrue(service.getHost().equals("127.0.0.1"));
         assertTrue(service.getPort() == 5672);
     }
 
+    public void testSingleTransportDefaultedBrokerWithIPandPort() throws URLSyntaxException
+    {
+        String url = "amqp://guest:guest@/test?brokerlist='127.0.0.1:1234'";
+
+//        ConnectionURL connectionurl = new AMQConnectionURL(url);
+//
+//        assertTrue(connectionurl.getFailoverMethod() == null);
+//        assertTrue(connectionurl.getUsername().equals("guest"));
+//        assertTrue(connectionurl.getPassword().equals("guest"));
+//        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+//
+//
+//        assertTrue(connectionurl.getBrokerCount() == 1);
+//
+//        BrokerDetails service = connectionurl.getBrokerDetails(0);
+//
+//        assertTrue(service.getTransport().equals("tcp"));
+//
+//        assertTrue(service.getHost().equals("127.0.0.1"));
+//        assertTrue(service.getPort() == 1234);
+    }
+
 
     public void testSingleTransportMultiOptionURL() throws URLSyntaxException
     {
-        String url = "amqp://guest:guest@/temp?brokerlist='tcp://localhost:5672',routingkey='jim',timeout='200',immediatedelivery='true'";
+        String url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672',routingkey='jim',timeout='200',immediatedelivery='true'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
         assertTrue(connectionurl.getFailoverMethod() == null);
         assertTrue(connectionurl.getUsername().equals("guest"));
         assertTrue(connectionurl.getPassword().equals("guest"));
-        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
 
         assertTrue(connectionurl.getBrokerCount() == 1);
 
@@ -235,14 +301,14 @@
 
     public void testSinglevmURL() throws URLSyntaxException
     {
-        String url = "amqp://guest:guest@/messages?brokerlist='vm://:2'";
+        String url = "amqp://guest:guest@/test?brokerlist='vm://:2'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
         assertTrue(connectionurl.getFailoverMethod() == null);
         assertTrue(connectionurl.getUsername().equals("guest"));
         assertTrue(connectionurl.getPassword().equals("guest"));
-        assertTrue(connectionurl.getVirtualHost().equals("/messages"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
 
         assertTrue(connectionurl.getBrokerCount() == 1);
 
@@ -256,14 +322,14 @@
 
     public void testFailoverVMURL() throws URLSyntaxException
     {
-        String url = "amqp://ritchiem:bob@/temp?brokerlist='vm://:2;vm://:3',failover='roundrobin'";
+        String url = "amqp://ritchiem:bob@/test?brokerlist='vm://:2;vm://:3',failover='roundrobin'";
 
         ConnectionURL connectionurl = new AMQConnectionURL(url);
 
         assertTrue(connectionurl.getFailoverMethod().equals("roundrobin"));
         assertTrue(connectionurl.getUsername().equals("ritchiem"));
         assertTrue(connectionurl.getPassword().equals("bob"));
-        assertTrue(connectionurl.getVirtualHost().equals("/temp"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
 
         assertTrue(connectionurl.getBrokerCount() == 2);
 
@@ -307,7 +373,6 @@
 
         assertTrue(connectionurl.getBrokerCount() == 1);
     }
-
 
 
     public void testWrongOptionSeparatorInOptions()