Boyscouting (#558)
* Boyscouting: Docker conventions
* Boyscouting: JUnit 5 conventions ("It is generally recommended to omit the public modifier for test classes, test methods, and lifecycle methods unless there is a technical reason for doing so)"
* Boyscouting: typo in RepositoryValidationInterceptorFactoryDstu3
* Boyscouting: use List.of instead of Guava; use StandardCharsets instead of Guava; remove unused imports
---------
Co-authored-by: Gerlach, Winfried <Winfried.Gerlach@draeger.com>
This commit is contained in:
@@ -5,7 +5,6 @@ import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum;
|
||||
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
|
||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
@@ -577,7 +576,7 @@ public class AppProperties {
|
||||
|
||||
public static class Cors {
|
||||
private Boolean allow_Credentials = true;
|
||||
private List<String> allowed_origin = ImmutableList.of("*");
|
||||
private List<String> allowed_origin = List.of("*");
|
||||
|
||||
public List<String> getAllowed_origin() {
|
||||
return allowed_origin;
|
||||
|
||||
@@ -9,7 +9,6 @@ import ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMod
|
||||
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
|
||||
import ca.uhn.fhir.jpa.starter.AppProperties;
|
||||
import ca.uhn.fhir.jpa.starter.util.JpaHibernatePropertiesProvider;
|
||||
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory;
|
||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
|
||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
|
||||
import ca.uhn.fhir.rest.server.mail.IMailSvc;
|
||||
@@ -27,7 +26,6 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -84,7 +82,7 @@ public class FhirServerConfigCommon {
|
||||
public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
|
||||
JpaStorageSettings jpaStorageSettings = new JpaStorageSettings();
|
||||
|
||||
jpaStorageSettings.setIndexMissingFields(appProperties.getEnable_index_missing_fields() ? JpaStorageSettings.IndexEnabledEnum.ENABLED : JpaStorageSettings.IndexEnabledEnum.DISABLED);
|
||||
jpaStorageSettings.setIndexMissingFields(appProperties.getEnable_index_missing_fields() ? StorageSettings.IndexEnabledEnum.ENABLED : StorageSettings.IndexEnabledEnum.DISABLED);
|
||||
jpaStorageSettings.setAutoCreatePlaceholderReferenceTargets(appProperties.getAuto_create_placeholder_reference_targets());
|
||||
jpaStorageSettings.setEnforceReferentialIntegrityOnWrite(appProperties.getEnforce_referential_integrity_on_write());
|
||||
jpaStorageSettings.setEnforceReferentialIntegrityOnDelete(appProperties.getEnforce_referential_integrity_on_delete());
|
||||
|
||||
@@ -24,7 +24,6 @@ import ca.uhn.fhir.jpa.config.util.ResourceCountCacheUtil;
|
||||
import ca.uhn.fhir.jpa.config.util.ValidationSupportConfigUtil;
|
||||
import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl;
|
||||
import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
|
||||
import ca.uhn.fhir.jpa.dao.mdm.MdmLinkDaoJpaImpl;
|
||||
import ca.uhn.fhir.jpa.dao.search.HSearchSortHelperImpl;
|
||||
import ca.uhn.fhir.jpa.dao.search.IHSearchSortHelper;
|
||||
import ca.uhn.fhir.jpa.delete.ThreadSafeResourceDeleterSvc;
|
||||
@@ -44,12 +43,10 @@ import ca.uhn.fhir.jpa.starter.AppProperties;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnCorsPresent;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnImplementationGuidesPresent;
|
||||
import ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory;
|
||||
import ca.uhn.fhir.jpa.starter.ips.IpsConfigCondition;
|
||||
import ca.uhn.fhir.jpa.starter.util.EnvironmentHelper;
|
||||
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
|
||||
import ca.uhn.fhir.jpa.util.ResourceCountCache;
|
||||
import ca.uhn.fhir.jpa.validation.JpaValidationSupportChain;
|
||||
import ca.uhn.fhir.mdm.dao.IMdmLinkDao;
|
||||
import ca.uhn.fhir.mdm.provider.MdmProviderLoader;
|
||||
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
||||
import ca.uhn.fhir.narrative2.NullNarrativeGenerator;
|
||||
@@ -64,7 +61,6 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
||||
import ca.uhn.fhir.validation.IValidatorModule;
|
||||
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -205,7 +201,7 @@ public class StarterJpaConfig {
|
||||
packageInstallationSpec.setReloadExisting(appProperties.getReload_existing_implementationguides());
|
||||
if (appProperties.getInstall_transitive_ig_dependencies()) {
|
||||
packageInstallationSpec.setFetchDependencies(true);
|
||||
packageInstallationSpec.setDependencyExcludes(ImmutableList.of("hl7.fhir.r2.core", "hl7.fhir.r3.core", "hl7.fhir.r4.core", "hl7.fhir.r5.core"));
|
||||
packageInstallationSpec.setDependencyExcludes(List.of("hl7.fhir.r2.core", "hl7.fhir.r3.core", "hl7.fhir.r4.core", "hl7.fhir.r5.core"));
|
||||
}
|
||||
packageInstallerSvc.install(packageInstallationSpec);
|
||||
}
|
||||
|
||||
@@ -47,12 +47,12 @@ public class RepositoryValidationInterceptorFactoryDstu3 implements IRepositoryV
|
||||
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
|
||||
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap().add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size())
|
||||
Map<String, List<StructureDefinition>> structureDefinitions = results.getResources(0, results.size())
|
||||
.stream()
|
||||
.map(StructureDefinition.class::cast)
|
||||
.collect(Collectors.groupingBy(StructureDefinition::getType));
|
||||
|
||||
structureDefintions.forEach((key, value) -> {
|
||||
structureDefinitions.forEach((key, value) -> {
|
||||
String[] urls = value.stream().map(StructureDefinition::getUrl).toArray(String[]::new);
|
||||
repositoryValidatingRuleBuilder.forResourcesOfType(key).requireAtLeastOneProfileOf(urls).and().requireValidationToDeclaredProfiles();
|
||||
});
|
||||
|
||||
@@ -15,18 +15,18 @@ import ca.uhn.fhir.jpa.ips.generator.IpsGeneratorSvcImpl;
|
||||
@Conditional(IpsConfigCondition.class)
|
||||
public class StarterIpsConfig {
|
||||
@Bean
|
||||
IIpsGenerationStrategy IpsGenerationStrategy()
|
||||
IIpsGenerationStrategy ipsGenerationStrategy()
|
||||
{
|
||||
return new DefaultIpsGenerationStrategy();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IpsOperationProvider IpsOperationProvider(IIpsGeneratorSvc theIpsGeneratorSvc){
|
||||
public IpsOperationProvider ipsOperationProvider(IIpsGeneratorSvc theIpsGeneratorSvc){
|
||||
return new IpsOperationProvider(theIpsGeneratorSvc);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IIpsGeneratorSvc IpsGeneratorSvcImpl(FhirContext theFhirContext, IIpsGenerationStrategy theGenerationStrategy, DaoRegistry theDaoRegistry)
|
||||
public IIpsGeneratorSvc ipsGeneratorSvcImpl(FhirContext theFhirContext, IIpsGenerationStrategy theGenerationStrategy, DaoRegistry theDaoRegistry)
|
||||
{
|
||||
return new IpsGeneratorSvcImpl(theFhirContext, theGenerationStrategy, theDaoRegistry);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import ca.uhn.fhir.jpa.starter.AppProperties;
|
||||
import ca.uhn.fhir.mdm.api.IMdmSettings;
|
||||
import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator;
|
||||
import ca.uhn.fhir.mdm.rules.config.MdmSettings;
|
||||
import com.google.common.base.Charsets;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -17,6 +16,7 @@ import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@Configuration
|
||||
@Conditional(MdmConfigCondition.class)
|
||||
@@ -27,7 +27,7 @@ public class MdmConfig {
|
||||
IMdmSettings mdmSettings(@Autowired MdmRuleValidator theMdmRuleValidator, AppProperties appProperties) throws IOException {
|
||||
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
|
||||
Resource resource = resourceLoader.getResource("mdm-rules.json");
|
||||
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8);
|
||||
String json = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8);
|
||||
return new MdmSettings(theMdmRuleValidator).setEnabled(appProperties.getMdm_enabled()).setScriptText(json);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings;
|
||||
import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy;
|
||||
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
|
||||
import org.springframework.core.env.CompositePropertySource;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.EnumerablePropertySource;
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
// "hapi.fhir.enable_repository_validating_interceptor=true",
|
||||
"hapi.fhir.fhir_version=r4"
|
||||
})
|
||||
public class CustomBeanTest {
|
||||
class CustomBeanTest {
|
||||
|
||||
@Autowired
|
||||
some.custom.pkg1.CustomBean customBean1;
|
||||
|
||||
@@ -21,7 +21,7 @@ import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
||||
"hapi.fhir.fhir_version=r4"
|
||||
})
|
||||
|
||||
public class CustomInterceptorTest {
|
||||
class CustomInterceptorTest {
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
|
||||
@@ -21,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
"hapi.fhir.fhir_version=dstu2",
|
||||
"spring.datasource.url=jdbc:h2:mem:dbr2",
|
||||
})
|
||||
public class ExampleServerDstu2IT {
|
||||
class ExampleServerDstu2IT {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu2IT.class);
|
||||
private IGenericClient ourClient;
|
||||
|
||||
@@ -49,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
})
|
||||
|
||||
|
||||
public class ExampleServerDstu3IT implements IServerSupport {
|
||||
class ExampleServerDstu3IT implements IServerSupport {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu2IT.class);
|
||||
private IGenericClient ourClient;
|
||||
@@ -71,8 +71,8 @@ public class ExampleServerDstu3IT implements IServerSupport {
|
||||
ourClient.registerInterceptor(new LoggingInterceptor(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndRead() {
|
||||
@Test
|
||||
void testCreateAndRead() {
|
||||
|
||||
String methodName = "testCreateResourceConditional";
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ExampleServerDstu3IT implements IServerSupport {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWebsocketSubscription() throws Exception {
|
||||
void testWebsocketSubscription() throws Exception {
|
||||
/*
|
||||
* Create subscription
|
||||
*/
|
||||
|
||||
@@ -52,7 +52,7 @@ class ExampleServerR4BIT {
|
||||
|
||||
|
||||
@Test
|
||||
public void testBatchPutWithIdenticalTags() {
|
||||
void testBatchPutWithIdenticalTags() {
|
||||
String batchPuts = "{\n" +
|
||||
"\t\"resourceType\": \"Bundle\",\n" +
|
||||
"\t\"id\": \"patients\",\n" +
|
||||
|
||||
@@ -87,7 +87,7 @@ class ExampleServerR4IT {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBatchPutWithIdenticalTags() {
|
||||
void testBatchPutWithIdenticalTags() {
|
||||
String batchPuts = "{\n" +
|
||||
"\t\"resourceType\": \"Bundle\",\n" +
|
||||
"\t\"id\": \"patients\",\n" +
|
||||
|
||||
@@ -45,15 +45,15 @@ public class ExampleServerR5IT {
|
||||
private IGenericClient ourClient;
|
||||
private FhirContext ourCtx;
|
||||
|
||||
public static final String SUBSCRIPTION_TOPIC_TEST_URL = "http://example.com/topic/test";
|
||||
public static final String SUBSCRIPTION_TOPIC_TEST_URL = "http://example.com/topic/test";
|
||||
|
||||
|
||||
@LocalServerPort
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateAndRead() {
|
||||
void testCreateAndRead() {
|
||||
|
||||
String methodName = "testCreateResourceConditional";
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ExampleServerR5IT {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWebsocketSubscription() throws Exception {
|
||||
void testWebsocketSubscription() throws Exception {
|
||||
String endpoint = "ws://localhost:" + port + "/websocket";
|
||||
/*
|
||||
* Create topic
|
||||
|
||||
@@ -26,7 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
"hapi.fhir.partitioning.partitioning_include_in_search_hashes=false",
|
||||
|
||||
})
|
||||
public class MultitenantServerR4IT {
|
||||
class MultitenantServerR4IT {
|
||||
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu2IT.class);
|
||||
@@ -40,7 +40,7 @@ public class MultitenantServerR4IT {
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateAndReadInTenantA() {
|
||||
void testCreateAndReadInTenantA() {
|
||||
|
||||
|
||||
// Create tenant A
|
||||
@@ -66,7 +66,7 @@ public class MultitenantServerR4IT {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndReadInTenantB() {
|
||||
void testCreateAndReadInTenantB() {
|
||||
|
||||
|
||||
// Create tenant A
|
||||
|
||||
@@ -18,7 +18,7 @@ public class SocketImplementation {
|
||||
private final String myCriteria;
|
||||
protected String myError;
|
||||
protected boolean myGotBound;
|
||||
private final List<String> myMessages = new ArrayList<String>();
|
||||
private final List<String> myMessages = new ArrayList<>();
|
||||
protected int myPingCount;
|
||||
protected String mySubsId;
|
||||
private Session session;
|
||||
|
||||
Reference in New Issue
Block a user