1 18 package org.apache.activemq.openwire.tool; 19 20 25 public class TestDataGenerator { 26 private int stringCounter; 27 28 private boolean boolCounter; 29 private byte byteCounter; 30 private char charCounter = 'a'; 31 private short shortCounter; 32 private int intCounter; 33 private long longCounter; 34 35 public String createByte() { 36 return "(byte) " + (++byteCounter); 37 } 38 39 public String createChar() { 40 return "'" + (charCounter++) + "'"; 41 } 42 43 public String createShort() { 44 return "(short) " + (++shortCounter); 45 } 46 47 public int createInt() { 48 return ++intCounter; 49 } 50 51 public long createLong() { 52 return ++longCounter; 53 } 54 55 public String createString(String property) { 56 return property + ":" + (++stringCounter); 57 } 58 59 public boolean createBool() { 60 boolCounter = !boolCounter; 61 return boolCounter; 62 } 63 64 public String createByteArray(String property) { 65 return "\"" + createString(property) + "\".getBytes()"; 66 } 67 } 68 | Popular Tags |