Martin, I forgot to commit my local changes that excluded the tests from the java profile. The commit at rev 960048 should take care of it.
However this test should work on the java 0-10 test profile. Rajith On Fri, Jul 2, 2010 at 11:35 AM, Martin Ritchie <[email protected]> wrote: > Hi Rajith, > > Can you run the straight java profile on thi stest case please > 'testLoadingFromPropertiesFile' > > It has been failing in the local CI: > > > The new addressing based sytanx is not supported for AMQP 0-8/0-9 versions > > > > java.lang.UnsupportedOperationException: The new addressing based > sytanx is not supported for AMQP 0-8/0-9 versions > at > org.apache.qpid.client.AMQSession_0_8.handleAddressBasedDestination(AMQSession_0_8.java:597) > at > org.apache.qpid.client.AMQSession.registerConsumer(AMQSession.java:2606) > at org.apache.qpid.client.AMQSession.access$500(AMQSession.java:95) > at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:1809) > at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:1775) > at > org.apache.qpid.client.AMQConnectionDelegate_8_0.executeRetrySupport(AMQConnectionDelegate_8_0.java:291) > at > org.apache.qpid.client.AMQConnection.executeRetrySupport(AMQConnection.java:765) > at > org.apache.qpid.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:102) > at > org.apache.qpid.client.AMQSession.createConsumerImpl(AMQSession.java:1773) > at > org.apache.qpid.client.AMQSession.createConsumer(AMQSession.java:921) > at > org.apache.qpid.test.client.destination.AddressBasedDestinationTest.testLoadingFromPropertiesFile(AddressBasedDestinationTest.java:424) > > Regards > > Martin > > > On 25 June 2010 14:51, <[email protected]> wrote: >> Author: rajith >> Date: Fri Jun 25 13:51:32 2010 >> New Revision: 957942 >> >> URL: http://svn.apache.org/viewvc?rev=957942&view=rev >> Log: >> QPID-2696 >> Modified the PropertiesFileInitialContextFactory to allow the new addressing >> strings to be specified in the jndi properties file. >> Downgraded some "info" log messages in AMQDestination to "debug". >> Added a test cases to cover the issue reported in the JIRA. >> >> Modified: >> >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java >> >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java >> >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java >> >> qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java >> >> Modified: >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java >> URL: >> http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java?rev=957942&r1=957941&r2=957942&view=diff >> ============================================================================== >> --- >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java >> (original) >> +++ >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java >> Fri Jun 25 13:51:32 2010 >> @@ -23,6 +23,7 @@ package org.apache.qpid.client; >> import java.net.URISyntaxException; >> >> import org.apache.qpid.framing.AMQShortString; >> +import org.apache.qpid.messaging.Address; >> import org.apache.qpid.url.BindingURL; >> >> /** >> @@ -46,6 +47,11 @@ public class AMQAnyDestination extends A >> super(str); >> } >> >> + public AMQAnyDestination(Address addr) throws Exception >> + { >> + super(addr); >> + } >> + >> public AMQAnyDestination(AMQShortString exchangeName,AMQShortString >> exchangeClass, >> AMQShortString routingKey,boolean isExclusive, >> boolean isAutoDelete, AMQShortString queueName, >> >> Modified: >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java >> URL: >> http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java?rev=957942&r1=957941&r2=957942&view=diff >> ============================================================================== >> --- >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java >> (original) >> +++ >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java >> Fri Jun 25 13:51:32 2010 >> @@ -147,6 +147,8 @@ public abstract class AMQDestination imp >> defaultDestSyntax = DestSyntax.getSyntaxType( >> System.getProperty(ClientProperties.DEST_SYNTAX, >> DestSyntax.ADDR.toString())); >> + >> + >> } >> >> protected AMQDestination(Address address) throws Exception >> @@ -154,14 +156,18 @@ public abstract class AMQDestination imp >> this._address = address; >> getInfoFromAddress(); >> _destSyntax = DestSyntax.ADDR; >> - _logger.info("Based on " + address + " the selected destination >> syntax is " + _destSyntax); >> + _logger.debug("Based on " + address + " the selected destination >> syntax is " + _destSyntax); >> } >> >> protected AMQDestination(String str) throws URISyntaxException >> { >> if (str.startsWith("BURL:") || >> (!str.startsWith("ADDR:") && defaultDestSyntax == >> DestSyntax.BURL)) >> - { >> + { >> + if (str.startsWith("BURL:")) >> + { >> + str = str.substring(5,str.length()); >> + } >> _destSyntax = DestSyntax.BURL; >> getInfoFromBindingURL(new AMQBindingURL(str)); >> } >> @@ -180,7 +186,7 @@ public abstract class AMQDestination imp >> throw ex; >> } >> } >> - _logger.info("Based on " + str + " the selected destination syntax >> is " + _destSyntax); >> + _logger.debug("Based on " + str + " the selected destination syntax >> is " + _destSyntax); >> } >> >> //retained for legacy support >> @@ -188,7 +194,7 @@ public abstract class AMQDestination imp >> { >> getInfoFromBindingURL(binding); >> _destSyntax = DestSyntax.BURL; >> - _logger.info("Based on " + binding + " the selected destination >> syntax is " + _destSyntax); >> + _logger.debug("Based on " + binding + " the selected destination >> syntax is " + _destSyntax); >> } >> >> protected void getInfoFromBindingURL(BindingURL binding) >> @@ -270,7 +276,11 @@ public abstract class AMQDestination imp >> _bindingKeys = bindingKeys == null || bindingKeys.length == 0 ? new >> AMQShortString[0] : bindingKeys; >> _destSyntax = DestSyntax.BURL; >> _browseOnly = browseOnly; >> - _logger.info("Based on " + toString() + " the selected destination >> syntax is " + _destSyntax); >> + >> + if (_logger.isDebugEnabled()) >> + { >> + _logger.debug("Based on " + toString() + " the selected >> destination syntax is " + _destSyntax); >> + } >> } >> >> public DestSyntax getDestSyntax() >> @@ -642,6 +652,24 @@ public abstract class AMQDestination imp >> } >> } >> >> + public static Destination createDestination(String str) throws Exception >> + { >> + if (str.startsWith("BURL:") || >> + (!str.startsWith("ADDR:") && defaultDestSyntax == >> DestSyntax.BURL)) >> + { >> + if (str.startsWith("BURL:")) >> + { >> + str = str.substring(5,str.length()); >> + } >> + return createDestination(new AMQBindingURL(str)); >> + } >> + else >> + { >> + Address address = createAddressFromString(str); >> + return new AMQAnyDestination(address); >> + } >> + } >> + >> // ----- new address syntax ----------- >> >> public static class Binding >> @@ -764,11 +792,11 @@ public abstract class AMQDestination imp >> this._routingKey = rk; >> } >> >> - private Address createAddressFromString(String str) >> + private static Address createAddressFromString(String str) >> { >> if (str.startsWith("ADDR:")) >> { >> - str = str.substring(str.indexOf(':')+1,str.length()); >> + str = str.substring(5,str.length()); >> } >> return Address.parse(str); >> } >> >> Modified: >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java >> URL: >> http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?rev=957942&r1=957941&r2=957942&view=diff >> ============================================================================== >> --- >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java >> (original) >> +++ >> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java >> Fri Jun 25 13:51:32 2010 >> @@ -233,27 +233,15 @@ public class PropertiesFileInitialContex >> /** >> * Factory method to create new Destination instances from an AMQP >> BindingURL >> */ >> - protected Destination createDestination(String bindingURL) >> + protected Destination createDestination(String str) >> { >> - AMQBindingURL binding; >> try >> { >> - binding = new AMQBindingURL(bindingURL); >> + return AMQDestination.createDestination(str); >> } >> - catch (URISyntaxException urlse) >> + catch (Exception e) >> { >> - _logger.warn("Unable to create destination:" + urlse, urlse); >> - >> - return null; >> - } >> - >> - try >> - { >> - return AMQDestination.createDestination(binding); >> - } >> - catch (IllegalArgumentException iaw) >> - { >> - _logger.warn("Binding: '" + binding + "' not supported"); >> + _logger.warn("Unable to create destination:" + e, e); >> >> return null; >> } >> >> Modified: >> qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java >> URL: >> http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java?rev=957942&r1=957941&r2=957942&view=diff >> ============================================================================== >> --- >> qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java >> (original) >> +++ >> qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java >> Fri Jun 25 13:51:32 2010 >> @@ -23,19 +23,24 @@ package org.apache.qpid.test.client.dest >> >> import java.util.Collections; >> import java.util.HashMap; >> +import java.util.Hashtable; >> import java.util.Map; >> import javax.jms.Connection; >> +import javax.jms.Destination; >> import javax.jms.JMSException; >> import javax.jms.Message; >> import javax.jms.MessageConsumer; >> import javax.jms.MessageProducer; >> import javax.jms.Session; >> +import javax.jms.TextMessage; >> +import javax.naming.Context; >> >> import org.apache.qpid.client.AMQAnyDestination; >> import org.apache.qpid.client.AMQDestination; >> import org.apache.qpid.client.AMQSession_0_10; >> import org.apache.qpid.client.messaging.address.Node.ExchangeNode; >> import org.apache.qpid.client.messaging.address.Node.QueueNode; >> +import org.apache.qpid.jndi.PropertiesFileInitialContextFactory; >> import org.apache.qpid.messaging.Address; >> import org.apache.qpid.test.utils.QpidBrokerTestCase; >> import org.slf4j.Logger; >> @@ -79,7 +84,7 @@ public class AddressBasedDestinationTest >> AMQDestination dest = new AMQAnyDestination(addr1); >> try >> { >> - cons = jmsSession.createConsumer(dest); >> + cons = jmsSession.createConsumer(dest); >> } >> catch(JMSException e) >> { >> @@ -398,6 +403,48 @@ public class AddressBasedDestinationTest >> } >> } >> >> + public void testLoadingFromPropertiesFile() throws Exception >> + { >> + Hashtable<String,String> map = new Hashtable<String,String>(); >> + map.put("destination.myQueue1", "ADDR:my-queue/hello; {create: >> always, node: " + >> + "{x-declare: {auto-delete: true,'qpid.max_size': 1000}}}"); >> + >> + map.put("destination.myQueue2", "ADDR:my-queue2; { create: receiver >> }"); >> + >> + map.put("destination.myQueue3", >> "BURL:direct://amq.direct/my-queue3?routingkey='test'"); >> + >> + PropertiesFileInitialContextFactory props = new >> PropertiesFileInitialContextFactory(); >> + Context ctx = props.getInitialContext(map); >> + >> + AMQDestination dest1 = (AMQDestination)ctx.lookup("myQueue1"); >> + AMQDestination dest2 = (AMQDestination)ctx.lookup("myQueue2"); >> + AMQDestination dest3 = (AMQDestination)ctx.lookup("myQueue3"); >> + >> + Session jmsSession = >> _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE); >> + MessageConsumer cons1 = jmsSession.createConsumer(dest1); >> + MessageConsumer cons2 = jmsSession.createConsumer(dest2); >> + MessageConsumer cons3 = jmsSession.createConsumer(dest3); >> + >> + assertTrue("Destination1 was not created as expected",( >> + >> (AMQSession_0_10)jmsSession).isQueueExist(dest1,(QueueNode)dest1.getSourceNode(), >> true)); >> + >> + assertTrue("Destination1 was not bound as expected",( >> + (AMQSession_0_10)jmsSession).isQueueBound("", >> + dest1.getAddressName(),dest1.getAddressName(), null)); >> + >> + assertTrue("Destination2 was not created as expected",( >> + >> (AMQSession_0_10)jmsSession).isQueueExist(dest2,(QueueNode)dest2.getSourceNode(), >> true)); >> + >> + assertTrue("Destination2 was not bound as expected",( >> + (AMQSession_0_10)jmsSession).isQueueBound("", >> + dest2.getAddressName(),dest2.getAddressName(), null)); >> + >> + MessageProducer producer = jmsSession.createProducer(dest3); >> + producer.send(jmsSession.createTextMessage("Hello")); >> + TextMessage msg = (TextMessage)cons3.receive(1000); >> + assertEquals("Destination3 was not created as >> expected.",msg.getText(),"Hello"); >> + } >> + >> /*public void testBindQueueForXMLExchange() throws Exception >> { >> if (!isCppBroker()) >> >> >> >> --------------------------------------------------------------------- >> Apache Qpid - AMQP Messaging Implementation >> Project: http://qpid.apache.org >> Use/Interact: mailto:[email protected] >> >> > > > > -- > Martin Ritchie > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:[email protected] > > -- Regards, Rajith Attapattu Red Hat http://rajith.2rlabs.com/ --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
