1 18 package org.apache.activemq.systest.impl; 19 20 import org.apache.activemq.systest.MessageList; 21 22 28 public class RandomMessageListImpl extends MessageListImpl { 29 30 public RandomMessageListImpl(int numberOfMessages, int charactersPerMessage) { 31 super(numberOfMessages, charactersPerMessage); 32 } 33 34 protected Object createTextPayload(int messageCounter, int charactersPerMessage) { 35 StringBuffer buffer = new StringBuffer (); 36 for (int i = 0; i < charactersPerMessage; i++) { 37 char ch = (char) (32 + (int) (Math.random() * 230)); 38 buffer.append(ch); 39 } 40 String answer = buffer.toString(); 41 assertEquals("String length should equal the requested length", charactersPerMessage, answer.length()); 42 return answer; 43 } 44 } 45 | Popular Tags |