timestamp, items, warehouses, quantities).getResults();
// Now to check returns are correct. We assume that inserts and such
// within the actual transaction went through since it didn't rollback
// and error out.
VoltTableRow customerData = neworder[0].fetchRow(0);
VoltTableRow miscData = neworder[1].fetchRow(0);
assertEquals("Name", customerData.getString("C_LAST"));
assertEquals("GC", customerData.getString("C_CREDIT"));
assertEquals(.13, customerData.getDouble("C_DISCOUNT"));
assertEquals(W_TAX, miscData.getDouble("w_tax"));
assertEquals(D_TAX, miscData.getDouble("d_tax"));
assertEquals(21L, miscData.getLong("o_id"));
final double AMOUNT = PRICE * (3 + 5 + 1) * (1 - C_DISCOUNT) * (1 + D_TAX + W_TAX);
assertEquals(AMOUNT, miscData.getDouble("total"), 0.001);
// Check each item
VoltTable itemResults = neworder[2];
assertEquals(quantities.length, itemResults.getRowCount());
for (int i = 0; i < itemResults.getRowCount(); ++i) {
VoltTableRow itemRow = itemResults.fetchRow(i);
assertEquals("ITEM" + (i + 1), itemRow.getString("i_name"));
//~ assertEquals(quantities[i], itemRow.getLong("));
long expected = s_quantities[i] - quantities[i];
if (expected < 10) expected += 91;
assertEquals(expected, itemRow.getLong("s_quantity"));
if (i == 1) {
assertEquals("B", itemRow.getString("brand_generic"));
} else {
assertEquals("G", itemRow.getString("brand_generic"));
}
assertEquals(PRICE, itemRow.getDouble("i_price"));
assertEquals(PRICE * quantities[i], itemRow.getDouble("ol_amount"));
}
// verify that stock was updated correctly
VoltTable[] allTables = client.callProcedure("SelectAll").getResults();
VoltTable stock = allTables[TPCDataPrinter.nameMap.get("STOCK")];
for (int i = 0; i < stock.getRowCount(); ++i) {
VoltTableRow stockRow = stock.fetchRow(i);
assertEquals(INITIAL_S_YTD + i*10 + quantities[i], stockRow.getLong("S_YTD"));
assertEquals(INITIAL_S_ORDER_CNT + i*10 + 1, stockRow.getLong("S_ORDER_CNT"));
}
// New order with a missing item
items = new int[] { TPCCConstants.NUM_ITEMS + 1 };
warehouses = new short[] { W_ID };