* Create the requisite objects in the database
* @throws Exception A general exception.
*/
private void createTestDataSet() throws Exception {
LOG.info("creating test data set...");
Database db = null;
try {
db = this._category.getDatabase();
db.begin();
LazyEmployee person = new LazyEmployee();
person.setFirstName("First");
person.setLastName("Person");
person.setBirthday(JDO_ORIGINAL_DATE);
person.setStartDate(JDO_ORIGINAL_DATE);
LazyAddress address1 = new LazyAddress();
address1.setId(1);
address1.setStreet(Integer.toString(1) + JDO_ORIGINAL_STRING);
address1.setCity("First City");
address1.setState("AB");
address1.setZip("10000");
address1.setPerson(person);
LazyAddress address2 = new LazyAddress();
address2.setId(2);
address2.setStreet(Integer.toString(2) + JDO_ORIGINAL_STRING);
address2.setCity("Second City");
address2.setState("BC");
address2.setZip("22222");
address2.setPerson(person);
LazyAddress address3 = new LazyAddress();
address3.setId(3);
address3.setStreet(Integer.toString(3) + JDO_ORIGINAL_STRING);
address3.setCity("Third Ave");
address3.setState("AB");
address3.setZip("30003");
address3.setPerson(person);
ArrayList addresslist = new ArrayList();
addresslist.add(address1);
addresslist.add(address2);
addresslist.add(address3);
person.setAddress(addresslist);
LazyPayRoll pr1 = new LazyPayRoll();
pr1.setId(1);
pr1.setHoliday(15);
pr1.setHourlyRate(25);
pr1.setEmployee(person);
person.setPayRoll(pr1);
LazyContractCategory cc = new LazyContractCategory();
cc.setId(101);
cc.setName("Full-time slave");
db.create(cc);
LazyContractCategory cc2 = new LazyContractCategory();
cc2.setId(102);
cc2.setName("Full-time employee");
db.create(cc2);
ArrayList category = new ArrayList();
category.add(cc);
category.add(cc2);
LazyContract con = new LazyContract();
con.setPolicyNo(1001);
con.setComment("80 hours a week, no pay hoilday, "
+ "no sick leave, arrive office at 7:30am everyday");
con.setContractNo(78);
con.setEmployee(person);
con.setCategory(category);
person.setContract(con);
db.create(person);
db.commit();
db.close();
} catch (Exception e) {
LOG.error("createTestDataSet: exception caught", e);
throw e;
}
}