Perhaps as a better way of phrasing my question, do the following unit
tests make sense??
public class DefaultJmsUriParserTestCase
extends TestCase
{
public void testBasicQueue()
{
DefaultJmsUriParser parser = new DefaultJmsUriParser();
assertEquals("Echo", parser.getDestinationName("jms://Echo"));
assertFalse(parser.isDestinationTopic("jms://Echo"));
assertEquals("", parser.getMessageSelector("jms://Echo"));
}
public void testBasicTopic()
{
DefaultJmsUriParser parser = new DefaultJmsUriParser();
assertEquals("Echo", parser.getDestinationName("jms://Echo?topic"));
assertTrue(parser.isDestinationTopic("jms://Echo?topic"));
assertEquals("", parser.getMessageSelector("jms://Echo?topic"));
}
public void testBasicSelector()
{
DefaultJmsUriParser parser = new DefaultJmsUriParser();
assertEquals("Echo", parser.getDestinationName("jms://Echo?jive"));
assertFalse(parser.isDestinationTopic("jms://Echo?jive"));
assertEquals("jive", parser.getMessageSelector("jms://Echo?jive"));
}
public void testQueueSelector()
{
DefaultJmsUriParser parser = new DefaultJmsUriParser();
assertEquals("Echo",
parser.getDestinationName("jms://Echo?queue=jive"));
assertFalse(parser.isDestinationTopic("jms://Echo?queue=jive"));
assertEquals("jive",
parser.getMessageSelector("jms://Echo?queue=jive"));
}
public void testTopicSelector()
{
DefaultJmsUriParser parser = new DefaultJmsUriParser();
assertEquals("Echo",
parser.getDestinationName("jms://Echo?topic=jive"));
assertTrue(parser.isDestinationTopic("jms://Echo?topic=jive"));
assertEquals("jive",
parser.getMessageSelector("jms://Echo?topic=jive"));
}
}
Thanks,
Sam Wilson
Sam Wilson wrote:
> Hi,
>
> I'm working on a custom JMS transport/channel that utilizes Spring's
> JmsTemplate for sending (for it's built-in retry logic) and
> ListenerContainer (for it's concurrent consumer pool).
>
> In the process I'm trying to grok the JmsTransport and JmsChannel
> code. I want to make sure that I extract the Jms destination
> information properly from the URI.
>
> I came across this entry in JIRA:
>
> http://jira.codehaus.org/browse/XFIRE-436
>
> and wanted to verify that the URI takes the form:
>
> jms://{destinationName}[?[(topic)|.*=]{selector}]
>
> The URI indicates a Queue destination in all cases EXCEPT when the
> text between the ? and the first = following it is exactly "topic". In
> addition, the selector consists of the whatever text follows the first
> = following the ?.
>
> I also noticed that there is some special code for handling WebLogic
> queue URI's in which case the URI is as follows:
>
> jms://{module!queueName}.*
>
> The destination name is module!queueName and the selector is queueName.
>
> The current JmsChannel code spreads this logic out through the
> getDestinationName() and initialize() methods.
>
> In my implementation I'm breaking this out in a JmsUriParser as follows:
>
> public interface JmsUriParser {
> public String getDestinationName(String uri);
> public boolean isTopic(String uri);
> public String getSelector(String uri);
> }
>
> I have a DefaultJmsUriParser and a WebLogicJmsUriParser. In this way
> the weblogic special code is kept separate (and also, so that other
> providers with weird behavior can be added later).
>
> Any comments or suggestions? When I finish my code I plan on
> submitting it back if anyone thinks it might be helpful.
>
> sw
Sam Wilson wrote:
Hi,
I'm working on a custom JMS transport/channel that utilizes Spring's
JmsTemplate for sending (for it's built-in retry logic) and
ListenerContainer (for it's concurrent consumer pool).
In the process I'm trying to grok the JmsTransport and JmsChannel
code. I want to make sure that I extract the Jms destination
information properly from the URI.
I came across this entry in JIRA:
http://jira.codehaus.org/browse/XFIRE-436
and wanted to verify that the URI takes the form:
jms://{destinationName}[?[(topic)|.*=]{selector}]
The URI indicates a Queue destination in all cases EXCEPT when the
text between the ? and the first = following it is exactly "topic". In
addition, the selector consists of the whatever text follows the first
= following the ?.
I also noticed that there is some special code for handling WebLogic
queue URI's in which case the URI is as follows:
jms://{module!queueName}.*
The destination name is module!queueName and the selector is queueName.
The current JmsChannel code spreads this logic out through the
getDestinationName() and initialize() methods.
In my implementation I'm breaking this out in a JmsUriParser as follows:
public interface JmsUriParser {
public String getDestinationName(String uri);
public boolean isTopic(String uri);
public String getSelector(String uri);
}
I have a DefaultJmsUriParser and a WebLogicJmsUriParser. In this way
the weblogic special code is kept separate (and also, so that other
providers with weird behavior can be added later).
Any comments or suggestions? When I finish my code I plan on
submitting it back if anyone thinks it might be helpful.
sw
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email