public void testLoadAnStoreDataPerformance() throws Exception { TimeTaker t = start("testLoadAnStoreDataPerformance"); { CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.createResource(getResourcePath("/test1")); getModel1Factory().createCustomer(); for (int i = 0; i < 500; i++) { Customer customer = getModel1Factory().createCustomer(); customer.setCity("Barovia"); customer.setName("Strahd von Zarovich"); customer.setStreet("Necromancer Road 5"); for (int c = 0; c < 5; c++) { SalesOrder salesOrder = getModel1Factory().createSalesOrder(); salesOrder.setCustomer(customer); salesOrder.setId(c); resource.getContents().add(salesOrder); } resource.getContents().add(customer); } transaction.commit(); session.close(); } { CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.getResource(getResourcePath("/test1")); int i = 0; for (EObject o : resource.getContents()) { if (o instanceof Customer) { Customer customer = (Customer) o; customer.setCity("Dargaard"); customer.setName("Lord Soth"); customer.setStreet("Death Knight Alley 7"); for (SalesOrder salesOrder : customer.getSalesOrders()) { salesOrder.setId(salesOrder.getId() + 1); } i++; } } assertEquals(500, i); transaction.commit(); session.close(); } finish(t); msg(t.getTiming()); }
public void testSimpleTestWithCommit() throws Exception { TimeTaker t = start("testBasicCommitPerformance"); CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.createResource(getResourcePath("/test1")); getModel1Factory().createCustomer(); for (int i = 0; i < 500; i++) { Customer customer = getModel1Factory().createCustomer(); customer.setCity("Barovia"); customer.setName("Strahd von Zarovich"); customer.setStreet("Necromancer Road 5"); for (int c = 0; c < 5; c++) { SalesOrder salesOrder = getModel1Factory().createSalesOrder(); salesOrder.setCustomer(customer); salesOrder.setId(c); resource.getContents().add(salesOrder); } resource.getContents().add(customer); } transaction.commit(); finish(t); msg(t.getTiming()); }
public void testSimpleTestNoCommit() throws Exception { TimeTaker t = start("testSimpleTestNoCommit"); getModel1Factory().createCustomer(); for (int i = 0; i < 50000; i++) { Customer customer = getModel1Factory().createCustomer(); customer.setCity("Barovia"); customer.setName("Strahd von Zarovich"); customer.setStreet("Necromancer Road 5"); for (int c = 0; c < 50; c++) { SalesOrder salesOrder = getModel1Factory().createSalesOrder(); salesOrder.setCustomer(customer); salesOrder.setId(c); } } finish(t); msg(t.getTiming()); }