Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.boot-version>3.5.7</spring.boot-version>
<jackson.version>3.0.1</jackson.version>
<spring.boot-version>4.0.5</spring.boot-version>
<elasticsearch.version>8.18.0</elasticsearch.version>
<junit-jupiter.version>5.10.0</junit-jupiter.version>
<skipITs>true</skipITs>
<skipITCoverage>true</skipITCoverage>
<jacoco.skip>true</jacoco.skip>
Expand All @@ -59,6 +57,12 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Keep testcontainers on 1.x until a dedicated TC 2 migration; prevents SB4 BOM from pulling in 2.0.4 -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.19.3</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
Expand All @@ -68,7 +72,11 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-restclient</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
Expand All @@ -78,7 +86,6 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -89,7 +96,6 @@
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
Expand All @@ -101,11 +107,6 @@
<artifactId>guava</artifactId>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
Expand All @@ -127,14 +128,15 @@
<artifactId>unboundid-ldapsdk</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-pva</artifactId>
<version>4.7.3</version>
<version>5.0.2</version>
</dependency>

<dependency>
Expand All @@ -157,7 +159,12 @@
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.8.5</version>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
Expand Down Expand Up @@ -250,9 +257,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot-version}</version>
<configuration>
<executable>true</executable>
</configuration>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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<Channel> channels) throws JsonProcessingException {
public long process(List<Channel> channels) throws JacksonException {
if (channels.isEmpty()) {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -13,5 +13,5 @@ public interface ChannelProcessor {

ChannelProcessorInfo processorInfo();

long process(List<Channel> channels) throws JsonProcessingException;
long process(List<Channel> channels) throws JacksonException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment thread
anderslindho marked this conversation as resolved.

@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<TomcatServletWebServerFactory> httpConnectorCustomizer() {
return factory -> factory.addAdditionalConnectors(getHttpConnector());
}

private Connector getHttpConnector() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Channel, String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Property, String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Tag, String> {
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/org/phoebus/channelfinder/service/InfoService.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,14 +8,18 @@
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 {

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();

Comment thread
anderslindho marked this conversation as resolved.
private final ElasticConfig esService;

Expand Down Expand Up @@ -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";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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")
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading
Loading