diff --git a/pom.xml b/pom.xml index d3f1719b..6b5dd7c9 100644 --- a/pom.xml +++ b/pom.xml @@ -36,10 +36,8 @@ UTF-8 - 3.5.7 - 3.0.1 + 4.0.5 8.18.0 - 5.10.0 true true true @@ -59,6 +57,12 @@ pom import + + + org.testcontainers + testcontainers + 1.19.3 + @@ -68,7 +72,11 @@ org.springframework.boot - spring-boot-starter-web + spring-boot-starter-webmvc + + + org.springframework.boot + spring-boot-restclient org.springframework.data @@ -78,7 +86,6 @@ org.junit.jupiter junit-jupiter - ${junit-jupiter.version} test @@ -89,7 +96,6 @@ tools.jackson.core jackson-core - ${jackson.version} jakarta.json @@ -101,11 +107,6 @@ guava 32.1.3-jre - - com.google.collections - google-collections - 1.0 - org.springframework.boot spring-boot-starter-security @@ -127,14 +128,15 @@ unboundid-ldapsdk - org.springframework.security - spring-security-test + org.springframework.boot + spring-boot-starter-security-test + test org.phoebus core-pva - 4.7.3 + 5.0.2 @@ -157,7 +159,12 @@ org.springdoc springdoc-openapi-starter-webmvc-ui - 2.8.5 + 3.0.3 + + + org.springframework.boot + spring-boot-starter-webmvc-test + test org.testcontainers @@ -250,9 +257,6 @@ org.springframework.boot spring-boot-maven-plugin ${spring.boot-version} - - true - diff --git a/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java b/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java index 7625d8bd..3da84200 100644 --- a/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java @@ -1,6 +1,5 @@ package org.phoebus.channelfinder.configuration; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.ArrayList; import java.util.Arrays; import java.util.EnumMap; @@ -23,6 +22,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Configuration; +import tools.jackson.core.JacksonException; /** * A post processor which uses the channel property *archive* to add pv's to the archiver appliance @@ -98,10 +98,10 @@ public ChannelProcessorInfo processorInfo() { * * @param channels List of channels * @return Return number of channels processed - * @throws JsonProcessingException If processing archiver responses fail. + * @throws JacksonException If processing archiver responses fail. */ @Override - public long process(List channels) throws JsonProcessingException { + public long process(List channels) throws JacksonException { if (channels.isEmpty()) { return 0; } diff --git a/src/main/java/org/phoebus/channelfinder/configuration/ChannelProcessor.java b/src/main/java/org/phoebus/channelfinder/configuration/ChannelProcessor.java index c5519ca2..1f1e32b7 100644 --- a/src/main/java/org/phoebus/channelfinder/configuration/ChannelProcessor.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/ChannelProcessor.java @@ -1,9 +1,9 @@ package org.phoebus.channelfinder.configuration; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.List; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.service.model.archiver.ChannelProcessorInfo; +import tools.jackson.core.JacksonException; public interface ChannelProcessor { @@ -13,5 +13,5 @@ public interface ChannelProcessor { ChannelProcessorInfo processorInfo(); - long process(List channels) throws JsonProcessingException; + long process(List channels) throws JacksonException; } diff --git a/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java b/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java index a7fc37e1..761f7dca 100644 --- a/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java @@ -23,6 +23,7 @@ import co.elastic.clients.transport.ElasticsearchTransport; import co.elastic.clients.transport.endpoints.BooleanResponse; import co.elastic.clients.transport.rest_client.RestClientTransport; +// Jackson 2 required by elasticsearch-java 8.x JacksonJsonpMapper — migrate with ES 9 import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.servlet.ServletContextEvent; import jakarta.servlet.ServletContextListener; diff --git a/src/main/java/org/phoebus/channelfinder/configuration/HttpConnectorConfig.java b/src/main/java/org/phoebus/channelfinder/configuration/HttpConnectorConfig.java index f4659fbe..2c50e01b 100644 --- a/src/main/java/org/phoebus/channelfinder/configuration/HttpConnectorConfig.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/HttpConnectorConfig.java @@ -3,28 +3,21 @@ import org.apache.catalina.connector.Connector; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; -import org.springframework.boot.web.servlet.server.ServletWebServerFactory; +import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory; +import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; @Configuration -@PropertySource(value = "classpath:application.properties") public class HttpConnectorConfig { - @Value("${server.http.enable:true}") - private boolean httpEnabled; - @Value("${server.http.port:8080}") private int port; @Bean @ConditionalOnProperty(name = "server.http.enable") - public ServletWebServerFactory servletContainer() { - TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); - tomcat.addAdditionalTomcatConnectors(getHttpConnector()); - return tomcat; + public WebServerFactoryCustomizer httpConnectorCustomizer() { + return factory -> factory.addAdditionalConnectors(getHttpConnector()); } private Connector getHttpConnector() { diff --git a/src/main/java/org/phoebus/channelfinder/configuration/PopulateDBConfiguration.java b/src/main/java/org/phoebus/channelfinder/configuration/PopulateDBConfiguration.java index 17dc96fa..05375349 100644 --- a/src/main/java/org/phoebus/channelfinder/configuration/PopulateDBConfiguration.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/PopulateDBConfiguration.java @@ -7,8 +7,6 @@ import co.elastic.clients.elasticsearch.core.IndexRequest; import co.elastic.clients.elasticsearch.core.bulk.BulkResponseItem; import co.elastic.clients.elasticsearch.core.bulk.IndexOperation; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -33,6 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Configuration; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.ObjectMapper; /** * An class for creating the example database. diff --git a/src/main/java/org/phoebus/channelfinder/repository/ChannelRepository.java b/src/main/java/org/phoebus/channelfinder/repository/ChannelRepository.java index b3b012b0..29689d2a 100644 --- a/src/main/java/org/phoebus/channelfinder/repository/ChannelRepository.java +++ b/src/main/java/org/phoebus/channelfinder/repository/ChannelRepository.java @@ -67,6 +67,8 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.server.ResponseStatusException; +// Jackson 2 required by elasticsearch-java 8.x JacksonJsonpMapper — migrate with ES 9 + @Repository @Configuration public class ChannelRepository implements CrudRepository { diff --git a/src/main/java/org/phoebus/channelfinder/repository/PropertyRepository.java b/src/main/java/org/phoebus/channelfinder/repository/PropertyRepository.java index 696616d7..8c1792c7 100644 --- a/src/main/java/org/phoebus/channelfinder/repository/PropertyRepository.java +++ b/src/main/java/org/phoebus/channelfinder/repository/PropertyRepository.java @@ -46,6 +46,8 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.server.ResponseStatusException; +// Jackson 2 required by elasticsearch-java 8.x JacksonJsonpMapper — migrate with ES 9 + @Repository @Configuration public class PropertyRepository implements CrudRepository { diff --git a/src/main/java/org/phoebus/channelfinder/repository/TagRepository.java b/src/main/java/org/phoebus/channelfinder/repository/TagRepository.java index 37a30497..da9ae87a 100644 --- a/src/main/java/org/phoebus/channelfinder/repository/TagRepository.java +++ b/src/main/java/org/phoebus/channelfinder/repository/TagRepository.java @@ -47,6 +47,8 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.server.ResponseStatusException; +// Jackson 2 required by elasticsearch-java 8.x JacksonJsonpMapper — migrate with ES 9 + @Repository @Configuration public class TagRepository implements CrudRepository { diff --git a/src/main/java/org/phoebus/channelfinder/service/InfoService.java b/src/main/java/org/phoebus/channelfinder/service/InfoService.java index 17b8cc3a..9bfb25da 100644 --- a/src/main/java/org/phoebus/channelfinder/service/InfoService.java +++ b/src/main/java/org/phoebus/channelfinder/service/InfoService.java @@ -1,8 +1,5 @@ package org.phoebus.channelfinder.service; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map; @@ -11,6 +8,10 @@ import org.phoebus.channelfinder.configuration.ElasticConfig; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.ObjectMapper; +import tools.jackson.databind.SerializationFeature; +import tools.jackson.databind.json.JsonMapper; @Service public class InfoService { @@ -18,7 +19,7 @@ public class InfoService { private static final Logger logger = Logger.getLogger(InfoService.class.getName()); private static final ObjectMapper objectMapper = - new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); + JsonMapper.builder().enable(SerializationFeature.INDENT_OUTPUT).build(); private final ElasticConfig esService; @@ -50,7 +51,7 @@ public String info() { try { return objectMapper.writeValueAsString(cfServiceInfo); - } catch (JsonProcessingException e) { + } catch (JacksonException e) { logger.log(Level.WARNING, "Failed to serialize ChannelFinder service info", e); return "Failed to gather ChannelFinder service info"; } diff --git a/src/main/java/org/phoebus/channelfinder/service/external/ArchiverService.java b/src/main/java/org/phoebus/channelfinder/service/external/ArchiverService.java index c6deda94..2da37b69 100644 --- a/src/main/java/org/phoebus/channelfinder/service/external/ArchiverService.java +++ b/src/main/java/org/phoebus/channelfinder/service/external/ArchiverService.java @@ -1,6 +1,5 @@ package org.phoebus.channelfinder.service.external; -import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; import java.util.ArrayList; import java.util.List; @@ -24,6 +23,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.client.RestClient; import org.springframework.web.util.UriComponentsBuilder; +import tools.jackson.databind.ObjectMapper; @Component @ConditionalOnProperty(name = "aa.enabled", havingValue = "true") diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e30952fd..1002887a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,8 @@ ################## ChannelFinder Server #################### +# Both spring-boot-starter-webmvc (Tomcat) and spring-boot-starter-webflux (Netty/reactor) +# are on the classpath; force servlet mode so Tomcat always wins. +spring.main.web-application-type=servlet + # ChannelFinder https port server.port=8443 @@ -11,8 +15,6 @@ server.ssl.key-store=classpath:keystore/newcf.p12 server.ssl.key-store-password=password server.ssl.key-alias=cf -security.require-ssl=false - server.compression.enabled=true # opt in to content types server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css diff --git a/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java b/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java index e43ae8ff..515e6923 100644 --- a/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java +++ b/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java @@ -8,7 +8,7 @@ import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java index f348626c..71d36c1e 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java @@ -24,7 +24,7 @@ import org.phoebus.channelfinder.web.v0.api.IChannel; import org.phoebus.channelfinder.web.v0.controller.ChannelController; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java index de1d23c7..aa5d9350 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java @@ -24,7 +24,7 @@ import org.phoebus.channelfinder.repository.PropertyRepository; import org.phoebus.channelfinder.repository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.util.LinkedMultiValueMap; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java index bb4c367a..b0f34e45 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java @@ -25,7 +25,7 @@ import org.phoebus.channelfinder.repository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.util.LinkedMultiValueMap; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java index 944513a9..5d682c82 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java @@ -17,7 +17,7 @@ import org.phoebus.channelfinder.web.v0.api.IChannelScroll; import org.phoebus.channelfinder.web.v0.controller.ChannelScrollController; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.util.LinkedMultiValueMap; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java index 87bce546..1fd6970e 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java @@ -17,7 +17,7 @@ import org.phoebus.channelfinder.web.v0.api.IChannelScroll; import org.phoebus.channelfinder.web.v0.controller.ChannelScrollController; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.util.LinkedMultiValueMap; diff --git a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java index 3119ca99..5079da41 100644 --- a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java +++ b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java @@ -20,8 +20,8 @@ import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.service.MetricsService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java b/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java index 0d03663e..49f7020a 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java @@ -25,7 +25,7 @@ import org.phoebus.channelfinder.web.v0.api.IProperty; import org.phoebus.channelfinder.web.v0.controller.PropertyController; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java index 85452d0e..9f82ede2 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java @@ -20,7 +20,7 @@ import org.phoebus.channelfinder.repository.ChannelRepository; import org.phoebus.channelfinder.repository.PropertyRepository; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.util.LinkedMultiValueMap; diff --git a/src/test/java/org/phoebus/channelfinder/TagControllerIT.java b/src/test/java/org/phoebus/channelfinder/TagControllerIT.java index f5d1086a..3d2f833c 100644 --- a/src/test/java/org/phoebus/channelfinder/TagControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagControllerIT.java @@ -25,7 +25,7 @@ import org.phoebus.channelfinder.web.v0.api.ITag; import org.phoebus.channelfinder.web.v0.controller.TagController; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java index cf40407e..d5655327 100644 --- a/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java @@ -18,7 +18,7 @@ import org.phoebus.channelfinder.repository.ChannelRepository; import org.phoebus.channelfinder.repository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.util.LinkedMultiValueMap; diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java index 9b5c1c94..829ae555 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java @@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -import com.fasterxml.jackson.databind.ObjectMapper; import java.net.HttpURLConnection; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -33,6 +32,7 @@ import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; +import tools.jackson.databind.ObjectMapper; /** * Integration tests for ChannelFinder and Elasticsearch with focus on usage of {@link diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java index 26f2c016..3382f733 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java @@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -import com.fasterxml.jackson.databind.ObjectMapper; import java.net.HttpURLConnection; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -34,6 +33,7 @@ import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; +import tools.jackson.databind.ObjectMapper; /** * Integration tests for ChannelFinder and Elasticsearch with focus on usage of {@link diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java index 7bfc6abf..6ce35f82 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java @@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -import com.fasterxml.jackson.databind.ObjectMapper; import java.net.HttpURLConnection; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -34,6 +33,7 @@ import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; +import tools.jackson.databind.ObjectMapper; /** * Integration tests for ChannelFinder and Elasticsearch with focus on usage of {@link diff --git a/src/test/java/org/phoebus/channelfinder/docker/ITUtil.java b/src/test/java/org/phoebus/channelfinder/docker/ITUtil.java index 0245484e..d5753c69 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ITUtil.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ITUtil.java @@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import com.fasterxml.jackson.databind.ObjectMapper; import com.github.dockerjava.api.DockerClient; import java.io.File; import java.io.IOException; @@ -32,6 +31,7 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; +import java.time.Duration; import java.util.Base64; import java.util.Optional; import org.springframework.http.HttpHeaders; @@ -39,6 +39,7 @@ import org.testcontainers.containers.ContainerState; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.shaded.org.apache.commons.lang3.StringUtils; +import tools.jackson.databind.ObjectMapper; /** * Utility class to help (Docker) integration tests for ChannelFinder and Elasticsearch with focus @@ -104,7 +105,8 @@ public static ComposeContainer defaultComposeContainers() { return new ComposeContainer(new File(ITUtil.INTEGRATIONTEST_DOCKER_COMPOSE)) .withEnv(ITUtil.JACOCO_SKIPITCOVERAGE, System.getProperty(ITUtil.JACOCO_SKIPITCOVERAGE)) .withLocalCompose(true) - .waitingFor(ITUtil.CHANNELFINDER, Wait.forHealthcheck()); + .waitingFor( + ITUtil.CHANNELFINDER, Wait.forHealthcheck().withStartupTimeout(Duration.ofMinutes(3))); } /** diff --git a/src/test/java/org/phoebus/channelfinder/docker/ITUtilChannels.java b/src/test/java/org/phoebus/channelfinder/docker/ITUtilChannels.java index 5b8387a8..26a86de8 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ITUtilChannels.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ITUtilChannels.java @@ -24,12 +24,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import com.fasterxml.jackson.core.JsonProcessingException; import java.net.HttpURLConnection; import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.docker.ITUtil.EndpointChoice; import org.phoebus.channelfinder.docker.ITUtil.MethodChoice; import org.phoebus.channelfinder.entity.Channel; +import tools.jackson.core.JacksonException; /** * Utility class to help (Docker) integration tests for ChannelFinder and Elasticsearch with focus @@ -83,7 +83,7 @@ private ITUtilChannels() { static String object2Json(Channel value) { try { return ITUtil.MAPPER.writeValueAsString(value); - } catch (JsonProcessingException e) { + } catch (JacksonException e) { fail(); } return null; @@ -98,7 +98,7 @@ static String object2Json(Channel value) { static String object2Json(Channel[] value) { try { return ITUtil.MAPPER.writeValueAsString(value); - } catch (JsonProcessingException e) { + } catch (JacksonException e) { fail(); } return null; diff --git a/src/test/java/org/phoebus/channelfinder/docker/ITUtilProperties.java b/src/test/java/org/phoebus/channelfinder/docker/ITUtilProperties.java index b2f509d0..989451c6 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ITUtilProperties.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ITUtilProperties.java @@ -24,12 +24,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import com.fasterxml.jackson.core.JsonProcessingException; import java.net.HttpURLConnection; import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.docker.ITUtil.EndpointChoice; import org.phoebus.channelfinder.docker.ITUtil.MethodChoice; import org.phoebus.channelfinder.entity.Property; +import tools.jackson.core.JacksonException; /** * Utility class to help (Docker) integration tests for ChannelFinder and Elasticsearch with focus @@ -89,7 +89,7 @@ private ITUtilProperties() { static String object2Json(Property value) { try { return ITUtil.MAPPER.writeValueAsString(value); - } catch (JsonProcessingException e) { + } catch (JacksonException e) { fail(); } return null; @@ -104,7 +104,7 @@ static String object2Json(Property value) { static String object2Json(Property[] value) { try { return ITUtil.MAPPER.writeValueAsString(value); - } catch (JsonProcessingException e) { + } catch (JacksonException e) { fail(); } return null; diff --git a/src/test/java/org/phoebus/channelfinder/docker/ITUtilTags.java b/src/test/java/org/phoebus/channelfinder/docker/ITUtilTags.java index 64fa5e83..401ccfdb 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ITUtilTags.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ITUtilTags.java @@ -24,12 +24,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import com.fasterxml.jackson.core.JsonProcessingException; import java.net.HttpURLConnection; import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.docker.ITUtil.EndpointChoice; import org.phoebus.channelfinder.docker.ITUtil.MethodChoice; import org.phoebus.channelfinder.entity.Tag; +import tools.jackson.core.JacksonException; /** * Utility class to help (Docker) integration tests for ChannelFinder and Elasticsearch with focus @@ -87,7 +87,7 @@ private ITUtilTags() { static String object2Json(Tag value) { try { return ITUtil.MAPPER.writeValueAsString(value); - } catch (JsonProcessingException e) { + } catch (JacksonException e) { fail(); } return null; @@ -102,7 +102,7 @@ static String object2Json(Tag value) { static String object2Json(Tag[] value) { try { return ITUtil.MAPPER.writeValueAsString(value); - } catch (JsonProcessingException e) { + } catch (JacksonException e) { fail(); } return null; diff --git a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java index 38a61c65..4cea3488 100644 --- a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java +++ b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java @@ -24,7 +24,7 @@ import org.phoebus.channelfinder.web.v0.api.IProperty; import org.phoebus.channelfinder.web.v0.api.ITag; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java b/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java index 48f7240e..3271d44d 100644 --- a/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java +++ b/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java @@ -7,7 +7,7 @@ import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.repository.ChannelRepository; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.TestPropertySource; /** diff --git a/src/test/java/org/phoebus/channelfinder/performance/PopulateDBConfigurationIT.java b/src/test/java/org/phoebus/channelfinder/performance/PopulateDBConfigurationIT.java index 06a169cd..bb6acace 100644 --- a/src/test/java/org/phoebus/channelfinder/performance/PopulateDBConfigurationIT.java +++ b/src/test/java/org/phoebus/channelfinder/performance/PopulateDBConfigurationIT.java @@ -6,7 +6,7 @@ import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.service.AuthorizationService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorControllerIT.java b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorControllerIT.java index 4d1a9492..866aa9a6 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorControllerIT.java @@ -16,7 +16,7 @@ import org.phoebus.channelfinder.service.external.ArchiverService; import org.phoebus.channelfinder.web.v0.controller.ChannelProcessorController; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.http.HttpHeaders; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; diff --git a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java index e3601542..0193c7c8 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java +++ b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java @@ -1,6 +1,5 @@ package org.phoebus.channelfinder.processors; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.Collections; import java.util.List; import java.util.Map; @@ -17,6 +16,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.TestPropertySource; +import tools.jackson.core.JacksonException; @SpringBootTest() @TestPropertySource(value = "classpath:application_test.properties") @@ -54,7 +54,7 @@ public ChannelProcessorInfo processorInfo() { } @Override - public long process(List channels) throws JsonProcessingException { + public long process(List channels) throws JacksonException { processed.set(true); return channels.size(); } diff --git a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorIT.java b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorIT.java index 6e26515e..e957dfad 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorIT.java @@ -8,7 +8,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.List; import java.util.Map; import java.util.stream.Stream; @@ -28,9 +27,10 @@ import org.phoebus.channelfinder.service.model.archiver.aa.ArchiveAction; import org.phoebus.channelfinder.service.model.archiver.aa.ArchivePVOptions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import tools.jackson.core.JacksonException; @WebMvcTest(AAChannelProcessor.class) @ExtendWith(MockitoExtension.class) @@ -99,7 +99,7 @@ public static void paramableAAChannelProcessorTest( List channels, String archiveStatus, String archiverEndpoint) - throws JsonProcessingException { + throws JacksonException { // Mock getAAPolicies when(archiverService.getAAPolicies(anyString())).thenReturn(List.of("policy")); @@ -156,7 +156,7 @@ private static ArchiveAction getActionFromEndpoint(String endpoint) { } @Test - void testProcessNoPVs() throws JsonProcessingException { + void testProcessNoPVs() throws JacksonException { aaChannelProcessor.process(List.of()); // verify interactions are minimal or none if empty @@ -166,7 +166,7 @@ void testProcessNoPVs() throws JsonProcessingException { @ParameterizedTest @MethodSource("processSource") void testProcessNotArchivedActive(Channel channel, String archiveStatus, String archiverEndpoint) - throws JsonProcessingException { + throws JacksonException { paramableAAChannelProcessorTest( archiverService, aaChannelProcessor, List.of(channel), archiveStatus, archiverEndpoint); } diff --git a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiArchiverIT.java b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiArchiverIT.java index 56a2b119..48552c57 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiArchiverIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiArchiverIT.java @@ -9,7 +9,6 @@ import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.archiveProperty; import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.inactiveProperty; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -23,9 +22,10 @@ import org.phoebus.channelfinder.service.external.ArchiverService; import org.phoebus.channelfinder.service.model.archiver.aa.ArchiveAction; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import tools.jackson.core.JacksonException; @WebMvcTest(AAChannelProcessor.class) @TestPropertySource(value = "classpath:application_test_multi.properties") @@ -97,7 +97,7 @@ void testProcessMultiArchivers( List channels, Map namesToStatuses, Map> actionsToNames) - throws JsonProcessingException { + throws JacksonException { when(archiverService.getAAPolicies(anyString())).thenReturn(List.of("policy")); // Request to archiver status diff --git a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiIT.java b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiIT.java index 2a46c9b7..3e919fac 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiIT.java @@ -10,7 +10,6 @@ import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.archiveProperty; import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.inactiveProperty; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -26,9 +25,10 @@ import org.phoebus.channelfinder.service.model.archiver.aa.ArchiveAction; import org.phoebus.channelfinder.service.model.archiver.aa.ArchivePVOptions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import tools.jackson.core.JacksonException; @WebMvcTest(AAChannelProcessor.class) @TestPropertySource(value = "classpath:application_aa_proc_test.properties") @@ -101,7 +101,7 @@ void testProcessMulti( Map namesToStatuses, Map> actionsToNames, int expectedProcessedChannels) - throws JsonProcessingException { + throws JacksonException { // Mock getAAPolicies when(archiverService.getAAPolicies(anyString())).thenReturn(List.of("policy")); diff --git a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoDefaultIT.java b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoDefaultIT.java index 3fec1608..38cdb1e4 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoDefaultIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoDefaultIT.java @@ -4,7 +4,6 @@ import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.archiveProperty; import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.paramableAAChannelProcessorTest; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.params.ParameterizedTest; @@ -15,9 +14,10 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.service.external.ArchiverService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import tools.jackson.core.JacksonException; @WebMvcTest(AAChannelProcessor.class) @TestPropertySource( @@ -54,7 +54,7 @@ private static Stream processNoPauseSource() { @MethodSource("processNoPauseSource") void testProcessNotArchivedActive( Channel channel, String archiveStatus, String archiverEndpoint, String submissionBody) - throws JsonProcessingException { + throws JacksonException { paramableAAChannelProcessorTest( archiverService, aaChannelProcessor, List.of(channel), archiveStatus, archiverEndpoint); } diff --git a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoPauseIT.java b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoPauseIT.java index ec0f32c6..9c6342bf 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoPauseIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoPauseIT.java @@ -4,7 +4,6 @@ import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.inactiveProperty; import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.paramableAAChannelProcessorTest; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.params.ParameterizedTest; @@ -14,9 +13,10 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.service.external.ArchiverService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import tools.jackson.core.JacksonException; @WebMvcTest(AAChannelProcessor.class) @TestPropertySource( @@ -47,7 +47,7 @@ private static Stream processNoPauseSource() { @MethodSource("processNoPauseSource") void testProcessNotArchivedActive( Channel channel, String archiveStatus, String archiverEndpoint, String submissionBody) - throws JsonProcessingException { + throws JacksonException { paramableAAChannelProcessorTest( archiverService, aaChannelProcessor, List.of(channel), archiveStatus, archiverEndpoint); } diff --git a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorStatusPauseIT.java b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorStatusPauseIT.java index deda7c26..86b4f49c 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorStatusPauseIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorStatusPauseIT.java @@ -4,7 +4,6 @@ import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.inactiveProperty; import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.paramableAAChannelProcessorTest; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.params.ParameterizedTest; @@ -14,9 +13,10 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.service.external.ArchiverService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import tools.jackson.core.JacksonException; @WebMvcTest(AAChannelProcessor.class) @TestPropertySource( @@ -47,7 +47,7 @@ private static Stream processNoPauseSource() { @MethodSource("processNoPauseSource") void testProcessNotArchivedActive( Channel channel, String archiveStatus, String archiverEndpoint, String submissionBody) - throws JsonProcessingException { + throws JacksonException { paramableAAChannelProcessorTest( archiverService, aaChannelProcessor, List.of(channel), archiveStatus, archiverEndpoint); } diff --git a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTagPauseIT.java b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTagPauseIT.java index 310f8047..1aeafff0 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTagPauseIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTagPauseIT.java @@ -4,7 +4,6 @@ import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.inactiveProperty; import static org.phoebus.channelfinder.processors.aa.AAChannelProcessorIT.paramableAAChannelProcessorTest; -import com.fasterxml.jackson.core.JsonProcessingException; import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.params.ParameterizedTest; @@ -14,9 +13,10 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.service.external.ArchiverService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import tools.jackson.core.JacksonException; @WebMvcTest(AAChannelProcessor.class) @TestPropertySource( @@ -51,7 +51,7 @@ private static Stream processNoPauseSource() { @MethodSource("processNoPauseSource") void testProcessNotArchivedActive( Channel channel, String archiveStatus, String archiverEndpoint, String submissionBody) - throws JsonProcessingException { + throws JacksonException { paramableAAChannelProcessorTest( archiverService, aaChannelProcessor, List.of(channel), archiveStatus, archiverEndpoint); } diff --git a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTest.java b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTest.java index f3508553..b2a9ec70 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTest.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTest.java @@ -1,7 +1,5 @@ package org.phoebus.channelfinder.processors.aa; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -12,6 +10,8 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.phoebus.channelfinder.service.model.archiver.aa.ArchivePVOptions; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.ObjectMapper; class AAChannelProcessorTest { @@ -101,7 +101,7 @@ void archivePolicyParsing() { } @Test - void archivePVJson() throws JsonProcessingException { + void archivePVJson() throws JacksonException { ArchivePVOptions ar1 = new ArchivePVOptions(); ar1.setPv("sim://testing1"); ar1.setSamplingParameters("monitor@1.0", new ArrayList<>()); @@ -134,7 +134,7 @@ void archivePVJson() throws JsonProcessingException { ar4.setSamplingParameters("Fast", testPolicyList); str = objectMapper.writeValueAsString(List.of(ar4)); - expectedString = "[{\"pv\":\"sim://testing4\",\"policy\":\"Fast\"}]"; + expectedString = "[{\"policy\":\"Fast\",\"pv\":\"sim://testing4\"}]"; Assertions.assertEquals(str, expectedString); // Invalid policy diff --git a/src/test/java/org/phoebus/channelfinder/service/external/ArchiverServiceTest.java b/src/test/java/org/phoebus/channelfinder/service/external/ArchiverServiceTest.java index 68c2efc4..81d60512 100644 --- a/src/test/java/org/phoebus/channelfinder/service/external/ArchiverServiceTest.java +++ b/src/test/java/org/phoebus/channelfinder/service/external/ArchiverServiceTest.java @@ -8,8 +8,6 @@ import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import java.util.EnumMap; import java.util.List; import java.util.Map; @@ -29,6 +27,8 @@ import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.web.client.RestClient; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.ObjectMapper; @ExtendWith(MockitoExtension.class) class ArchiverServiceTest { @@ -56,7 +56,7 @@ void tearDown() { @ParameterizedTest @ValueSource(strings = {"other-archiver", "test-archiver"}) - void testGetStatuses(String archiverAlias) throws JsonProcessingException { + void testGetStatuses(String archiverAlias) throws JacksonException { Map pvs = Map.of("pv1", new ArchivePVOptions()); @@ -105,7 +105,7 @@ void testGetStatusesInvalidResponse() { } @Test - void testSubmitBasicAction() throws JsonProcessingException { + void testSubmitBasicAction() throws JacksonException { List pvs = List.of("pv1"); List> expectedResponse = List.of(Map.of("pv", "pv1", "status", "ok")); @@ -125,7 +125,7 @@ void testSubmitBasicAction() throws JsonProcessingException { } @Test - void testSubmitBasicActionStatusNotOk() throws JsonProcessingException { + void testSubmitBasicActionStatusNotOk() throws JacksonException { List pvs = List.of("pv1"); List> expectedResponse = List.of(Map.of("pv", "pv1", "status", "failed")); @@ -143,7 +143,7 @@ void testSubmitBasicActionStatusNotOk() throws JsonProcessingException { } @Test - void testSubmitBasicActionPartialFailure() throws JsonProcessingException { + void testSubmitBasicActionPartialFailure() throws JacksonException { List pvs = List.of("pv1", "pv2"); List> expectedResponse = @@ -179,7 +179,7 @@ void testSubmitBasicActionInvalidResponse() { @ParameterizedTest @EnumSource(ArchiveAction.class) - void testConfigureAA(ArchiveAction action) throws JsonProcessingException { + void testConfigureAA(ArchiveAction action) throws JacksonException { ArchivePVOptions options = new ArchivePVOptions(); options.setPv("pv1"); @@ -217,7 +217,7 @@ void testConfigureAA(ArchiveAction action) throws JsonProcessingException { } @Test - void testConfigureAAStatusNotOk() throws JsonProcessingException { + void testConfigureAAStatusNotOk() throws JacksonException { ArchivePVOptions options = new ArchivePVOptions(); options.setPv("pv1"); @@ -263,7 +263,7 @@ void testConfigureAAInvalidResponse() { } @Test - void testGetAAPolicies() throws JsonProcessingException { + void testGetAAPolicies() throws JacksonException { Map policies = Map.of("policy1", "desc1", "policy2", "desc2"); @@ -333,7 +333,7 @@ void testSubmitActionWithRealResponsePause() { } @Test - void testSubmitActionWithRealResponseArchive() throws JsonProcessingException { + void testSubmitActionWithRealResponseArchive() throws JacksonException { List pvs = List.of("PV1"); ArchivePVOptions options = new ArchivePVOptions(); diff --git a/src/test/resources/application_test.properties b/src/test/resources/application_test.properties index ec31e9b6..2af67656 100644 --- a/src/test/resources/application_test.properties +++ b/src/test/resources/application_test.properties @@ -10,8 +10,6 @@ server.ssl.key-store=classpath:keystore/cf.p12 server.ssl.key-store-password=password server.ssl.key-alias=cf -security.require-ssl=true - server.compression.enabled=true # opt in to content types server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css diff --git a/src/test/resources/application_test_multi.properties b/src/test/resources/application_test_multi.properties index 91c2ed0e..ab06d796 100644 --- a/src/test/resources/application_test_multi.properties +++ b/src/test/resources/application_test_multi.properties @@ -10,8 +10,6 @@ server.ssl.key-store=classpath:keystore/cf.p12 server.ssl.key-store-password=password server.ssl.key-alias=cf -security.require-ssl=true - server.compression.enabled=true # opt in to content types server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css diff --git a/src/test/resources/compose.yml b/src/test/resources/compose.yml index c5fccd12..d0519483 100644 --- a/src/test/resources/compose.yml +++ b/src/test/resources/compose.yml @@ -52,6 +52,7 @@ services: interval: 30s timeout: 60s retries: 5 + start_period: 60s elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:8.18.0 diff --git a/src/test/resources/performance_application.properties b/src/test/resources/performance_application.properties index 121d9567..2f9b55ff 100644 --- a/src/test/resources/performance_application.properties +++ b/src/test/resources/performance_application.properties @@ -11,12 +11,9 @@ server.ssl.key-store=classpath:keystore/newcf.p12 server.ssl.key-store-password=password server.ssl.key-alias=cf -security.require-ssl=true - logging.level.=ERROR logging.o.p.channelfinder.ChannelRepository=ERROR logging.level.org.springframework.web=ERROR -spring.http.log-request-details=true ############## LDAP - External ############## ldap.enabled = false