organisations.add(otherOrg);
pm.makePersistentAll(organisations);
// Units
List<Unit> units = new ArrayList<Unit>();
Unit unit1 = new Unit(TestConstants.UNIT1_NAME, organisations.get(0), true);
unit1.setVillageKey(village1.getKeyCheckNotNull());
// FIXME: Note, all units are in all events for now...
//unit1.addEventRegistration(event1);
//unit1.addEventRegistration(event2);
units.add(unit1);
Unit unit2 = new Unit(TestConstants.UNIT2_NAME, organisations.get(0), true);
// FIXME: Note, all units are in all events for now...
//unit2.addEventRegistration(event1);
units.add(unit2);
Unit unapprovedWcfUnit = new Unit("Unapproved unit for wcf", organisations.get(0), false);
units.add(unapprovedWcfUnit);
Unit otherOrgUnit = new Unit("Unapproved unit", organisations.get(1), false);
units.add(otherOrgUnit);
Unit otherOrgUnit2 = new Unit("Approved unit in other org", organisations.get(1), true);
units.add(otherOrgUnit2);
pm.makePersistentAll(units);
// Bookings
List<Booking> bookings = getBookings(event1, event2, unit1, unit2, unapprovedWcfUnit, otherOrgUnit2);
pm.makePersistentAll(bookings);
// Transactions
List<Transaction> transactions = new ArrayList<Transaction>();
transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Payment, "Payment 1", "Comment 1", 23.32d));
transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Payment, "Payment 2", "", 12.00d));
transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Payment, "Payment 3", "", 130.00d));
transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Adjustment, "Refund 1", "Refund test", -23.32d));
transactions.add(new Transaction(unit2.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Payment, "Unit 2 payment", "", 70.00d));
// after earlybird deadline
transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), afterEarlyBird.getTime(), TransactionType.Payment, "Payment after earlybird", "", 10.00d));
transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), afterEarlyBird.getTime(), TransactionType.Discount, "Discount for early payment", "", 5.00d));
pm.makePersistentAll(transactions);
// Users
User user1 = new User(TestConstants.USER_ADMIN_EMAIL, "Global Admin 1", "password", Accesslevel.GLOBAL_ADMIN);
user1.setOrganisationKey(orgWcf.getKeyCheckNotNull());
user1.setUnitKey(unit1.getKeyCheckNotNull());
User user2 = new User("orgadmin@example.com", "Org Admin 1", "password", Accesslevel.ORG_ADMIN);
user2.setOrganisationKey(orgWcf.getKeyCheckNotNull());
user2.setUnitKey(unit1.getKeyCheckNotNull());
User user3 = new User("unitadmin@example.com", "Unit Admin 1", "password", Accesslevel.UNIT_ADMIN);
user3.setOrganisationKey(orgWcf.getKeyCheckNotNull());
user3.setUnitKey(unit1.getKeyCheckNotNull());
User user4 = new User("unassigned@example.com", "Unassigned 1", "password", Accesslevel.UNIT_ADMIN);
user4.setOrganisationKey(orgWcf.getKeyCheckNotNull());
user4.setUnitKey(unit2.getKeyCheckNotNull());
user4.setApproved(false);
User user5 = new User("otherorg@example.com", "Other Org 1", "password", Accesslevel.ORG_ADMIN);
user5.setOrganisationKey(otherOrg.getKeyCheckNotNull());
user5.setUnitKey(otherOrgUnit2.getKeyCheckNotNull());
pm.makePersistentAll(user1, user2, user3, user4, user5);
// Application settings