change test to a red-green test

This commit is contained in:
Ken Stevens 2021-11-07 09:08:52 -05:00
parent 3cf580ed4f
commit 8e27b85094
1 changed files with 10 additions and 7 deletions

View File

@ -82,7 +82,6 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
@ -1518,9 +1517,12 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
ourLog.info("Validation time: {}", stopwatch); ourLog.info("Validation time: {}", stopwatch);
List<SingleValidationMessage> all = logResultsAndReturnErrorOnes(output); List<SingleValidationMessage> all = logResultsAndReturnErrorOnes(output);
assertThat(output.getMessages(), hasSize(entriesCount * 2)); assertThat(output.getMessages(), hasSize(entriesCount * 2));
// This assert proves that we did a multi-threaded validation since the outer bundle fails validation
// due to lack of unique fullUrl values on the entries. If you setConcurrentBundleValidation(false)
// above this test will fail.
assertEquals(0, all.size(), all.toString()); assertEquals(0, all.size(), all.toString());
} finally { } finally {
myDefaultValidationSupport.setBundleValidationThreadCount(IValidationSupport.DEFAULT_BUNDLE_VALIDATION_THREADCOUNT); myVal.setExecutor(null);
myDefaultValidationSupport.setConcurrentBundleValidation(false); myDefaultValidationSupport.setConcurrentBundleValidation(false);
} }
} }
@ -1531,11 +1533,12 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
for (int i = 0; i < theSize; ++i) { for (int i = 0; i < theSize; ++i) {
bundleBuilder.addTransactionCreateEntry(p); bundleBuilder.addTransactionCreateEntry(p);
} }
return (Bundle) bundleBuilder.getBundle();
Bundle retval = (Bundle) bundleBuilder.getBundle(); // We deliberately omit setting unique fullUrls on the bundle to validate that the bundle was validated concurrently
AtomicInteger count = new AtomicInteger(1); // Bundle retval = (Bundle) bundleBuilder.getBundle();
retval.getEntry().stream().forEach(entry -> entry.setFullUrl("urn:uuid:" + count.getAndIncrement())); // AtomicInteger count = new AtomicInteger(1);
return retval; // retval.getEntry().stream().forEach(entry -> entry.setFullUrl("urn:uuid:" + count.getAndIncrement()));
// return retval;
} }
@AfterAll @AfterAll