Author: aidan
Date: Sun Apr 20 03:54:09 2008
New Revision: 649905

URL: http://svn.apache.org/viewvc?rev=649905&view=rev
Log:
QPID-832 now 95% bug free

Modified:
    
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
    
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
    
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
    
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
    
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java

Modified: 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=649905&r1=649904&r2=649905&view=diff
==============================================================================
--- 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
 (original)
+++ 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
 Sun Apr 20 03:54:09 2008
@@ -369,7 +369,7 @@
         }
 
         _failoverPolicy = new FailoverPolicy(connectionURL);
-        if 
(_failoverPolicy.getCurrentBrokerDetails().getTransport().equals(BrokerDetails.VM))
+        if 
(_failoverPolicy.getNextBrokerDetails().getTransport().equals(BrokerDetails.VM))
         {
             _delegate = new AMQConnectionDelegate_0_8(this);
         }

Modified: 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java?rev=649905&r1=649904&r2=649905&view=diff
==============================================================================
--- 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
 (original)
+++ 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
 Sun Apr 20 03:54:09 2008
@@ -115,7 +115,7 @@
     {
         final AMQProtocolHandler handler = getProtocolHandler();
 
-        
handler.syncWrite(getProtocolHandler().getMethodRegistry().createTxCommitOkBody().generateFrame(_channelId),
 TxCommitOkBody.class);
+        
handler.syncWrite(getProtocolHandler().getMethodRegistry().createTxCommitBody().generateFrame(_channelId),
 TxCommitOkBody.class);
     }
 
     public void sendCreateQueue(AMQShortString name, final boolean autoDelete, 
final boolean durable, final boolean exclusive) throws AMQException,

Modified: 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java?rev=649905&r1=649904&r2=649905&view=diff
==============================================================================
--- 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
 (original)
+++ 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
 Sun Apr 20 03:54:09 2008
@@ -747,7 +747,10 @@
     public void setStateManager(AMQStateManager stateManager)
     {
         _stateManager = stateManager;
-        _protocolSession.setStateManager(stateManager);
+        if (_protocolSession != null)
+        {
+            _protocolSession.setStateManager(stateManager);
+        }
     }
 
     public AMQProtocolSession getProtocolSession()

Modified: 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java?rev=649905&r1=649904&r2=649905&view=diff
==============================================================================
--- 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
 (original)
+++ 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
 Sun Apr 20 03:54:09 2008
@@ -78,7 +78,7 @@
        TopicSubscriber subscriber = _session.createDurableSubscriber(_topic, 
"mysubname");
         assertEquals("Topic names should match from durable TopicSubscriber", 
_topic.getTopicName(), subscriber.getTopic().getTopicName());
 
-        subscriber = _session.createDurableSubscriber(_topic, "mysubname", 
"abc", false);
+        subscriber = _session.createDurableSubscriber(_topic, "mysubname2", 
"abc", false);
         assertEquals("Topic names should match from durable TopicSubscriber 
with selector", _topic.getTopicName(), subscriber.getTopic().getTopicName());
     }
 

Modified: 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java?rev=649905&r1=649904&r2=649905&view=diff
==============================================================================
--- 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
 (original)
+++ 
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
 Sun Apr 20 03:54:09 2008
@@ -196,7 +196,7 @@
     private void durabilityImplSessionPerConnection(int ackMode) throws 
AMQException, JMSException, URLSyntaxException
     {
         Message msg;
-
+        org.apache.log4j.BasicConfigurator.configure();
         // Create producer.
         AMQConnection con0 = new AMQConnection("vm://:1", "guest", "guest", 
"test", "test");
         con0.start();
@@ -259,15 +259,13 @@
         TopicSubscriber consumer3 = session3.createDurableSubscriber(topic, 
"MySubscription");
 
         _logger.info("Receive message on consumer 3 :expecting B");
-        msg = consumer3.receive(1000);
-        assertEquals("B", ((TextMessage) msg).getText());
+        msg = consumer3.receive(500);
+        assertNotNull("Consumer 3 should get message 'B'.", msg);
+        assertEquals("Incorrect Message recevied on consumer4.", "B", 
((TextMessage) msg).getText());
         _logger.info("Receive message on consumer 3 :expecting null");
-        msg = consumer3.receive(1000);
-        assertEquals(null, msg);
-        // we need to unsubscribe as the session is NO_ACKNOWLEDGE
-        // messages for the durable subscriber are not deleted so the test 
cannot
-        // be run twice in a row
-        session2.unsubscribe("MySubscription");
+        msg = consumer3.receive(500);
+        assertNull("There should be no more messages for consumption on 
consumer3.", msg);
+
         consumer1.close();
         consumer3.close();
 


Reply via email to