Skip to content

Commit 5f77b0e

Browse files
committed
Update to Test
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
1 parent b4afb74 commit 5f77b0e

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

fhir-parent/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,8 @@
867867
<maxmemory>2g</maxmemory>
868868
<!-- doclint is none, otherwise build breaks -->
869869
<doclint>none</doclint>
870+
<additionalparam>-Xdoclint:none
871+
-Djava.awt.headless=true</additionalparam>
870872
<detectLinks>true</detectLinks>
871873
<!-- control display -->
872874
<author>false</author>

fhir-profile/src/test/java/com/ibm/fhir/profile/test/provider/ProviderTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
package com.ibm.fhir.profile.test.provider;
88

9+
import static org.testng.Assert.assertNotNull;
10+
911
import org.testng.annotations.BeforeClass;
1012
import org.testng.annotations.Test;
1113

@@ -24,9 +26,17 @@ public void before() {
2426
FHIRRegistry.init();
2527
}
2628

29+
@Test
30+
public void testProviderRegistryLookup() {
31+
String url = "http://ibm.com/example/fhir/StructureDefinition/orgRef";
32+
StructureDefinition sd = FHIRRegistry.getInstance().getResource(url, StructureDefinition.class);
33+
assertNotNull(sd);
34+
}
35+
2736
@Test
2837
public void testProviderWithLocalLookup() throws Exception {
2938
TestRegistryResourceProvider provider = new TestRegistryResourceProvider();
39+
provider.init();
3040
for (FHIRRegistryResource registryResource : provider.getRegistryResources()) {
3141
if (StructureDefinition.class.equals(registryResource.getResourceType())) {
3242
String url = registryResource.getUrl();

fhir-profile/src/test/java/com/ibm/fhir/profile/test/provider/TestRegistryResourceProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public class TestRegistryResourceProvider extends AbstractRegistryResourceProvid
3939
* loads from the classloader and the order is not fixed.
4040
* Once these are created, then we can use the resource lookup to support retrieval.
4141
*/
42+
@Override
43+
public void init() {
44+
deferredLoad();
45+
}
4246
private void deferredLoad() {
4347
if (registryResources == null) {
4448
synchronized (TestRegistryResourceProvider.class) {
@@ -78,23 +82,20 @@ private StructureDefinition generateStructureDefinition() {
7882

7983
@Override
8084
protected List<FHIRRegistryResource> getRegistryResources(Class<? extends Resource> resourceType, String url) {
81-
deferredLoad();
8285
return registryResources.stream()
8386
.filter(rr -> rr.getResourceType() == resourceType && rr.getUrl().equals(url))
8487
.collect(Collectors.toList());
8588
}
8689

8790
@Override
8891
public Collection<FHIRRegistryResource> getRegistryResources(Class<? extends Resource> resourceType) {
89-
deferredLoad();
9092
return registryResources.stream()
9193
.filter(rr -> rr.getResourceType().equals(resourceType))
9294
.collect(Collectors.toSet());
9395
}
9496

9597
@Override
9698
public Collection<FHIRRegistryResource> getRegistryResources() {
97-
deferredLoad();
9899
return registryResources;
99100
}
100101

@@ -105,7 +106,6 @@ public Collection<FHIRRegistryResource> getProfileResources(String type) {
105106

106107
@Override
107108
public Collection<FHIRRegistryResource> getSearchParameterResources(String type) {
108-
deferredLoad();
109109
return registryResources.stream()
110110
.filter(rr -> rr.getResourceType() == SearchParameter.class)
111111
.filter(rr -> ((SearchParameter) rr.getResource()).getType().getValue().equals(type))

0 commit comments

Comments
 (0)