Examples of MapMessageImpl


Examples of com.caucho.jms.message.MapMessageImpl

   * Reads a map message.
   */
  private MapMessageImpl readMapMessage(InputStream is)
    throws IOException, JMSException
  {
    MapMessageImpl map = new MapMessageImpl();

    if (is == null)
      return map;

    ObjectInputStream in = new ContextLoaderObjectInputStream(is);

    try {
      while (true) {
        String name = in.readUTF();
        Object obj = in.readObject();

        map.setObject(name, obj);
      }
    } catch (EOFException e) {
    } catch (Exception e) {
      throw new JmsExceptionWrapper(e);
    }
View Full Code Here

Examples of com.caucho.jms.message.MapMessageImpl

  public MapMessage createMapMessage()
    throws JMSException
  {
    checkOpen();
   
    return new MapMessageImpl();
  }
View Full Code Here

Examples of com.caucho.jms.message.MapMessageImpl

  public MapMessage createMapMessage()
    throws JMSException
  {
    checkOpen();
   
    return new MapMessageImpl();
  }
View Full Code Here

Examples of com.caucho.jms.message.MapMessageImpl

   * Reads a map message.
   */
  private MapMessageImpl readMapMessage(InputStream is)
    throws IOException, JMSException
  {
    MapMessageImpl map = new MapMessageImpl();

    if (is == null)
      return map;

    ObjectInputStream in = new ContextLoaderObjectInputStream(is);

    try {
      while (true) {
  String name = in.readUTF();
  Object obj = in.readObject();

  map.setObject(name, obj);
      }
    } catch (EOFException e) {
    } catch (Exception e) {
      throw new JmsExceptionWrapper(e);
    }
View Full Code Here

Examples of hermes.providers.messages.MapMessageImpl

   * (non-Javadoc)
   *
   * @see hermes.MessageFactory#createMapMessage()
   */
  public MapMessage createMapMessage() throws JMSException {
    return new MapMessageImpl();
  }
View Full Code Here

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

        return msg;
    }
   
    public static MapMessageImpl createMapMessage( int size ) throws JMSException
    {
        MapMessageImpl msg = new MapMessageImpl();
        setDummyProperties(msg);
       
        msg.setBoolean("boolean", true);
        msg.setString("string", "foobar");
        msg.setChar("char", 'c');
        msg.setByte("byte", (byte)1);
        msg.setShort("short", (short)2);
        msg.setInt("int", 3);
        msg.setLong("long", 4);
        msg.setFloat("float", 1.23f);
        msg.setDouble("double", 4.56);
        msg.setBytes("bytearray", createDummyByteArray(size));
       
        return msg;
    }
View Full Code Here

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

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

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

    assertEquals("foobar",msg.getString("prop"));
  }
 
  public void testNumericStringConversion() throws Exception
  {
    MapMessageImpl msg;
   
    // Boolean
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    assertFalse(msg.getBoolean("prop"));
   
    // Byte
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    assertEquals((byte)123,msg.getByte("prop"));
   
    // Short
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    assertEquals(123,msg.getShort("prop"));
   
    // Char
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    try { msg.getChar("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals("123",msg.getString("prop"));
   
    // Int
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    assertEquals(123,msg.getInt("prop"));
   
    // Long
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    assertEquals(123,msg.getLong("prop"));
   
    // Float
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    assertEquals(123,msg.getFloat("prop"),0);
   
    // Double
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    assertEquals(123,msg.getDouble("prop"),0);
   
    // String
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    assertEquals("123",msg.getString("prop"));
   
    // Bytes
    msg = new MapMessageImpl();
    msg.setString("prop","123");
    msg.markAsReadOnly();
    try { msg.getBytes("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals("123",msg.getString("prop"));
  }
 
View Full Code Here

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

    assertEquals("123",msg.getString("prop"));
  }
 
  public void testBytesConversion() throws Exception
  {
    MapMessageImpl msg;
   
    byte[] dummy = { (byte)1 , (byte)2 , (byte)3 };
   
    // Boolean
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getBoolean("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(3,msg.getBytes("prop").length);
   
    // Byte
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getByte("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(3,msg.getBytes("prop").length);
   
    // Short
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getShort("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(3,msg.getBytes("prop").length);
   
    // Char
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getChar("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(3,msg.getBytes("prop").length);
   
    // Int
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getInt("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(3,msg.getBytes("prop").length);
   
    // Long
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getLong("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(3,msg.getBytes("prop").length);
   
    // Float
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getFloat("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(3,msg.getBytes("prop").length);
   
    // Double
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getDouble("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(3,msg.getBytes("prop").length);
   
    // String
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    try { msg.getString("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(3,msg.getBytes("prop").length);
   
    // Bytes
    msg = new MapMessageImpl();
    msg.setBytes("prop",dummy);
    msg.markAsReadOnly();
    byte[] data = msg.getBytes("prop");
    assertEquals(3,data.length);
    assertEquals(1, data[0]);
    assertEquals(2, data[1]);
    assertEquals(3, data[2]);
  }
View Full Code Here

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

*/
public class MapMessageImplTest extends TestCase
{
  public void testBooleanConversion() throws Exception
  {
    MapMessageImpl msg;
   
    // Boolean
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    assertTrue(msg.getBoolean("prop"));
   
    // Byte
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    try { msg.getByte("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertTrue(msg.getBoolean("prop"));
   
    // Short
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    try { msg.getShort("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.getBoolean("prop"));

    // Char
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    try { msg.getChar("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertTrue(msg.getBoolean("prop"));
   
    // Int
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    try { msg.getInt("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.getBoolean("prop"));
   
    // Long
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    try { msg.getLong("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.getBoolean("prop"));
   
    // Float
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    try { msg.getFloat("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.getBoolean("prop"));
   
    // Double
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    try { msg.getDouble("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.getBoolean("prop"));
   
    // String
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    assertEquals("true",msg.getString("prop"));
   
    // Bytes
    msg = new MapMessageImpl();
    msg.setBoolean("prop",true);
    msg.markAsReadOnly();
    try { msg.getBytes("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertTrue(msg.getBoolean("prop"));
  }
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.