Package javax.jms

Examples of javax.jms.StreamMessage.readByte()


            StreamMessage message = (StreamMessage) consumer.receive(1000);
            assertNotNull(message);
           
            // Invalid conversion should throw exception and not move the stream position.
            try {
                message.readByte();
                fail("Should have received NumberFormatException");
            } catch (NumberFormatException e) {
            }
           
            assertEquals("This is a test to see how it works.", message.readString() );
View Full Code Here


           
            assertEquals("This is a test to see how it works.", message.readString() );
   
            // Invalid conversion should throw exception and not move the stream position.
            try {
                message.readByte();
                fail("Should have received MessageEOFException");
            } catch (MessageEOFException e) {
            }
        }
        assertNull(consumer.receiveNoWait());
View Full Code Here

      sent.writeString("31415926535897932384626433832795");

      StreamMessage recv = (StreamMessage) sendRecMsg(sent);
      log.debug("recv: "+recv);
      assertTrue("Boolean == true", recv.readBoolean() == true);
      assertTrue("Byte == 1", recv.readByte() == 1);
      // Quirky spec behavior requires a read past the end of the byte[] field
      byte[] bytes = new byte[testBytes.length];
      recv.readBytes(bytes);
      assertTrue(recv.readBytes(bytes) < 0);
      assertTrue("Bytes == Bytes[]",
View Full Code Here

      ret = m2.readBytes(bytes2);
      assertEquals(-1, ret);

      assertEquals(myBool, m2.readBoolean());
      assertEquals(myByte, m2.readByte());
      assertEquals(myShort, m2.readShort());
      assertEquals(myInt, m2.readInt());
      assertEquals(myLong, m2.readLong());
      assertEquals(myFloat, m2.readFloat(), 0);
      assertEquals(myDouble, m2.readDouble(), 0);
View Full Code Here

      {
      }

      try
      {
         m2.readByte();
         fail();
      }
      catch (MessageEOFException e)
      {
      }
View Full Code Here

      m2.reset();

      // check we go back to the beginning
      assertEquals(myBool, m2.readBoolean());
      assertEquals(myByte, m2.readByte());
      assertEquals(myShort, m2.readShort());
      assertEquals(myChar, m2.readChar());
      assertEquals(myInt, m2.readInt());
      assertEquals(myLong, m2.readLong());
      assertEquals(myFloat, m2.readFloat(), 0);
View Full Code Here

      sm.setStringProperty("COM_SUN_JMS_TESTNAME",
                                    "xMessageEOFExceptionQTestforStreamMessage");
      queueProducer.send(sm);

      StreamMessage received = (StreamMessage)queueConsumer.receive(3000);
      received.readByte();
   }
  
   public void testBytesMessage() throws Exception
   {
      BytesMessage m = queueProducerSession.createBytesMessage();
View Full Code Here

      queueProducer.send(queue, m);

      StreamMessage m2 = (StreamMessage) queueConsumer.receive(2000);

      assertEquals(myBool, m2.readBoolean());
      assertEquals(myByte, m2.readByte());
      assertEquals(myShort, m2.readShort());
      assertEquals(myChar, m2.readChar());
      assertEquals(myInt, m2.readInt());
      assertEquals(myLong, m2.readLong());
      assertEquals(myFloat, m2.readFloat(), 0);
View Full Code Here

      StreamMessage sm = (StreamMessage)m;

      sm.reset();

      assertEquals(true, sm.readBoolean());
      assertEquals((byte)3, sm.readByte());
      byte[] bytes = new byte[3];
      sm.readBytes(bytes);
      assertEquals((byte)4, bytes[0]);
      assertEquals((byte)5, bytes[1]);
      assertEquals((byte)6, bytes[2]);
View Full Code Here

        con.start();

        StreamMessage msg2 = (StreamMessage) consumer.receive(2000);
        assertNotNull(msg2);

        msg2.readByte();
        try
        {
            msg2.readByte();
        }
        catch (Exception e)
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.