Add tests to checkstyle (#6006)

* Add tests to checkstyle

* Add includede test dirs in execution

* wip

* wip

* bump checkstyle deps

* bump checkstyle deps

* wip50

* wip

* Handle upgrade

* triple-wip

* wip

* Wip replacement of prints

* All checkstyle now passing

* wip

* Reset checkstyle

* spotless

* reset checkstyle

* Add checkstyle to pipeline

* Tidy

* Tidy

* wip

* Cut over to not empty for correct behaviour

* imports
This commit is contained in:
Tadgh 2024-06-15 17:15:46 -07:00 committed by GitHub
parent c1c6d4fc49
commit 73a6a8ef82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
63 changed files with 653 additions and 662 deletions

View File

@ -1,5 +1,6 @@
package android.util;
@SuppressWarnings("checkstyle:NoPrintln")
public class Log {
public static final int VERBOSE = 2;

View File

@ -208,7 +208,7 @@
<version>1.8</version>
<configuration>
<target>
<!--suppress UnresolvedMavenProperty -->
<!-- suppress UnresolvedMavenProperty-->
<delete dir="${pom.basedir}/target/" includes="checkstyle*"/>
</target>
</configuration>
@ -223,40 +223,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<configLocation>${maven.multiModuleProjectDirectory}/hapi-fhir-checkstyle/src/checkstyle/hapi-base-checkstyle.xml</configLocation>
<!--suppress UnresolvedMavenProperty -->
<suppressionsLocation>${maven.multiModuleProjectDirectory}/hapi-fhir-checkstyle/src/checkstyle/hapi-base-checkstyle-suppression.xml</suppressionsLocation>
<inputEncoding>UTF-8</inputEncoding>
<consoleOutput>true</consoleOutput>
</configuration>
<inherited>true</inherited>
<executions>
<execution>
<id>hapi-single-module-checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-checkstyle</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle_version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<resources>
<resource>

View File

@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class BaseBatchJobParametersTest {
public class BatchJobParametersTest {
private static class TestParameters extends BaseBatchJobParameters {

View File

@ -29,7 +29,6 @@ public class QualifiedParamListTest {
@Test
public void testSplit3() {
List<String> actual = QualifiedParamList.splitQueryStringByCommasIgnoreEscape(null,"aaa,b\\,bb");
System.out.println(actual);
assertThat(actual).hasSize(2);
assertEquals("aaa", actual.get(0));
assertEquals("b,bb", actual.get(1));

View File

@ -44,6 +44,7 @@ public class MessageSupplierTest {
}
@Test
public void testLog() {
@ -51,9 +52,6 @@ public class MessageSupplierTest {
verify(myMockAppender, times(1)).doAppend(argThat((ArgumentMatcher<ILoggingEvent>) argument -> {
String formattedMessage = argument.getFormattedMessage();
System.out.flush();
System.out.println("** Got Message: " + formattedMessage);
System.out.flush();
return formattedMessage.equals("Hello: Goodbye");
}));

View File

@ -36,6 +36,7 @@
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
@ -59,7 +60,6 @@
</plugins>
</pluginManagement>
</build>
<profiles>
<!-- For releases, we need to generate javadoc and sources JAR -->
<profile>
@ -102,7 +102,7 @@
</build>
</profile>
<profile>
<id>CI</id>
<id>CHECKSTYLE</id>
<build>
<plugins>
<plugin>
@ -115,6 +115,7 @@
<!--suppress UnresolvedMavenProperty -->
<directory>${maven.multiModuleProjectDirectory}/</directory>
</sourceDirectories>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<!--suppress UnresolvedMavenProperty -->
<configLocation>${maven.multiModuleProjectDirectory}/hapi-fhir-checkstyle/src/checkstyle/hapi-base-checkstyle.xml</configLocation>
<!--suppress UnresolvedMavenProperty -->

View File

@ -4,7 +4,6 @@
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files="[/\\]test[/\\]" checks="[a-zA-Z0-9]*" />
<suppress files="[/\\]resources[/\\]" checks="[a-zA-Z0-9]*" />
<suppress files="[\\/]target[\\/]" checks="[a-zA-Z0-9]*" />
<suppress files="[\\/]hapi-fhir-docs[\\/]" checks="[a-zA-Z0-9]*" />
@ -15,11 +14,18 @@
<suppress files="[\\/]osgi[\\/]" checks="[a-zA-Z0-9]*"/>
<!-- Name suppressions -->
<!-- We don't care if test files have `base` or abstract in the name` -->
<suppress files="[/\\]test[/\\]" checks="AbstractClassName" />
<suppress files="[/\\]test[/\\]" checks="ca.uhn.fhir.checks.HapiErrorCodeCheck" id="HapiErrorCodeUniqueness"/>
<suppress files="Base64BinaryDt\.java" checks="AbstractClassName"/>
<!-- TODO KHS cdr instantiates these. Remove them once cdr has been fixed. -->
<!-- TODO CHECKSTYLE KHS cdr instantiates these. Remove them once cdr has been fixed. -->
<suppress files="BaseMigrationTasks\.java" checks="AbstractClassName"/>
<suppress files="BaseLoincTop2000LabResultsHandler\.java" checks="AbstractClassName"/>
<!-- TODO GGG Checkstyle MDM tests can currently use hamcrest until we fix em -->
<suppress files=".*/mdm/.*" checks="RegexpSinglelineJava" id="NoHamcrestAssert"/>
<!-- Missing "Base" prefix suppressions -->
<suppress files="ResourceMetadataKeyEnum\.java" checks="AbstractClassName"/>
<suppress files="RequestDetails\.java" checks="AbstractClassName"/>

View File

@ -4,14 +4,17 @@
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="SuppressWarningsFilter" />
<property name="severity" value="error"/>
<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java, properties, xml, js, json"/>
<module name="TreeWalker">
<module name="SuppressWarningsHolder" />
<!-- Run custom HapiErrorCodeCheck to find duplicate error codes -->
<module name="ca.uhn.fhir.checks.HapiErrorCodeCheck"/>
<module name="ca.uhn.fhir.checks.HapiErrorCodeCheck">
<property name="id" value="HapiErrorCodeUniqueness"/>
</module>
<!-- Throw error if any FIX ME is left in the code -->
<module name="TodoComment">
<!-- The (?i) below means Case Insensitive -->
@ -26,10 +29,12 @@
-->
<module name="RegexpSinglelineJava">
<property name="id" value="NoPrintln"/>
<property name="format" value="System\.out\.println"/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="id" value="NoHamcrestAssert"/>
<property name="format" value="org.hamcrest.MatcherAssert.assertThat"/>
<property name="message" value="Incorrect assertThat import used: The &quot;org.assertj.core.api.Assertions.assertThat&quot; import should be used for tests"/>
</module>

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.checks;
import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean;
import com.puppycrawl.tools.checkstyle.Checker;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.DefaultLogger;
@ -31,8 +32,8 @@ class HapiErrorCodeCheckTest {
files.add(getFile("BadClass.java"));
ByteArrayOutputStream errors = new ByteArrayOutputStream();
DefaultLogger listener = new DefaultLogger(NullOutputStream.NULL_OUTPUT_STREAM, AutomaticBean.OutputStreamOptions.CLOSE,
errors, AutomaticBean.OutputStreamOptions.CLOSE);
DefaultLogger listener = new DefaultLogger(NullOutputStream.NULL_OUTPUT_STREAM, AbstractAutomaticBean.OutputStreamOptions.CLOSE,
errors, AbstractAutomaticBean.OutputStreamOptions.CLOSE);
checker.addListener(listener);
// execute

View File

@ -22,6 +22,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.class);
private static final String BASEURI = "http://basiuri";
private static final String REQUESTURI = BASEURI + "/metadata";
@ -49,7 +51,7 @@ public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProviderDstu2Hl7Org.class, new TestJaxRsDummyPatientProviderDstu2Hl7Org());
Response response = createConformanceProvider(providers).conformance();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -57,7 +59,7 @@ public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProviderDstu2Hl7Org.class, new TestJaxRsDummyPatientProviderDstu2Hl7Org());
Response response = createConformanceProvider(providers).conformanceUsingOptions();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -68,8 +70,8 @@ public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
assertThat(response.getEntity().toString()).contains("\"type\": \"Patient\"");
assertThat(response.getEntity().toString()).contains("someCustomOperation");
System.out.println(response);
System.out.println(response.getEntity());
ourLog.info(response.toString());
ourLog.info(response.getEntity().toString());
}
@Test
@ -79,10 +81,10 @@ public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
providers.put(TestJaxRsMockPatientRestProviderDstu2Hl7Org.class, new TestJaxRsMockPatientRestProviderDstu2Hl7Org());
Response response = createConformanceProvider(providers).conformance();
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
assertThat(response.getEntity().toString()).contains(" <type value=\"Patient\"/>");
assertThat(response.getEntity().toString()).contains("someCustomOperation");
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
}
private AbstractJaxRsConformanceProvider createConformanceProvider(final ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers)

View File

@ -23,6 +23,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderDstu2_1Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(AbstractJaxRsConformanceProviderDstu2_1Test.class);
private static final String BASEURI = "http://basiuri";
private static final String REQUESTURI = BASEURI + "/metadata";
@ -50,7 +52,7 @@ public class AbstractJaxRsConformanceProviderDstu2_1Test {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProviderDstu2_1.class, new TestJaxRsDummyPatientProviderDstu2_1());
Response response = createConformanceProvider(providers).conformance();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -58,7 +60,7 @@ public class AbstractJaxRsConformanceProviderDstu2_1Test {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProviderDstu2_1.class, new TestJaxRsDummyPatientProviderDstu2_1());
Response response = createConformanceProvider(providers).conformanceUsingOptions();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -69,8 +71,8 @@ public class AbstractJaxRsConformanceProviderDstu2_1Test {
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
assertThat(response.getEntity().toString()).contains("\"type\": \"Patient\"");
assertThat(response.getEntity().toString()).contains("\"someCustomOperation");
System.out.println(response);
System.out.println(response.getEntity());
ourLog.info(response.toString());
ourLog.info(response.getEntity().toString());
}
@Test
@ -80,10 +82,10 @@ public class AbstractJaxRsConformanceProviderDstu2_1Test {
providers.put(TestJaxRsMockPatientRestProviderDstu2_1.class, new TestJaxRsMockPatientRestProviderDstu2_1());
Response response = createConformanceProvider(providers).conformance();
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
assertThat(response.getEntity().toString()).contains(" <type value=\"Patient\"/>");
assertThat(response.getEntity().toString()).contains("\"someCustomOperation");
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
}
private AbstractJaxRsConformanceProvider createConformanceProvider(final ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers)

View File

@ -22,6 +22,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderDstu3Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(AbstractJaxRsConformanceProviderDstu3Test.class);
private static final String BASEURI = "http://basiuri";
private static final String REQUESTURI = BASEURI + "/metadata";
@ -49,7 +51,7 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProviderDstu3.class, new TestJaxRsDummyPatientProviderDstu3());
Response response = createConformanceProvider(providers).conformance();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -57,7 +59,7 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProviderDstu3.class, new TestJaxRsDummyPatientProviderDstu3());
Response response = createConformanceProvider(providers).conformanceUsingOptions();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -68,8 +70,8 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
assertThat(response.getEntity().toString()).contains("\"type\": \"Patient\"");
assertThat(response.getEntity().toString()).contains("\"someCustomOperation");
System.out.println(response);
System.out.println(response.getEntity());
ourLog.info(response.toString());
ourLog.info(response.getEntity().toString());
}
@Test
@ -79,10 +81,10 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
providers.put(TestJaxRsMockPatientRestProviderDstu3.class, new TestJaxRsMockPatientRestProviderDstu3());
Response response = createConformanceProvider(providers).conformance();
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
assertThat(response.getEntity().toString()).contains(" <type value=\"Patient\"/>");
assertThat(response.getEntity().toString()).contains("\"someCustomOperation");
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
}
private AbstractJaxRsConformanceProvider createConformanceProvider(final ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers)

View File

@ -22,6 +22,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderR4Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(AbstractJaxRsConformanceProviderR4Test.class);
private static final String BASEURI = "http://basiuri";
private static final String REQUESTURI = BASEURI + "/metadata";
@ -49,7 +51,7 @@ public class AbstractJaxRsConformanceProviderR4Test {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProviderR4.class, new TestJaxRsDummyPatientProviderR4());
Response response = createConformanceProvider(providers).conformance();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -57,7 +59,7 @@ public class AbstractJaxRsConformanceProviderR4Test {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProviderR4.class, new TestJaxRsDummyPatientProviderR4());
Response response = createConformanceProvider(providers).conformanceUsingOptions();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -68,8 +70,8 @@ public class AbstractJaxRsConformanceProviderR4Test {
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
assertThat(response.getEntity().toString()).contains("\"type\": \"Patient\"");
assertThat(response.getEntity().toString()).contains("\"someCustomOperation");
System.out.println(response);
System.out.println(response.getEntity());
ourLog.info(response.toString());
ourLog.info(response.getEntity().toString());
}
@Test
@ -79,10 +81,10 @@ public class AbstractJaxRsConformanceProviderR4Test {
providers.put(TestJaxRsMockPatientRestProviderR4.class, new TestJaxRsMockPatientRestProviderR4());
Response response = createConformanceProvider(providers).conformance();
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
assertThat(response.getEntity().toString()).contains(" <type value=\"Patient\"/>");
assertThat(response.getEntity().toString()).contains("\"someCustomOperation");
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
}
private AbstractJaxRsConformanceProvider createConformanceProvider(final ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers)

View File

@ -21,6 +21,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderTest {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(AbstractJaxRsConformanceProviderTest.class);
private static final String BASEURI = "http://basiuri";
private static final String REQUESTURI = BASEURI + "/metadata";
@ -48,7 +50,7 @@ public class AbstractJaxRsConformanceProviderTest {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProvider.class, new TestJaxRsDummyPatientProvider());
Response response = createConformanceProvider(providers).conformance();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -56,7 +58,7 @@ public class AbstractJaxRsConformanceProviderTest {
providers.put(AbstractJaxRsConformanceProvider.class, provider);
providers.put(TestJaxRsDummyPatientProvider.class, new TestJaxRsDummyPatientProvider());
Response response = createConformanceProvider(providers).conformanceUsingOptions();
System.out.println(response);
ourLog.info(response.toString());
}
@Test
@ -67,8 +69,8 @@ public class AbstractJaxRsConformanceProviderTest {
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
assertThat(response.getEntity().toString()).contains("\"type\": \"Patient\"");
assertThat(response.getEntity().toString()).contains("\"someCustomOperation");
System.out.println(response);
System.out.println(response.getEntity());
ourLog.info(response.toString());
ourLog.info(response.getEntity().toString());
}
@Test
@ -78,10 +80,10 @@ public class AbstractJaxRsConformanceProviderTest {
providers.put(TestJaxRsMockPatientRestProvider.class, new TestJaxRsMockPatientRestProvider());
Response response = createConformanceProvider(providers).conformance();
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
assertThat(response.getEntity().toString()).contains(" <type value=\"Patient\"/>");
assertThat(response.getEntity().toString()).contains("\"someCustomOperation");
System.out.println(response.getEntity());
ourLog.info(response.getEntity().toString());
}
private AbstractJaxRsConformanceProvider createConformanceProvider(final ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers)

View File

@ -21,6 +21,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
public class JaxRsResponseTest {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JaxRsResponseTest.class);
private JaxRsResponse response;
private JaxRsRequest request;
@ -80,7 +82,7 @@ public class JaxRsResponseTest {
Response result = (Response) RestfulServerUtils.streamResponseAsResource(request.getServer(), createPatient(), theSummaryMode, 200, addContentLocationHeader, respondGzip, this.request);
assertEquals(200, result.getStatus());
assertEquals("application/json+fhir; charset=UTF-8", result.getHeaderString(Constants.HEADER_CONTENT_TYPE));
System.out.println(result.getEntity().toString());
ourLog.info(result.getEntity().toString());
assertThat(result.getEntity().toString()).contains("resourceType\": \"Patient");
assertThat(result.getEntity().toString()).contains("15");

View File

@ -48,7 +48,6 @@ import jakarta.persistence.criteria.Order;
import jakarta.persistence.criteria.Path;
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ObjectUtils;
@ -287,7 +286,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<JpaPid, MdmLink> {
return myEntityManager.createQuery(countQuery).getSingleResult();
}
@NotNull
@Nonnull
private List<Predicate> buildPredicates(
MdmQuerySearchParameters theParams, CriteriaBuilder criteriaBuilder, Root<MdmLink> from) {
List<Predicate> andPredicates = new ArrayList<>();

View File

@ -122,7 +122,6 @@ public class JpaBulkExportProcessorTest {
@Spy
private FhirContext myFhirContext = FhirContext.forR4Cached();
@Mock
private BulkExportHelperService myBulkExportHelperService;

View File

@ -51,9 +51,7 @@ public class JpaResourceExpungeServiceTest {
public void testExpungeDoesNotDeleteAllSearchParams() {
when(myResourceTableDao.findById(any())).thenReturn(Optional.of(resourceTable));
when(resourceTable.getIdDt()).thenReturn(new IdDt());
myService.expungeCurrentVersionOfResource(myRequestDetails, 1L, new AtomicInteger(1));
verify(myService, never()).deleteAllSearchParams(any());
}
}

View File

@ -91,7 +91,7 @@ public class ResourceProviderR4ElasticTest extends BaseResourceProviderR4Test {
ourLog.info("testAutocompleteDirectionExisting {}", text);
assertNotNull(valueSet);
List<ValueSet.ValueSetExpansionContainsComponent> expansions = valueSet.getExpansion().getContains();
// FIXME KHS
// TODO CHECKSTYLE KHS
// assertThat(expansions, hasItem(valueSetExpansionMatching(mean_blood_pressure)));
// assertThat(expansions).doesNotContain(valueSetExpansionMatching(blood_count));
}

View File

@ -311,7 +311,7 @@ public class IpsGenerationR4Test extends BaseResourceProviderR4Test {
public IIpsGenerationStrategy ipsGenerationStrategy() {
return new DefaultJpaIpsGenerationStrategy() {
@Override
public IIdType massageResourceId(@Nullable IpsContext theIpsContext, @javax.annotation.Nonnull IBaseResource theResource) {
public IIdType massageResourceId(@Nullable IpsContext theIpsContext, @Nonnull IBaseResource theResource) {
return IdType.newRandomUuid();
}
};

View File

@ -124,7 +124,7 @@ public class IpsGeneratorSvcImplTest {
private void initializeGenerationStrategy(List<Function<Section, Section>> theGlobalSectionCustomizers) {
myStrategy = new DefaultJpaIpsGenerationStrategy() {
@Override
public IIdType massageResourceId(@Nullable IpsContext theIpsContext, @javax.annotation.Nonnull IBaseResource theResource) {
public IIdType massageResourceId(@Nullable IpsContext theIpsContext, @Nonnull IBaseResource theResource) {
return IdType.newRandomUuid();
}
};

View File

@ -29,6 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
//TODO GGG Convert this to assertJ
public class MdmProviderMergeGoldenResourcesR4Test extends BaseProviderR4Test {
private Patient myFromGoldenPatient;

View File

@ -95,7 +95,7 @@ public class MdmGoldenResourceMergerSvcTest extends BaseMdmR4Test {
Patient mergedGoldenPatient = mergeGoldenPatients();
assertEquals(myToGoldenPatient.getIdElement(), mergedGoldenPatient.getIdElement());
// FIXME KHS restore
// TODO CHECKSTYLE KHS restore
// assertThat(mergedGoldenPatient).is(sameGoldenResourceAs(mergedGoldenPatient));
assertThat(getAllGoldenPatients()).hasSize(1);
assertThat(getAllRedirectedGoldenPatients()).hasSize(1);
@ -242,7 +242,7 @@ public class MdmGoldenResourceMergerSvcTest extends BaseMdmR4Test {
Patient mergedGoldenPatient = mergeGoldenPatients();
List<MdmLink> links = getNonRedirectLinksByGoldenResource(mergedGoldenPatient);
assertThat(links).hasSize(1);
// FIXME KHS restore
// TODO CHECKSTYLE KHS restore
// assertThat(mergedGoldenPatient, possibleLinkedTo(myTargetPatient1));
}
@ -253,7 +253,7 @@ public class MdmGoldenResourceMergerSvcTest extends BaseMdmR4Test {
Patient mergedSourcePatient = mergeGoldenPatients();
List<MdmLink> links = getNonRedirectLinksByGoldenResource(mergedSourcePatient);
assertThat(links).hasSize(1);
// FIXME KHS restore
// TODO CHECKSTYLE KHS restore
// assertThat(mergedSourcePatient, possibleLinkedTo(myTargetPatient1));
}

View File

@ -15,10 +15,10 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.server.messaging.BaseResourceMessage;
import ca.uhn.fhir.rest.server.messaging.json.ResourceOperationJsonMessage;
import jakarta.annotation.Nonnull;
import org.hl7.fhir.r4.model.InstantType;
import org.hl7.fhir.r4.model.Subscription;
import org.hl7.fhir.r4.model.codesystems.SubscriptionStatus;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -69,7 +69,7 @@ public class SubscriptionRegisteringSubscriberTest {
mySubscription = buildSubscription();
}
@NotNull
@Nonnull
private static Subscription buildSubscription() {
Subscription subscription = new Subscription();
subscription.setId("Subscription/testrest");

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.subscription.match.registry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.model.primitive.IdDt;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
@ -130,7 +130,7 @@ public class ActiveSubscriptionCacheTest {
assertEquals(ID3, match.getId());
}
@NotNull
@Nonnull
private ActiveSubscription buildTopicSubscription(String theId, String theTopicUrl) {
ActiveSubscription activeSub2 = buildActiveSubscription(theId);
activeSub2.getSubscription().setTopicSubscription(true);

View File

@ -11,6 +11,7 @@ import ca.uhn.fhir.model.dstu2.FhirDstu2;
import ca.uhn.fhir.model.primitive.BooleanDt;
import ca.uhn.fhir.subscription.SubscriptionConstants;
import ca.uhn.fhir.subscription.SubscriptionTestDataHelper;
import jakarta.annotation.Nonnull;
import org.hl7.fhir.dstu3.hapi.ctx.FhirDstu3;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.hapi.ctx.FhirR4;
@ -21,7 +22,6 @@ import org.hl7.fhir.r4b.hapi.ctx.FhirR4B;
import org.hl7.fhir.r5.hapi.ctx.FhirR5;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.Enumerations;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@ -301,7 +301,7 @@ class SubscriptionCanonicalizerTest {
assertEquals("testId", theCanonicalSubscription.getIdElementString());
}
@NotNull
@Nonnull
private static org.hl7.fhir.r5.model.Subscription.SubscriptionFilterByComponent buildFilter(String theResourceType, String theParam, String theValue) {
org.hl7.fhir.r5.model.Subscription.SubscriptionFilterByComponent filter = new org.hl7.fhir.r5.model.Subscription.SubscriptionFilterByComponent();
filter.setResourceType(theResourceType);

View File

@ -3,9 +3,9 @@ package ca.uhn.fhir.jpa.topic.filter;
import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult;
import ca.uhn.fhir.jpa.subscription.model.CanonicalTopicSubscription;
import ca.uhn.fhir.jpa.subscription.model.CanonicalTopicSubscriptionFilter;
import jakarta.annotation.Nonnull;
import org.hl7.fhir.r4.model.Encounter;
import org.hl7.fhir.r4.model.Observation;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import java.util.List;
@ -99,7 +99,7 @@ class SubscriptionTopicFilterUtilTest {
assertFalse(result);
}
@NotNull
@Nonnull
private static CanonicalTopicSubscription buildTopicSubscriptionWithFilter(String... theQueryUrls) {
CanonicalTopicSubscription topicSubscription = new CanonicalTopicSubscription();
for (String queryUrl : theQueryUrls) {

View File

@ -158,7 +158,7 @@ public class ResourceMinimizerMojo {
LoggerContext loggerContext = ((ch.qos.logback.classic.Logger) ourLog).getLoggerContext();
URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(loggerContext);
System.out.println(mainURL);
ourLog.info(mainURL.toExternalForm());
// or even
ourLog.info("Logback used '{}' as the configuration file.", mainURL);

View File

@ -152,7 +152,7 @@ public class ResourceMinimizerMojo {
LoggerContext loggerContext = ((ch.qos.logback.classic.Logger) ourLog).getLoggerContext();
URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(loggerContext);
System.out.println(mainURL);
ourLog.info(mainURL.toExternalForm());
// or even
ourLog.info("Logback used '{}' as the configuration file.", mainURL);

View File

@ -31,7 +31,7 @@ import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.Task;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
@ -104,7 +104,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test {
messageHeaderAutoVersionExtension = createAutoVersionReferencesExtensions("focus");
}
@NotNull
@Nonnull
private List<Extension> createAutoVersionReferencesExtensions(String... thePaths) {
return Arrays.stream(thePaths)
.map(path -> new Extension(EXTENSION_AUTO_VERSION_REFERENCES_AT_PATH, new StringType(path)))

View File

@ -1242,7 +1242,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
ourLog.info("Patient TEMP UUID: {}", patient.getId());
String s = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(transactionBundle);
System.out.println(s);
ourLog.info(s);
Bundle outcome = mySystemDao.transaction(null, transactionBundle);
String patientLocation = outcome.getEntry().get(0).getResponse().getLocation();
assertThat(patientLocation).matches("Patient/[a-z0-9-]+/_history/1");

View File

@ -984,7 +984,7 @@ public class PackageInstallerSvcR4Test extends BaseJpaR4Test {
if (s.charAt(0) != '/' && s.charAt(1) == ':') { // is Windows..
s = s.substring(2); // .. get rid of the "C:" part (not perfect but...
}
System.out.println("Current absolute path is: " + s);
ourLog.info("Current absolute path is: " + s);
String fileUrl = "file:" + s + "/src/test/resources/packages/de.basisprofil.r4-1.2.0.tgz";

View File

@ -248,7 +248,7 @@ public class ResourceProviderMeaningfulOutcomeMessageR4Test extends BaseResource
.execute();
ourLog.debug("Create {}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(output));
OperationOutcome oo = (OperationOutcome) output.getEntry().get(0).getResponse().getOutcome();
// FIXME KHS restore this
// TODO CHECKSTYLE KHS restore this
// assertThat(oo.getIssueFirstRep().getDiagnostics()).matches("Successfully conditionally created resource \".*\". No existing resources matched URL \"Patient\\?active=true\". Took [0-9]+ms.");
assertEquals(StorageResponseCodeEnum.SUCCESSFUL_CREATE_NO_CONDITIONAL_MATCH.name(), oo.getIssueFirstRep().getDetails().getCodingFirstRep().getCode());
assertEquals(StorageResponseCodeEnum.SYSTEM, oo.getIssueFirstRep().getDetails().getCodingFirstRep().getSystem());

View File

@ -27,7 +27,7 @@ import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Subscription;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@ -130,7 +130,7 @@ public abstract class BaseSubscriptionsR4Test extends BaseResourceProviderR4Test
return createSubscription(theCriteria, thePayload, theExtension, id);
}
@NotNull
@Nonnull
protected Subscription createSubscription(String theCriteria, String thePayload, Extension theExtension, String id) {
Subscription subscription = newSubscription(theCriteria, thePayload);
if (theExtension != null) {

View File

@ -26,7 +26,7 @@ import org.hl7.fhir.r4b.model.Observation;
import org.hl7.fhir.r4b.model.Organization;
import org.hl7.fhir.r4b.model.Patient;
import org.hl7.fhir.r4b.model.Subscription;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@ -125,7 +125,7 @@ public abstract class BaseSubscriptionsR4BTest extends BaseResourceProviderR4BTe
return createSubscription(theCriteria, thePayload, theExtension, id);
}
@NotNull
@Nonnull
protected Subscription createSubscription(String theCriteria, String thePayload, Extension theExtension, String id) {
Subscription subscription = newSubscription(theCriteria, thePayload);
if (theExtension != null) {

View File

@ -28,7 +28,7 @@ import org.hl7.fhir.r5.model.SearchParameter;
import org.hl7.fhir.r5.model.Subscription;
import org.hl7.fhir.r5.model.SubscriptionStatus;
import org.hl7.fhir.r5.model.SubscriptionTopic;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
@ -86,12 +86,12 @@ public class RestHookTestR5IT extends BaseSubscriptionsR5Test {
assertEquals(sentObservation.getIdElement(), obs.getIdElement());
}
@NotNull
@Nonnull
private Observation sendObservationExpectDelivery(int theCount) throws InterruptedException {
return sendObservation(OBS_CODE, "SNOMED-CT", true, theCount);
}
@NotNull
@Nonnull
private Observation sendObservationExpectDelivery() throws InterruptedException {
return sendObservation(OBS_CODE, "SNOMED-CT", true, 1);
}
@ -143,7 +143,7 @@ public class RestHookTestR5IT extends BaseSubscriptionsR5Test {
assertEquals("2", receivedObs.getIdentifierFirstRep().getValue());
}
@NotNull
@Nonnull
private Subscription createMatchingTopicSubscription() throws Exception {
Subscription subscription = createTopicSubscription(OBS_CODE);
waitForActivatedSubscriptionCount(1);
@ -271,7 +271,7 @@ public class RestHookTestR5IT extends BaseSubscriptionsR5Test {
}
}
@NotNull
@Nonnull
private Subscription createTopicSubscription() throws InterruptedException {
Subscription subscription = newTopicSubscription(SUBSCRIPTION_TOPIC_TEST_URL + OBS_CODE, Constants.CT_FHIR_JSON_NEW);

View File

@ -11,7 +11,7 @@ import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import org.hl7.fhir.r5.model.Enumerations;
import org.hl7.fhir.r5.model.IdType;
import org.hl7.fhir.r5.model.Patient;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -123,7 +123,7 @@ public class PreviousVersionReaderPartitionedTest extends BaseJpaR5Test {
assertTrue(previousPatient.isDeleted());
}
@NotNull
@Nonnull
private Patient setupPreviousDeletedResource() {
Patient patient = createMale();
assertEquals(1L, patient.getIdElement().getVersionIdPartAsLong());

View File

@ -67,6 +67,7 @@ public class MdmSearchExpandingInterceptor {
@Hook(Pointcut.STORAGE_PRESEARCH_REGISTERED)
public void hook(RequestDetails theRequestDetails, SearchParameterMap theSearchParameterMap) {
if (myStorageSettings.isAllowMdmExpansion()) {
final RequestDetails requestDetailsToUse =
theRequestDetails == null ? new SystemRequestDetails() : theRequestDetails;

View File

@ -26,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.Validate;
@ -44,7 +44,7 @@ public class BulkImportJobParameters implements IModelJson {
@JsonProperty(value = "ndJsonUrls", required = true)
@Size(min = 1, message = "At least one NDJSON URL must be provided")
@NotNull(message = "At least one NDJSON URL must be provided")
@NotEmpty(message = "At least one NDJSON URL must be provided")
private List<@Pattern(regexp = "^http[s]?://.*", message = "Must be a valid URL") String> myNdJsonUrls;
@JsonProperty(value = "httpBasicCredentials", required = false)

View File

@ -37,7 +37,7 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Patient;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -234,7 +234,7 @@ public class ExpandResourceAndWriteBinaryStepTest {
assertEquals(binaryId.getValueAsString(), fileIdArgumentCaptor.getValue().getBinaryId());
}
@NotNull
@Nonnull
private static ArrayList<IBaseResource> createResourceList(ResourceIdList idList) {
idList.setResourceType("Patient");
ArrayList<IBaseResource> resources = new ArrayList<>();

View File

@ -20,6 +20,7 @@ import ca.uhn.fhir.test.utilities.HttpClientExtension;
import ca.uhn.fhir.test.utilities.server.RestfulServerExtension;
import com.google.common.base.Charsets;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
@ -32,8 +33,6 @@ import org.hl7.fhir.r4.model.Parameters;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.model.UrlType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
@ -419,15 +418,15 @@ public class BulkDataImportProviderTest {
return null;
}
@NotNull
@Nonnull
@Override
public RequestPartitionId determineCreatePartitionForRequest(@Nullable RequestDetails theRequest, @NotNull IBaseResource theResource, @NotNull String theResourceType) {
public RequestPartitionId determineCreatePartitionForRequest(@Nullable RequestDetails theRequest, @Nonnull IBaseResource theResource, @Nonnull String theResourceType) {
return null;
}
@NotNull
@Nonnull
@Override
public Set<Integer> toReadPartitions(@NotNull RequestPartitionId theRequestPartitionId) {
public Set<Integer> toReadPartitions(@Nonnull RequestPartitionId theRequestPartitionId) {
return null;
}

View File

@ -45,7 +45,7 @@ import ca.uhn.hapi.fhir.batch2.test.support.TestJobStep2InputType;
import ca.uhn.hapi.fhir.batch2.test.support.TestJobStep3InputType;
import ca.uhn.test.concurrency.PointcutLatch;
import jakarta.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Nested;
import org.mockito.ArgumentCaptor;
@ -111,15 +111,15 @@ public abstract class AbstractIJobPersistenceSpecificationTest
.addFirstStep(FIRST_STEP_ID, "the first step", TestJobStep2InputType.class, (theStepExecutionDetails, theDataSink) -> new RunOutcome(0))
.addIntermediateStep(SECOND_STEP_ID, "the second step", TestJobStep3InputType.class, (theStepExecutionDetails, theDataSink) -> new RunOutcome(0))
.addFinalReducerStep(LAST_STEP_ID, "reduction step", VoidModel.class, new IReductionStepWorker<TestJobParameters, TestJobStep3InputType, VoidModel>() {
@NotNull
@Nonnull
@Override
public ChunkOutcome consume(ChunkExecutionDetails<TestJobParameters, TestJobStep3InputType> theChunkDetails) {
return ChunkOutcome.SUCCESS();
}
@NotNull
@Nonnull
@Override
public RunOutcome run(@NotNull StepExecutionDetails<TestJobParameters, TestJobStep3InputType> theStepExecutionDetails, @NotNull IJobDataSink<VoidModel> theDataSink) throws JobExecutionFailedException {
public RunOutcome run(@Nonnull StepExecutionDetails<TestJobParameters, TestJobStep3InputType> theStepExecutionDetails, @Nonnull IJobDataSink<VoidModel> theDataSink) throws JobExecutionFailedException {
return RunOutcome.SUCCESS;
}
});

View File

@ -1848,7 +1848,7 @@ public class JsonParserDstu2_1Test {
IParser parser = ourCtx.newJsonParser();
String output = parser.encodeResourceToString(fhirPat);
System.out.println("output: " + output);
ourLog.info("output: " + output);
// Deserialize then check that valueReference value is still correct
fhirPat = parser.parseResource(Patient.class, output);

View File

@ -2567,7 +2567,7 @@ public class XmlParserDstu2_1Test {
IParser parser = ourCtx.newXmlParser();
String output = parser.encodeResourceToString(fhirPat);
System.out.println("output: " + output);
ourLog.info("output: " + output);
// Deserialize then check that valueReference value is still correct
fhirPat = parser.parseResource(Patient.class, output);

View File

@ -153,7 +153,7 @@ public class JsonParserDstu2Test {
IParser parser = ourCtx.newJsonParser();
String output = parser.encodeResourceToString(fhirPat);
System.out.println("output: " + output);
ourLog.info("output: " + output);
// Deserialize then check that valueReference value is still correct
fhirPat = parser.parseResource(Patient.class, output);
@ -227,7 +227,7 @@ public class JsonParserDstu2Test {
jsonParser.setServerBaseUrl("http://www.example.com");
final String parsedPatient = jsonParser.encodeResourceToString(patient);
System.out.println(parsedPatient);
ourLog.info(parsedPatient);
assertEquals(expected, parsedPatient);
// Parse with string
@ -261,7 +261,7 @@ public class JsonParserDstu2Test {
jsonParser.setServerBaseUrl("http://www.example.com");
final String parsedBundle = jsonParser.encodeResourceToString(bundle);
System.out.println(parsedBundle);
ourLog.info(parsedBundle);
assertEquals(expected, parsedBundle);
// Parse with string

View File

@ -2827,7 +2827,7 @@ public class XmlParserDstu2Test {
xmlParser.setServerBaseUrl("http://www.example.com");
final String parsedPatient = xmlParser.encodeResourceToString(patient);
System.out.println(parsedPatient);
ourLog.info(parsedPatient);
assertEquals(expected, parsedPatient);
// Parse with string
@ -2860,7 +2860,7 @@ public class XmlParserDstu2Test {
xmlParser.setServerBaseUrl("http://www.example.com");
final String parsedBundle = xmlParser.encodeResourceToString(bundle);
System.out.println(parsedBundle);
ourLog.info(parsedBundle);
assertEquals(expected, parsedBundle);
// Parse with string
@ -2889,7 +2889,7 @@ public class XmlParserDstu2Test {
IParser parser = ourCtx.newXmlParser();
String output = parser.encodeResourceToString(fhirPat);
System.out.println("output: " + output);
ourLog.info("output: " + output);
// Deserialize then check that valueReference value is still correct
fhirPat = parser.parseResource(Patient.class, output);

View File

@ -95,7 +95,7 @@ public class BundleTypeDstu2Test {
client.registerInterceptor(new LoggingInterceptor(true));
Bundle result = client.search().forResource(Patient.class).where(Patient.NAME.matches().value("Alice")).returnBundle(Bundle.class).execute();
System.out.println(result.getEntry().size());
ourLog.info("size is " + result.getEntry().size());
}

View File

@ -119,7 +119,7 @@ public class CompartmentDstu2Test {
public List<Encounter> method2SearchCompartment(final @IdParam IdDt theId) {
ourLastId = theId;
ourLastMethod = "searchEncounterCompartment";
System.out.println("Encounter compartment search");
ourLog.info("Encounter compartment search");
List<Encounter> encounters = new ArrayList<Encounter>();
Encounter encounter = new Encounter();
encounter.setId("1");
@ -132,7 +132,7 @@ public class CompartmentDstu2Test {
public List<Observation> method2SearchCompartment2(final @IdParam IdDt theId) {
ourLastId = theId;
ourLastMethod = "searchObservationCompartment";
System.out.println("Encounter compartment search");
ourLog.info("Encounter compartment search");
List<Observation> encounters = new ArrayList<Observation>();
Observation obs = new Observation();
obs.setId("1");

View File

@ -3,7 +3,7 @@ package ca.uhn.fhir.rest.server.provider;
import ca.uhn.test.util.LogbackTestExtension;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import org.jetbrains.annotations.NotNull;
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@ -84,12 +84,12 @@ class ObservableSupplierSetTest {
int removed = 0;
@Override
public void update(@NotNull Supplier<Object> theSupplier) {
public void update(@Nonnull Supplier<Object> theSupplier) {
++updated;
}
@Override
public void remove(@NotNull Supplier<Object> theSupplier) {
public void remove(@Nonnull Supplier<Object> theSupplier) {
++removed;
}

View File

@ -241,7 +241,7 @@ public class FhirTerserDstu2Test {
p.addUndeclaredExtension(true, "http://acme.org/modifierExtension", new StringDt("modifierValue"));
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = ourCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -280,7 +280,7 @@ public class FhirTerserDstu2Test {
p.addUndeclaredExtension(true, "http://acme.org/modifierExtension", new StringDt("modifierValue"));
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = ourCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -290,7 +290,7 @@ public class FhirTerserDstu2Test {
((BooleanDt) values.get(0)).setValue(Boolean.FALSE);
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = ourCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -307,7 +307,7 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(0)).setValue(new StringDt("modifiedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = ourCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/extension')");
assertThat(values).hasSize(1);
@ -325,7 +325,7 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(0)).setValue(new StringDt("modifiedModifierValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = ourCtx.newTerser().getValues(p, "Patient.modifierExtension('http://acme.org/modifierExtension')");
assertThat(values).hasSize(1);
@ -343,7 +343,7 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(0)).setValue(new StringDt("modifiedNestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = ourCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/parentExtension').extension('http://acme.org/childExtension')");
assertThat(values).hasSize(1);
@ -364,7 +364,7 @@ public class FhirTerserDstu2Test {
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue1"));
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue2"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = ourCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/extension')");
assertThat(values).hasSize(2);
@ -409,7 +409,7 @@ public class FhirTerserDstu2Test {
p.addUndeclaredExtension(true, "http://acme.org/modifierExtension", new StringDt("modifierValue"));
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IPrimitiveType> values = ourCtx.newTerser().getValues(p, "Patient.active", IPrimitiveType.class);
assertThat(values).hasSize(1);
@ -444,7 +444,7 @@ public class FhirTerserDstu2Test {
p.addUndeclaredExtension(true, "http://acme.org/modifierExtension", new StringDt("modifierValue"));
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IPrimitiveType> values = ourCtx.newTerser().getValues(p, "Patient.active", IPrimitiveType.class);
assertThat(values).hasSize(1);
@ -453,7 +453,7 @@ public class FhirTerserDstu2Test {
((BooleanDt) values.get(0)).setValue(Boolean.FALSE);
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = ourCtx.newTerser().getValues(p, "Patient.active", IPrimitiveType.class);
assertThat(values).hasSize(1);
@ -468,7 +468,7 @@ public class FhirTerserDstu2Test {
extValues.get(0).setValue(new StringDt("modifiedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
extValues = ourCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/extension')", ExtensionDt.class);
assertThat(extValues).hasSize(1);
@ -484,7 +484,7 @@ public class FhirTerserDstu2Test {
extValues.get(0).setValue(new StringDt("modifiedModifierValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
extValues = ourCtx.newTerser().getValues(p, "Patient.modifierExtension('http://acme.org/modifierExtension')", ExtensionDt.class);
assertThat(extValues).hasSize(1);
@ -500,7 +500,7 @@ public class FhirTerserDstu2Test {
extValues.get(0).setValue(new StringDt("modifiedNestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
extValues = ourCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/parentExtension').extension('http://acme.org/childExtension')", ExtensionDt.class);
assertThat(extValues).hasSize(1);
@ -513,7 +513,7 @@ public class FhirTerserDstu2Test {
public void testGetValuesWithWantedClassAndTheCreate() {
Patient p = new Patient();
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IPrimitiveType> values = ourCtx.newTerser().getValues(p, "Patient.active", IPrimitiveType.class, true);
assertThat(values).hasSize(1);
@ -545,7 +545,7 @@ public class FhirTerserDstu2Test {
p.addUndeclaredExtension(true, "http://acme.org/modifierExtension", new StringDt("modifierValue"));
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = ourCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -580,7 +580,7 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(1)).setValue(new StringDt("addedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof ExtensionDt);
@ -607,14 +607,14 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(1)).setValue(new StringDt("addedModifierValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof ExtensionDt);
assertEquals("http://acme.org/modifierExtension", ((ExtensionDt) values.get(1)).getUrl());
assertEquals("addedModifierValue", ((StringDt) ((ExtensionDt) values.get(1)).getValue()).getValueAsString());
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = ourCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/parentExtension').extension('http://acme.org/childExtension')");
assertThat(values).hasSize(1);
@ -636,7 +636,7 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(1)).setValue(new StringDt("addedNestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof ExtensionDt);
@ -648,7 +648,7 @@ public class FhirTerserDstu2Test {
public void testGetValuesWithTheCreate() {
Patient p = new Patient();
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = ourCtx.newTerser().getValues(p, "Patient.active", true);
assertThat(values).hasSize(1);
@ -687,7 +687,7 @@ public class FhirTerserDstu2Test {
p.addUndeclaredExtension(true, "http://acme.org/modifierExtension", new StringDt("modifierValue"));
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = ourCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -722,7 +722,7 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(1)).setValue(new StringDt("addedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof ExtensionDt);
@ -749,7 +749,7 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(1)).setValue(new StringDt("addedModifierValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof ExtensionDt);
@ -776,7 +776,7 @@ public class FhirTerserDstu2Test {
((ExtensionDt) values.get(1)).setValue(new StringDt("addedNestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof ExtensionDt);
@ -793,7 +793,7 @@ public class FhirTerserDstu2Test {
p.addUndeclaredExtension(true, "http://acme.org/modifierExtension", new StringDt("modifierValue"));
p.addUndeclaredExtension(false, "http://acme.org/parentExtension").addUndeclaredExtension(false, "http://acme.org/childExtension", new StringDt("nestedValue"));
System.out.println(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = ourCtx.newTerser().getValues(p, "Patient.active", true);
assertThat(values).hasSize(1);

View File

@ -7,6 +7,7 @@ import ca.uhn.fhir.model.dstu2.valueset.AppointmentStatusEnum;
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
import ca.uhn.fhir.model.dstu2.valueset.ParticipantTypeEnum;
import ca.uhn.fhir.model.dstu2.valueset.ParticipationStatusEnum;
import ca.uhn.fhir.rest.server.CompartmentDstu2Test;
import ca.uhn.fhir.util.TestUtil;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Disabled;
@ -19,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
* @author Bill de Beaubien on 11/30/2015.
*/
public class BundleValidationTest {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BundleValidationTest.class);
private static FhirContext ourCtx = FhirContext.forDstu2();
@Test
@ -33,7 +35,7 @@ public class BundleValidationTest {
assertFalse(result.isSuccessful());
assertThat(result.getMessages()).hasSize(1);
for (SingleValidationMessage singleValidationMessage : result.getMessages()) {
System.out.println(singleValidationMessage.getMessage());
ourLog.info(singleValidationMessage.getMessage());
}
}
@ -54,7 +56,7 @@ public class BundleValidationTest {
assertThat(result.isSuccessful()).as("Validation should have failed").isFalse();
assertThat(result.getMessages()).hasSize(1);
for (SingleValidationMessage singleValidationMessage : result.getMessages()) {
System.out.println(singleValidationMessage.getMessage());
ourLog.info(singleValidationMessage.getMessage());
}
}

View File

@ -181,7 +181,7 @@ public class JsonParserDstu3Test {
IParser parser = ourCtx.newJsonParser();
String output = parser.encodeResourceToString(fhirPat);
System.out.println("output: " + output);
ourLog.info("output: " + output);
// Deserialize then check that valueReference value is still correct
fhirPat = parser.parseResource(Patient.class, output);
@ -233,7 +233,7 @@ public class JsonParserDstu3Test {
jsonParser.setServerBaseUrl("http://www.example.com");
final String parsedPatient = jsonParser.encodeResourceToString(patient);
System.out.println(parsedPatient);
ourLog.info(parsedPatient);
assertEquals(expected, parsedPatient);
// Parse with string
@ -266,7 +266,7 @@ public class JsonParserDstu3Test {
jsonParser.setServerBaseUrl("http://www.example.com");
final String parsedBundle = jsonParser.encodeResourceToString(bundle);
System.out.println(parsedBundle);
ourLog.info(parsedBundle);
assertEquals(expected, parsedBundle);
// Parse with string

View File

@ -214,7 +214,7 @@ public class XmlParserDstu3Test {
IParser parser = ourCtx.newXmlParser();
String output = parser.encodeResourceToString(fhirPat);
System.out.println("output: " + output);
ourLog.info("output: " + output);
// Deserialize then check that valueReference value is still correct
fhirPat = parser.parseResource(Patient.class, output);
@ -425,7 +425,7 @@ public class XmlParserDstu3Test {
xmlParser.setServerBaseUrl("http://www.example.com");
final String parsedPatient = xmlParser.encodeResourceToString(patient);
System.out.println(parsedPatient);
ourLog.info(parsedPatient);
assertEquals(expected, parsedPatient);
// Parse with string
@ -458,7 +458,7 @@ public class XmlParserDstu3Test {
xmlParser.setServerBaseUrl("http://www.example.com");
final String parsedBundle = xmlParser.encodeResourceToString(bundle);
System.out.println(parsedBundle);
ourLog.info(parsedBundle);
assertEquals(expected, parsedBundle);
// Parse with string

View File

@ -67,7 +67,8 @@ public class JsonLikeParserDstu3Test {
jsonLikeParser.encodeResourceToJsonLikeWriter(fhirPat, jsonLikeWriter);
Map<String,Object> jsonLikeMap = jsonLikeWriter.getResultMap();
System.out.println("encoded map: " + jsonLikeMap.toString());
ourLog.info("encoded map: " + jsonLikeMap.toString());
assertThat(jsonLikeMap.get("resourceType")).as("Encoded resource missing 'resourceType' element").isNotNull();
assertThat("Patient").as("Expecting 'resourceType'='Patient'; found '" + jsonLikeMap.get("resourceType") + "'").isEqualTo(jsonLikeMap.get("resourceType"));

View File

@ -1266,7 +1266,7 @@ public class JsonParserHl7OrgDstu2Test {
IParser parser = ourCtx.newJsonParser();
String output = parser.encodeResourceToString(fhirPat);
System.out.println("output: " + output);
ourLog.info("output: " + output);
// Deserialize then check that valueReference value is still correct
fhirPat = parser.parseResource(Patient.class, output);

View File

@ -1737,7 +1737,7 @@ public class XmlParserHl7OrgDstu2Test {
IParser parser = ourCtx.newXmlParser();
String output = parser.encodeResourceToString(fhirPat);
System.out.println("output: " + output);
ourLog.info("output: " + output);
// Deserialize then check that valueReference value is still correct
fhirPat = parser.parseResource(Patient.class, output);

View File

@ -124,7 +124,7 @@ public class JsonLikeParserTest {
jsonLikeParser.encodeResourceToJsonLikeWriter(fhirPat, jsonLikeWriter);
Map<String,Object> jsonLikeMap = jsonLikeWriter.getResultMap();
System.out.println("encoded map: " + jsonLikeMap.toString());
ourLog.info("encoded map: {}", jsonLikeMap.toString());
assertThat(jsonLikeMap.get("resourceType")).as("Encoded resource missing 'resourceType' element").isNotNull();
assertThat("Patient").as("Expecting 'resourceType'='Patient'; found '" + jsonLikeMap.get("resourceType") + "'").isEqualTo(jsonLikeMap.get("resourceType"));

View File

@ -39,6 +39,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@SuppressWarnings("checkstyle:NoPrintln")
public class LoggingInterceptorTest {
private static final FhirContext ourCtx = FhirContext.forR4Cached();
@ -77,7 +78,6 @@ public class LoggingInterceptorTest {
@Test
public void testLoggerNonVerbose() {
System.out.println("Starting testLogger");
IGenericClient client = ourCtx.newRestfulGenericClient(ourServer.getBaseUrl());
ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);

View File

@ -586,7 +586,7 @@ public class FhirTerserR4Test {
.setUrl("http://acme.org/childExtension")
.setValue(new StringType("nestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = myCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -705,7 +705,7 @@ public class FhirTerserR4Test {
.setUrl("http://acme.org/childExtension")
.setValue(new StringType("nestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = myCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -715,7 +715,7 @@ public class FhirTerserR4Test {
((BooleanType) values.get(0)).setValue(Boolean.FALSE);
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = myCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -732,7 +732,7 @@ public class FhirTerserR4Test {
((Extension) values.get(0)).setValue(new StringType("modifiedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = myCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/extension')");
assertThat(values).hasSize(1);
@ -750,7 +750,7 @@ public class FhirTerserR4Test {
((Extension) values.get(0)).setValue(new StringType("modifiedModifierValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = myCtx.newTerser().getValues(p, "Patient.modifierExtension('http://acme.org/modifierExtension')");
assertThat(values).hasSize(1);
@ -768,7 +768,7 @@ public class FhirTerserR4Test {
((Extension) values.get(0)).setValue(new StringType("modifiedNestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = myCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/parentExtension').extension('http://acme.org/childExtension')");
assertThat(values).hasSize(1);
@ -807,7 +807,7 @@ public class FhirTerserR4Test {
.setUrl("http://acme.org/childExtension")
.setValue(new StringType("nestedValue2"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = myCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/extension')");
assertThat(values).hasSize(2);
@ -862,7 +862,7 @@ public class FhirTerserR4Test {
.setUrl("http://acme.org/childExtension")
.setValue(new StringType("nestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<PrimitiveType> values = myCtx.newTerser().getValues(p, "Patient.active", PrimitiveType.class);
assertThat(values).hasSize(1);
@ -907,7 +907,7 @@ public class FhirTerserR4Test {
.setUrl("http://acme.org/childExtension")
.setValue(new StringType("nestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<PrimitiveType> values = myCtx.newTerser().getValues(p, "Patient.active", PrimitiveType.class);
assertThat(values).hasSize(1);
@ -916,7 +916,7 @@ public class FhirTerserR4Test {
((BooleanType) values.get(0)).setValue(Boolean.FALSE);
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = myCtx.newTerser().getValues(p, "Patient.active", PrimitiveType.class);
assertThat(values).hasSize(1);
@ -931,7 +931,7 @@ public class FhirTerserR4Test {
extValues.get(0).setValue(new StringType("modifiedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
extValues = myCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/extension')", Extension.class);
assertThat(extValues).hasSize(1);
@ -947,7 +947,7 @@ public class FhirTerserR4Test {
extValues.get(0).setValue(new StringType("modifiedModifierValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
extValues = myCtx.newTerser().getValues(p, "Patient.modifierExtension('http://acme.org/modifierExtension')", Extension.class);
assertThat(extValues).hasSize(1);
@ -963,7 +963,7 @@ public class FhirTerserR4Test {
extValues.get(0).setValue(new StringType("modifiedNestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
extValues = myCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/parentExtension').extension('http://acme.org/childExtension')", Extension.class);
assertThat(extValues).hasSize(1);
@ -976,7 +976,7 @@ public class FhirTerserR4Test {
public void testGetValuesWithWantedClassAndTheCreate() {
Patient p = new Patient();
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<PrimitiveType> values = myCtx.newTerser().getValues(p, "Patient.active", PrimitiveType.class, true);
assertThat(values).hasSize(1);
@ -1018,7 +1018,7 @@ public class FhirTerserR4Test {
.setUrl("http://acme.org/childExtension")
.setValue(new StringType("nestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = myCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -1053,7 +1053,7 @@ public class FhirTerserR4Test {
((Extension) values.get(1)).setValue(new StringType("addedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof Extension);
@ -1080,14 +1080,14 @@ public class FhirTerserR4Test {
((Extension) values.get(1)).setValue(new StringType("addedModifierValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof Extension);
assertEquals("http://acme.org/modifierExtension", ((Extension) values.get(1)).getUrl());
assertEquals("addedModifierValue", ((StringType) ((Extension) values.get(1)).getValue()).getValueAsString());
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
values = myCtx.newTerser().getValues(p, "Patient.extension('http://acme.org/parentExtension').extension('http://acme.org/childExtension')");
assertThat(values).hasSize(1);
@ -1109,7 +1109,7 @@ public class FhirTerserR4Test {
((Extension) values.get(1)).setValue(new StringType("addedNestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof Extension);
@ -1168,7 +1168,7 @@ public class FhirTerserR4Test {
.setUrl("http://acme.org/childExtension")
.setValue(new StringType("nestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = myCtx.newTerser().getValues(p, "Patient.active");
assertThat(values).hasSize(1);
@ -1203,7 +1203,7 @@ public class FhirTerserR4Test {
((Extension) values.get(1)).setValue(new StringType("addedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof Extension);
@ -1230,7 +1230,7 @@ public class FhirTerserR4Test {
((Extension) values.get(1)).setValue(new StringType("addedModifierValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof Extension);
@ -1257,7 +1257,7 @@ public class FhirTerserR4Test {
((Extension) values.get(1)).setValue(new StringType("addedNestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
assertTrue(values.get(1) instanceof IBaseExtension);
assertTrue(values.get(1) instanceof Extension);
@ -1284,7 +1284,7 @@ public class FhirTerserR4Test {
.setUrl("http://acme.org/childExtension")
.setValue(new StringType("nestedValue"));
System.out.println(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p));
List<IBase> values = myCtx.newTerser().getValues(p, "Patient.active", true);
assertThat(values).hasSize(1);

View File

@ -8,6 +8,8 @@ import org.hl7.fhir.dstu3.model.Encounter;
import org.hl7.fhir.dstu3.model.OperationOutcome;
public class Example20_ValidateResource {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(Example20_ValidateResource.class);
public static void main(String[] args) {
// Create an incomplete encounter (status is required)
@ -20,11 +22,11 @@ public class Example20_ValidateResource {
// Did we succeed?
ValidationResult result = validator.validateWithResult(enc);
System.out.println("Success: " + result.isSuccessful());
ourLog.info("Success: " + result.isSuccessful());
// What was the result
OperationOutcome outcome = (OperationOutcome) result.toOperationOutcome();
IParser parser = ctx.newXmlParser().setPrettyPrint(true);
System.out.println(parser.encodeResourceToString(outcome));
ourLog.info(parser.encodeResourceToString(outcome));
}
}

View File

@ -144,7 +144,7 @@ public class VersionSpecificWorkerContextWrapperCoreTest {
public ValueSet answer(InvocationOnMock theInvocation) {
String url = (String) theInvocation.getArguments()[1];
System.out.println("Looking for valueSet: " + url + "... " + (myValueSets.containsKey(url) ? "found" : "not found"));
ourLog.info("Looking for valueSet: " + url + "... " + (myValueSets.containsKey(url) ? "found" : "not found"));
return myValueSets.get(url);
}
}
@ -156,7 +156,7 @@ public class VersionSpecificWorkerContextWrapperCoreTest {
public ValueSet answer(InvocationOnMock theInvocation) {
String url = (String) theInvocation.getArguments()[0];
System.out.println("Looking for valueSet: " + url + "... " + (myValueSets.containsKey(url) ? "found" : "not found"));
ourLog.info("Looking for valueSet: " + url + "... " + (myValueSets.containsKey(url) ? "found" : "not found"));
return myValueSets.get(url);
}
}
@ -168,7 +168,7 @@ public class VersionSpecificWorkerContextWrapperCoreTest {
public IBaseResource answer(InvocationOnMock theInvocation) {
String url = (String) theInvocation.getArguments()[0];
System.out.println("Looking for codeSystem: " + url);
ourLog.info("Looking for codeSystem: " + url);
return myCodeSystems.get(url);
}
}
@ -208,7 +208,7 @@ public class VersionSpecificWorkerContextWrapperCoreTest {
@ParameterizedTest(name = "{0}")
@MethodSource("argumentSource")
public void fhirTestCasesCodeValidationTest(String name, TxTestData testData, TxTestSetup setup) throws IOException {
System.out.println("Name: " + name);
ourLog.info("Name: " + name);
for (String s : setup.getSuite().forceArray("setup").asStrings()) {
@ -220,7 +220,7 @@ public class VersionSpecificWorkerContextWrapperCoreTest {
CodeSystem codeSystem = (CodeSystem) res;
myCodeSystems.put(codeSystem.getUrl(), codeSystem);
} else {
System.out.println("Can't load setup resource: " + s);
ourLog.info("Can't load setup resource: " + s);
}
}
Resource req = loadResource(setup.getTest().asString("request"));

57
pom.xml
View File

@ -3,7 +3,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- the version info -->
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
@ -949,7 +948,7 @@
<apache_karaf_version>4.2.5</apache_karaf_version>
<aries_spifly_version>1.2</aries_spifly_version>
<caffeine_version>3.1.8</caffeine_version>
<checkstyle_version>10.6.0</checkstyle_version>
<checkstyle_version>10.17.0</checkstyle_version>
<maven_changes_version>2.12.1</maven_changes_version>
<commons_codec_version>1.15</commons_codec_version>
<commons_compress_version>1.26.0</commons_compress_version>
@ -1039,7 +1038,7 @@
<maven.compiler.testSource>17</maven.compiler.testSource>
<maven.compiler.testTarget>17</maven.compiler.testTarget>
<maven.compiler.testRelease>17</maven.compiler.testRelease>
<maven_checkstyle_version>3.3.1</maven_checkstyle_version>
<maven_checkstyle_version>3.4.0</maven_checkstyle_version>
<!-- Jacoco -->
<argLine></argLine>
@ -2347,7 +2346,7 @@
<spacesPerTab>4</spacesPerTab>
</indent>
<!--Just removes unused imports-->
<removeUnusedImports />
<removeUnusedImports/>
<!--Follow the editorconfig-defined order of imports-->
<importOrder>
<wildcardsLast>true</wildcardsLast>
@ -2405,11 +2404,6 @@
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven_checkstyle_version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
@ -2687,6 +2681,11 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
@ -3135,16 +3134,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>hapi-single-module-checkstyle</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-checkstyle-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>hapi-single-module-checkstyle</id>-->
<!-- <phase>none</phase>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>
</profile>
@ -3196,16 +3195,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>validate</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-checkstyle-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>validate</id>-->
<!-- <phase>none</phase>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>
</profile>

View File

@ -27,7 +27,7 @@ jobs:
inputs:
goals: 'install'
# These are Maven CLI options (and show up in the build logs) - "-nsu"=Don't update snapshots. We can remove this when Maven OSS is more healthy
options: '-P CI,FASTINSTALL -Dmaven.test.skip -e -B -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -Dmaven.javadoc.skip=true -Dmaven.wagon.http.pool=false -Dhttp.keepAlive=false -Dstyle.color=always -Djansi.force=true'
options: '-P CI,CHECKSTYLE -Dmaven.test.skip -e -B -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -Dmaven.javadoc.skip=true -Dmaven.wagon.http.pool=false -Dhttp.keepAlive=false -Dstyle.color=always -Djansi.force=true'
# These are JVM options (and don't show up in the build logs)
mavenOptions: '-Xmx1024m $(MAVEN_OPTS) -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto'
jdkVersionOption: 1.11