newAdmin.setAddress(generalAddress);
dao.makePersistent(newAdmin);
// create a sample customer
Customer customer = new Customer();
customer.setAddress(customerAddress);
customer.setCompanyName("XYZ Corp.");
customer.setEmailAddress("jim@xyzcorp.com");
customer.setNameFirst("Jim");
customer.setNameLast("Smith");
customer.setUsername("jimmy");
customer.setPassword("testpass");
// create a searchDetails object
SearchUtility searchDetails = new SearchUtility();
searchDetails.setSearchMetaAuthor("daniel");
searchDetails.setSearchMetaCopyright("daniel");
searchDetails.setSearchMetaDate("today");
searchDetails.setSearchMetaDescription("cool");
searchDetails.setSearchMetaKeywords("daniel");
// create a category
InternetProductCategory category = new InternetProductCategory();
category.setConsumerVisible(true);
category.setName("Test Category");
category.setDescription("Test Category");
category.setSearchDetails(searchDetails);
// create a product
InternetProduct product = new InternetProduct();
product.setConsumerVisible(true);
product.setName("Test Product");
product.setDescription("Test Product");
product.setSearchDetails(searchDetails);
// create an option
InternetProductOption option1 = new InternetProductOption();
option1.setConsumerVisible(true);
option1.setDescription("fake option");
option1.setName("faker option");
option1.setStockKeepingUnitIdentifier("FAKE0");
option1.setUnitPriceActualRetail((float)4.56);
option1.setUnitPriceManufacturerSuggestedRetail((float)6.74);
option1.setUnitWeightInOunces(2);
option1.setSearchDetails(searchDetails);
// create an option
InternetProductOption option2 = new InternetProductOption();
option2.setConsumerVisible(true);
option2.setDescription("fake option");
option2.setName("faker option");
option2.setStockKeepingUnitIdentifier("FAKE1");
option2.setUnitPriceActualRetail((float)4.56);
option2.setUnitPriceManufacturerSuggestedRetail((float)6.74);
option2.setUnitWeightInOunces(2);
option2.setSearchDetails(searchDetails);
// associate category, product and option
category.associate(product);
product.associate(option1);
product.associate(option2);
// persist option
// TODO: I should be able to make a single call to save the category
optdao.makePersistent(option1);
optdao.makePersistent(option2);
proddao.makePersistent(product);
catdao.makePersistent(category);
// create a sample order
InternetSalesOrder salesOrder = new InternetSalesOrder();
salesOrder.setAddress(orderAddress);
salesOrder.setNotes("TEST NOTES!");
salesOrder.setPlacedOn(new Date());
salesOrder.addLineItem(new SalesOrderLineItem((float)3,(float)3.64,"line 1",option1));
salesOrder.addLineItem(new SalesOrderLineItem((float)6,(float)4.91,"line 2",option2));
// associate order
customer.addOrder(salesOrder);
cdao.makePersistent(customer);
sdao.makePersistent(salesOrder);
HibernateUtility.commitTransaction();