[jboss-cvs] JBoss Messaging SVN: r3751 - branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 20 19:08:52 EST 2008


Author: timfox
Date: 2008-02-20 19:08:52 -0500 (Wed, 20 Feb 2008)
New Revision: 3751

Modified:
   branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/TemporaryDestinationTest.java
Log:
Fixed test


Modified: branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/TemporaryDestinationTest.java
===================================================================
--- branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/TemporaryDestinationTest.java	2008-02-20 23:16:11 UTC (rev 3750)
+++ branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/TemporaryDestinationTest.java	2008-02-21 00:08:52 UTC (rev 3751)
@@ -67,35 +67,35 @@
    public void testTemp() throws Exception
    {
    	Connection conn = null;
-   	
+
    	try
    	{
    		conn = cf.createConnection();
-   		
+
    		Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
    		Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
 	      TemporaryTopic tempTopic = producerSession.createTemporaryTopic();
-	
+
 	      MessageProducer producer = producerSession.createProducer(tempTopic);
-	
+
 	      MessageConsumer consumer = consumerSession.createConsumer(tempTopic);
-	
+
 	      conn.start();
-	
+
 	      final String messageText = "This is a message";
-	
+
 	      Message m = producerSession.createTextMessage(messageText);
-	
+
 	      producer.send(m);
-	
+
 	      TextMessage m2 = (TextMessage)consumer.receive(2000);
-	
+
 	      assertNotNull(m2);
-	
+
 	      assertEquals(messageText, m2.getText());
-	
+
 	      try
 	      {
 	         tempTopic.delete();
@@ -105,10 +105,10 @@
 	      {
 	         //Can't delete temp dest if there are open consumers
 	      }
-	
+
 	      consumer.close();
-	      
-	      tempTopic.delete();      
+
+	      tempTopic.delete();
    	}
    	finally
    	{
@@ -123,33 +123,33 @@
    public void testTemporaryQueueBasic() throws Exception
    {
    	Connection conn = null;
-   	
+
    	try
    	{
    		conn = cf.createConnection();
-   		
+
    		Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
    		Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
 	      TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
-	
+
 	      MessageProducer producer = producerSession.createProducer(tempQueue);
-	
+
 	      MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
-	      
+
 	      conn.start();
-	
+
 	      final String messageText = "This is a message";
-	
+
 	      Message m = producerSession.createTextMessage(messageText);
-	
+
 	      producer.send(m);
-	
+
 	      TextMessage m2 = (TextMessage)consumer.receive(2000);
-	
+
 	      assertNotNull(m2);
-	
+
 	      assertEquals(messageText, m2.getText());
    	}
    	finally
@@ -167,15 +167,15 @@
    public void testTemporaryQueueOnClosedSession() throws Exception
    {
    	Connection producerConnection = null;
-   	
+
    	try
    	{
    		producerConnection = cf.createConnection();
-   		
+
    		Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		   	   	
+
 	      producerSession.close();
-	
+
 	      try
 	      {
 	         producerSession.createTemporaryQueue();
@@ -263,35 +263,35 @@
          }
       }
    }
-   
+
    public void testTemporaryQueueDeleteWithConsumer() throws Exception
    {
    	Connection conn = null;
-   	
+
    	try
    	{
    		conn = cf.createConnection();
-   		
+
    		Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
    		Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
 	   	TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
-	   	
+
 	   	MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
-	   	
+
 	   	try
 	   	{
 	   		tempQueue.delete();
-	   		
+
 	   		fail("Should throw JMSException");
 	   	}
 	   	catch (JMSException e)
 	   	{
 	   		//Should fail - you can't delete a temp queue if it has active consumers
 	   	}
-	   	
-	   	consumer.close();   	
+
+	   	consumer.close();
    	}
    	finally
    	{
@@ -301,35 +301,35 @@
    		}
    	}
    }
-   
+
    public void testTemporaryTopicDeleteWithConsumer() throws Exception
    {
    	Connection conn = null;
-   	
+
    	try
    	{
    		conn = cf.createConnection();
-   		
+
    		Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
    		Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
 	   	TemporaryTopic tempTopic = producerSession.createTemporaryTopic();
-	   	
+
 	   	MessageConsumer consumer = consumerSession.createConsumer(tempTopic);
-	   	
+
 	   	try
 	   	{
 	   		tempTopic.delete();
-	   		
+
 	   		fail("Should throw JMSException");
 	   	}
 	   	catch (JMSException e)
 	   	{
 	   		//Should fail - you can't delete a temp topic if it has active consumers
 	   	}
-	   	
-	   	consumer.close();   	
+
+	   	consumer.close();
 	   }
 		finally
 		{
@@ -343,41 +343,41 @@
    public void testTemporaryQueueDeleted() throws Exception
    {
    	Connection conn = null;
-   	
+
    	try
    	{
    		conn = cf.createConnection();
-   		
+
    		Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
    		Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
 	      //Make sure temporary queue cannot be used after it has been deleted
-	
+
 	      TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
-	
+
 	      MessageProducer producer = producerSession.createProducer(tempQueue);
-	
+
 	      MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
-	
+
 	      conn.start();
-	
+
 	      final String messageText = "This is a message";
-	
+
 	      Message m = producerSession.createTextMessage(messageText);
-	
+
 	      producer.send(m);
-	
+
 	      TextMessage m2 = (TextMessage)consumer.receive(2000);
-	
+
 	      assertNotNull(m2);
-	
+
 	      assertEquals(messageText, m2.getText());
-	
+
 	      consumer.close();
-	
+
 	      tempQueue.delete();
-	
+
 	      try
 	      {
 	         producer.send(m);
@@ -399,28 +399,28 @@
    public void testTemporaryTopicBasic() throws Exception
    {
    	Connection conn = null;
-   	
+
    	try
    	{
    		conn = cf.createConnection();
-   		
+
    		Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
    		Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		   	
+
 	      TemporaryTopic tempTopic = producerSession.createTemporaryTopic();
-	
+
 	      final MessageProducer producer = producerSession.createProducer(tempTopic);
-	
+
 	      MessageConsumer consumer = consumerSession.createConsumer(tempTopic);
-	
+
 	      conn.start();
-	
+
 	      final String messageText = "This is a message";
-	
+
 	      final Message m = producerSession.createTextMessage(messageText);
 	      log.trace("Message reliable:" + ((MessageProxy)m).getMessage().isReliable());
-	
+
 	      Thread t = new Thread(new Runnable()
 	      {
 	         public void run()
@@ -438,13 +438,13 @@
 	         }
 	      }, "Producer");
 	      t.start();
-	
+
 	      TextMessage m2 = (TextMessage)consumer.receive(3000);
-	
+
 	      assertNotNull(m2);
-	
+
 	      assertEquals(messageText, m2.getText());
-	
+
 	      t.join();
    	}
    	finally
@@ -463,15 +463,15 @@
    public void testTemporaryTopicOnClosedSession() throws Exception
    {
    	Connection producerConnection = null;
-   	
+
    	try
    	{
    		producerConnection = cf.createConnection();
-   		
+
    		Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   		
+
 	      producerSession.close();
-	
+
 	      try
 	      {
 	         producerSession.createTemporaryTopic();
@@ -494,16 +494,16 @@
    public void testTemporaryTopicShouldNotBeInJNDI() throws Exception
    {
    	Connection producerConnection = null;
-   	
+
    	try
    	{
    		producerConnection = cf.createConnection();
-   		
+
    		Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   	
+
 	      TemporaryTopic tempTopic = producerSession.createTemporaryTopic();
 	      String topicName = tempTopic.getTopicName();
-	      
+
 	      try
 	      {
 	         ic.lookup("/topic/" + topicName);
@@ -526,16 +526,16 @@
    public void testTemporaryQueueShouldNotBeInJNDI() throws Exception
    {
    	Connection producerConnection = null;
-   	
+
    	try
    	{
    		producerConnection = cf.createConnection();
-   		
+
    		Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-   	
+
 	      TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
 	      String queueName = tempQueue.getQueueName();
-	      
+
 	      try
 	      {
 	         ic.lookup("/queue/" + queueName);
@@ -561,6 +561,10 @@
     */
    public void testDeleteTemporaryQueueOnClose() throws Exception
    {
+      if (ServerManagement.isRemote())
+      {
+         return;
+      }
       ConnectionFactory factory = (ConnectionFactory) ic.lookup("ConnectionFactory");
       Connection connection = factory.createConnection();
 
@@ -569,18 +573,18 @@
 
       TemporaryQueue tempQueue = responseSession.createTemporaryQueue();
       log.info("Created TemporaryQueue: " + tempQueue);
-      
+
       DestinationManager dm = ServerManagement.getDestinationManager();
       Set destinations = dm.getDestinations();
       log.info("Destinations after temp queue creation: " + destinations);
-      
+
       assertTrue("Temporary destination is not registered in destination manager.", destinations.contains(tempQueue));
-      
+
       connection.close();
-      
+
       destinations = dm.getDestinations();
       log.info("Destinations after connection.close(): " + destinations);
-      assertTrue("Temporary destination is registered in destination manager.", ! destinations.contains(tempQueue)); 
+      assertTrue("Temporary destination is registered in destination manager.", ! destinations.contains(tempQueue));
    }
 
    // Package protected ---------------------------------------------




More information about the jboss-cvs-commits mailing list