Add check
This commit is contained in:
parent
e069d344b8
commit
517fafbd0a
|
@ -37,11 +37,11 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
|
|||
retVal.setUrl("jdbc:derby:memory:myUnitTestDB;create=true");
|
||||
retVal.setUsername("");
|
||||
retVal.setPassword("");
|
||||
retVal.setMaxTotal(4);
|
||||
retVal.setMaxTotal((int)(Math.random() * 6) + 1);
|
||||
|
||||
DataSource dataSource = ProxyDataSourceBuilder
|
||||
.create(retVal)
|
||||
.logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL")
|
||||
// .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL")
|
||||
.logSlowQueryBySlf4j(10, TimeUnit.SECONDS)
|
||||
.countQuery()
|
||||
.build();
|
||||
|
|
|
@ -42,6 +42,37 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
|
||||
ourRestServer.unregisterInterceptor(myRequestValidatingInterceptor);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMultithreadedSearch() throws Exception {
|
||||
Bundle input = new Bundle();
|
||||
input.setType(BundleType.TRANSACTION);
|
||||
for (int i = 0; i < 500; i++) {
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("http://test").setValue("BAR");
|
||||
input.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
|
||||
}
|
||||
ourClient.transaction().withBundle(input).execute();
|
||||
|
||||
|
||||
List<BaseTask> tasks = Lists.newArrayList();
|
||||
try {
|
||||
for (int threadIndex = 0; threadIndex < 10; threadIndex++) {
|
||||
SearchTask task = new SearchTask();
|
||||
tasks.add(task);
|
||||
task.start();
|
||||
}
|
||||
} finally {
|
||||
for (BaseTask next : tasks) {
|
||||
next.join();
|
||||
}
|
||||
}
|
||||
|
||||
validateNoErrors(tasks);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This test prevents a deadlock that was detected with a large number of
|
||||
|
@ -89,6 +120,10 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
|
|||
}
|
||||
}
|
||||
|
||||
validateNoErrors(tasks);
|
||||
}
|
||||
|
||||
private void validateNoErrors(List<BaseTask> tasks) {
|
||||
int total = 0;
|
||||
for (BaseTask next : tasks) {
|
||||
if (next.getError() != null) {
|
||||
|
|
Loading…
Reference in New Issue