From: Manik S. <msu...@jb...> - 2006-05-10 23:54:04
|
User: msurtani Date: 06/05/10 19:54:01 Added: tests/functional/org/jboss/cache/data Address.java Course.java Person.java RandomString.java Student.java Log: Moved test data from perf to functional Revision Changes Path 1.1 date: 2006/05/10 23:54:01; author: msurtani; state: Exp;JBossCache/tests/functional/org/jboss/cache/data/Address.java Index: Address.java =================================================================== package org.jboss.cache.data; /** * @author Ben Wang * @@org.jboss.cache.aop.AopMarker */ public class Address implements java.io.Serializable { protected String city; protected int zip; protected String street; public void setCity(String city) { this.city = city; } public String getCity() { return this.city; } public void setZip(int zip) { this.zip = zip; } public int getZip() { return zip; } public void setStreet(String street) { this.street = street; } public String getStreet() { return this.street; } public String getSimpleAddress() { StringBuffer buf = new StringBuffer(street); buf.append(" " + city); if (zip > 0) buf.append(" " + zip); return buf.toString(); } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("{City = " +city).append(" ,zip = " +zip).append(" ,street = " +street + "}\n"); return buf.toString(); } } 1.1 date: 2006/05/10 23:54:01; author: msurtani; state: Exp;JBossCache/tests/functional/org/jboss/cache/data/Course.java Index: Course.java =================================================================== package org.jboss.cache.data; /** * @author Brian Stansberry * @@org.jboss.cache.aop.AopMarker */ public class Course implements java.io.Serializable { protected String title; protected String instructor; protected String room; public void setTitle(String title) { this.title = title; } public String getTitle() { return this.title; } public void setRoom(String room) { this.room = room; } public String getRoom() { return this.room; } public void setInstructor(String instructor) { this.instructor = instructor; } public String getInstructor() { return instructor; } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("{Title = " +title).append(", Instructor = " + instructor).append(", Room = " +room + "}\n"); return buf.toString(); } public boolean equals(Object other) { if (this == other) return true; if (other instanceof Course) { String otherTitle = ((Course) other).getTitle(); return (title == otherTitle || (title != null && title.equals(otherTitle))); } return false; } public int hashCode() { return title == null ? 0 : title.hashCode(); } } 1.1 date: 2006/05/10 23:54:01; author: msurtani; state: Exp;JBossCache/tests/functional/org/jboss/cache/data/Person.java Index: Person.java =================================================================== package org.jboss.cache.data; import java.util.List; /** * @author Ben Wang * @@org.jboss.cache.aop.InstanceOfAopMarker */ public class Person implements java.io.Serializable { protected String name; protected Address address; public void setName(String name) { this.name = name; } public String getName() { return this.name; } public void setAddress(Address address) { this.address = address; } public Address getAddress() { return this.address; } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("{Name = " +name); if (address != null) buf.append(", Address = " + address.getSimpleAddress()); buf.append("}\n"); return buf.toString(); } } 1.1 date: 2006/05/10 23:54:01; author: msurtani; state: Exp;JBossCache/tests/functional/org/jboss/cache/data/RandomString.java Index: RandomString.java =================================================================== package org.jboss.cache.data; import java.util.*; public class RandomString { private static Random rn = new Random(12); public static int rand(int lo, int hi) { int n = hi - lo + 1; int i = rn.nextInt() % n; if (i < 0) i = -i; return lo + i; } public static String randomstring(int lo, int hi) { int n = rand(lo, hi); byte b[] = new byte[n]; for (int i = 0; i < n; i++) b[i] = (byte)rand('a', 'z'); return new String(b, 0); } public static String randomstring() { return randomstring(5, 25); } } 1.1 date: 2006/05/10 23:54:01; author: msurtani; state: Exp;JBossCache/tests/functional/org/jboss/cache/data/Student.java Index: Student.java =================================================================== package org.jboss.cache.data; import java.util.*; /** * @author Ben Wang */ public class Student extends Person { protected String school; // protected Set courses = new LinkedHashSet(); protected List courses = new ArrayList(); public void setSchool(String school) { this.school = school; } public String getSchool() { return this.school; } public void addCourse(Course course) { courses.add(course); } public void removeCourse(Course course) { courses.remove(course); } public Collection getCourses() { return Collections.unmodifiableList(courses); } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("{Name = " +name).append(", School = " +school); if (address != null) buf.append(", Address = " + address.getSimpleAddress()); buf.append("}\n"); buf.append("Courses:\n"); for (Iterator iter = getCourses().iterator(); iter.hasNext(); ) buf.append(iter.next()); return buf.toString(); } } |