Package net.timewalker.ffmq3.common.message

Examples of net.timewalker.ffmq3.common.message.EmptyMessageImpl


        }
    }
   
    protected void multiTopicConnectionListenerTest( String testName , CommTestParameters params , DummyMessageFactory msgFactory ) throws Exception
    {
        Topic topic = new TopicRef(params.destinationName);
       
        SynchronizationPoint startSynchro = new SynchronizationPoint();
        TopicConnection[] receiverConnections = new TopicConnection[params.receiverCount];
        for (int n = 0 ; n < receiverConnections.length ; n++)
            receiverConnections[n] = createTopicConnection();
View Full Code Here


          if (timeout == 0)
          {
            if (!connection.isStarted())
              return null;
           
            AbstractMessage message = localQueue.get((LocalSession)session,
                                   transactionSet,
                                                 selector);         
              if (message == null)
                return null;
             
            if (traceEnabled)
                  log.trace(session+" [GET] in "+localQueue+" - "+message);
 
            if (duplicateRequired)
              message = MessageTools.duplicate(message);
              message.markAsReadOnly();
             
              return message;
          }
   
          // Wait loop
          long now = System.currentTimeMillis();
          long startTime = now;
         
          // Passive wait
          while (!closed && (timeout < 0 || (now - startTime < timeout)))
          {
            // Don't do anything if connection is not started
          if (connection.isStarted())
          {
                  // Try obtaining something from target queue
            AbstractMessage message = localQueue.get((LocalSession)session,
                                                 transactionSet,
                                                 selector);
                if (message != null)
                {
                    if (traceEnabled)
                        log.trace(session+" [GET] in "+localQueue+" - "+message);
                   
                    if (duplicateRequired)
                  message = MessageTools.duplicate(message);
                  message.markAsReadOnly();
                 
                  return message;
                }
          }
             
View Full Code Here

        synchronized (this)
      {
            // Push up to 'prefetchCapacity' messages to the remote consumer
          while (prefetchCapacity > 0)
          {         
            AbstractMessage message = receiveFromDestination(0, false);
            if (message != null)
            {
                count++;
              prefetchCapacity--;
              notificationProxy.addNotification(id,message,prefetchCapacity);
View Full Code Here

        if (messages != null)
        {
            // Dispatch to session
            for(int n=0;n<messages.size();n++)
            {
                AbstractMessage msg = (AbstractMessage)messages.get(n);
                localSession.dispatch(msg);
            }
        }
       
        // Commit session
View Full Code Here

    }
   
    private PutResponse processPut( PutQuery query ) throws JMSException
    {
        LocalSession session = lookupSession(query);
        AbstractMessage msg = query.getMessage();
       
        // Dispatch to session
        session.dispatch(msg);
    
        return new PutResponse();
View Full Code Here

        if (messages != null)
        {
            // Dispatch to session
            for(int n=0;n<messages.size();n++)
            {
                AbstractMessage msg = (AbstractMessage)messages.get(n);
                session.dispatch(msg);
            }
        }
    
        return new MultiplePutResponse();
View Full Code Here

        return sb.toString();
    }
   
    public static EmptyMessageImpl createEmptyMessage() throws JMSException
    {
        EmptyMessageImpl msg = new EmptyMessageImpl();
        setDummyProperties(msg);
        return msg;
    }
View Full Code Here

     * (non-Javadoc)
     * @see javax.jms.Session#createMessage()
     */
    public final Message createMessage() throws JMSException
    {
        return new EmptyMessageImpl();
    }
View Full Code Here

*/
public class EmptyMessageImplTest extends TestCase
{
  public void testBooleanConversion() throws Exception
  {
    Message msg = new EmptyMessageImpl();
   
    msg.setBooleanProperty("prop", true);
   
    assertTrue(msg.getBooleanProperty("prop"));
    assertEquals("true",msg.getStringProperty("prop"));
   
    try { msg.getByteProperty("prop");   fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    try { msg.getShortProperty("prop");  fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    try { msg.getIntProperty("prop");    fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    try { msg.getLongProperty("prop");   fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    try { msg.getFloatProperty("prop");  fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    try { msg.getDoubleProperty("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
  }
View Full Code Here

    try { msg.getDoubleProperty("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
  }
 
  public void testByteConversion() throws Exception
  {
    Message msg = new EmptyMessageImpl();
   
    msg.setByteProperty("prop", (byte)123);
   
    assertEquals(123,msg.getByteProperty("prop"));
    assertEquals(123,msg.getShortProperty("prop"));
    assertEquals(123,msg.getIntProperty("prop"));
    assertEquals(123,msg.getLongProperty("prop"));
    assertEquals("123",msg.getStringProperty("prop"));
   
    try { msg.getBooleanProperty("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    try { msg.getFloatProperty("prop");   fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    try { msg.getDoubleProperty("prop");  fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
  }
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.common.message.EmptyMessageImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.