@SuppressWarnings("unchecked")
@Test public void testPutOldKeyNotFound() throws Exception {
txnScheduler.runTask(
new TestAbstractKernelRunnable() {
public void run() throws Exception {
ScalableHashMap test = new ScalableHashMap();
dataService.setBinding("test", test);
Bar bar = new Bar(1);
dataService.setBinding("bar", bar);
test.put(bar, Boolean.TRUE);
}
}, taskOwner);
try {
txnScheduler.runTask(
new TestAbstractKernelRunnable() {
public void run() throws Exception {
dataService.removeObject(
dataService.getBinding("bar"));
ScalableHashMap test =
(ScalableHashMap) dataService.getBinding("test");
assertEquals(null, test.put(new Bar(1), Boolean.FALSE));
assertEquals(Boolean.FALSE, test.get(new Bar(1)));
throw new RuntimeException("Intentional Abort");
}
}, taskOwner);
} catch (RuntimeException re) {}
txnScheduler.runTask(
new TestAbstractKernelRunnable() {
public void run() throws Exception {
dataService.removeObject(dataService.getBinding("bar"));
ScalableHashMap test =
(ScalableHashMap) dataService.getBinding("test");
}
}, taskOwner);
txnScheduler.runTask(
new TestAbstractKernelRunnable() {
public void run() throws Exception {
ScalableHashMap test =
(ScalableHashMap) dataService.getBinding("test");
assertEquals(null, test.put(new Bar(1), Boolean.FALSE));
assertEquals(Boolean.FALSE, test.get(new Bar(1)));
}
}, taskOwner);
}