// what the transaction was initialized with
final Map<Long, LocalTransaction> copiedHandles = new HashMap<Long, LocalTransaction>();
EventObserver<LocalTransaction> newTxnObserver = new EventObserver<LocalTransaction>() {
@Override
public void update(EventObservable<LocalTransaction> o, LocalTransaction ts) {
LocalTransaction copy = new LocalTransaction(hstore_site);
copy.init(ts.getTransactionId(),
ts.getInitiateTime(),
ts.getClientHandle(),
ts.getBasePartition(),
new PartitionSet(ts.getPredictTouchedPartitions()),
ts.isPredictReadOnly(),
ts.isPredictAbortable(),
ts.getProcedure(),
ts.getProcedureParameters(),
null);
copiedHandles.put(ts.getTransactionId(), copy);
}
};
hstore_site.getTransactionInitializer().getNewTxnObservable().addObserver(newTxnObserver);
Procedure catalog_proc = this.getProcedure(UpdateLocation.class);
Object params[] = { 1234l, "XXXX" };
ClientResponse cr = this.client.callProcedure(catalog_proc.getName(), params);
assertEquals(Status.OK, cr.getStatus());
// System.err.println(cr);
// System.err.println(StringUtil.formatMaps(copiedHandles));
assertTrue(cr.hasDebug());
ClientResponseDebug crDebug = cr.getDebug();
assertNotNull(crDebug);
LocalTransaction copy = copiedHandles.get(cr.getTransactionId());
assertNotNull(copiedHandles.toString(), copy);
assertEquals(copy.getTransactionId().longValue(), cr.getTransactionId());
assertEquals(copy.getClientHandle(), cr.getClientHandle());
assertEquals(copy.getBasePartition(), cr.getBasePartition());
assertEquals(copy.isPredictAbortable(), crDebug.isPredictAbortable());
assertEquals(copy.isPredictReadOnly(), crDebug.isPredictReadOnly());
assertEquals(copy.isPredictSinglePartition(), crDebug.isPredictSinglePartition());
assertEquals(copy.getPredictTouchedPartitions(), crDebug.getPredictTouchedPartitions());
}