public static void bytesWriteUTF(ActiveMQBuffer message, String value) { message.writeUTF(value); }
public static void bytesWriteUTF(ActiveMQBuffer message, String value) { message.writeUTF(value); }
public static void bytesWriteUTF(ActiveMQBuffer message, String value) { message.writeUTF(value); }
public static void bytesWriteUTF(ActiveMQBuffer message, String value) { message.writeUTF(value); }
public static void bytesWriteUTF(ActiveMQBuffer message, String value) { message.writeUTF(value); }
public static void bytesWriteUTF(ActiveMQBuffer message, String value) { message.writeUTF(value); }
public static void bytesWriteUTF(ActiveMQBuffer message, String value) { message.writeUTF(value); }
@Test public void testUTF() throws Exception { String str = RandomUtil.randomString(); wrapper.writeUTF(str); Assert.assertEquals(str, wrapper.readUTF()); }
message.getBodyBuffer().writeUTF(stringbuffer.toString()); producer.send(message);
public void sendMessages(final int start, final int end) throws Exception { try (ClientSession session = factory.createSession(false, false)) { try { session.createQueue(QUEUE, QUEUE, true); } catch (Exception ignored) { } ClientProducer prod = session.createProducer(QUEUE); for (int i = start; i < end; i++) { ClientMessage msg = session.createMessage(true); msg.putIntProperty(new SimpleString("key"), i); msg.getBodyBuffer().writeUTF("message " + i); prod.send(msg); } session.commit(); session.close(); // server.stop(); -- this test was not supposed to stop the server, it should crash } }
@Test public void testReadData() throws Exception { ActiveMQBuffer dynamic = ActiveMQBuffers.dynamicBuffer(1); String str1 = RandomUtil.randomString(); String str2 = RandomUtil.randomString(); double d1 = RandomUtil.randomDouble(); float f1 = RandomUtil.randomFloat(); dynamic.writeUTF(str1); dynamic.writeString(str2); dynamic.writeDouble(d1); dynamic.writeFloat(f1); LargeMessageControllerImpl readBuffer = splitBuffer(3, dynamic.toByteBuffer().array()); Assert.assertEquals(str1, readBuffer.readUTF()); Assert.assertEquals(str2, readBuffer.readString()); Assert.assertEquals(d1, readBuffer.readDouble(), 0.000001); Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001); }
@Test public void testReadDataOverCached() throws Exception { clearDataRecreateServerDirs(); ActiveMQBuffer dynamic = ActiveMQBuffers.dynamicBuffer(1); String str1 = RandomUtil.randomString(); String str2 = RandomUtil.randomString(); double d1 = RandomUtil.randomDouble(); float f1 = RandomUtil.randomFloat(); dynamic.writeUTF(str1); dynamic.writeString(str2); dynamic.writeDouble(d1); dynamic.writeFloat(f1); LargeMessageControllerImpl readBuffer = splitBuffer(3, dynamic.toByteBuffer().array(), getTestFile()); Assert.assertEquals(str1, readBuffer.readUTF()); Assert.assertEquals(str2, readBuffer.readString()); Assert.assertEquals(d1, readBuffer.readDouble(), 0.00000001); Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001); readBuffer.readerIndex(0); Assert.assertEquals(str1, readBuffer.readUTF()); Assert.assertEquals(str2, readBuffer.readString()); Assert.assertEquals(d1, readBuffer.readDouble(), 0.00000001); Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001); readBuffer.close(); }