[ 
https://issues.apache.org/jira/browse/AMQ-5877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

siva phani kumar reopened AMQ-5877:
-----------------------------------
    Regression: Unit Test Broken

I downloaded activemq 5.11.1 from 
http://www.apache.org/dyn/closer.cgi?path=/activemq/5.11.1/apache-activemq-5.11.1-bin.zip
  unzipped and placed the 'activemq-all-5.11.1.jar' in classpath and run 
attached AMQ5877Test.java.

Then i  get the same old error.
{code}
java.lang.AssertionError: Expected message to be read with message selector : 
JMSMessageID='ID:SKOTHURI4T5ZD02-54709-1439369166722-3:1:4:1:1'
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.assertTrue(Assert.java:41)
        at org.junit.Assert.assertNotNull(Assert.java:621)
        at AMQ5877Test.testScenario(AMQ5877Test.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
{code}

I am missing something to configure?

> The Queue got hanged with a scenario said in description with version 5.11.1 
> but this works with version 5.5.1
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-5877
>                 URL: https://issues.apache.org/jira/browse/AMQ-5877
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.11.1
>         Environment: Window 7 Enterprise Edition,  64 bit
> JDK 1.8.0_25, 64 bit 
> apache-activemq-5.11.1
>            Reporter: siva phani kumar
>            Priority: Blocker
>         Attachments: AMQ5877Test.java
>
>
> We are unable to read the message with message selector if we follow the 
> below steps in ActiveMQ 5.11.1 
> * Start ActiveMQ
> * Send Two messages
> * Read one message with our selector,Using consumer.recieve() API
> * Send One more message, And hold the messageId
> * Read the message with the above message Id which we are holding as a 
> selector("JMSMessageID='" + messageId + "'") immediately.
> * Now message we wont able to read, consumer thread will be waiting infinitely
> *Note :*  Its required activemq-all-5.11.1.jar,Junit jars need to be in 
> classpath.
> Issue reproducible prgoram
> {code:java}
> import java.util.Properties;
> import javax.jms.Connection;
> import javax.jms.ConnectionFactory;
> import javax.jms.Message;
> import javax.jms.MessageConsumer;
> import javax.jms.MessageProducer;
> import javax.jms.Queue;
> import javax.jms.Session;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import org.junit.AfterClass;
> import org.junit.Assert;
> import org.junit.BeforeClass;
> import org.junit.Test;
> /**
>  * We are unable to read the message with message selector if we follow the
>  * below steps in ActiveMQ 5.11.1
>  * <ul>
>  * <li>Start ActiveMQ</li>
>  * <li>Send Two messages</li>
>  * <li>Read one message with our selector,Using consumer.recieve() API</li>
>  * <li>Send One more message, And hold the messageId</li>
>  * <li>Read the message with the above message Id which we are holding as a
>  * selector("JMSMessageID='" + messageId + "'") immediately.</li>
>  * <li>Now message we wont able to read, consumer thread will be waiting
>  * infinitely</li>
>  * </ul>
>  * <b>Note : </b> Its required activemq-all-5.11.1.jar,Junit jars need to be 
> in classpath.
>  *
>  */
> public final class MessageSelectorJunit {
>       private static Connection connection = null;
>       private static final String CONTEXT_FACTORY = 
> "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
>       private static final String URL = "tcp://localhost:61616";
>       private static final String QUEUE_NAME = "TestQueue";
>       @BeforeClass
>       public static void oneTimeSetUp() throws Exception {
>               Properties properties = new Properties();
>               properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
> CONTEXT_FACTORY);
>               properties.setProperty(Context.PROVIDER_URL, URL);
>               // Connection Creation
>               Context context = new InitialContext(properties);
>               ConnectionFactory connectionFactory = (ConnectionFactory) 
> context.lookup("QueueConnectionFactory");
>               connection = connectionFactory.createConnection();
>               connection.start();
>       }
>       @Test
>       public void testScenario() throws Exception {
>               // Message1
>               sendJMSMessage();
>               sendJMSMessage();
>               getJMSMessage(null);
>               // Message2
>               String messageId2 = sendJMSMessage();
>               String messageSelector = "JMSMessageID='" + messageId2 + "'";
>               Assert.assertNotNull("Expected message to be read with message 
> selector : " + messageSelector,
>                               getJMSMessage(messageSelector));
>       }
>       private String sendJMSMessage() throws Exception {
>               String messageId = null;
>               Session session = null;
>               MessageProducer producer = null;
>               try {
>                       session = connection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>                       producer = 
> session.createProducer(session.createQueue(QUEUE_NAME));
>                       Message msg = session.createTextMessage("Test Message");
>                       producer.send(msg);
>                       messageId = msg.getJMSMessageID();
>                       System.out.println("Send MessageId : " + messageId);
>               } finally {
>                       producer.close();
>                       session.close();
>               }
>               return messageId;
>       }
>       private String getJMSMessage(String messageSelector) throws Exception {
>               String recievedId = null;
>               MessageConsumer consumer = null;
>               Session session = null;
>               try {
>                       session = connection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>                       Queue queue = session.createQueue(QUEUE_NAME);
>                       System.out.println("Started Recieving the message with 
> the message selector : " + messageSelector);
>                       consumer = session.createConsumer(queue, 
> messageSelector);
>                       connection.start();
>                       Message msg = consumer.receive(1000);
>                       if (msg != null) {
>                               recievedId = msg.getJMSMessageID();
>                               System.out.println("Message Recieved, Id : " + 
> msg.getJMSMessageID());
>                       } else {
>                               System.out.println("Message not recieved.");
>                       }
>               } finally {
>                       consumer.close();
>                       session.close();
>               }
>               return recievedId;
>       }
>       @AfterClass
>       public static void oneTimeTearDown() throws Exception {
>               if (connection != null) {
>                       connection.close();
>               }
>       }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to