mirror of
https://github.com/corda/corda.git
synced 2025-02-10 04:41:35 +00:00
bugfixes and print statements in DynamicWind
This commit is contained in:
parent
9837528a3e
commit
cc6bf3f42b
@ -18,8 +18,10 @@ public class DynamicWind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void unwindTest(final Callable<Integer> unwind) throws Exception {
|
private void unwindTest(final Callable<Integer> unwind) throws Exception {
|
||||||
|
System.out.println("unwindTest enter");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
expect(dynamicWind(new Runnable() {
|
expect(dynamicWind(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
System.out.println("unwindTest before");
|
System.out.println("unwindTest before");
|
||||||
|
|
||||||
@ -57,9 +59,13 @@ public class DynamicWind {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("unwindTest expect");
|
||||||
|
|
||||||
expect(before == 1);
|
expect(before == 1);
|
||||||
expect(task == 1);
|
expect(task == 1);
|
||||||
expect(after == 1);
|
expect(after == 1);
|
||||||
|
|
||||||
|
System.out.println("unwindTest exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void normalUnwind() throws Exception {
|
private void normalUnwind() throws Exception {
|
||||||
@ -81,6 +87,8 @@ public class DynamicWind {
|
|||||||
private void continuationUnwindTest(final CallbackReceiver<Integer> receiver)
|
private void continuationUnwindTest(final CallbackReceiver<Integer> receiver)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
System.out.println("continuationUnwindTest enter");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
expect(callWithCurrentContinuation(new CallbackReceiver<Integer>() {
|
expect(callWithCurrentContinuation(new CallbackReceiver<Integer>() {
|
||||||
public Integer receive(final Callback<Integer> continuation)
|
public Integer receive(final Callback<Integer> continuation)
|
||||||
@ -98,9 +106,13 @@ public class DynamicWind {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("continuationUnwindTest expect");
|
||||||
|
|
||||||
expect(before == 1);
|
expect(before == 1);
|
||||||
expect(task == 1);
|
expect(task == 1);
|
||||||
expect(after == 1);
|
expect(after == 1);
|
||||||
|
|
||||||
|
System.out.println("continuationUnwindTest exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void continuationResultUnwind() throws Exception {
|
private void continuationResultUnwind() throws Exception {
|
||||||
@ -124,18 +136,24 @@ public class DynamicWind {
|
|||||||
private void rewindTest(final Callable<Integer> unwind, Runnable rewind)
|
private void rewindTest(final Callable<Integer> unwind, Runnable rewind)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
System.out.println("rewindTest enter");
|
||||||
|
|
||||||
int value;
|
int value;
|
||||||
try {
|
try {
|
||||||
value = dynamicWind(new Runnable() {
|
value = dynamicWind(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
System.out.println("rewindTest before");
|
||||||
|
|
||||||
expect(before == continuationCount);
|
expect(before == continuationCount);
|
||||||
expect(task == 0);
|
expect(task == continuationCount);
|
||||||
expect(after == 0);
|
expect(after == continuationCount);
|
||||||
|
|
||||||
++ before;
|
++ before;
|
||||||
}
|
}
|
||||||
}, new Callable<Integer>() {
|
}, new Callable<Integer>() {
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
|
System.out.println("rewindTest thunk");
|
||||||
|
|
||||||
expect(before == 1);
|
expect(before == 1);
|
||||||
expect(task == 0);
|
expect(task == 0);
|
||||||
expect(after == 0);
|
expect(after == 0);
|
||||||
@ -154,6 +172,8 @@ public class DynamicWind {
|
|||||||
}
|
}
|
||||||
}, new Runnable() {
|
}, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
System.out.println("rewindTest after");
|
||||||
|
|
||||||
expect(before == continuationCount + 1);
|
expect(before == continuationCount + 1);
|
||||||
expect(task == 1);
|
expect(task == 1);
|
||||||
expect(after == continuationCount);
|
expect(after == continuationCount);
|
||||||
@ -165,9 +185,13 @@ public class DynamicWind {
|
|||||||
value = e.value;
|
value = e.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("rewindTest expect");
|
||||||
|
|
||||||
expect(value == continuationCount);
|
expect(value == continuationCount);
|
||||||
|
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
|
System.out.println("rewindTest expect 0");
|
||||||
|
|
||||||
expect(before == 1);
|
expect(before == 1);
|
||||||
expect(task == 1);
|
expect(task == 1);
|
||||||
expect(after == 1);
|
expect(after == 1);
|
||||||
@ -176,11 +200,15 @@ public class DynamicWind {
|
|||||||
rewind.run();
|
rewind.run();
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
} else {
|
} else {
|
||||||
|
System.out.println("rewindTest expect 1");
|
||||||
|
|
||||||
expect(value == 1);
|
expect(value == 1);
|
||||||
expect(before == 2);
|
expect(before == 2);
|
||||||
expect(task == 1);
|
expect(task == 1);
|
||||||
expect(after == 2);
|
expect(after == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("rewindTest exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void continuationResultRewind() throws Exception {
|
private void continuationResultRewind() throws Exception {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user