Issue #5201 - Fix issues with test after changes to QTP dump

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2020-09-03 10:34:18 +10:00
parent 0a59a2b090
commit 85c8c6510e
2 changed files with 15 additions and 13 deletions

View File

@ -715,9 +715,11 @@ public class QueuedThreadPool extends ContainerLifeCycle implements ThreadFactor
threads.add(baseThreadInfo + " @ " + (trace.length > 0 ? trace[0].toString() : "???"));
}
dumpObjects(out, indent, new DumpableCollection("threads", threads));
DumpableCollection threadsDump = new DumpableCollection("threads", threads);
if (isDetailedDump())
dumpObjects(out, indent, new DumpableCollection("jobs", new ArrayList<>(getQueue())));
dumpObjects(out, indent, threadsDump, new DumpableCollection("jobs", new ArrayList<>(getQueue())));
else
dumpObjects(out, indent, threadsDump);
}
private String getKnownMethod(StackTraceElement[] trace)

View File

@ -778,8 +778,8 @@ public class QueuedThreadPoolTest extends AbstractThreadPoolTest
assertThat(count(dump, " - STARTED"), is(2));
assertThat(dump, containsString(",3<=3<=4,i=3,r=2,q=0"));
assertThat(dump, containsString("[ReservedThreadExecutor@"));
assertThat(count(dump, " IDLE "), is(3));
assertThat(count(dump, " RESERVED "), is(0));
assertThat(count(dump, " IDLE"), is(3));
assertThat(count(dump, " RESERVED"), is(0));
CountDownLatch started = new CountDownLatch(1);
CountDownLatch waiting = new CountDownLatch(1);
@ -801,9 +801,9 @@ public class QueuedThreadPoolTest extends AbstractThreadPoolTest
assertThat(count(dump, " - STARTED"), is(2));
assertThat(dump, containsString(",3<=3<=4,i=2,r=2,q=0"));
assertThat(dump, containsString("[ReservedThreadExecutor@"));
assertThat(count(dump, " IDLE "), is(2));
assertThat(count(dump, " WAITING "), is(1));
assertThat(count(dump, " RESERVED "), is(0));
assertThat(count(dump, " IDLE"), is(2));
assertThat(count(dump, " WAITING"), is(1));
assertThat(count(dump, " RESERVED"), is(0));
assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(0));
pool.setDetailedDump(true);
@ -812,9 +812,9 @@ public class QueuedThreadPoolTest extends AbstractThreadPoolTest
assertThat(dump, containsString(",3<=3<=4,i=2,r=2,q=0"));
assertThat(dump, containsString("s=0/2"));
assertThat(dump, containsString("[ReservedThreadExecutor@"));
assertThat(count(dump, " IDLE "), is(2));
assertThat(count(dump, " WAITING "), is(1));
assertThat(count(dump, " RESERVED "), is(0));
assertThat(count(dump, " IDLE"), is(2));
assertThat(count(dump, " WAITING"), is(1));
assertThat(count(dump, " RESERVED"), is(0));
assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(1));
assertFalse(pool.tryExecute(() ->
@ -827,9 +827,9 @@ public class QueuedThreadPoolTest extends AbstractThreadPoolTest
assertThat(dump, containsString(",3<=3<=4,i=1,r=2,q=0"));
assertThat(dump, containsString("s=1/2"));
assertThat(dump, containsString("[ReservedThreadExecutor@"));
assertThat(count(dump, " IDLE "), is(1));
assertThat(count(dump, " WAITING "), is(1));
assertThat(count(dump, " RESERVED "), is(1));
assertThat(count(dump, " IDLE"), is(1));
assertThat(count(dump, " WAITING"), is(1));
assertThat(count(dump, " RESERVED"), is(1));
assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(1));
}