qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPID-5931) [Java client] JMSException instead of InvalidDestinationException raised when sending to temporary destination after session closure
Date Mon, 28 Jul 2014 12:44:40 GMT

    [ https://issues.apache.org/jira/browse/QPID-5931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14076188#comment-14076188
] 

ASF subversion and git services commented on QPID-5931:
-------------------------------------------------------

Commit 1613984 from [~pmoravec] in branch 'qpid/trunk'
[ https://svn.apache.org/r1613984 ]

[QPID-5931]: [Java client] JMSException instead of InvalidDestinationException raised when
sending to temporary destination after session closure

> [Java client]  JMSException instead of InvalidDestinationException raised when sending
to temporary destination after session closure
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-5931
>                 URL: https://issues.apache.org/jira/browse/QPID-5931
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.28
>            Reporter: Pavel Moravec
>            Assignee: Pavel Moravec
>            Priority: Trivial
>              Labels: easyfix, easytest, patch
>             Fix For: 0.29
>
>
> An attempt to send to an auxiliary queue after the relevant session is closed should
raise InvalidDestinationException. But  javax.jms.JMSException is raised instead.
> junit test for this follows:
> ~~~
> package org.apache.qpid.example;
> import static org.junit.Assert.assertEquals;
> import static org.junit.Assert.assertNotNull;
> import static org.junit.Assert.fail;
> import org.apache.qpid.client.AMQConnection;
> import org.apache.qpid.client.AMQAnyDestination;
> import javax.jms.Connection;
> import javax.jms.ConnectionFactory;
> import javax.jms.Destination;
> import javax.jms.InvalidDestinationException;
> import javax.jms.JMSException;
> import javax.jms.MessageConsumer;
> import javax.jms.MessageProducer;
> import javax.jms.Session;
> import javax.jms.TemporaryQueue;
> import javax.jms.TextMessage;
> import org.junit.After;
> import org.junit.Before;
> import org.junit.Test;
> public class InvalidDestinationTest 
> {
> 	private Destination destination;
> 	private ConnectionFactory conFac;
> 	private Connection publisherConnection;
> 	private Session publisherSession;
> 	private Connection consumerConnection;
> 	private Session consumerSession;
> 	private MessageProducer publisherMsgProducer;
> 	private MessageConsumer consumerMsgConsumer;
> 	private MessageProducer consumerMsgProducer;
> 	private TemporaryQueue replyToQueue;
> 	public void setupQpid() throws Exception
> 	{
> 		destination = new AMQAnyDestination("demoQueue; {create: always}");
> 		
>                 String brokerlist = "amqp://guest:guest@guest/test?brokerlist='tcp://localhost:5672'";
> 		publisherConnection = new AMQConnection(brokerlist);
> 		publisherSession = publisherConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
> 		
> 		consumerConnection = new AMQConnection(brokerlist);;
> 		consumerSession = consumerConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
	
> 	}	
> 	@Before
> 	public void before() throws Exception
> 	{
> 		setupQpid();
> 	}
> 	
> 	@After
> 	public void after() throws Exception
> 	{
> 		consumerSession.close();
> 		consumerConnection.close();
> 		publisherSession.close();
> 		publisherConnection.close();
> 	}
> 	
> 	@Test
> 	public void sendToTempQueueWhenItDoesNotExist() throws Exception
> 	{
> 		consumerMsgConsumer = consumerSession.createConsumer(destination);
> 		consumerConnection.start();
> 		publisherMsgProducer = publisherSession.createProducer(destination);
> 		replyToQueue = publisherSession.createTemporaryQueue();		
> 		publisherConnection.close();
> 				
> 		TextMessage response = consumerSession.createTextMessage("");
> 		consumerMsgProducer = consumerSession.createProducer(replyToQueue);
> 		try
> 		{
> 			consumerMsgProducer.send(response);
> 		}
> 		catch (InvalidDestinationException e)
> 		{	
> 			//expect to get this exception			
> 		}
> 		catch (JMSException e)
> 		{
> 			e.printStackTrace();
> 			fail("Unexpected exception type");
> 		}
> 	}	
> }
> ~~~



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message