From 3f69e184a6a03555ad5e2de00e4fef6e2b6bbde8 Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Wed, 3 Dec 2025 08:39:16 +0100 Subject: [PATCH 01/13] Move service classes - Create package for service classes and move them there - Adjust scopes for (service) functions to not to break current functionality --- .../java/org/phoebus/channelfinder/ChannelManager.java | 8 +++++--- .../org/phoebus/channelfinder/PropertyManager.java | 6 ++++-- .../java/org/phoebus/channelfinder/TagManager.java | 6 ++++-- .../org/phoebus/channelfinder/epics/NTXmlUtil.java | 4 ++-- .../processors/ChannelProcessorManager.java | 6 ++++-- .../{ => service}/AuthorizationService.java | 2 +- .../{epics => service}/ChannelFinderEpicsService.java | 2 +- .../ChannelProcessorService.java | 10 ++++++---- .../channelfinder/{ => service}/MetricsService.java | 5 ++++- .../org/phoebus/channelfinder/AuthorizationIT.java | 3 ++- .../org/phoebus/channelfinder/MetricsServiceIT.java | 4 +++- .../org/phoebus/channelfinder/MetricsServiceTest.java | 1 + .../phoebus/channelfinder/epics/EpicsRPCRequestIT.java | 1 + .../channelfinder/performance/PopulateServiceIT.java | 2 +- .../processors/ChannelProcessorServiceTest.java | 1 + 15 files changed, 40 insertions(+), 21 deletions(-) rename src/main/java/org/phoebus/channelfinder/{ => service}/AuthorizationService.java (99%) rename src/main/java/org/phoebus/channelfinder/{epics => service}/ChannelFinderEpicsService.java (99%) rename src/main/java/org/phoebus/channelfinder/{processors => service}/ChannelProcessorService.java (90%) rename src/main/java/org/phoebus/channelfinder/{ => service}/MetricsService.java (97%) diff --git a/src/main/java/org/phoebus/channelfinder/ChannelManager.java b/src/main/java/org/phoebus/channelfinder/ChannelManager.java index 061d313..f525186 100644 --- a/src/main/java/org/phoebus/channelfinder/ChannelManager.java +++ b/src/main/java/org/phoebus/channelfinder/ChannelManager.java @@ -21,12 +21,13 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.servlet.ServletContext; -import org.phoebus.channelfinder.AuthorizationService.ROLES; +import org.phoebus.channelfinder.service.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.processors.ChannelProcessorService; +import org.phoebus.channelfinder.service.ChannelProcessorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.http.HttpStatus; @@ -62,7 +63,8 @@ public class ChannelManager { @Autowired ChannelRepository channelRepository; - @Autowired AuthorizationService authorizationService; + @Autowired + AuthorizationService authorizationService; @Autowired ChannelProcessorService channelProcessorService; diff --git a/src/main/java/org/phoebus/channelfinder/PropertyManager.java b/src/main/java/org/phoebus/channelfinder/PropertyManager.java index a446989..d7b453f 100644 --- a/src/main/java/org/phoebus/channelfinder/PropertyManager.java +++ b/src/main/java/org/phoebus/channelfinder/PropertyManager.java @@ -19,7 +19,8 @@ import java.util.Optional; import java.util.logging.Level; import java.util.logging.Logger; -import org.phoebus.channelfinder.AuthorizationService.ROLES; +import org.phoebus.channelfinder.service.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.springframework.beans.factory.annotation.Autowired; @@ -54,7 +55,8 @@ public class PropertyManager { @Autowired ChannelRepository channelRepository; - @Autowired AuthorizationService authorizationService; + @Autowired + AuthorizationService authorizationService; @Operation( summary = "List all properties", diff --git a/src/main/java/org/phoebus/channelfinder/TagManager.java b/src/main/java/org/phoebus/channelfinder/TagManager.java index f831ec1..bd04466 100644 --- a/src/main/java/org/phoebus/channelfinder/TagManager.java +++ b/src/main/java/org/phoebus/channelfinder/TagManager.java @@ -20,7 +20,8 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import org.phoebus.channelfinder.AuthorizationService.ROLES; +import org.phoebus.channelfinder.service.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.springframework.beans.factory.annotation.Autowired; @@ -53,7 +54,8 @@ public class TagManager { @Autowired ChannelRepository channelRepository; - @Autowired AuthorizationService authorizationService; + @Autowired + AuthorizationService authorizationService; @Operation( summary = "List all tags", diff --git a/src/main/java/org/phoebus/channelfinder/epics/NTXmlUtil.java b/src/main/java/org/phoebus/channelfinder/epics/NTXmlUtil.java index 60e1182..99b5481 100644 --- a/src/main/java/org/phoebus/channelfinder/epics/NTXmlUtil.java +++ b/src/main/java/org/phoebus/channelfinder/epics/NTXmlUtil.java @@ -1,7 +1,7 @@ package org.phoebus.channelfinder.epics; -import static org.phoebus.channelfinder.epics.ChannelFinderEpicsService.COLUMN_CHANNEL_NAME; -import static org.phoebus.channelfinder.epics.ChannelFinderEpicsService.COLUMN_OWNER; +import static org.phoebus.channelfinder.service.ChannelFinderEpicsService.COLUMN_CHANNEL_NAME; +import static org.phoebus.channelfinder.service.ChannelFinderEpicsService.COLUMN_OWNER; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java index 209c9dd..3df8c86 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java @@ -13,10 +13,11 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import org.phoebus.channelfinder.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.ChannelScroll; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; +import org.phoebus.channelfinder.service.ChannelProcessorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -39,7 +40,8 @@ public class ChannelProcessorManager { private static final Logger logger = Logger.getLogger(ChannelProcessorManager.class.getName()); - @Autowired ChannelProcessorService channelProcessorService; + @Autowired + ChannelProcessorService channelProcessorService; @Autowired AuthorizationService authorizationService; // TODO replace with PIT and search_after diff --git a/src/main/java/org/phoebus/channelfinder/AuthorizationService.java b/src/main/java/org/phoebus/channelfinder/service/AuthorizationService.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/AuthorizationService.java rename to src/main/java/org/phoebus/channelfinder/service/AuthorizationService.java index 822fd43..af4cf8d 100644 --- a/src/main/java/org/phoebus/channelfinder/AuthorizationService.java +++ b/src/main/java/org/phoebus/channelfinder/service/AuthorizationService.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.service; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/org/phoebus/channelfinder/epics/ChannelFinderEpicsService.java b/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/epics/ChannelFinderEpicsService.java rename to src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java index 96c0078..cb42a96 100644 --- a/src/main/java/org/phoebus/channelfinder/epics/ChannelFinderEpicsService.java +++ b/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.epics; +package org.phoebus.channelfinder.service; import java.util.Arrays; import java.util.HashMap; diff --git a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorService.java b/src/main/java/org/phoebus/channelfinder/service/ChannelProcessorService.java similarity index 90% rename from src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorService.java rename to src/main/java/org/phoebus/channelfinder/service/ChannelProcessorService.java index a87c954..43cd73f 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorService.java +++ b/src/main/java/org/phoebus/channelfinder/service/ChannelProcessorService.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.processors; +package org.phoebus.channelfinder.service; import java.util.ArrayList; import java.util.List; @@ -9,6 +9,8 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import org.phoebus.channelfinder.entity.Channel; +import org.phoebus.channelfinder.processors.ChannelProcessor; +import org.phoebus.channelfinder.processors.ChannelProcessorInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.task.TaskExecutor; @@ -34,15 +36,15 @@ public ChannelProcessorService( this.chunkSize = chunkSize; } - long getProcessorCount() { + public long getProcessorCount() { return channelProcessors.size(); } - List getProcessorsInfo() { + public List getProcessorsInfo() { return channelProcessors.stream().map(ChannelProcessor::processorInfo).toList(); } - void setProcessorEnabled(String name, boolean enabled) { + public void setProcessorEnabled(String name, boolean enabled) { Optional processor = channelProcessors.stream() .filter(p -> Objects.equals(p.processorInfo().name(), name)) diff --git a/src/main/java/org/phoebus/channelfinder/MetricsService.java b/src/main/java/org/phoebus/channelfinder/service/MetricsService.java similarity index 97% rename from src/main/java/org/phoebus/channelfinder/MetricsService.java rename to src/main/java/org/phoebus/channelfinder/service/MetricsService.java index 78db0e8..c4d9fc0 100644 --- a/src/main/java/org/phoebus/channelfinder/MetricsService.java +++ b/src/main/java/org/phoebus/channelfinder/service/MetricsService.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.service; import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.ImmutableTag; @@ -13,6 +13,9 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; import javax.annotation.PostConstruct; +import org.phoebus.channelfinder.ChannelRepository; +import org.phoebus.channelfinder.PropertyRepository; +import org.phoebus.channelfinder.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java b/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java index d6622a0..907b319 100644 --- a/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java +++ b/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java @@ -2,7 +2,8 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.phoebus.channelfinder.AuthorizationService.ROLES; +import org.phoebus.channelfinder.service.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; diff --git a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java index c222dc2..a00a8c8 100644 --- a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java +++ b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java @@ -16,6 +16,7 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.example.PopulateService; +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; @@ -55,7 +56,8 @@ class MetricsServiceIT { @Autowired PopulateService populateService; - @Autowired MetricsService metricsService; + @Autowired + MetricsService metricsService; @Autowired private MockMvc mockMvc; diff --git a/src/test/java/org/phoebus/channelfinder/MetricsServiceTest.java b/src/test/java/org/phoebus/channelfinder/MetricsServiceTest.java index b9d4513..8bd0841 100644 --- a/src/test/java/org/phoebus/channelfinder/MetricsServiceTest.java +++ b/src/test/java/org/phoebus/channelfinder/MetricsServiceTest.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import org.junit.jupiter.api.Test; +import org.phoebus.channelfinder.service.MetricsService; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; diff --git a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java index f7030aa..89edb20 100644 --- a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java +++ b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java @@ -21,6 +21,7 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.service.ChannelFinderEpicsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java b/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java index 4a39314..66f9563 100644 --- a/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java +++ b/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java @@ -2,7 +2,7 @@ import java.net.URL; import org.junit.jupiter.api.Test; -import org.phoebus.channelfinder.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.example.PopulateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; diff --git a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java index 88454b7..1447b64 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java +++ b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.phoebus.channelfinder.entity.Channel; +import org.phoebus.channelfinder.service.ChannelProcessorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; From 8f396a7ecfbab1d1135f5355dd1bfc608ff515cc Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Wed, 3 Dec 2025 09:48:47 +0100 Subject: [PATCH 02/13] Move repository classes - Create package for repository classes and move them there --- .../java/org/phoebus/channelfinder/ChannelManager.java | 10 ++++++---- .../org/phoebus/channelfinder/PropertyManager.java | 10 ++++++---- .../java/org/phoebus/channelfinder/TagManager.java | 9 +++++---- .../processors/ChannelProcessorManager.java | 5 ++--- .../{ => respository}/ChannelRepository.java | 5 ++++- .../{ => respository}/PropertyRepository.java | 4 +++- .../channelfinder/{ => respository}/TagRepository.java | 4 +++- .../service/ChannelFinderEpicsService.java | 2 +- .../phoebus/channelfinder/service/MetricsService.java | 6 +++--- .../org/phoebus/channelfinder/AuthorizationIT.java | 4 ++-- .../org/phoebus/channelfinder/ChannelManagerIT.java | 3 +++ .../org/phoebus/channelfinder/ChannelRepositoryIT.java | 3 +++ .../channelfinder/ChannelRepositorySearchIT.java | 3 +++ .../org/phoebus/channelfinder/ChannelScrollIT.java | 3 +++ .../phoebus/channelfinder/ChannelScrollSearchIT.java | 2 ++ .../org/phoebus/channelfinder/ChannelValidationIT.java | 3 +++ .../org/phoebus/channelfinder/MetricsServiceIT.java | 6 ++++-- .../org/phoebus/channelfinder/PropertyManagerIT.java | 2 ++ .../phoebus/channelfinder/PropertyRepositoryIT.java | 2 ++ .../phoebus/channelfinder/PropertyValidationIT.java | 1 + .../java/org/phoebus/channelfinder/TagManagerIT.java | 2 ++ .../org/phoebus/channelfinder/TagRepositoryIT.java | 2 ++ .../org/phoebus/channelfinder/TagValidationIT.java | 1 + .../channelfinder/performance/ExistsPerformanceIT.java | 2 +- .../channelfinder/performance/PopulateServiceIT.java | 2 +- src/test/resources/logging.properties | 2 +- 26 files changed, 69 insertions(+), 29 deletions(-) rename src/main/java/org/phoebus/channelfinder/{ => respository}/ChannelRepository.java (99%) rename src/main/java/org/phoebus/channelfinder/{ => respository}/PropertyRepository.java (99%) rename src/main/java/org/phoebus/channelfinder/{ => respository}/TagRepository.java (99%) diff --git a/src/main/java/org/phoebus/channelfinder/ChannelManager.java b/src/main/java/org/phoebus/channelfinder/ChannelManager.java index f525186..09e2f7d 100644 --- a/src/main/java/org/phoebus/channelfinder/ChannelManager.java +++ b/src/main/java/org/phoebus/channelfinder/ChannelManager.java @@ -21,12 +21,15 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.servlet.ServletContext; -import org.phoebus.channelfinder.service.AuthorizationService; -import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.service.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.service.ChannelProcessorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -63,8 +66,7 @@ public class ChannelManager { @Autowired ChannelRepository channelRepository; - @Autowired - AuthorizationService authorizationService; + @Autowired AuthorizationService authorizationService; @Autowired ChannelProcessorService channelProcessorService; diff --git a/src/main/java/org/phoebus/channelfinder/PropertyManager.java b/src/main/java/org/phoebus/channelfinder/PropertyManager.java index d7b453f..ae90fc6 100644 --- a/src/main/java/org/phoebus/channelfinder/PropertyManager.java +++ b/src/main/java/org/phoebus/channelfinder/PropertyManager.java @@ -19,10 +19,13 @@ import java.util.Optional; import java.util.logging.Level; import java.util.logging.Logger; -import org.phoebus.channelfinder.service.AuthorizationService; -import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.service.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.http.HttpStatus; @@ -55,8 +58,7 @@ public class PropertyManager { @Autowired ChannelRepository channelRepository; - @Autowired - AuthorizationService authorizationService; + @Autowired AuthorizationService authorizationService; @Operation( summary = "List all properties", diff --git a/src/main/java/org/phoebus/channelfinder/TagManager.java b/src/main/java/org/phoebus/channelfinder/TagManager.java index bd04466..505d3b6 100644 --- a/src/main/java/org/phoebus/channelfinder/TagManager.java +++ b/src/main/java/org/phoebus/channelfinder/TagManager.java @@ -20,10 +20,12 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import org.phoebus.channelfinder.service.AuthorizationService; -import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.service.AuthorizationService; +import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.http.HttpStatus; @@ -54,8 +56,7 @@ public class TagManager { @Autowired ChannelRepository channelRepository; - @Autowired - AuthorizationService authorizationService; + @Autowired AuthorizationService authorizationService; @Operation( summary = "List all tags", diff --git a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java index 3df8c86..1a2e38d 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java @@ -13,10 +13,10 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.ChannelScroll; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; +import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.ChannelProcessorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -40,8 +40,7 @@ public class ChannelProcessorManager { private static final Logger logger = Logger.getLogger(ChannelProcessorManager.class.getName()); - @Autowired - ChannelProcessorService channelProcessorService; + @Autowired ChannelProcessorService channelProcessorService; @Autowired AuthorizationService authorizationService; // TODO replace with PIT and search_after diff --git a/src/main/java/org/phoebus/channelfinder/ChannelRepository.java b/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/ChannelRepository.java rename to src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java index a429667..46a77a6 100644 --- a/src/main/java/org/phoebus/channelfinder/ChannelRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.respository; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchException; @@ -49,6 +49,9 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.annotation.PreDestroy; +import org.phoebus.channelfinder.CFResourceDescriptors; +import org.phoebus.channelfinder.ElasticConfig; +import org.phoebus.channelfinder.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; diff --git a/src/main/java/org/phoebus/channelfinder/PropertyRepository.java b/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/PropertyRepository.java rename to src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java index 7b2a011..1f7fc4c 100644 --- a/src/main/java/org/phoebus/channelfinder/PropertyRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.respository; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchException; @@ -31,6 +31,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.StreamSupport; +import org.phoebus.channelfinder.ElasticConfig; +import org.phoebus.channelfinder.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Property.OnlyNameOwnerProperty; diff --git a/src/main/java/org/phoebus/channelfinder/TagRepository.java b/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/TagRepository.java rename to src/main/java/org/phoebus/channelfinder/respository/TagRepository.java index 46c0e39..2e2f333 100644 --- a/src/main/java/org/phoebus/channelfinder/TagRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.respository; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchException; @@ -32,6 +32,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.StreamSupport; +import org.phoebus.channelfinder.ElasticConfig; +import org.phoebus.channelfinder.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.entity.Tag.OnlyTag; diff --git a/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java b/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java index cb42a96..4b93779 100644 --- a/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java +++ b/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java @@ -19,8 +19,8 @@ import org.epics.pva.server.PVAServer; import org.epics.pva.server.RPCService; import org.epics.pva.server.ServerPV; -import org.phoebus.channelfinder.ChannelRepository; import org.phoebus.channelfinder.entity.Channel; +import org.phoebus.channelfinder.respository.ChannelRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.stereotype.Service; diff --git a/src/main/java/org/phoebus/channelfinder/service/MetricsService.java b/src/main/java/org/phoebus/channelfinder/service/MetricsService.java index c4d9fc0..1eb5d21 100644 --- a/src/main/java/org/phoebus/channelfinder/service/MetricsService.java +++ b/src/main/java/org/phoebus/channelfinder/service/MetricsService.java @@ -13,9 +13,9 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; import javax.annotation.PostConstruct; -import org.phoebus.channelfinder.ChannelRepository; -import org.phoebus.channelfinder.PropertyRepository; -import org.phoebus.channelfinder.TagRepository; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java b/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java index 907b319..4215691 100644 --- a/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java +++ b/src/test/java/org/phoebus/channelfinder/AuthorizationIT.java @@ -2,11 +2,11 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.phoebus.channelfinder.service.AuthorizationService; -import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; +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.security.core.context.SecurityContextHolder; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java index dd3fd58..8b2dadc 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java @@ -16,6 +16,9 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java index 909c649..dadfe44 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java @@ -19,6 +19,9 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java index 8a127c4..aac0488 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java @@ -18,6 +18,9 @@ import org.junit.jupiter.api.TestInstance; import org.phoebus.channelfinder.entity.SearchResult; import org.phoebus.channelfinder.example.PopulateService; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java index 2e40fbc..ff788a9 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java @@ -8,6 +8,9 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; import org.phoebus.channelfinder.example.PopulateService; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java index c97c2c4..9663934 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java @@ -11,6 +11,8 @@ import org.junit.jupiter.api.TestInstance; import org.phoebus.channelfinder.entity.Scroll; import org.phoebus.channelfinder.example.PopulateService; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java index fb29879..727327d 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java @@ -13,6 +13,9 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java index a00a8c8..1078478 100644 --- a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java +++ b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java @@ -16,6 +16,9 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.example.PopulateService; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.phoebus.channelfinder.service.MetricsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -56,8 +59,7 @@ class MetricsServiceIT { @Autowired PopulateService populateService; - @Autowired - MetricsService metricsService; + @Autowired MetricsService metricsService; @Autowired private MockMvc mockMvc; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java b/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java index 3a42532..f86d9c5 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java @@ -18,6 +18,8 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java index 38cd4f8..bd91d88 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java @@ -16,6 +16,8 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.PropertyRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java index 3c060f8..fb0f8af 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java @@ -12,6 +12,7 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java b/src/test/java/org/phoebus/channelfinder/TagManagerIT.java index 5635b84..311c66a 100644 --- a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagManagerIT.java @@ -18,6 +18,8 @@ import org.junit.jupiter.api.TestInstance; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java index 10c37a0..038a8a0 100644 --- a/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java @@ -14,6 +14,8 @@ import org.junit.jupiter.api.TestInstance; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java index aa05276..6ad279a 100644 --- a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java @@ -11,6 +11,7 @@ import org.junit.jupiter.api.TestInstance; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.respository.ChannelRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java b/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java index b25ee37..6386238 100644 --- a/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java +++ b/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java @@ -3,8 +3,8 @@ import com.google.common.collect.Lists; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.phoebus.channelfinder.ChannelRepository; import org.phoebus.channelfinder.example.PopulateService; +import org.phoebus.channelfinder.respository.ChannelRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; diff --git a/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java b/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java index 66f9563..3713641 100644 --- a/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java +++ b/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java @@ -2,8 +2,8 @@ import java.net.URL; import org.junit.jupiter.api.Test; -import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.example.PopulateService; +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.security.test.context.support.WithMockUser; diff --git a/src/test/resources/logging.properties b/src/test/resources/logging.properties index 5052185..e9a2676 100644 --- a/src/test/resources/logging.properties +++ b/src/test/resources/logging.properties @@ -4,5 +4,5 @@ handlers= java.util.logging.ConsoleHandler org.phoebus.channelfinder.ChannelManager = SEVERE o.p.channelfinder.ChannelManager = SEVERE -org.phoebus.channelfinder.ChannelRepository = SEVERE +org.phoebus.channelfinder.respository.ChannelRepository = SEVERE o.p.channelfinder.ChannelRepository = SEVERE \ No newline at end of file From 384b401460c5817eefd75090d825d3f7f9587bbc Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Wed, 3 Dec 2025 13:32:10 +0100 Subject: [PATCH 03/13] Move configuration classes - Create package for configuration classes and move them there - Adjust class name to represent it's function --- .../phoebus/channelfinder/Application.java | 4 +-- .../phoebus/channelfinder/ChannelScroll.java | 1 + .../phoebus/channelfinder/InfoManager.java | 1 + .../{ => configuration}/ElasticConfig.java | 5 ++-- .../HttpConnectorConfig.java | 2 +- .../PopulateDBConfiguration.java} | 25 +++++++++---------- .../RequestLoggingFilterConfig.java | 2 +- .../WebSecurityConfig.java | 2 +- .../respository/ChannelRepository.java | 2 +- .../respository/PropertyRepository.java | 2 +- .../respository/TagRepository.java | 2 +- .../channelfinder/ChannelManagerIT.java | 1 + .../channelfinder/ChannelRepositoryIT.java | 1 + .../ChannelRepositorySearchIT.java | 17 +++++++------ .../channelfinder/ChannelScrollIT.java | 13 +++++----- .../channelfinder/ChannelScrollSearchIT.java | 9 ++++--- .../channelfinder/ChannelValidationIT.java | 1 + .../channelfinder/ElasticConfigIT.java | 1 + .../channelfinder/MetricsServiceIT.java | 5 ++-- .../channelfinder/PropertyManagerIT.java | 1 + .../channelfinder/PropertyRepositoryIT.java | 1 + .../channelfinder/PropertyValidationIT.java | 1 + .../phoebus/channelfinder/TagManagerIT.java | 1 + .../channelfinder/TagRepositoryIT.java | 1 + .../channelfinder/TagValidationIT.java | 1 + .../performance/ExistsPerformanceIT.java | 4 +-- ...IT.java => PopulateDBConfigurationIT.java} | 12 ++++----- 27 files changed, 67 insertions(+), 51 deletions(-) rename src/main/java/org/phoebus/channelfinder/{ => configuration}/ElasticConfig.java (98%) rename src/main/java/org/phoebus/channelfinder/{ => configuration}/HttpConnectorConfig.java (96%) rename src/main/java/org/phoebus/channelfinder/{example/PopulateService.java => configuration/PopulateDBConfiguration.java} (98%) rename src/main/java/org/phoebus/channelfinder/{ => configuration}/RequestLoggingFilterConfig.java (92%) rename src/main/java/org/phoebus/channelfinder/{ => configuration}/WebSecurityConfig.java (99%) rename src/test/java/org/phoebus/channelfinder/performance/{PopulateServiceIT.java => PopulateDBConfigurationIT.java} (74%) diff --git a/src/main/java/org/phoebus/channelfinder/Application.java b/src/main/java/org/phoebus/channelfinder/Application.java index ca17a6d..d48a2bd 100644 --- a/src/main/java/org/phoebus/channelfinder/Application.java +++ b/src/main/java/org/phoebus/channelfinder/Application.java @@ -21,7 +21,7 @@ import java.util.ServiceLoader; import java.util.logging.Level; import java.util.logging.Logger; -import org.phoebus.channelfinder.example.PopulateService; +import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.processors.ChannelProcessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; @@ -72,7 +72,7 @@ private static void configureTruststore() { } } - @Autowired PopulateService service; + @Autowired PopulateDBConfiguration service; public void run(ApplicationArguments args) throws Exception { if (args.containsOption("demo-data")) { diff --git a/src/main/java/org/phoebus/channelfinder/ChannelScroll.java b/src/main/java/org/phoebus/channelfinder/ChannelScroll.java index 5ac6175..b3d378f 100644 --- a/src/main/java/org/phoebus/channelfinder/ChannelScroll.java +++ b/src/main/java/org/phoebus/channelfinder/ChannelScroll.java @@ -24,6 +24,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/org/phoebus/channelfinder/InfoManager.java b/src/main/java/org/phoebus/channelfinder/InfoManager.java index 1c4f2c9..8af53d9 100644 --- a/src/main/java/org/phoebus/channelfinder/InfoManager.java +++ b/src/main/java/org/phoebus/channelfinder/InfoManager.java @@ -17,6 +17,7 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Level; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; diff --git a/src/main/java/org/phoebus/channelfinder/ElasticConfig.java b/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/ElasticConfig.java rename to src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java index 7d0943b..e876b9a 100644 --- a/src/main/java/org/phoebus/channelfinder/ElasticConfig.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java @@ -1,5 +1,5 @@ /** */ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.configuration; /* * #%L @@ -41,6 +41,7 @@ import org.apache.http.message.BasicHeader; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClientBuilder; +import org.phoebus.channelfinder.TextUtil; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; import org.springframework.beans.factory.annotation.Value; @@ -215,7 +216,7 @@ public void contextDestroyed(ServletContextEvent sce) { * * @param client client connected to elasticsearch */ - void elasticIndexValidation(ElasticsearchClient client) { + public void elasticIndexValidation(ElasticsearchClient client) { validateIndex(client, ES_CHANNEL_INDEX, "/channel_mapping.json"); validateIndex(client, ES_TAG_INDEX, "/tag_mapping.json"); validateIndex(client, ES_PROPERTY_INDEX, "/properties_mapping.json"); diff --git a/src/main/java/org/phoebus/channelfinder/HttpConnectorConfig.java b/src/main/java/org/phoebus/channelfinder/configuration/HttpConnectorConfig.java similarity index 96% rename from src/main/java/org/phoebus/channelfinder/HttpConnectorConfig.java rename to src/main/java/org/phoebus/channelfinder/configuration/HttpConnectorConfig.java index fe44408..f4659fb 100644 --- a/src/main/java/org/phoebus/channelfinder/HttpConnectorConfig.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/HttpConnectorConfig.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.configuration; import org.apache.catalina.connector.Connector; import org.springframework.beans.factory.annotation.Value; diff --git a/src/main/java/org/phoebus/channelfinder/example/PopulateService.java b/src/main/java/org/phoebus/channelfinder/configuration/PopulateDBConfiguration.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/example/PopulateService.java rename to src/main/java/org/phoebus/channelfinder/configuration/PopulateDBConfiguration.java index 676bae8..3f7421d 100644 --- a/src/main/java/org/phoebus/channelfinder/example/PopulateService.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/PopulateDBConfiguration.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.example; +package org.phoebus.channelfinder.configuration; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.Refresh; @@ -25,7 +25,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; -import org.phoebus.channelfinder.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; @@ -56,9 +55,9 @@ * @author Kunal Shroff */ @Configuration -public class PopulateService { +public class PopulateDBConfiguration { - private static final Logger logger = Logger.getLogger(PopulateService.class.getName()); + private static final Logger logger = Logger.getLogger(PopulateDBConfiguration.class.getName()); public static final String DEVICE_POWER_SUPPLY = "power supply"; public static final String DEVICE_MAGNET = "magnet"; public static final String UNIT_TEMP = "temperature"; @@ -843,7 +842,7 @@ private Collection insertValves( "{" + "GV" + "}Opn-Sw", loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "valve", "position", SIGTYPE_SWITCH)); @@ -857,7 +856,7 @@ private Collection insertValves( "{" + "GV" + "}Opn-St", loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "valve", "position", SIGTYPE_STATUS)); @@ -883,7 +882,7 @@ private Collection insertGauges( "{" + dev + "}P-RB", loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "gauge", "pressure", SIGTYPE_READBACK)); @@ -897,7 +896,7 @@ private Collection insertGauges( "{" + dev + OK_ST, loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "gauge", "error", SIGTYPE_STATUS)); @@ -922,7 +921,7 @@ private Collection insertPumps( "{" + dev + "}I-RB", loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "pump", UNIT_CURRENT, SIGTYPE_READBACK)); @@ -936,7 +935,7 @@ private Collection insertPumps( "{" + dev + "}P-RB", loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "pump", "pressure", SIGTYPE_READBACK)); @@ -950,7 +949,7 @@ private Collection insertPumps( "{" + dev + "}On-Sw", loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "pump", UNIT_POWER, SIGTYPE_SWITCH)); @@ -964,7 +963,7 @@ private Collection insertPumps( "{" + dev + OK_ST, loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "pump", "error", SIGTYPE_STATUS)); @@ -978,7 +977,7 @@ private Collection insertPumps( "{" + dev + ON_ST, loc, cell, - PopulateService.ELEMENT_VACUUM, + PopulateDBConfiguration.ELEMENT_VACUUM, "pump", UNIT_POWER, SIGTYPE_STATUS)); diff --git a/src/main/java/org/phoebus/channelfinder/RequestLoggingFilterConfig.java b/src/main/java/org/phoebus/channelfinder/configuration/RequestLoggingFilterConfig.java similarity index 92% rename from src/main/java/org/phoebus/channelfinder/RequestLoggingFilterConfig.java rename to src/main/java/org/phoebus/channelfinder/configuration/RequestLoggingFilterConfig.java index a83bb57..48eb264 100644 --- a/src/main/java/org/phoebus/channelfinder/RequestLoggingFilterConfig.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/RequestLoggingFilterConfig.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/org/phoebus/channelfinder/WebSecurityConfig.java b/src/main/java/org/phoebus/channelfinder/configuration/WebSecurityConfig.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/WebSecurityConfig.java rename to src/main/java/org/phoebus/channelfinder/configuration/WebSecurityConfig.java index b9868c3..4fe197d 100644 --- a/src/main/java/org/phoebus/channelfinder/WebSecurityConfig.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/WebSecurityConfig.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.configuration; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java b/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java index 46a77a6..d8e62d0 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java @@ -50,8 +50,8 @@ import java.util.stream.StreamSupport; import javax.annotation.PreDestroy; import org.phoebus.channelfinder.CFResourceDescriptors; -import org.phoebus.channelfinder.ElasticConfig; import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; diff --git a/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java b/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java index 1f7fc4c..34dbb38 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java @@ -31,8 +31,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.StreamSupport; -import org.phoebus.channelfinder.ElasticConfig; import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Property.OnlyNameOwnerProperty; diff --git a/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java b/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java index 2e2f333..e15d84d 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java @@ -32,8 +32,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.StreamSupport; -import org.phoebus.channelfinder.ElasticConfig; import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.entity.Tag.OnlyTag; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java index 8b2dadc..94388aa 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java @@ -13,6 +13,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java index dadfe44..9b13ab4 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java index aac0488..0fcbd22 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java @@ -1,8 +1,8 @@ package org.phoebus.channelfinder; import static java.lang.Math.min; -import static org.phoebus.channelfinder.example.PopulateService.valBucket; -import static org.phoebus.channelfinder.example.PopulateService.valBucketSize; +import static org.phoebus.channelfinder.configuration.PopulateDBConfiguration.valBucket; +import static org.phoebus.channelfinder.configuration.PopulateDBConfiguration.valBucketSize; import java.io.IOException; import java.util.Arrays; @@ -16,8 +16,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; +import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.entity.SearchResult; -import org.phoebus.channelfinder.example.PopulateService; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; @@ -41,7 +42,7 @@ class ChannelRepositorySearchIT { @Autowired TagRepository tagRepository; @Autowired PropertyRepository propertyRepository; @Autowired ElasticConfig esService; - @Autowired PopulateService populateService; + @Autowired PopulateDBConfiguration populateDBConfiguration; @Value("${elasticsearch.query.size:10000}") int ELASTIC_LIMIT; @@ -53,14 +54,14 @@ void setupAll() { @BeforeEach public void setup() throws InterruptedException { - populateService.cleanupDB(); - populateService.createDB(CELLS); + populateDBConfiguration.cleanupDB(); + populateDBConfiguration.createDB(CELLS); Thread.sleep(5000); } @AfterEach public void cleanup() throws InterruptedException { - populateService.cleanupDB(); + populateDBConfiguration.cleanupDB(); } /** @@ -71,7 +72,7 @@ public void cleanup() throws InterruptedException { @Test void searchTest() { List channelNames = - Arrays.asList(populateService.getChannelList().toArray(new String[0])); + Arrays.asList(populateDBConfiguration.getChannelList().toArray(new String[0])); MultiValueMap searchParameters = new LinkedMultiValueMap(); // logger.log(Level.INFO, "Search for a single unique channel " + channelNames.get(0)); diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java index ff788a9..1f32366 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java @@ -5,9 +5,10 @@ import java.util.List; import java.util.Random; import org.junit.jupiter.api.*; +import org.phoebus.channelfinder.configuration.ElasticConfig; +import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; -import org.phoebus.channelfinder.example.PopulateService; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; @@ -32,17 +33,17 @@ class ChannelScrollIT { @Autowired ElasticConfig esService; - @Autowired PopulateService populateService; + @Autowired PopulateDBConfiguration populateDBConfiguration; @BeforeEach public void setup() throws InterruptedException { - populateService.createDB(1); + populateDBConfiguration.createDB(1); Thread.sleep(10000); } @AfterEach public void cleanup() throws InterruptedException { - populateService.cleanupDB(); + populateDBConfiguration.cleanupDB(); } @BeforeAll @@ -66,9 +67,9 @@ void tearDown() throws IOException { void searchNameTest() throws InterruptedException { List channelNames = Arrays.asList( - populateService + populateDBConfiguration .getChannelList() - .toArray(new String[populateService.getChannelList().size()])); + .toArray(new String[populateDBConfiguration.getChannelList().size()])); MultiValueMap searchParameters = new LinkedMultiValueMap(); // Search for a single unique channel diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java index 9663934..ecfb096 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java @@ -9,8 +9,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; +import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.entity.Scroll; -import org.phoebus.channelfinder.example.PopulateService; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -32,17 +33,17 @@ class ChannelScrollSearchIT { @Autowired PropertyRepository propertyRepository; @Autowired ElasticConfig esService; - @Autowired PopulateService populateService; + @Autowired PopulateDBConfiguration populateDBConfiguration; @BeforeEach public void setup() throws InterruptedException { - populateService.createDB(1); + populateDBConfiguration.createDB(1); Thread.sleep(10000); } @AfterEach public void cleanup() throws InterruptedException { - populateService.cleanupDB(); + populateDBConfiguration.cleanupDB(); Thread.sleep(10000); } diff --git a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java index 727327d..b4de7b3 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; diff --git a/src/test/java/org/phoebus/channelfinder/ElasticConfigIT.java b/src/test/java/org/phoebus/channelfinder/ElasticConfigIT.java index b242a6e..a731f13 100644 --- a/src/test/java/org/phoebus/channelfinder/ElasticConfigIT.java +++ b/src/test/java/org/phoebus/channelfinder/ElasticConfigIT.java @@ -1,6 +1,7 @@ package org.phoebus.channelfinder; import java.io.IOException; +import org.phoebus.channelfinder.configuration.ElasticConfig; public class ElasticConfigIT { diff --git a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java index 1078478..0fd4701 100644 --- a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java +++ b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java @@ -12,10 +12,11 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; +import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.example.PopulateService; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; @@ -57,7 +58,7 @@ class MetricsServiceIT { @Autowired ElasticConfig esService; - @Autowired PopulateService populateService; + @Autowired PopulateDBConfiguration populateDBConfiguration; @Autowired MetricsService metricsService; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java b/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java index f86d9c5..bb72740 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java index bd91d88..151d440 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java @@ -13,6 +13,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java index fb0f8af..96e94ae 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; diff --git a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java b/src/test/java/org/phoebus/channelfinder/TagManagerIT.java index 311c66a..ac89e61 100644 --- a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagManagerIT.java @@ -16,6 +16,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java index 038a8a0..7e93223 100644 --- a/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java @@ -12,6 +12,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java index 6ad279a..4aeea58 100644 --- a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java b/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java index 6386238..2d74309 100644 --- a/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java +++ b/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java @@ -3,7 +3,7 @@ import com.google.common.collect.Lists; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.phoebus.channelfinder.example.PopulateService; +import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.respository.ChannelRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -16,7 +16,7 @@ @WebMvcTest(ChannelRepository.class) class ExistsPerformanceIT { - @Autowired PopulateService service; + @Autowired PopulateDBConfiguration service; @Autowired ChannelRepository channelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java b/src/test/java/org/phoebus/channelfinder/performance/PopulateDBConfigurationIT.java similarity index 74% rename from src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java rename to src/test/java/org/phoebus/channelfinder/performance/PopulateDBConfigurationIT.java index 3713641..fa2290a 100644 --- a/src/test/java/org/phoebus/channelfinder/performance/PopulateServiceIT.java +++ b/src/test/java/org/phoebus/channelfinder/performance/PopulateDBConfigurationIT.java @@ -2,7 +2,7 @@ import java.net.URL; import org.junit.jupiter.api.Test; -import org.phoebus.channelfinder.example.PopulateService; +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; @@ -12,9 +12,9 @@ /** An class for creating the example database and testing the speed. */ @WebMvcTest(AuthorizationService.class) @TestPropertySource(value = "classpath:performance_application.properties") -class PopulateServiceIT { +class PopulateDBConfigurationIT { - @Autowired PopulateService populateService; + @Autowired PopulateDBConfiguration populateDBConfiguration; @Test @WithMockUser(username = "admin", roles = "CF-ADMINS") @@ -22,16 +22,16 @@ void testCreateTagsAndProperties() { final URL tagResource = getClass().getResource("/perf_tags.json"); final URL propertyResource = getClass().getResource("/perf_properties.json"); - populateService.createTagsAndProperties(tagResource, propertyResource); + populateDBConfiguration.createTagsAndProperties(tagResource, propertyResource); } @Test void testCreateDB() { - populateService.createDB(); + populateDBConfiguration.createDB(); } @Test void testCleanUpDB() { - populateService.cleanupDB(); + populateDBConfiguration.cleanupDB(); } } From 028894beb0ef93be766bb0689041505e03b229be Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Wed, 3 Dec 2025 15:16:04 +0100 Subject: [PATCH 04/13] Move controller classes - Create package for controller classes and move them there --- src/main/java/org/phoebus/channelfinder/Application.java | 2 +- .../channelfinder/{ => rest/controller}/ChannelManager.java | 3 ++- .../controller}/ChannelProcessorManager.java | 4 ++-- .../channelfinder/{ => rest/controller}/ChannelScroll.java | 4 +++- .../channelfinder/{ => rest/controller}/InfoManager.java | 3 ++- .../{ => rest/controller}/PropertyManager.java | 3 ++- .../channelfinder/{ => rest/controller}/TagManager.java | 3 ++- .../java/org/phoebus/channelfinder/ChannelManagerIT.java | 1 + .../java/org/phoebus/channelfinder/ChannelScrollIT.java | 1 + .../org/phoebus/channelfinder/ChannelScrollSearchIT.java | 1 + .../java/org/phoebus/channelfinder/ChannelValidationIT.java | 1 + .../java/org/phoebus/channelfinder/PropertyManagerIT.java | 1 + .../org/phoebus/channelfinder/PropertyValidationIT.java | 1 + src/test/java/org/phoebus/channelfinder/TagManagerIT.java | 1 + .../java/org/phoebus/channelfinder/TagValidationIT.java | 1 + .../channelfinder/docker/ChannelFinderChannelsIT.java | 3 ++- .../channelfinder/docker/ChannelFinderPropertiesIT.java | 3 ++- .../phoebus/channelfinder/docker/ChannelFinderScrollIT.java | 3 ++- .../phoebus/channelfinder/docker/ChannelFinderTagsIT.java | 3 ++- .../org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java | 6 +++--- .../channelfinder/processors/ChannelProcessorManagerIT.java | 3 ++- src/test/resources/logging.properties | 2 +- 22 files changed, 36 insertions(+), 17 deletions(-) rename src/main/java/org/phoebus/channelfinder/{ => rest/controller}/ChannelManager.java (99%) rename src/main/java/org/phoebus/channelfinder/{processors => rest/controller}/ChannelProcessorManager.java (98%) rename src/main/java/org/phoebus/channelfinder/{ => rest/controller}/ChannelScroll.java (98%) rename src/main/java/org/phoebus/channelfinder/{ => rest/controller}/InfoManager.java (97%) rename src/main/java/org/phoebus/channelfinder/{ => rest/controller}/PropertyManager.java (99%) rename src/main/java/org/phoebus/channelfinder/{ => rest/controller}/TagManager.java (99%) diff --git a/src/main/java/org/phoebus/channelfinder/Application.java b/src/main/java/org/phoebus/channelfinder/Application.java index d48a2bd..9330b98 100644 --- a/src/main/java/org/phoebus/channelfinder/Application.java +++ b/src/main/java/org/phoebus/channelfinder/Application.java @@ -43,7 +43,7 @@ @SpringBootApplication public class Application implements ApplicationRunner { - static final Logger logger = Logger.getLogger(Application.class.getName()); + public static final Logger logger = Logger.getLogger(Application.class.getName()); public static void main(String[] args) { // Set the java truststore used by channelfinder diff --git a/src/main/java/org/phoebus/channelfinder/ChannelManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/ChannelManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java index 09e2f7d..52749c6 100644 --- a/src/main/java/org/phoebus/channelfinder/ChannelManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.rest.controller; import static org.phoebus.channelfinder.CFResourceDescriptors.CHANNEL_RESOURCE_URI; import static org.phoebus.channelfinder.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; @@ -21,6 +21,7 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.servlet.ServletContext; +import org.phoebus.channelfinder.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; diff --git a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java index 1a2e38d..3dadeae 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.processors; +package org.phoebus.channelfinder.rest.controller; import static org.phoebus.channelfinder.CFResourceDescriptors.CHANNEL_PROCESSOR_RESOURCE_URI; import static org.phoebus.channelfinder.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; @@ -13,7 +13,7 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import org.phoebus.channelfinder.ChannelScroll; +import org.phoebus.channelfinder.processors.ChannelProcessorInfo; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; import org.phoebus.channelfinder.service.AuthorizationService; diff --git a/src/main/java/org/phoebus/channelfinder/ChannelScroll.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/ChannelScroll.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java index b3d378f..5392df8 100644 --- a/src/main/java/org/phoebus/channelfinder/ChannelScroll.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.rest.controller; import static org.phoebus.channelfinder.CFResourceDescriptors.SCROLL_RESOURCE_URI; @@ -24,6 +24,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; +import org.phoebus.channelfinder.CFResourceDescriptors; +import org.phoebus.channelfinder.TextUtil; import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; diff --git a/src/main/java/org/phoebus/channelfinder/InfoManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java similarity index 97% rename from src/main/java/org/phoebus/channelfinder/InfoManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java index 8af53d9..34e7888 100644 --- a/src/main/java/org/phoebus/channelfinder/InfoManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.rest.controller; import static org.phoebus.channelfinder.CFResourceDescriptors.CF_SERVICE_INFO; @@ -17,6 +17,7 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Level; +import org.phoebus.channelfinder.Application; import org.phoebus.channelfinder.configuration.ElasticConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/src/main/java/org/phoebus/channelfinder/PropertyManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/PropertyManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java index ae90fc6..8223933 100644 --- a/src/main/java/org/phoebus/channelfinder/PropertyManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.rest.controller; import static org.phoebus.channelfinder.CFResourceDescriptors.PROPERTY_RESOURCE_URI; @@ -19,6 +19,7 @@ import java.util.Optional; import java.util.logging.Level; import java.util.logging.Logger; +import org.phoebus.channelfinder.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.respository.ChannelRepository; diff --git a/src/main/java/org/phoebus/channelfinder/TagManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/TagManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java index 505d3b6..4301fad 100644 --- a/src/main/java/org/phoebus/channelfinder/TagManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.rest.controller; import static org.phoebus.channelfinder.CFResourceDescriptors.TAG_RESOURCE_URI; @@ -20,6 +20,7 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import org.phoebus.channelfinder.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java index 94388aa..64376f7 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java @@ -20,6 +20,7 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.controller.ChannelManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java index 1f32366..3793a59 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java @@ -12,6 +12,7 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java index ecfb096..9766704 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java @@ -14,6 +14,7 @@ import org.phoebus.channelfinder.entity.Scroll; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java index b4de7b3..303a5cb 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java @@ -17,6 +17,7 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.controller.ChannelManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java b/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java index bb72740..5c0cb56 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java @@ -21,6 +21,7 @@ import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.rest.controller.PropertyManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java index 96e94ae..befa5e6 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java @@ -14,6 +14,7 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.rest.controller.PropertyManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java b/src/test/java/org/phoebus/channelfinder/TagManagerIT.java index ac89e61..e505298 100644 --- a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagManagerIT.java @@ -21,6 +21,7 @@ import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.controller.TagManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java index 4aeea58..44fcedc 100644 --- a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java @@ -13,6 +13,7 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.rest.controller.TagManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java index bc0925c..9e13bfb 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.Test; import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; +import org.phoebus.channelfinder.rest.controller.ChannelManager; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -37,7 +38,7 @@ * org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. * * @author Lars Johansson - * @see org.phoebus.channelfinder.ChannelManager + * @see ChannelManager * @see org.phoebus.channelfinder.docker.ITTestFixture * @see org.phoebus.channelfinder.docker.ITUtil * @see org.phoebus.channelfinder.docker.ITUtilChannels diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java index cb0118e..e0ae674 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java @@ -29,6 +29,7 @@ import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; +import org.phoebus.channelfinder.rest.controller.PropertyManager; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -38,7 +39,7 @@ * org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. * * @author Lars Johansson - * @see org.phoebus.channelfinder.PropertyManager + * @see PropertyManager * @see org.phoebus.channelfinder.docker.ITUtil * @see org.phoebus.channelfinder.docker.ITUtilProperties */ diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java index 4132a94..0197336 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java @@ -25,6 +25,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import org.phoebus.channelfinder.entity.Scroll; +import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -34,7 +35,7 @@ * org.phoebus.channelfinder.CFResourceDescriptors#SCROLL_RESOURCE_URI}. * * @author Lars Johansson - * @see org.phoebus.channelfinder.ChannelScroll + * @see ChannelScroll * @see org.phoebus.channelfinder.docker.ITUtil * @see org.phoebus.channelfinder.docker.ITUtilScroll */ diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java index 1ca5c35..86464a6 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java @@ -29,6 +29,7 @@ import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.rest.controller.TagManager; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -38,7 +39,7 @@ * org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. * * @author Lars Johansson - * @see org.phoebus.channelfinder.TagManager + * @see TagManager * @see org.phoebus.channelfinder.docker.ITUtil * @see org.phoebus.channelfinder.docker.ITUtilTags */ diff --git a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java index 89edb20..25aff22 100644 --- a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java +++ b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java @@ -15,9 +15,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; -import org.phoebus.channelfinder.ChannelManager; -import org.phoebus.channelfinder.PropertyManager; -import org.phoebus.channelfinder.TagManager; +import org.phoebus.channelfinder.rest.controller.ChannelManager; +import org.phoebus.channelfinder.rest.controller.PropertyManager; +import org.phoebus.channelfinder.rest.controller.TagManager; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; diff --git a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java index 7131902..8e48271 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java @@ -10,7 +10,8 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; import org.phoebus.channelfinder.CFResourceDescriptors; -import org.phoebus.channelfinder.ChannelScroll; +import org.phoebus.channelfinder.rest.controller.ChannelProcessorManager; +import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.phoebus.channelfinder.entity.Scroll; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; diff --git a/src/test/resources/logging.properties b/src/test/resources/logging.properties index e9a2676..4fd2c90 100644 --- a/src/test/resources/logging.properties +++ b/src/test/resources/logging.properties @@ -2,7 +2,7 @@ handlers= java.util.logging.ConsoleHandler .level = SEVERE -org.phoebus.channelfinder.ChannelManager = SEVERE +org.phoebus.channelfinder.rest.controller.ChannelManager = SEVERE o.p.channelfinder.ChannelManager = SEVERE org.phoebus.channelfinder.respository.ChannelRepository = SEVERE o.p.channelfinder.ChannelRepository = SEVERE \ No newline at end of file From 781053f4b2ea0bd221c08a73c3dde5d32b2702f1 Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Wed, 3 Dec 2025 15:38:21 +0100 Subject: [PATCH 05/13] Move util classes - Create package for util classes and move them there --- .../{ => common}/CFResourceDescriptors.java | 2 +- .../{epics => common}/NTXmlUtil.java | 2 +- .../channelfinder/{ => common}/TextUtil.java | 2 +- .../configuration/ElasticConfig.java | 2 +- .../respository/ChannelRepository.java | 4 +-- .../respository/PropertyRepository.java | 2 +- .../respository/TagRepository.java | 2 +- .../rest/controller/ChannelManager.java | 6 ++-- .../controller/ChannelProcessorManager.java | 4 +-- .../rest/controller/ChannelScroll.java | 6 ++-- .../rest/controller/InfoManager.java | 2 +- .../rest/controller/PropertyManager.java | 4 +-- .../rest/controller/TagManager.java | 4 +-- .../docker/ChannelFinderChannelsIT.java | 27 ++++++++--------- .../docker/ChannelFinderPropertiesIT.java | 29 ++++++++++--------- .../docker/ChannelFinderScrollIT.java | 9 +++--- .../docker/ChannelFinderTagsIT.java | 29 ++++++++++--------- .../epics/EpicsRPCRequestIT.java | 1 + .../processors/ChannelProcessorManagerIT.java | 2 +- .../INTEGRATIONTEST_DOCKER_TUTORIAL.md | 2 +- 20 files changed, 73 insertions(+), 68 deletions(-) rename src/main/java/org/phoebus/channelfinder/{ => common}/CFResourceDescriptors.java (95%) rename src/main/java/org/phoebus/channelfinder/{epics => common}/NTXmlUtil.java (98%) rename src/main/java/org/phoebus/channelfinder/{ => common}/TextUtil.java (99%) diff --git a/src/main/java/org/phoebus/channelfinder/CFResourceDescriptors.java b/src/main/java/org/phoebus/channelfinder/common/CFResourceDescriptors.java similarity index 95% rename from src/main/java/org/phoebus/channelfinder/CFResourceDescriptors.java rename to src/main/java/org/phoebus/channelfinder/common/CFResourceDescriptors.java index 34037fd..a5694ef 100644 --- a/src/main/java/org/phoebus/channelfinder/CFResourceDescriptors.java +++ b/src/main/java/org/phoebus/channelfinder/common/CFResourceDescriptors.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.common; public class CFResourceDescriptors { diff --git a/src/main/java/org/phoebus/channelfinder/epics/NTXmlUtil.java b/src/main/java/org/phoebus/channelfinder/common/NTXmlUtil.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/epics/NTXmlUtil.java rename to src/main/java/org/phoebus/channelfinder/common/NTXmlUtil.java index 99b5481..437160c 100644 --- a/src/main/java/org/phoebus/channelfinder/epics/NTXmlUtil.java +++ b/src/main/java/org/phoebus/channelfinder/common/NTXmlUtil.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.epics; +package org.phoebus.channelfinder.common; import static org.phoebus.channelfinder.service.ChannelFinderEpicsService.COLUMN_CHANNEL_NAME; import static org.phoebus.channelfinder.service.ChannelFinderEpicsService.COLUMN_OWNER; diff --git a/src/main/java/org/phoebus/channelfinder/TextUtil.java b/src/main/java/org/phoebus/channelfinder/common/TextUtil.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/TextUtil.java rename to src/main/java/org/phoebus/channelfinder/common/TextUtil.java index a73d8de..1521ce0 100644 --- a/src/main/java/org/phoebus/channelfinder/TextUtil.java +++ b/src/main/java/org/phoebus/channelfinder/common/TextUtil.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder; +package org.phoebus.channelfinder.common; /** * Utility class to assist in handling of text. diff --git a/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java b/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java index e876b9a..736e118 100644 --- a/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/ElasticConfig.java @@ -41,7 +41,7 @@ import org.apache.http.message.BasicHeader; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClientBuilder; -import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; import org.springframework.beans.factory.annotation.Value; diff --git a/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java b/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java index d8e62d0..ef6bfdf 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java @@ -49,8 +49,8 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.annotation.PreDestroy; -import org.phoebus.channelfinder.CFResourceDescriptors; -import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.common.CFResourceDescriptors; +import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; diff --git a/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java b/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java index 34dbb38..640174a 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java @@ -31,7 +31,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.StreamSupport; -import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; diff --git a/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java b/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java index e15d84d..58be445 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java +++ b/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java @@ -32,7 +32,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.StreamSupport; -import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java index 52749c6..cdd2458 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java @@ -1,7 +1,7 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.CFResourceDescriptors.CHANNEL_RESOURCE_URI; -import static org.phoebus.channelfinder.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.CHANNEL_RESOURCE_URI; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; import com.google.common.collect.FluentIterable; import com.google.common.collect.Lists; @@ -21,7 +21,7 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.servlet.ServletContext; -import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java index 3dadeae..1d94837 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java @@ -1,7 +1,7 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.CFResourceDescriptors.CHANNEL_PROCESSOR_RESOURCE_URI; -import static org.phoebus.channelfinder.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.CHANNEL_PROCESSOR_RESOURCE_URI; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java index 5392df8..e8a9d7c 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java @@ -1,6 +1,6 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.CFResourceDescriptors.SCROLL_RESOURCE_URI; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.SCROLL_RESOURCE_URI; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.FieldSort; @@ -24,8 +24,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; -import org.phoebus.channelfinder.CFResourceDescriptors; -import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.common.CFResourceDescriptors; +import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java index 34e7888..684f83d 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java @@ -1,6 +1,6 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.CFResourceDescriptors.CF_SERVICE_INFO; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.CF_SERVICE_INFO; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchVersionInfo; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java index 8223933..1de0ce7 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java @@ -1,6 +1,6 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.CFResourceDescriptors.PROPERTY_RESOURCE_URI; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.PROPERTY_RESOURCE_URI; import com.google.common.collect.Lists; import io.swagger.v3.oas.annotations.Operation; @@ -19,7 +19,7 @@ import java.util.Optional; import java.util.logging.Level; import java.util.logging.Logger; -import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.respository.ChannelRepository; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java index 4301fad..9e57cac 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java @@ -1,6 +1,6 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.CFResourceDescriptors.TAG_RESOURCE_URI; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.TAG_RESOURCE_URI; import com.google.common.collect.Lists; import io.swagger.v3.oas.annotations.Operation; @@ -20,7 +20,7 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import org.phoebus.channelfinder.TextUtil; +import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java index 9e13bfb..bc7ef51 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.rest.controller.ChannelManager; @@ -35,7 +36,7 @@ /** * Integration tests for ChannelFinder and Elasticsearch with focus on usage of {@link - * org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. + * CFResourceDescriptors#CHANNEL_RESOURCE_URI}. * * @author Lars Johansson * @see ChannelManager @@ -162,7 +163,7 @@ void channelfinderUp() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannelRetrieveCheck() { // what @@ -173,7 +174,7 @@ void handleChannelRetrieveCheck() { ITUtilChannels.assertRetrieveChannel("/c11", HttpURLConnection.HTTP_NOT_FOUND); } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleChannelDeleteCheck() { // what @@ -197,7 +198,7 @@ void handleChannelDeleteCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannelCreateUpdateCheckJson() { // what @@ -293,7 +294,7 @@ void handleChannelCreateUpdateCheckJson() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannelCreateUpdateCheck() { // what @@ -376,7 +377,7 @@ void handleChannelCreateUpdateCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannel() { // what @@ -409,7 +410,7 @@ void handleChannel() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannel2() { // what @@ -446,7 +447,7 @@ void handleChannel2() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannel3RenameOwner() { // what @@ -477,7 +478,7 @@ void handleChannel3RenameOwner() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannel4ReplaceNonExisting() { // what @@ -504,7 +505,7 @@ void handleChannel4ReplaceNonExisting() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannelsCreateUpdateCheck() { // what @@ -625,7 +626,7 @@ void handleChannelsCreateUpdateCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannels() { // what @@ -694,7 +695,7 @@ void handleChannels() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannels2ReplaceNonExisting() { // what @@ -763,7 +764,7 @@ void handleChannels2ReplaceNonExisting() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#CHANNEL_RESOURCE_URI}. */ @Test void handleChannels3QueryByPattern() { // what diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java index e0ae674..be2fdcc 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; @@ -36,7 +37,7 @@ /** * Integration tests for ChannelFinder and Elasticsearch with focus on usage of {@link - * org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. + * CFResourceDescriptors#PROPERTY_RESOURCE_URI}. * * @author Lars Johansson * @see PropertyManager @@ -167,7 +168,7 @@ void channelfinderUp() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handlePropertyRetrieveCheck() { // what @@ -178,7 +179,7 @@ void handlePropertyRetrieveCheck() { ITUtilProperties.assertRetrieveProperty("/p11", HttpURLConnection.HTTP_NOT_FOUND); } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handlePropertyRemoveCheck() { // what @@ -202,7 +203,7 @@ void handlePropertyRemoveCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handlePropertyCreateUpdateCheckJson() { // what @@ -310,7 +311,7 @@ void handlePropertyCreateUpdateCheckJson() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handlePropertyCreateUpdateCheck() { // what @@ -390,7 +391,7 @@ void handlePropertyCreateUpdateCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperty() { // what @@ -423,7 +424,7 @@ void handleProperty() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperty2() { // what @@ -456,7 +457,7 @@ void handleProperty2() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperty3RenameOwner() { // what @@ -484,7 +485,7 @@ void handleProperty3RenameOwner() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperty4ReplaceNonExisting() { // what @@ -508,7 +509,7 @@ void handleProperty4ReplaceNonExisting() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperty5SingleChannel() { // what @@ -604,7 +605,7 @@ void handleProperty5SingleChannel() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperty6MultipleChannels() { // what @@ -706,7 +707,7 @@ void handleProperty6MultipleChannels() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handlePropertiesCreateUpdateCheck() { // what @@ -827,7 +828,7 @@ void handlePropertiesCreateUpdateCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperties() { // what @@ -903,7 +904,7 @@ void handleProperties() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperties2ReplaceNonExisting() { // what diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java index 0197336..fbd1217 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java @@ -24,6 +24,7 @@ import java.net.HttpURLConnection; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; +import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.entity.Scroll; import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.testcontainers.containers.ComposeContainer; @@ -32,7 +33,7 @@ /** * Integration tests for ChannelFinder and Elasticsearch with focus on usage of {@link - * org.phoebus.channelfinder.CFResourceDescriptors#SCROLL_RESOURCE_URI}. + * CFResourceDescriptors#SCROLL_RESOURCE_URI}. * * @author Lars Johansson * @see ChannelScroll @@ -86,7 +87,7 @@ void channelfinderUp() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#SCROLL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#SCROLL_RESOURCE_URI}. */ @Test void handleScrollQueryChannels() { // what @@ -102,7 +103,7 @@ void handleScrollQueryChannels() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#SCROLL_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#SCROLL_RESOURCE_URI}. */ @Test void handleScrollContinueChannelsQuery() { // what @@ -117,7 +118,7 @@ void handleScrollContinueChannelsQuery() { } /** - * Test {@link org.phoebus.channelfinder.CFResourceDescriptors#SCROLL_RESOURCE_URI}. + * Test {@link CFResourceDescriptors#SCROLL_RESOURCE_URI}. * * @see ChannelFinderChannelsIT#handleChannels3QueryByPattern() * @see ITTestFixture diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java index 86464a6..38621f4 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; @@ -36,7 +37,7 @@ /** * Integration tests for ChannelFinder and Elasticsearch with focus on usage of {@link - * org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. + * CFResourceDescriptors#TAG_RESOURCE_URI}. * * @author Lars Johansson * @see TagManager @@ -152,7 +153,7 @@ void channelfinderUp() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTagRetrieveCheck() { // what @@ -163,7 +164,7 @@ void handleTagRetrieveCheck() { ITUtilTags.assertRetrieveTag("/t11", HttpURLConnection.HTTP_NOT_FOUND); } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTagRemoveCheck() { // what @@ -187,7 +188,7 @@ void handleTagRemoveCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTagCreateUpdateCheckJson() { // what @@ -293,7 +294,7 @@ void handleTagCreateUpdateCheckJson() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTagCreateUpdateCheck() { // what @@ -361,7 +362,7 @@ void handleTagCreateUpdateCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTag() { // what @@ -392,7 +393,7 @@ void handleTag() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTag2() { // what @@ -424,7 +425,7 @@ void handleTag2() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTag3RenameOwner() { // what @@ -452,7 +453,7 @@ void handleTag3RenameOwner() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTag4ReplaceNonExisting() { // what @@ -476,7 +477,7 @@ void handleTag4ReplaceNonExisting() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleTag5SingleChannel() { // what @@ -570,7 +571,7 @@ void handleTag5SingleChannel() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleTag6MultipleChannels() { // what @@ -665,7 +666,7 @@ void handleTag6MultipleChannels() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTagsCreateUpdateCheck() { // what @@ -783,7 +784,7 @@ void handleTagsCreateUpdateCheck() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTags() { // what @@ -854,7 +855,7 @@ void handleTags() { } } - /** Test {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}. */ + /** Test {@link CFResourceDescriptors#TAG_RESOURCE_URI}. */ @Test void handleTags2ReplaceNonExisting() { // what diff --git a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java index 25aff22..9b33ffa 100644 --- a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java +++ b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.phoebus.channelfinder.common.NTXmlUtil; import org.phoebus.channelfinder.rest.controller.ChannelManager; import org.phoebus.channelfinder.rest.controller.PropertyManager; import org.phoebus.channelfinder.rest.controller.TagManager; diff --git a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java index 8e48271..8a43960 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; -import org.phoebus.channelfinder.CFResourceDescriptors; +import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.rest.controller.ChannelProcessorManager; import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.phoebus.channelfinder.entity.Scroll; diff --git a/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md b/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md index cde23d9..d0bb2d4 100644 --- a/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md +++ b/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md @@ -140,7 +140,7 @@ class ChannelFinderPropertiesIT { } /** - * Test {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. + * Test {@link org.phoebus.channelfinder.common.CFResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperty() { From df9f0455b6cd61786fe8c486413675ca87b12cb4 Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Thu, 4 Dec 2025 10:04:46 +0100 Subject: [PATCH 06/13] Extract contrroller-level functions into interfaces - Extract endpoint functions into interfaces - Move endpoint (swagger) documentation into interfaces - Remove unused imports from controller classes --- .../rest/api/IChannelManager.java | 291 ++++++++++++++++ .../rest/api/IChannelProcessorManager.java | 110 ++++++ .../rest/api/IChannelScroll.java | 83 +++++ .../channelfinder/rest/api/IInfoManager.java | 31 ++ .../rest/api/IPropertyManager.java | 292 ++++++++++++++++ .../channelfinder/rest/api/ITagManager.java | 313 ++++++++++++++++++ .../rest/controller/ChannelManager.java | 248 +------------- .../controller/ChannelProcessorManager.java | 91 +---- .../rest/controller/ChannelScroll.java | 50 +-- .../rest/controller/InfoManager.java | 27 +- .../rest/controller/PropertyManager.java | 244 +------------- .../rest/controller/TagManager.java | 262 +-------------- .../channelfinder/ChannelManagerIT.java | 3 +- .../channelfinder/ChannelScrollIT.java | 3 +- .../channelfinder/ChannelScrollSearchIT.java | 3 +- .../channelfinder/ChannelValidationIT.java | 3 +- .../channelfinder/PropertyManagerIT.java | 3 +- .../channelfinder/PropertyValidationIT.java | 3 +- .../phoebus/channelfinder/TagManagerIT.java | 3 +- .../channelfinder/TagValidationIT.java | 3 +- .../epics/EpicsRPCRequestIT.java | 12 +- .../processors/ChannelProcessorManagerIT.java | 6 +- 22 files changed, 1200 insertions(+), 884 deletions(-) create mode 100644 src/main/java/org/phoebus/channelfinder/rest/api/IChannelManager.java create mode 100644 src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java create mode 100644 src/main/java/org/phoebus/channelfinder/rest/api/IChannelScroll.java create mode 100644 src/main/java/org/phoebus/channelfinder/rest/api/IInfoManager.java create mode 100644 src/main/java/org/phoebus/channelfinder/rest/api/IPropertyManager.java create mode 100644 src/main/java/org/phoebus/channelfinder/rest/api/ITagManager.java diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelManager.java new file mode 100644 index 0000000..a2ec3ab --- /dev/null +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelManager.java @@ -0,0 +1,291 @@ +package org.phoebus.channelfinder.rest.api; + +import static org.phoebus.channelfinder.common.CFResourceDescriptors.CHANNEL_RESOURCE_URI; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import java.util.List; +import org.phoebus.channelfinder.entity.Channel; +import org.phoebus.channelfinder.entity.SearchResult; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.server.ResponseStatusException; + +@RequestMapping(CHANNEL_RESOURCE_URI) +public interface IChannelManager { + + @Operation( + summary = "Query channels", + description = + "Query a collection of Channel instances based on tags, property values, and channel names.", + operationId = "queryChannels", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "List of channels", + content = + @Content(array = @ArraySchema(schema = @Schema(implementation = Channel.class)))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to find all channels", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping + List query( + @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam + MultiValueMap allRequestParams); + + @Operation( + summary = "Combined query for channels", + description = + "Query for a collection of Channel instances and get a count and the first 10k hits.", + operationId = "combinedQueryChannels", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "The number of matches for the query, and the first 10k channels", + content = + @Content( + array = @ArraySchema(schema = @Schema(implementation = SearchResult.class)))), + @ApiResponse( + responseCode = "400", + description = "Invalid request - response size exceeded", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to find all channels", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping("/combined") + SearchResult combinedQuery( + @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam + MultiValueMap allRequestParams); + + @Operation( + summary = "Count channels matching query", + description = "Get the number of channels matching the given query parameters.", + operationId = "countChannels", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "The number of channels matching the query", + content = @Content(schema = @Schema(implementation = Long.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to count the result for channel-query", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping("/count") + long queryCount( + @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam + MultiValueMap allRequestParams); + + @Operation( + summary = "Get channel by name", + description = "Retrieve a Channel instance by its name.", + operationId = "getChannelByName", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Channel with the specified name", + content = @Content(schema = @Schema(implementation = Channel.class))), + @ApiResponse( + responseCode = "404", + description = "Channel not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping("/{channelName}") + Channel read(@PathVariable("channelName") String channelName); + + @Operation( + summary = "Create or replace a channel", + description = "Create or replace a channel instance identified by the payload.", + operationId = "createOrReplaceChannel", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "The created/replaced channel", + content = @Content(schema = @Schema(implementation = Channel.class))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Channel, Tag, or property not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to create channel", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping("/{channelName}") + Channel create(@PathVariable("channelName") String channelName, @RequestBody Channel channel); + + @Operation( + summary = "Create or replace multiple channels", + description = "Create or replace multiple channel instances.", + operationId = "createOrReplaceChannels", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "The created/replaced channels", + content = + @Content(array = @ArraySchema(schema = @Schema(implementation = Channel.class)))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Tag, or property not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to create channels", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping + Iterable create(@RequestBody Iterable channels); + + @Operation( + summary = "Update a channel", + description = + "Merge properties and tags of the channel identified by the payload into an existing channel.", + operationId = "updateChannel", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "The updated channel", + content = @Content(schema = @Schema(implementation = Channel.class))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Channel, Tag, or property not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to update channel", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PostMapping("/{channelName}") + Channel update(@PathVariable("channelName") String channelName, @RequestBody Channel channel); + + @Operation( + summary = "Update multiple channels", + description = + "Merge properties and tags of the channels identified by the payload into existing channels.", + operationId = "updateChannels", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "The updated channels", + content = @Content(schema = @Schema(implementation = Channel.class))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Channel not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to update channels", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PostMapping() + Iterable update(@RequestBody Iterable channels); + + @Operation( + summary = "Delete a channel", + description = "Delete a channel instance identified by its name.", + operationId = "deleteChannel", + tags = {"Channel"}) + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "Channel deleted"), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Channel not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to delete channel", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @DeleteMapping("/{channelName}") + void remove(@PathVariable("channelName") String channelName); + + /** + * Checks if 1. the channel name is not null and matches the name in the body 2. the channel owner + * is not null or empty 3. all the listed tags/props exist and prop value is not null or empty + * + * @param channel channel to be validated + */ + void validateChannelRequest(Channel channel); + + /** + * Checks if 1. the tag names are not null 2. the tag owners are not null or empty 3. all the + * channels exist + * + * @param channels list of channels to be validated + */ + void validateChannelRequest(Iterable channels); +} diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java new file mode 100644 index 0000000..06024fb --- /dev/null +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java @@ -0,0 +1,110 @@ +package org.phoebus.channelfinder.rest.api; + +import static org.phoebus.channelfinder.common.CFResourceDescriptors.CHANNEL_PROCESSOR_RESOURCE_URI; +import static org.phoebus.channelfinder.common.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import java.util.List; +import org.phoebus.channelfinder.entity.Channel; +import org.phoebus.channelfinder.processors.ChannelProcessorInfo; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.server.ResponseStatusException; + +@RequestMapping(CHANNEL_PROCESSOR_RESOURCE_URI) +public interface IChannelProcessorManager { + + @Operation( + summary = "Get processor count", + description = "Returns the number of channel processors.", + operationId = "getProcessorCount", + tags = {"ChannelProcessor"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Number of channel-processors", + content = @Content(schema = @Schema(implementation = Long.class))) + }) + @GetMapping("/count") + long processorCount(); + + @Operation( + summary = "Get processor info", + description = "Returns information about all channel processors.", + operationId = "getProcessorInfo", + tags = {"ChannelProcessor"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "List of processor-info", + content = + @Content( + array = + @ArraySchema( + schema = @Schema(implementation = ChannelProcessorInfo.class)))) + }) + @GetMapping("/processors") + List processorInfo(); + + @Operation( + summary = "Process all channels", + description = "Manually trigger processing on all channels in ChannelFinder.", + operationId = "processAllChannels", + tags = {"ChannelProcessor"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Number of channels where processor was called", + content = @Content(schema = @Schema(implementation = Long.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping("/process/all") + long processAllChannels(); + + @Operation( + summary = "Process channels by query", + description = "Manually trigger processing on channels matching the given query.", + operationId = "processChannelsByQuery", + tags = {"ChannelProcessor"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Number of channels where processor was called", + content = @Content(schema = @Schema(implementation = Long.class))) + }) + @PutMapping("/process/query") + long processChannels( + @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam + MultiValueMap allRequestParams); + + @PutMapping("/process/channels") + void processChannels(List channels); + + @Operation(summary = "Set if the processor is enabled or not") + @PutMapping( + value = "/processor/{processorName}/enabled", + produces = {"application/json"}, + consumes = {"application/json"}) + void setProcessorEnabled( + @PathVariable("processorName") String processorName, + @Parameter(description = "Value of enabled to set, default value: true") + @RequestParam(required = false, name = "enabled", defaultValue = "true") + Boolean enabled); +} diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelScroll.java b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelScroll.java new file mode 100644 index 0000000..875d01c --- /dev/null +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelScroll.java @@ -0,0 +1,83 @@ +package org.phoebus.channelfinder.rest.api; + +import static org.phoebus.channelfinder.common.CFResourceDescriptors.SCROLL_RESOURCE_URI; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import org.phoebus.channelfinder.common.CFResourceDescriptors; +import org.phoebus.channelfinder.entity.Scroll; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.server.ResponseStatusException; + +@RequestMapping(SCROLL_RESOURCE_URI) +public interface IChannelScroll { + + @Operation( + summary = "Scroll query for channels", + description = "Retrieve a collection of Channel instances based on multi-parameter search.", + operationId = "scrollQueryChannels", + tags = {"ChannelScroll"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Scroll that contains a collection of channel instances", + content = @Content(schema = @Schema(implementation = Scroll.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to list channels", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping + Scroll query( + @Parameter(description = CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION) @RequestParam + MultiValueMap allRequestParams); + + @Operation( + summary = "Scroll query by scrollId", + description = + "Retrieve a collection of Channel instances using a scrollId and search parameters.", + operationId = "scrollQueryById", + tags = {"ChannelScroll"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Scroll List of channels", + content = @Content(schema = @Schema(implementation = Scroll.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to list channels", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping("/{scrollId}") + Scroll query( + @Parameter(description = "Scroll ID from previous query") @PathVariable("scrollId") + String scrollId, + @Parameter(description = CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION) @RequestParam + MultiValueMap searchParameters); + + /** + * Search for a list of channels based on their name, tags, and/or properties. Search parameters + * ~name - The name of the channel ~tags - A list of comma separated values + * ${propertyName}:${propertyValue} - + * + *

The query result is sorted based on the channel name ~size - The number of channels to be + * returned ~from - The starting index of the channel list + * + *

TODO combine with ChannelRepository code. + * + * @param scrollId scroll ID + * @param searchParameters - search parameters for scrolling searches + * @return search scroll + */ + Scroll search(String scrollId, MultiValueMap searchParameters); +} diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IInfoManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IInfoManager.java new file mode 100644 index 0000000..ee139a6 --- /dev/null +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IInfoManager.java @@ -0,0 +1,31 @@ +package org.phoebus.channelfinder.rest.api; + +import static org.phoebus.channelfinder.common.CFResourceDescriptors.CF_SERVICE_INFO; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@RequestMapping(CF_SERVICE_INFO) +public interface IInfoManager { + + @Operation( + summary = "Get ChannelFinder service info", + description = + "Returns information about the ChannelFinder service and its Elasticsearch backend.", + operationId = "getServiceInfo", + tags = {"Info"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "ChannelFinder info", + content = @Content(schema = @Schema(implementation = String.class))) + }) + @GetMapping + String info(); +} diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IPropertyManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IPropertyManager.java new file mode 100644 index 0000000..d51603f --- /dev/null +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IPropertyManager.java @@ -0,0 +1,292 @@ +package org.phoebus.channelfinder.rest.api; + +import static org.phoebus.channelfinder.common.CFResourceDescriptors.PROPERTY_RESOURCE_URI; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import org.phoebus.channelfinder.entity.Property; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.server.ResponseStatusException; + +@RequestMapping(PROPERTY_RESOURCE_URI) +public interface IPropertyManager { + + @Operation( + summary = "List all properties", + description = "Retrieve the list of all properties in the database.", + operationId = "listProperties", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "List of properties", + content = + @Content(array = @ArraySchema(schema = @Schema(implementation = Property.class)))), + @ApiResponse( + responseCode = "500", + description = "Error while listing properties", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping + Iterable list(); + + @Operation( + summary = "Get property by name", + description = "Retrieve a property by its name. Optionally include its channels.", + operationId = "getPropertyByName", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Fetch property by propertyName", + content = @Content(schema = @Schema(implementation = Property.class))), + @ApiResponse( + responseCode = "404", + description = "Property not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping("/{propertyName}") + Property read( + @PathVariable("propertyName") String propertyName, + @RequestParam(value = "withChannels", defaultValue = "true") boolean withChannels); + + @Operation( + summary = "Create or update a property", + description = "Create and exclusively update the property identified by the path parameter.", + operationId = "createOrUpdateProperty", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Property created", + content = @Content(schema = @Schema(implementation = Property.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Property not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to create property", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping("/{propertyName}") + Property create( + @PathVariable("propertyName") String propertyName, @RequestBody Property property); + + @Operation( + summary = "Create multiple properties", + description = "Create multiple properties in a single request.", + operationId = "createMultipleProperties", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Properties created", + content = @Content(schema = @Schema(implementation = Property.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to create properties", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping() + Iterable create(@RequestBody Iterable properties); + + @Operation( + summary = "Add property to a single channel", + description = + "Add the property identified by propertyName to the channel identified by channelName.", + operationId = "addPropertyToChannel", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Property added to the channel", + content = @Content(schema = @Schema(implementation = Property.class))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Property-, or Channel-name does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to add property", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping("/{propertyName}/{channelName}") + Property addSingle( + @PathVariable("propertyName") String propertyName, + @PathVariable("channelName") String channelName, + @RequestBody Property property); + + @Operation( + summary = "Update a property", + description = + "Update the property identified by the path parameter, adding it to all channels in the payload.", + operationId = "updateProperty", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Property updated", + content = @Content(schema = @Schema(implementation = Property.class))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Property does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to update property", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PostMapping("/{propertyName}") + Property update( + @PathVariable("propertyName") String propertyName, @RequestBody Property property); + + @Operation( + summary = "Update multiple properties", + description = "Update multiple properties and all appropriate channels.", + operationId = "updateMultipleProperties", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Properties updated", + content = + @Content(array = @ArraySchema(schema = @Schema(implementation = Property.class)))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Property does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to update properties", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PostMapping() + Iterable update(@RequestBody Iterable properties); + + @Operation( + summary = "Delete a property", + description = "Delete the property identified by the path parameter from all channels.", + operationId = "deleteProperty", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "Property deleted"), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Property does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to delete property", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @DeleteMapping("/{propertyName}") + void remove(@PathVariable("propertyName") String propertyName); + + @Operation( + summary = "Delete property from a channel", + description = + "Delete the property identified by propertyName from the channel identified by channelName.", + operationId = "deletePropertyFromChannel", + tags = {"Property"}) + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "Property deleted from the channel"), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Property does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to delete property from a channel", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @DeleteMapping("/{propertyName}/{channelName}") + void removeSingle( + @PathVariable("propertyName") String propertyName, + @PathVariable("channelName") String channelName); + + /** + * Checks if 1. the property name is not null and matches the name in the body 2. the property + * owner is not null or empty 3. all the listed channels exist and have the property with a non + * null and non empty value + * + * @param property validate property + */ + void validatePropertyRequest(Property property); + + /** + * Checks if 1. the property name is not null and matches the name in the body 2. the property + * owner is not null or empty 3. the property value is not null or empty 4. all the listed + * channels exist + * + * @param properties properties to be validated + */ + void validatePropertyRequest(Iterable properties); + + /** + * Checks if the channel exists + * + * @param channelName check channel exists + */ + void validatePropertyRequest(String channelName); +} diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/ITagManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/ITagManager.java new file mode 100644 index 0000000..1bc074e --- /dev/null +++ b/src/main/java/org/phoebus/channelfinder/rest/api/ITagManager.java @@ -0,0 +1,313 @@ +package org.phoebus.channelfinder.rest.api; + +import static org.phoebus.channelfinder.common.CFResourceDescriptors.TAG_RESOURCE_URI; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import org.phoebus.channelfinder.entity.Tag; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.server.ResponseStatusException; + +@RequestMapping(TAG_RESOURCE_URI) +public interface ITagManager { + + @Operation( + summary = "List all tags", + description = "Retrieve the list of all tags in the database.", + operationId = "listTags", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "List all Tags", + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Tag.class)))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to list all Tags", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping + Iterable list(); + + @Operation( + summary = "Get tag by name", + description = "Retrieve a tag by its name. Optionally include its channels.", + operationId = "getTagByName", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Finding Tag by tagName", + content = @Content(schema = @Schema(implementation = Tag.class))), + @ApiResponse( + responseCode = "404", + description = "Tag not found", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @GetMapping("/{tagName}") + Tag read( + @PathVariable("tagName") String tagName, + @RequestParam(value = "withChannels", defaultValue = "true") boolean withChannels); + + @Operation( + summary = "Create or update a tag", + description = "Create and exclusively update the tag identified by the path parameter.", + operationId = "createOrUpdateTag", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Tag created and updated", + content = @Content(schema = @Schema(implementation = Tag.class))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Tag-, or Channel-name does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to create/update Tag", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping("/{tagName}") + Tag create(@PathVariable("tagName") String tagName, @RequestBody Tag tag); + + @Operation( + summary = "Create multiple tags", + description = "Create multiple tags in a single request.", + operationId = "createMultipleTags", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Tags created", + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Tag.class)))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Tag-, or Channel-name does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while trying to create Tags", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping() + Iterable create(@RequestBody Iterable tags); + + @Operation( + summary = "Add tag to a single channel", + description = "Add the tag identified by tagName to the channel identified by channelName.", + operationId = "addTagToChannel", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Tags added to a single channel", + content = @Content(schema = @Schema(implementation = Tag.class))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Tag-, or Channel-name does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Tag creational error", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PutMapping("/{tagName}/{channelName}") + Tag addSingle( + @PathVariable("tagName") String tagName, @PathVariable("channelName") String channelName); + + @Operation( + summary = "Update a tag", + description = + "Update the tag identified by the path parameter, adding it to all channels in the payload.", + operationId = "updateTag", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Tag updated", + content = @Content(schema = @Schema(implementation = Tag.class))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Tag name does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Tag update error", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PostMapping("/{tagName}") + Tag update(@PathVariable("tagName") String tagName, @RequestBody Tag tag); + + @Operation( + summary = "Update multiple tags", + description = + "Update multiple tags and all appropriate channels. The operation will fail if any of the specified channels do not exist.", + operationId = "updateMultipleTags", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "Tags updated", + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Tag.class)))), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Tag-, or Channel-name does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Error while updating tags", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @PostMapping() + Iterable update(@RequestBody Iterable tags); + + @Operation( + summary = "Delete a tag", + description = "Delete the tag identified by the path parameter from all channels.", + operationId = "deleteTag", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "Tag deleted"), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Tag does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Tag creational error", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @DeleteMapping("/{tagName}") + void remove(@PathVariable("tagName") String tagName); + + @Operation( + summary = "Delete tag from a channel", + description = + "Delete the tag identified by tagName from the channel identified by channelName.", + operationId = "deleteTagFromChannel", + tags = {"Tag"}) + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "Tag deleted from the desired channel"), + @ApiResponse( + responseCode = "400", + description = "Invalid request", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "401", + description = "Unauthorized", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "404", + description = "Tag does not exist", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), + @ApiResponse( + responseCode = "500", + description = "Tag creational error", + content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) + }) + @DeleteMapping("/{tagName}/{channelName}") + void removeSingle( + @PathVariable("tagName") String tagName, @PathVariable("channelName") String channelName); + + /** + * Checks if all the tags included satisfy the following conditions + * + *

    + *
  1. the tag names are not null or empty and matches the names in the bodies + *
  2. the tag owners are not null or empty + *
  3. all the channels exist + *
+ * + * @param tags the list of tags to be validated + */ + void validateTagRequest(Iterable tags); + + /** + * Checks if tag satisfies the following conditions + * + *
    + *
  1. the tag name is not null or empty and matches the name in the body + *
  2. the tag owner is not null or empty + *
  3. all the listed channels exist + *
+ * + * @param tag the tag to be validates + */ + void validateTagRequest(Tag tag); + + /** + * Checks if channel with name "channelName" exists + * + * @param channelName check channel exists + */ + void validateTagWithChannelRequest(String channelName); +} diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java index cdd2458..d5c3f1c 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java @@ -1,17 +1,10 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.common.CFResourceDescriptors.CHANNEL_RESOURCE_URI; import static org.phoebus.channelfinder.common.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; import com.google.common.collect.FluentIterable; import com.google.common.collect.Lists; -import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.text.MessageFormat; import java.util.List; import java.util.Map; @@ -38,22 +31,16 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @CrossOrigin @RestController -@RequestMapping(CHANNEL_RESOURCE_URI) @EnableAutoConfiguration -public class ChannelManager { +public class ChannelManager implements org.phoebus.channelfinder.rest.api.IChannelManager { private static final Logger channelManagerAudit = Logger.getLogger(ChannelManager.class.getName() + ".audit"); @@ -71,105 +58,28 @@ public class ChannelManager { @Autowired ChannelProcessorService channelProcessorService; - @Operation( - summary = "Query channels", - description = - "Query a collection of Channel instances based on tags, property values, and channel names.", - operationId = "queryChannels", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "List of channels", - content = - @Content(array = @ArraySchema(schema = @Schema(implementation = Channel.class)))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to find all channels", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping + @Override public List query( @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam MultiValueMap allRequestParams) { return channelRepository.search(allRequestParams).channels(); } - @Operation( - summary = "Combined query for channels", - description = - "Query for a collection of Channel instances and get a count and the first 10k hits.", - operationId = "combinedQueryChannels", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "The number of matches for the query, and the first 10k channels", - content = - @Content( - array = @ArraySchema(schema = @Schema(implementation = SearchResult.class)))), - @ApiResponse( - responseCode = "400", - description = "Invalid request - response size exceeded", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to find all channels", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping("/combined") + @Override public SearchResult combinedQuery( @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam MultiValueMap allRequestParams) { return channelRepository.search(allRequestParams); } - @Operation( - summary = "Count channels matching query", - description = "Get the number of channels matching the given query parameters.", - operationId = "countChannels", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "The number of channels matching the query", - content = @Content(schema = @Schema(implementation = Long.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to count the result for channel-query", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping("/count") + @Override public long queryCount( @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam MultiValueMap allRequestParams) { return channelRepository.count(allRequestParams); } - @Operation( - summary = "Get channel by name", - description = "Retrieve a Channel instance by its name.", - operationId = "getChannelByName", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Channel with the specified name", - content = @Content(schema = @Schema(implementation = Channel.class))), - @ApiResponse( - responseCode = "404", - description = "Channel not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping("/{channelName}") + @Override public Channel read(@PathVariable("channelName") String channelName) { channelManagerAudit.log( Level.INFO, () -> MessageFormat.format(TextUtil.FIND_CHANNEL, channelName)); @@ -183,35 +93,7 @@ public Channel read(@PathVariable("channelName") String channelName) { } } - @Operation( - summary = "Create or replace a channel", - description = "Create or replace a channel instance identified by the payload.", - operationId = "createOrReplaceChannel", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "The created/replaced channel", - content = @Content(schema = @Schema(implementation = Channel.class))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Channel, Tag, or property not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to create channel", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping("/{channelName}") + @Override public Channel create( @PathVariable("channelName") String channelName, @RequestBody Channel channel) { // check if authorized role @@ -263,36 +145,7 @@ public Channel create( } } - @Operation( - summary = "Create or replace multiple channels", - description = "Create or replace multiple channel instances.", - operationId = "createOrReplaceChannels", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "The created/replaced channels", - content = - @Content(array = @ArraySchema(schema = @Schema(implementation = Channel.class)))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Tag, or property not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to create channels", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping + @Override public Iterable create(@RequestBody Iterable channels) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -383,36 +236,7 @@ private void resetOwnersToExisting(Iterable channels) { } } - @Operation( - summary = "Update a channel", - description = - "Merge properties and tags of the channel identified by the payload into an existing channel.", - operationId = "updateChannel", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "The updated channel", - content = @Content(schema = @Schema(implementation = Channel.class))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Channel, Tag, or property not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to update channel", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PostMapping("/{channelName}") + @Override public Channel update( @PathVariable("channelName") String channelName, @RequestBody Channel channel) { if (authorizationService.isAuthorizedRole( @@ -482,36 +306,7 @@ public Channel update( } } - @Operation( - summary = "Update multiple channels", - description = - "Merge properties and tags of the channels identified by the payload into existing channels.", - operationId = "updateChannels", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "The updated channels", - content = @Content(schema = @Schema(implementation = Channel.class))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Channel not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to update channels", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PostMapping() + @Override public Iterable update(@RequestBody Iterable channels) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -571,28 +366,7 @@ public Iterable update(@RequestBody Iterable channels) { } } - @Operation( - summary = "Delete a channel", - description = "Delete a channel instance identified by its name.", - operationId = "deleteChannel", - tags = {"Channel"}) - @ApiResponses( - value = { - @ApiResponse(responseCode = "200", description = "Channel deleted"), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Channel not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to delete channel", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @DeleteMapping("/{channelName}") + @Override public void remove(@PathVariable("channelName") String channelName) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -630,6 +404,7 @@ public void remove(@PathVariable("channelName") String channelName) { * * @param channel channel to be validated */ + @Override public void validateChannelRequest(Channel channel) { // 1 checkAndThrow( @@ -705,6 +480,7 @@ private static void checkAndThrow( * * @param channels list of channels to be validated */ + @Override public void validateChannelRequest(Iterable channels) { List existingProperties = StreamSupport.stream(propertyRepository.findAll().spliterator(), true) diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java index 1d94837..a9c02c3 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java @@ -1,21 +1,15 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.common.CFResourceDescriptors.CHANNEL_PROCESSOR_RESOURCE_URI; import static org.phoebus.channelfinder.common.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; -import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import org.phoebus.channelfinder.processors.ChannelProcessorInfo; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; +import org.phoebus.channelfinder.processors.ChannelProcessorInfo; +import org.phoebus.channelfinder.rest.api.IChannelScroll; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.ChannelProcessorService; import org.springframework.beans.factory.annotation.Autowired; @@ -25,18 +19,15 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @RestController -@RequestMapping(CHANNEL_PROCESSOR_RESOURCE_URI) @EnableAutoConfiguration -public class ChannelProcessorManager { +public class ChannelProcessorManager + implements org.phoebus.channelfinder.rest.api.IChannelProcessorManager { private static final Logger logger = Logger.getLogger(ChannelProcessorManager.class.getName()); @@ -44,66 +35,22 @@ public class ChannelProcessorManager { @Autowired AuthorizationService authorizationService; // TODO replace with PIT and search_after - @Autowired ChannelScroll channelScroll; + @Autowired IChannelScroll channelScroll; @Value("${elasticsearch.query.size:10000}") private int defaultMaxSize; - @Operation( - summary = "Get processor count", - description = "Returns the number of channel processors.", - operationId = "getProcessorCount", - tags = {"ChannelProcessor"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Number of channel-processors", - content = @Content(schema = @Schema(implementation = Long.class))) - }) - @GetMapping("/count") + @Override public long processorCount() { return channelProcessorService.getProcessorCount(); } - @Operation( - summary = "Get processor info", - description = "Returns information about all channel processors.", - operationId = "getProcessorInfo", - tags = {"ChannelProcessor"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "List of processor-info", - content = - @Content( - array = - @ArraySchema( - schema = @Schema(implementation = ChannelProcessorInfo.class)))) - }) - @GetMapping("/processors") + @Override public List processorInfo() { return channelProcessorService.getProcessorsInfo(); } - @Operation( - summary = "Process all channels", - description = "Manually trigger processing on all channels in ChannelFinder.", - operationId = "processAllChannels", - tags = {"ChannelProcessor"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Number of channels where processor was called", - content = @Content(schema = @Schema(implementation = Long.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping("/process/all") + @Override public long processAllChannels() { logger.log(Level.INFO, "Calling processor on ALL channels in ChannelFinder"); // Only allow authorized users to trigger this operation @@ -124,19 +71,7 @@ public long processAllChannels() { } } - @Operation( - summary = "Process channels by query", - description = "Manually trigger processing on channels matching the given query.", - operationId = "processChannelsByQuery", - tags = {"ChannelProcessor"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Number of channels where processor was called", - content = @Content(schema = @Schema(implementation = Long.class))) - }) - @PutMapping("/process/query") + @Override public long processChannels( @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam MultiValueMap allRequestParams) { @@ -152,16 +87,12 @@ public long processChannels( return channelCount; } - @PutMapping("/process/channels") + @Override public void processChannels(List channels) { channelProcessorService.sendToProcessors(channels); } - @Operation(summary = "Set if the processor is enabled or not") - @PutMapping( - value = "/processor/{processorName}/enabled", - produces = {"application/json"}, - consumes = {"application/json"}) + @Override public void setProcessorEnabled( @PathVariable("processorName") String processorName, @Parameter(description = "Value of enabled to set, default value: true") diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java index e8a9d7c..3380cbc 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java @@ -1,7 +1,5 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.common.CFResourceDescriptors.SCROLL_RESOURCE_URI; - import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.FieldSort; import co.elastic.clients.elasticsearch._types.FieldValue; @@ -10,12 +8,7 @@ import co.elastic.clients.elasticsearch.core.SearchRequest; import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.elasticsearch.core.search.Hit; -import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.text.MessageFormat; import java.util.Comparator; import java.util.List; @@ -35,18 +28,15 @@ import org.springframework.http.HttpStatus; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @CrossOrigin @RestController -@RequestMapping(SCROLL_RESOURCE_URI) @EnableAutoConfiguration -public class ChannelScroll { +public class ChannelScroll implements org.phoebus.channelfinder.rest.api.IChannelScroll { private static final Logger logger = Logger.getLogger(ChannelScroll.class.getName()); @@ -56,47 +46,14 @@ public class ChannelScroll { @Qualifier("indexClient") ElasticsearchClient client; - @Operation( - summary = "Scroll query for channels", - description = "Retrieve a collection of Channel instances based on multi-parameter search.", - operationId = "scrollQueryChannels", - tags = {"ChannelScroll"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Scroll that contains a collection of channel instances", - content = @Content(schema = @Schema(implementation = Scroll.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to list channels", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping + @Override public Scroll query( @Parameter(description = CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION) @RequestParam MultiValueMap allRequestParams) { return search(null, allRequestParams); } - @Operation( - summary = "Scroll query by scrollId", - description = - "Retrieve a collection of Channel instances using a scrollId and search parameters.", - operationId = "scrollQueryById", - tags = {"ChannelScroll"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Scroll List of channels", - content = @Content(schema = @Schema(implementation = Scroll.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to list channels", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping("/{scrollId}") + @Override public Scroll query( @Parameter(description = "Scroll ID from previous query") @PathVariable("scrollId") String scrollId, @@ -119,6 +76,7 @@ public Scroll query( * @param searchParameters - search parameters for scrolling searches * @return search scroll */ + @Override public Scroll search(String scrollId, MultiValueMap searchParameters) { BoolQuery.Builder boolQuery = new BoolQuery.Builder(); int size = esService.getES_QUERY_SIZE(); diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java index 684f83d..43e57ca 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java @@ -1,18 +1,11 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.common.CFResourceDescriptors.CF_SERVICE_INFO; - import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchVersionInfo; import co.elastic.clients.elasticsearch.core.InfoResponse; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map; @@ -23,15 +16,12 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @CrossOrigin @RestController -@RequestMapping(CF_SERVICE_INFO) @EnableAutoConfiguration -public class InfoManager { +public class InfoManager implements org.phoebus.channelfinder.rest.api.IInfoManager { @Value("${channelfinder.version:4.7.0}") private String version; @@ -41,20 +31,7 @@ public class InfoManager { private static final ObjectMapper objectMapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); - @Operation( - summary = "Get ChannelFinder service info", - description = - "Returns information about the ChannelFinder service and its Elasticsearch backend.", - operationId = "getServiceInfo", - tags = {"Info"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "ChannelFinder info", - content = @Content(schema = @Schema(implementation = String.class))) - }) - @GetMapping + @Override public String info() { Map cfServiceInfo = new LinkedHashMap<>(); diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java index 1de0ce7..8369b16 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java @@ -1,14 +1,6 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.common.CFResourceDescriptors.PROPERTY_RESOURCE_URI; - import com.google.common.collect.Lists; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; @@ -32,22 +24,16 @@ import org.springframework.http.HttpStatus; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @CrossOrigin @RestController -@RequestMapping(PROPERTY_RESOURCE_URI) @EnableAutoConfiguration -public class PropertyManager { +public class PropertyManager implements org.phoebus.channelfinder.rest.api.IPropertyManager { private static final Logger propertyManagerAudit = Logger.getLogger(PropertyManager.class.getName() + ".audit"); @@ -61,45 +47,12 @@ public class PropertyManager { @Autowired AuthorizationService authorizationService; - @Operation( - summary = "List all properties", - description = "Retrieve the list of all properties in the database.", - operationId = "listProperties", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "List of properties", - content = - @Content(array = @ArraySchema(schema = @Schema(implementation = Property.class)))), - @ApiResponse( - responseCode = "500", - description = "Error while listing properties", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping + @Override public Iterable list() { return propertyRepository.findAll(); } - @Operation( - summary = "Get property by name", - description = "Retrieve a property by its name. Optionally include its channels.", - operationId = "getPropertyByName", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Fetch property by propertyName", - content = @Content(schema = @Schema(implementation = Property.class))), - @ApiResponse( - responseCode = "404", - description = "Property not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping("/{propertyName}") + @Override public Property read( @PathVariable("propertyName") String propertyName, @RequestParam(value = "withChannels", defaultValue = "true") boolean withChannels) { @@ -121,31 +74,7 @@ public Property read( } } - @Operation( - summary = "Create or update a property", - description = "Create and exclusively update the property identified by the path parameter.", - operationId = "createOrUpdateProperty", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Property created", - content = @Content(schema = @Schema(implementation = Property.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Property not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to create property", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping("/{propertyName}") + @Override public Property create( @PathVariable("propertyName") String propertyName, @RequestBody Property property) { // check if authorized role @@ -197,27 +126,7 @@ public Property create( } } - @Operation( - summary = "Create multiple properties", - description = "Create multiple properties in a single request.", - operationId = "createMultipleProperties", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Properties created", - content = @Content(schema = @Schema(implementation = Property.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to create properties", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping() + @Override public Iterable create(@RequestBody Iterable properties) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -272,36 +181,7 @@ public Iterable create(@RequestBody Iterable properties) { } } - @Operation( - summary = "Add property to a single channel", - description = - "Add the property identified by propertyName to the channel identified by channelName.", - operationId = "addPropertyToChannel", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Property added to the channel", - content = @Content(schema = @Schema(implementation = Property.class))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Property-, or Channel-name does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to add property", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping("/{propertyName}/{channelName}") + @Override public Property addSingle( @PathVariable("propertyName") String propertyName, @PathVariable("channelName") String channelName, @@ -354,36 +234,7 @@ public Property addSingle( } } - @Operation( - summary = "Update a property", - description = - "Update the property identified by the path parameter, adding it to all channels in the payload.", - operationId = "updateProperty", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Property updated", - content = @Content(schema = @Schema(implementation = Property.class))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Property does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to update property", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PostMapping("/{propertyName}") + @Override public Property update( @PathVariable("propertyName") String propertyName, @RequestBody Property property) { // check if authorized role @@ -476,36 +327,7 @@ public Property update( return updatedProperty; } - @Operation( - summary = "Update multiple properties", - description = "Update multiple properties and all appropriate channels.", - operationId = "updateMultipleProperties", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Properties updated", - content = - @Content(array = @ArraySchema(schema = @Schema(implementation = Property.class)))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Property does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to update properties", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PostMapping() + @Override public Iterable update(@RequestBody Iterable properties) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -601,28 +423,7 @@ private void checkPropertyAuthorization(Optional existingProperty) { } } - @Operation( - summary = "Delete a property", - description = "Delete the property identified by the path parameter from all channels.", - operationId = "deleteProperty", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse(responseCode = "200", description = "Property deleted"), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Property does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to delete property", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @DeleteMapping("/{propertyName}") + @Override public void remove(@PathVariable("propertyName") String propertyName) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -652,29 +453,7 @@ public void remove(@PathVariable("propertyName") String propertyName) { } } - @Operation( - summary = "Delete property from a channel", - description = - "Delete the property identified by propertyName from the channel identified by channelName.", - operationId = "deletePropertyFromChannel", - tags = {"Property"}) - @ApiResponses( - value = { - @ApiResponse(responseCode = "200", description = "Property deleted from the channel"), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Property does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to delete property from a channel", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @DeleteMapping("/{propertyName}/{channelName}") + @Override public void removeSingle( @PathVariable("propertyName") final String propertyName, @PathVariable("channelName") String channelName) { @@ -723,6 +502,7 @@ public void removeSingle( * * @param property validate property */ + @Override public void validatePropertyRequest(Property property) { // 1 if (property.getName() == null || property.getName().isEmpty()) { @@ -777,6 +557,7 @@ public void validatePropertyRequest(Property property) { * * @param properties properties to be validated */ + @Override public void validatePropertyRequest(Iterable properties) { for (Property property : properties) { validatePropertyRequest(property); @@ -788,6 +569,7 @@ public void validatePropertyRequest(Iterable properties) { * * @param channelName check channel exists */ + @Override public void validatePropertyRequest(String channelName) { if (!channelRepository.existsById(channelName)) { String message = MessageFormat.format(TextUtil.CHANNEL_NAME_DOES_NOT_EXIST, channelName); diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java index 9e57cac..ed0c17b 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java @@ -1,14 +1,6 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.common.CFResourceDescriptors.TAG_RESOURCE_URI; - import com.google.common.collect.Lists; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; @@ -32,22 +24,16 @@ import org.springframework.http.HttpStatus; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @CrossOrigin @RestController -@RequestMapping(TAG_RESOURCE_URI) @EnableAutoConfiguration -public class TagManager { +public class TagManager implements org.phoebus.channelfinder.rest.api.ITagManager { private static final Logger tagManagerAudit = Logger.getLogger(TagManager.class.getName() + ".audit"); @@ -59,44 +45,12 @@ public class TagManager { @Autowired AuthorizationService authorizationService; - @Operation( - summary = "List all tags", - description = "Retrieve the list of all tags in the database.", - operationId = "listTags", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "List all Tags", - content = @Content(array = @ArraySchema(schema = @Schema(implementation = Tag.class)))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to list all Tags", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping + @Override public Iterable list() { return tagRepository.findAll(); } - @Operation( - summary = "Get tag by name", - description = "Retrieve a tag by its name. Optionally include its channels.", - operationId = "getTagByName", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Finding Tag by tagName", - content = @Content(schema = @Schema(implementation = Tag.class))), - @ApiResponse( - responseCode = "404", - description = "Tag not found", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @GetMapping("/{tagName}") + @Override public Tag read( @PathVariable("tagName") String tagName, @RequestParam(value = "withChannels", defaultValue = "true") boolean withChannels) { @@ -123,35 +77,7 @@ public Tag read( } } - @Operation( - summary = "Create or update a tag", - description = "Create and exclusively update the tag identified by the path parameter.", - operationId = "createOrUpdateTag", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Tag created and updated", - content = @Content(schema = @Schema(implementation = Tag.class))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Tag-, or Channel-name does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to create/update Tag", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping("/{tagName}") + @Override public Tag create(@PathVariable("tagName") String tagName, @RequestBody Tag tag) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -207,35 +133,7 @@ public Tag create(@PathVariable("tagName") String tagName, @RequestBody Tag tag) } } - @Operation( - summary = "Create multiple tags", - description = "Create multiple tags in a single request.", - operationId = "createMultipleTags", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Tags created", - content = @Content(array = @ArraySchema(schema = @Schema(implementation = Tag.class)))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Tag-, or Channel-name does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while trying to create Tags", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping() + @Override public Iterable create(@RequestBody Iterable tags) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -311,35 +209,7 @@ public Iterable create(@RequestBody Iterable tags) { } } - @Operation( - summary = "Add tag to a single channel", - description = "Add the tag identified by tagName to the channel identified by channelName.", - operationId = "addTagToChannel", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Tags added to a single channel", - content = @Content(schema = @Schema(implementation = Tag.class))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Tag-, or Channel-name does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Tag creational error", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PutMapping("/{tagName}/{channelName}") + @Override public Tag addSingle( @PathVariable("tagName") String tagName, @PathVariable("channelName") String channelName) { // check if authorized role @@ -384,36 +254,7 @@ public Tag addSingle( } } - @Operation( - summary = "Update a tag", - description = - "Update the tag identified by the path parameter, adding it to all channels in the payload.", - operationId = "updateTag", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Tag updated", - content = @Content(schema = @Schema(implementation = Tag.class))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Tag name does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Tag update error", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PostMapping("/{tagName}") + @Override public Tag update(@PathVariable("tagName") String tagName, @RequestBody Tag tag) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -489,36 +330,7 @@ public Tag update(@PathVariable("tagName") String tagName, @RequestBody Tag tag) } } - @Operation( - summary = "Update multiple tags", - description = - "Update multiple tags and all appropriate channels. The operation will fail if any of the specified channels do not exist.", - operationId = "updateMultipleTags", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "Tags updated", - content = @Content(array = @ArraySchema(schema = @Schema(implementation = Tag.class)))), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Tag-, or Channel-name does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Error while updating tags", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @PostMapping() + @Override public Iterable update(@RequestBody Iterable tags) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -587,32 +399,7 @@ public Iterable update(@RequestBody Iterable tags) { } } - @Operation( - summary = "Delete a tag", - description = "Delete the tag identified by the path parameter from all channels.", - operationId = "deleteTag", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse(responseCode = "200", description = "Tag deleted"), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Tag does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Tag creational error", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @DeleteMapping("/{tagName}") + @Override public void remove(@PathVariable("tagName") String tagName) { // check if authorized role if (authorizationService.isAuthorizedRole( @@ -641,33 +428,7 @@ public void remove(@PathVariable("tagName") String tagName) { } } - @Operation( - summary = "Delete tag from a channel", - description = - "Delete the tag identified by tagName from the channel identified by channelName.", - operationId = "deleteTagFromChannel", - tags = {"Tag"}) - @ApiResponses( - value = { - @ApiResponse(responseCode = "200", description = "Tag deleted from the desired channel"), - @ApiResponse( - responseCode = "400", - description = "Invalid request", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "401", - description = "Unauthorized", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "404", - description = "Tag does not exist", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))), - @ApiResponse( - responseCode = "500", - description = "Tag creational error", - content = @Content(schema = @Schema(implementation = ResponseStatusException.class))) - }) - @DeleteMapping("/{tagName}/{channelName}") + @Override public void removeSingle( @PathVariable("tagName") final String tagName, @PathVariable("channelName") String channelName) { @@ -719,6 +480,7 @@ public void removeSingle( * * @param tags the list of tags to be validated */ + @Override public void validateTagRequest(Iterable tags) { for (Tag tag : tags) { validateTagRequest(tag); @@ -736,6 +498,7 @@ public void validateTagRequest(Iterable tags) { * * @param tag the tag to be validates */ + @Override public void validateTagRequest(Tag tag) { // 1 if (tag.getName() == null || tag.getName().isEmpty()) { @@ -767,6 +530,7 @@ public void validateTagRequest(Tag tag) { * * @param channelName check channel exists */ + @Override public void validateTagWithChannelRequest(String channelName) { if (!channelRepository.existsById(channelName)) { String message = MessageFormat.format(TextUtil.CHANNEL_NAME_DOES_NOT_EXIST, channelName); diff --git a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java index 64376f7..42467ac 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java @@ -20,6 +20,7 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.api.IChannelManager; import org.phoebus.channelfinder.rest.controller.ChannelManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -33,7 +34,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class ChannelManagerIT { - @Autowired ChannelManager channelManager; + @Autowired IChannelManager channelManager; @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java index 3793a59..88c7607 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java @@ -12,6 +12,7 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.api.IChannelScroll; import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -24,7 +25,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class ChannelScrollIT { - @Autowired ChannelScroll channelScroll; + @Autowired IChannelScroll channelScroll; @Autowired ChannelRepository channelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java index 9766704..8e7dcf6 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java @@ -14,6 +14,7 @@ import org.phoebus.channelfinder.entity.Scroll; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.api.IChannelScroll; import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -28,7 +29,7 @@ class ChannelScrollSearchIT { private static final Logger logger = Logger.getLogger(ChannelScrollSearchIT.class.getName()); - @Autowired ChannelScroll channelScroll; + @Autowired IChannelScroll channelScroll; @Autowired TagRepository tagRepository; @Autowired PropertyRepository propertyRepository; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java index 303a5cb..5038bf2 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java @@ -17,6 +17,7 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.api.IChannelManager; import org.phoebus.channelfinder.rest.controller.ChannelManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -30,7 +31,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class ChannelValidationIT { - @Autowired ChannelManager channelManager; + @Autowired IChannelManager channelManager; @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java b/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java index 5c0cb56..89f428f 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java @@ -21,6 +21,7 @@ import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.rest.api.IPropertyManager; import org.phoebus.channelfinder.rest.controller.PropertyManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -36,7 +37,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class PropertyManagerIT { - @Autowired PropertyManager propertyManager; + @Autowired IPropertyManager propertyManager; @Autowired PropertyRepository propertyRepository; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java index befa5e6..0661d26 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java @@ -14,6 +14,7 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.rest.api.IPropertyManager; import org.phoebus.channelfinder.rest.controller.PropertyManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -27,7 +28,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class PropertyValidationIT { - @Autowired PropertyManager propertyManager; + @Autowired IPropertyManager propertyManager; @Autowired ChannelRepository channelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java b/src/test/java/org/phoebus/channelfinder/TagManagerIT.java index e505298..9661f61 100644 --- a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagManagerIT.java @@ -21,6 +21,7 @@ import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.api.ITagManager; import org.phoebus.channelfinder.rest.controller.TagManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -38,7 +39,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class TagManagerIT { - @Autowired TagManager tagManager; + @Autowired ITagManager tagManager; @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java index 44fcedc..d834b1c 100644 --- a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java @@ -13,6 +13,7 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.rest.api.ITagManager; import org.phoebus.channelfinder.rest.controller.TagManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -26,7 +27,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class TagValidationIT { - @Autowired TagManager tagManager; + @Autowired ITagManager tagManager; @Autowired ElasticConfig esService; @Autowired ChannelRepository channelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java index 9b33ffa..3113711 100644 --- a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java +++ b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java @@ -16,12 +16,12 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.phoebus.channelfinder.common.NTXmlUtil; -import org.phoebus.channelfinder.rest.controller.ChannelManager; -import org.phoebus.channelfinder.rest.controller.PropertyManager; -import org.phoebus.channelfinder.rest.controller.TagManager; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; +import org.phoebus.channelfinder.rest.api.IChannelManager; +import org.phoebus.channelfinder.rest.api.IPropertyManager; +import org.phoebus.channelfinder.rest.api.ITagManager; import org.phoebus.channelfinder.service.ChannelFinderEpicsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -61,11 +61,11 @@ public static void cleanup() { pvaClient.getChannel(ChannelFinderEpicsService.SERVICE_DESC); ; - @Autowired ChannelManager channelManager; + @Autowired IChannelManager channelManager; - @Autowired PropertyManager propertyManager; + @Autowired IPropertyManager propertyManager; - @Autowired TagManager tagManager; + @Autowired ITagManager tagManager; @Test void testRPCService() throws ExecutionException, InterruptedException, TimeoutException { diff --git a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java index 8a43960..367c9a4 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java @@ -10,9 +10,9 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; import org.phoebus.channelfinder.common.CFResourceDescriptors; -import org.phoebus.channelfinder.rest.controller.ChannelProcessorManager; -import org.phoebus.channelfinder.rest.controller.ChannelScroll; import org.phoebus.channelfinder.entity.Scroll; +import org.phoebus.channelfinder.rest.api.IChannelScroll; +import org.phoebus.channelfinder.rest.controller.ChannelProcessorManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -34,7 +34,7 @@ class ChannelProcessorManagerIT { "Basic " + Base64Utils.encodeToString("admin:adminPass".getBytes()); @Autowired protected MockMvc mockMvc; - @MockBean ChannelScroll channelScroll; + @MockBean IChannelScroll channelScroll; @Test void testProcessorCount() throws Exception { From afaf8a395e172a1557763fa123fe7c22e6d19394 Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Thu, 4 Dec 2025 10:57:23 +0100 Subject: [PATCH 07/13] Refactor archiver packages - Move classes into corresponding packages --- .../java/org/phoebus/channelfinder/Application.java | 2 +- .../aa => configuration}/AAChannelProcessor.java | 9 ++++++--- .../ChannelProcessor.java | 3 ++- .../rest/api/IChannelProcessorManager.java | 2 +- .../rest/controller/ChannelProcessorManager.java | 2 +- .../{processors/aa => service}/ArchiverClient.java | 12 +++++++----- .../service/ChannelProcessorService.java | 4 ++-- .../model/archiver}/ChannelProcessorInfo.java | 2 +- .../model/archiver}/aa/ArchiveAction.java | 2 +- .../model/archiver}/aa/ArchivePVOptions.java | 2 +- .../model/archiver}/aa/ArchiverInfo.java | 2 +- ...ebus.channelfinder.configuration.ChannelProcessor | 1 + ...phoebus.channelfinder.processors.ChannelProcessor | 1 - .../processors/ChannelProcessorServiceTest.java | 2 ++ .../processors/aa/AAChannelProcessorIT.java | 3 ++- .../aa/AAChannelProcessorMultiArchiverIT.java | 2 ++ .../processors/aa/AAChannelProcessorMultiIT.java | 2 ++ .../processors/aa/AAChannelProcessorNoDefaultIT.java | 1 + .../processors/aa/AAChannelProcessorNoPauseIT.java | 1 + .../aa/AAChannelProcessorStatusPauseIT.java | 1 + .../processors/aa/AAChannelProcessorTagPauseIT.java | 1 + .../processors/aa/AAChannelProcessorTest.java | 1 + 22 files changed, 38 insertions(+), 20 deletions(-) rename src/main/java/org/phoebus/channelfinder/{processors/aa => configuration}/AAChannelProcessor.java (96%) rename src/main/java/org/phoebus/channelfinder/{processors => configuration}/ChannelProcessor.java (72%) rename src/main/java/org/phoebus/channelfinder/{processors/aa => service}/ArchiverClient.java (95%) rename src/main/java/org/phoebus/channelfinder/{processors => service/model/archiver}/ChannelProcessorInfo.java (68%) rename src/main/java/org/phoebus/channelfinder/{processors => service/model/archiver}/aa/ArchiveAction.java (83%) rename src/main/java/org/phoebus/channelfinder/{processors => service/model/archiver}/aa/ArchivePVOptions.java (97%) rename src/main/java/org/phoebus/channelfinder/{processors => service/model/archiver}/aa/ArchiverInfo.java (66%) create mode 100644 src/main/resources/META-INF/services/org.phoebus.channelfinder.configuration.ChannelProcessor delete mode 100644 src/main/resources/META-INF/services/org.phoebus.channelfinder.processors.ChannelProcessor diff --git a/src/main/java/org/phoebus/channelfinder/Application.java b/src/main/java/org/phoebus/channelfinder/Application.java index 9330b98..0d7716d 100644 --- a/src/main/java/org/phoebus/channelfinder/Application.java +++ b/src/main/java/org/phoebus/channelfinder/Application.java @@ -21,8 +21,8 @@ import java.util.ServiceLoader; import java.util.logging.Level; import java.util.logging.Logger; +import org.phoebus.channelfinder.configuration.ChannelProcessor; import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; -import org.phoebus.channelfinder.processors.ChannelProcessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; diff --git a/src/main/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessor.java b/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java similarity index 96% rename from src/main/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessor.java rename to src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java index c4de947..45b8211 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessor.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.processors.aa; +package org.phoebus.channelfinder.configuration; import com.fasterxml.jackson.core.JsonProcessingException; import java.util.ArrayList; @@ -14,8 +14,11 @@ import org.apache.commons.lang3.StringUtils; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; -import org.phoebus.channelfinder.processors.ChannelProcessor; -import org.phoebus.channelfinder.processors.ChannelProcessorInfo; +import org.phoebus.channelfinder.service.ArchiverClient; +import org.phoebus.channelfinder.service.model.archiver.ChannelProcessorInfo; +import org.phoebus.channelfinder.service.model.archiver.aa.ArchiveAction; +import org.phoebus.channelfinder.service.model.archiver.aa.ArchivePVOptions; +import org.phoebus.channelfinder.service.model.archiver.aa.ArchiverInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessor.java b/src/main/java/org/phoebus/channelfinder/configuration/ChannelProcessor.java similarity index 72% rename from src/main/java/org/phoebus/channelfinder/processors/ChannelProcessor.java rename to src/main/java/org/phoebus/channelfinder/configuration/ChannelProcessor.java index 7f9e82d..c5519ca 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessor.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/ChannelProcessor.java @@ -1,8 +1,9 @@ -package org.phoebus.channelfinder.processors; +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; public interface ChannelProcessor { diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java index 06024fb..9a04200 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java @@ -12,7 +12,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.util.List; import org.phoebus.channelfinder.entity.Channel; -import org.phoebus.channelfinder.processors.ChannelProcessorInfo; +import org.phoebus.channelfinder.service.model.archiver.ChannelProcessorInfo; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java index a9c02c3..2a38711 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java @@ -8,10 +8,10 @@ import java.util.logging.Logger; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; -import org.phoebus.channelfinder.processors.ChannelProcessorInfo; import org.phoebus.channelfinder.rest.api.IChannelScroll; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.ChannelProcessorService; +import org.phoebus.channelfinder.service.model.archiver.ChannelProcessorInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; diff --git a/src/main/java/org/phoebus/channelfinder/processors/aa/ArchiverClient.java b/src/main/java/org/phoebus/channelfinder/service/ArchiverClient.java similarity index 95% rename from src/main/java/org/phoebus/channelfinder/processors/aa/ArchiverClient.java rename to src/main/java/org/phoebus/channelfinder/service/ArchiverClient.java index ee7edd6..17772fa 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/aa/ArchiverClient.java +++ b/src/main/java/org/phoebus/channelfinder/service/ArchiverClient.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.processors.aa; +package org.phoebus.channelfinder.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; @@ -16,6 +16,8 @@ import java.util.stream.IntStream; import java.util.stream.Stream; import org.apache.commons.lang3.StringUtils; +import org.phoebus.channelfinder.service.model.archiver.aa.ArchiveAction; +import org.phoebus.channelfinder.service.model.archiver.aa.ArchivePVOptions; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; @@ -50,7 +52,7 @@ private Stream> partitionSet(Set pvSet, int pageSize) { .mapToObj(i -> list.subList(i * pageSize, Math.min(pageSize * (i + 1), list.size()))); } - List> getStatuses( + public List> getStatuses( Map archivePVS, String archiverURL, String archiverAlias) { Set pvs = archivePVS.keySet(); Boolean postSupportOverride = postSupportArchivers.contains(archiverAlias); @@ -158,7 +160,7 @@ private void submitAction(String values, String endpoint, String aaURL) { } } - long configureAA(Map> archivePVS, String aaURL) + public long configureAA(Map> archivePVS, String aaURL) throws JsonProcessingException { logger.log( Level.INFO, () -> String.format("Configure PVs %s in %s", archivePVS.toString(), aaURL)); @@ -207,7 +209,7 @@ long configureAA(Map> archivePVS, String a return count; } - List getAAPolicies(String aaURL) { + public List getAAPolicies(String aaURL) { if (StringUtils.isEmpty(aaURL)) { return List.of(); } @@ -231,7 +233,7 @@ List getAAPolicies(String aaURL) { } } - String getVersion(String archiverURL) { + public String getVersion(String archiverURL) { try { String uriString = archiverURL + ARCHIVER_VERSIONS_RESOURCE; String response = diff --git a/src/main/java/org/phoebus/channelfinder/service/ChannelProcessorService.java b/src/main/java/org/phoebus/channelfinder/service/ChannelProcessorService.java index 43cd73f..26b62dc 100644 --- a/src/main/java/org/phoebus/channelfinder/service/ChannelProcessorService.java +++ b/src/main/java/org/phoebus/channelfinder/service/ChannelProcessorService.java @@ -8,9 +8,9 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; +import org.phoebus.channelfinder.configuration.ChannelProcessor; import org.phoebus.channelfinder.entity.Channel; -import org.phoebus.channelfinder.processors.ChannelProcessor; -import org.phoebus.channelfinder.processors.ChannelProcessorInfo; +import org.phoebus.channelfinder.service.model.archiver.ChannelProcessorInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.task.TaskExecutor; diff --git a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorInfo.java b/src/main/java/org/phoebus/channelfinder/service/model/archiver/ChannelProcessorInfo.java similarity index 68% rename from src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorInfo.java rename to src/main/java/org/phoebus/channelfinder/service/model/archiver/ChannelProcessorInfo.java index a4e77d1..8b48d85 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/ChannelProcessorInfo.java +++ b/src/main/java/org/phoebus/channelfinder/service/model/archiver/ChannelProcessorInfo.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.processors; +package org.phoebus.channelfinder.service.model.archiver; import java.util.Map; diff --git a/src/main/java/org/phoebus/channelfinder/processors/aa/ArchiveAction.java b/src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchiveAction.java similarity index 83% rename from src/main/java/org/phoebus/channelfinder/processors/aa/ArchiveAction.java rename to src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchiveAction.java index d44545b..40d3d4b 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/aa/ArchiveAction.java +++ b/src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchiveAction.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.processors.aa; +package org.phoebus.channelfinder.service.model.archiver.aa; public enum ArchiveAction { ARCHIVE("/archivePV"), diff --git a/src/main/java/org/phoebus/channelfinder/processors/aa/ArchivePVOptions.java b/src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchivePVOptions.java similarity index 97% rename from src/main/java/org/phoebus/channelfinder/processors/aa/ArchivePVOptions.java rename to src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchivePVOptions.java index b483a12..05c6e0d 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/aa/ArchivePVOptions.java +++ b/src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchivePVOptions.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.processors.aa; +package org.phoebus.channelfinder.service.model.archiver.aa; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/src/main/java/org/phoebus/channelfinder/processors/aa/ArchiverInfo.java b/src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchiverInfo.java similarity index 66% rename from src/main/java/org/phoebus/channelfinder/processors/aa/ArchiverInfo.java rename to src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchiverInfo.java index 31219b5..4d43bda 100644 --- a/src/main/java/org/phoebus/channelfinder/processors/aa/ArchiverInfo.java +++ b/src/main/java/org/phoebus/channelfinder/service/model/archiver/aa/ArchiverInfo.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.processors.aa; +package org.phoebus.channelfinder.service.model.archiver.aa; import java.util.List; diff --git a/src/main/resources/META-INF/services/org.phoebus.channelfinder.configuration.ChannelProcessor b/src/main/resources/META-INF/services/org.phoebus.channelfinder.configuration.ChannelProcessor new file mode 100644 index 0000000..c1948c9 --- /dev/null +++ b/src/main/resources/META-INF/services/org.phoebus.channelfinder.configuration.ChannelProcessor @@ -0,0 +1 @@ +org.phoebus.channelfinder.configuration.AAChannelProcessor \ No newline at end of file diff --git a/src/main/resources/META-INF/services/org.phoebus.channelfinder.processors.ChannelProcessor b/src/main/resources/META-INF/services/org.phoebus.channelfinder.processors.ChannelProcessor deleted file mode 100644 index 1f2d383..0000000 --- a/src/main/resources/META-INF/services/org.phoebus.channelfinder.processors.ChannelProcessor +++ /dev/null @@ -1 +0,0 @@ -org.phoebus.channelfinder.processors.aa.AAChannelProcessor \ No newline at end of file diff --git a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java index 1447b64..bbd4795 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java +++ b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorServiceTest.java @@ -8,8 +8,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.phoebus.channelfinder.configuration.ChannelProcessor; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.service.ChannelProcessorService; +import org.phoebus.channelfinder.service.model.archiver.ChannelProcessorInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; 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 8fa12e5..665f14c 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorIT.java @@ -19,9 +19,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.phoebus.channelfinder.configuration.AAChannelProcessor; +import org.phoebus.channelfinder.configuration.ChannelProcessor; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; -import org.phoebus.channelfinder.processors.ChannelProcessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; 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 baeb914..763ed5d 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiArchiverIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiArchiverIT.java @@ -24,7 +24,9 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.phoebus.channelfinder.configuration.AAChannelProcessor; import org.phoebus.channelfinder.entity.Channel; +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.test.context.TestPropertySource; 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 dbd2d24..593b2b0 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorMultiIT.java @@ -24,7 +24,9 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.phoebus.channelfinder.configuration.AAChannelProcessor; import org.phoebus.channelfinder.entity.Channel; +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.test.context.TestPropertySource; 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 6912593..8ed2eb0 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoDefaultIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoDefaultIT.java @@ -15,6 +15,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.phoebus.channelfinder.configuration.AAChannelProcessor; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.springframework.beans.factory.annotation.Autowired; 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 adc10c8..aeb0457 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoPauseIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorNoPauseIT.java @@ -15,6 +15,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.phoebus.channelfinder.configuration.AAChannelProcessor; import org.phoebus.channelfinder.entity.Channel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; 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 8888585..5b8fdbb 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorStatusPauseIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorStatusPauseIT.java @@ -15,6 +15,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.phoebus.channelfinder.configuration.AAChannelProcessor; import org.phoebus.channelfinder.entity.Channel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; 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 36d8988..b6b9a83 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTagPauseIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTagPauseIT.java @@ -15,6 +15,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.phoebus.channelfinder.configuration.AAChannelProcessor; import org.phoebus.channelfinder.entity.Channel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; 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 4bbc511..f350855 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTest.java +++ b/src/test/java/org/phoebus/channelfinder/processors/aa/AAChannelProcessorTest.java @@ -11,6 +11,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.phoebus.channelfinder.service.model.archiver.aa.ArchivePVOptions; class AAChannelProcessorTest { From 3836472571e140b06edda0602955c42d33e977e5 Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Thu, 4 Dec 2025 11:03:15 +0100 Subject: [PATCH 08/13] Rename controller classes - Rename controller classes - Rename controller interfaces --- .../api/{IChannelManager.java => IChannel.java} | 2 +- ...ocessorManager.java => IChannelProcessor.java} | 2 +- .../rest/api/{IInfoManager.java => IInfo.java} | 2 +- .../api/{IPropertyManager.java => IProperty.java} | 2 +- .../rest/api/{ITagManager.java => ITag.java} | 2 +- ...ChannelManager.java => ChannelController.java} | 7 ++++--- ...nager.java => ChannelProcessorController.java} | 7 ++++--- ...elScroll.java => ChannelScrollController.java} | 4 ++-- .../{InfoManager.java => InfoController.java} | 3 ++- ...opertyManager.java => PropertyController.java} | 7 ++++--- .../{TagManager.java => TagController.java} | 7 ++++--- ...nelManagerIT.java => ChannelControllerIT.java} | 11 ++++++----- ...rollIT.java => ChannelScrollControllerIT.java} | 6 +++--- ....java => ChannelScrollControllerSearchIT.java} | 8 ++++---- .../channelfinder/ChannelValidationIT.java | 9 +++++---- ...tyManagerIT.java => PropertyControllerIT.java} | 11 ++++++----- .../channelfinder/PropertyValidationIT.java | 9 +++++---- .../{TagManagerIT.java => TagControllerIT.java} | 13 +++++++------ .../phoebus/channelfinder/TagValidationIT.java | 9 +++++---- .../docker/ChannelFinderChannelsIT.java | 4 ++-- .../docker/ChannelFinderPropertiesIT.java | 4 ++-- .../docker/ChannelFinderScrollIT.java | 4 ++-- .../channelfinder/docker/ChannelFinderTagsIT.java | 4 ++-- .../channelfinder/epics/EpicsRPCRequestIT.java | 15 +++++++++------ ...rIT.java => ChannelProcessorControllerIT.java} | 6 +++--- src/test/resources/logging.properties | 2 +- 26 files changed, 87 insertions(+), 73 deletions(-) rename src/main/java/org/phoebus/channelfinder/rest/api/{IChannelManager.java => IChannel.java} (99%) rename src/main/java/org/phoebus/channelfinder/rest/api/{IChannelProcessorManager.java => IChannelProcessor.java} (98%) rename src/main/java/org/phoebus/channelfinder/rest/api/{IInfoManager.java => IInfo.java} (97%) rename src/main/java/org/phoebus/channelfinder/rest/api/{IPropertyManager.java => IProperty.java} (99%) rename src/main/java/org/phoebus/channelfinder/rest/api/{ITagManager.java => ITag.java} (99%) rename src/main/java/org/phoebus/channelfinder/rest/controller/{ChannelManager.java => ChannelController.java} (98%) rename src/main/java/org/phoebus/channelfinder/rest/controller/{ChannelProcessorManager.java => ChannelProcessorController.java} (95%) rename src/main/java/org/phoebus/channelfinder/rest/controller/{ChannelScroll.java => ChannelScrollController.java} (98%) rename src/main/java/org/phoebus/channelfinder/rest/controller/{InfoManager.java => InfoController.java} (96%) rename src/main/java/org/phoebus/channelfinder/rest/controller/{PropertyManager.java => PropertyController.java} (99%) rename src/main/java/org/phoebus/channelfinder/rest/controller/{TagManager.java => TagController.java} (98%) rename src/test/java/org/phoebus/channelfinder/{ChannelManagerIT.java => ChannelControllerIT.java} (99%) rename src/test/java/org/phoebus/channelfinder/{ChannelScrollIT.java => ChannelScrollControllerIT.java} (98%) rename src/test/java/org/phoebus/channelfinder/{ChannelScrollSearchIT.java => ChannelScrollControllerSearchIT.java} (97%) rename src/test/java/org/phoebus/channelfinder/{PropertyManagerIT.java => PropertyControllerIT.java} (99%) rename src/test/java/org/phoebus/channelfinder/{TagManagerIT.java => TagControllerIT.java} (99%) rename src/test/java/org/phoebus/channelfinder/processors/{ChannelProcessorManagerIT.java => ChannelProcessorControllerIT.java} (97%) diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IChannel.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/rest/api/IChannelManager.java rename to src/main/java/org/phoebus/channelfinder/rest/api/IChannel.java index a2ec3ab..9dad009 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IChannel.java @@ -25,7 +25,7 @@ import org.springframework.web.server.ResponseStatusException; @RequestMapping(CHANNEL_RESOURCE_URI) -public interface IChannelManager { +public interface IChannel { @Operation( summary = "Query channels", diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessor.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java rename to src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessor.java index 9a04200..4c25dcf 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IChannelProcessor.java @@ -22,7 +22,7 @@ import org.springframework.web.server.ResponseStatusException; @RequestMapping(CHANNEL_PROCESSOR_RESOURCE_URI) -public interface IChannelProcessorManager { +public interface IChannelProcessor { @Operation( summary = "Get processor count", diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IInfoManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IInfo.java similarity index 97% rename from src/main/java/org/phoebus/channelfinder/rest/api/IInfoManager.java rename to src/main/java/org/phoebus/channelfinder/rest/api/IInfo.java index ee139a6..7c8acf0 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/api/IInfoManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IInfo.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping; @RequestMapping(CF_SERVICE_INFO) -public interface IInfoManager { +public interface IInfo { @Operation( summary = "Get ChannelFinder service info", diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/IPropertyManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/IProperty.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/rest/api/IPropertyManager.java rename to src/main/java/org/phoebus/channelfinder/rest/api/IProperty.java index d51603f..a55b188 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/api/IPropertyManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/api/IProperty.java @@ -20,7 +20,7 @@ import org.springframework.web.server.ResponseStatusException; @RequestMapping(PROPERTY_RESOURCE_URI) -public interface IPropertyManager { +public interface IProperty { @Operation( summary = "List all properties", diff --git a/src/main/java/org/phoebus/channelfinder/rest/api/ITagManager.java b/src/main/java/org/phoebus/channelfinder/rest/api/ITag.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/rest/api/ITagManager.java rename to src/main/java/org/phoebus/channelfinder/rest/api/ITag.java index 1bc074e..570ccb3 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/api/ITagManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/api/ITag.java @@ -20,7 +20,7 @@ import org.springframework.web.server.ResponseStatusException; @RequestMapping(TAG_RESOURCE_URI) -public interface ITagManager { +public interface ITag { @Operation( summary = "List all tags", diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java index d5c3f1c..84da878 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java @@ -22,6 +22,7 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.api.IChannel; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.phoebus.channelfinder.service.ChannelProcessorService; @@ -40,11 +41,11 @@ @CrossOrigin @RestController @EnableAutoConfiguration -public class ChannelManager implements org.phoebus.channelfinder.rest.api.IChannelManager { +public class ChannelController implements IChannel { private static final Logger channelManagerAudit = - Logger.getLogger(ChannelManager.class.getName() + ".audit"); - private static final Logger logger = Logger.getLogger(ChannelManager.class.getName()); + Logger.getLogger(ChannelController.class.getName() + ".audit"); + private static final Logger logger = Logger.getLogger(ChannelController.class.getName()); @Autowired private ServletContext servletContext; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java similarity index 95% rename from src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java index 2a38711..f2162fa 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java @@ -8,6 +8,7 @@ import java.util.logging.Logger; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; +import org.phoebus.channelfinder.rest.api.IChannelProcessor; import org.phoebus.channelfinder.rest.api.IChannelScroll; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.ChannelProcessorService; @@ -26,10 +27,10 @@ @RestController @EnableAutoConfiguration -public class ChannelProcessorManager - implements org.phoebus.channelfinder.rest.api.IChannelProcessorManager { +public class ChannelProcessorController + implements IChannelProcessor { - private static final Logger logger = Logger.getLogger(ChannelProcessorManager.class.getName()); + private static final Logger logger = Logger.getLogger(ChannelProcessorController.class.getName()); @Autowired ChannelProcessorService channelProcessorService; @Autowired AuthorizationService authorizationService; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScrollController.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScrollController.java index 3380cbc..2919f3a 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScroll.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScrollController.java @@ -36,9 +36,9 @@ @CrossOrigin @RestController @EnableAutoConfiguration -public class ChannelScroll implements org.phoebus.channelfinder.rest.api.IChannelScroll { +public class ChannelScrollController implements org.phoebus.channelfinder.rest.api.IChannelScroll { - private static final Logger logger = Logger.getLogger(ChannelScroll.class.getName()); + private static final Logger logger = Logger.getLogger(ChannelScrollController.class.getName()); @Autowired ElasticConfig esService; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoController.java similarity index 96% rename from src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/InfoController.java index 43e57ca..ad1cb65 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/InfoManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoController.java @@ -12,6 +12,7 @@ import java.util.logging.Level; import org.phoebus.channelfinder.Application; import org.phoebus.channelfinder.configuration.ElasticConfig; +import org.phoebus.channelfinder.rest.api.IInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -21,7 +22,7 @@ @CrossOrigin @RestController @EnableAutoConfiguration -public class InfoManager implements org.phoebus.channelfinder.rest.api.IInfoManager { +public class InfoController implements IInfo { @Value("${channelfinder.version:4.7.0}") private String version; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java index 8369b16..d454ae5 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java @@ -17,6 +17,7 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.api.IProperty; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.springframework.beans.factory.annotation.Autowired; @@ -33,11 +34,11 @@ @CrossOrigin @RestController @EnableAutoConfiguration -public class PropertyManager implements org.phoebus.channelfinder.rest.api.IPropertyManager { +public class PropertyController implements IProperty { private static final Logger propertyManagerAudit = - Logger.getLogger(PropertyManager.class.getName() + ".audit"); - private static final Logger logger = Logger.getLogger(PropertyManager.class.getName()); + Logger.getLogger(PropertyController.class.getName() + ".audit"); + private static final Logger logger = Logger.getLogger(PropertyController.class.getName()); @Autowired TagRepository tagRepository; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java b/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java similarity index 98% rename from src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java rename to src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java index ed0c17b..0e4c7fb 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/TagManager.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java @@ -17,6 +17,7 @@ import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.rest.api.ITag; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.AuthorizationService.ROLES; import org.springframework.beans.factory.annotation.Autowired; @@ -33,11 +34,11 @@ @CrossOrigin @RestController @EnableAutoConfiguration -public class TagManager implements org.phoebus.channelfinder.rest.api.ITagManager { +public class TagController implements ITag { private static final Logger tagManagerAudit = - Logger.getLogger(TagManager.class.getName() + ".audit"); - private static final Logger logger = Logger.getLogger(TagManager.class.getName()); + Logger.getLogger(TagController.class.getName() + ".audit"); + private static final Logger logger = Logger.getLogger(TagController.class.getName()); @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java similarity index 99% rename from src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java rename to src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java index 42467ac..b328a6d 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java @@ -20,8 +20,8 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; -import org.phoebus.channelfinder.rest.api.IChannelManager; -import org.phoebus.channelfinder.rest.controller.ChannelManager; +import org.phoebus.channelfinder.rest.api.IChannel; +import org.phoebus.channelfinder.rest.controller.ChannelController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; @@ -29,12 +29,13 @@ import org.springframework.web.server.ResponseStatusException; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@WebMvcTest(ChannelManager.class) +@WebMvcTest(ChannelController.class) @WithMockUser(roles = "CF-ADMINS") @TestPropertySource(value = "classpath:application_test.properties") -class ChannelManagerIT { +class ChannelControllerIT { - @Autowired IChannelManager channelManager; + @Autowired + IChannel channelManager; @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java similarity index 98% rename from src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java rename to src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java index 88c7607..98a0301 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java @@ -13,7 +13,7 @@ import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; import org.phoebus.channelfinder.rest.api.IChannelScroll; -import org.phoebus.channelfinder.rest.controller.ChannelScroll; +import org.phoebus.channelfinder.rest.controller.ChannelScrollController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; @@ -21,9 +21,9 @@ import org.springframework.util.MultiValueMap; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@WebMvcTest(ChannelScroll.class) +@WebMvcTest(ChannelScrollController.class) @TestPropertySource(value = "classpath:application_test.properties") -class ChannelScrollIT { +class ChannelScrollControllerIT { @Autowired IChannelScroll channelScroll; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java similarity index 97% rename from src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java rename to src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java index 8e7dcf6..f5414d3 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollSearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java @@ -15,7 +15,7 @@ import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; import org.phoebus.channelfinder.rest.api.IChannelScroll; -import org.phoebus.channelfinder.rest.controller.ChannelScroll; +import org.phoebus.channelfinder.rest.controller.ChannelScrollController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.context.TestPropertySource; @@ -23,11 +23,11 @@ import org.springframework.util.MultiValueMap; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@WebMvcTest(ChannelScroll.class) +@WebMvcTest(ChannelScrollController.class) @TestPropertySource(value = "classpath:application_test.properties") -class ChannelScrollSearchIT { +class ChannelScrollControllerSearchIT { - private static final Logger logger = Logger.getLogger(ChannelScrollSearchIT.class.getName()); + private static final Logger logger = Logger.getLogger(ChannelScrollControllerSearchIT.class.getName()); @Autowired IChannelScroll channelScroll; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java index 5038bf2..b678324 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java @@ -17,8 +17,8 @@ import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; import org.phoebus.channelfinder.respository.TagRepository; -import org.phoebus.channelfinder.rest.api.IChannelManager; -import org.phoebus.channelfinder.rest.controller.ChannelManager; +import org.phoebus.channelfinder.rest.api.IChannel; +import org.phoebus.channelfinder.rest.controller.ChannelController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; @@ -26,12 +26,13 @@ import org.springframework.web.server.ResponseStatusException; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@WebMvcTest(ChannelManager.class) +@WebMvcTest(ChannelController.class) @WithMockUser(roles = "CF-ADMINS") @TestPropertySource(value = "classpath:application_test.properties") class ChannelValidationIT { - @Autowired IChannelManager channelManager; + @Autowired + IChannel channelManager; @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java b/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java similarity index 99% rename from src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java rename to src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java index 89f428f..6abd79b 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java @@ -21,8 +21,8 @@ import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.rest.api.IPropertyManager; -import org.phoebus.channelfinder.rest.controller.PropertyManager; +import org.phoebus.channelfinder.rest.api.IProperty; +import org.phoebus.channelfinder.rest.controller.PropertyController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; @@ -32,12 +32,13 @@ import org.springframework.web.server.ResponseStatusException; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@WebMvcTest(PropertyManager.class) // TODO Somehow creating one +@WebMvcTest(PropertyController.class) // TODO Somehow creating one @WithMockUser(roles = "CF-ADMINS") @TestPropertySource(value = "classpath:application_test.properties") -class PropertyManagerIT { +class PropertyControllerIT { - @Autowired IPropertyManager propertyManager; + @Autowired + IProperty propertyManager; @Autowired PropertyRepository propertyRepository; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java index 0661d26..c0a2bff 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java @@ -14,8 +14,8 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.rest.api.IPropertyManager; -import org.phoebus.channelfinder.rest.controller.PropertyManager; +import org.phoebus.channelfinder.rest.api.IProperty; +import org.phoebus.channelfinder.rest.controller.PropertyController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; @@ -23,12 +23,13 @@ import org.springframework.web.server.ResponseStatusException; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@WebMvcTest(PropertyManager.class) +@WebMvcTest(PropertyController.class) @WithMockUser(roles = "CF-ADMINS") @TestPropertySource(value = "classpath:application_test.properties") class PropertyValidationIT { - @Autowired IPropertyManager propertyManager; + @Autowired + IProperty propertyManager; @Autowired ChannelRepository channelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java b/src/test/java/org/phoebus/channelfinder/TagControllerIT.java similarity index 99% rename from src/test/java/org/phoebus/channelfinder/TagManagerIT.java rename to src/test/java/org/phoebus/channelfinder/TagControllerIT.java index 9661f61..790fbe5 100644 --- a/src/test/java/org/phoebus/channelfinder/TagManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagControllerIT.java @@ -21,8 +21,8 @@ import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; import org.phoebus.channelfinder.respository.TagRepository; -import org.phoebus.channelfinder.rest.api.ITagManager; -import org.phoebus.channelfinder.rest.controller.TagManager; +import org.phoebus.channelfinder.rest.api.ITag; +import org.phoebus.channelfinder.rest.controller.TagController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; @@ -33,20 +33,21 @@ import org.springframework.web.server.ResponseStatusException; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@WebMvcTest(TagManager.class) +@WebMvcTest(TagController.class) @WithMockUser(roles = "CF-ADMINS") @ContextConfiguration(classes = {TagRepository.class, ElasticConfig.class}) @TestPropertySource(value = "classpath:application_test.properties") -class TagManagerIT { +class TagControllerIT { - @Autowired ITagManager tagManager; + @Autowired + ITag tagManager; @Autowired TagRepository tagRepository; @Autowired ChannelRepository channelRepository; @Autowired ElasticConfig esService; - private static final Logger logger = Logger.getLogger(TagManagerIT.class.getName()); + private static final Logger logger = Logger.getLogger(TagControllerIT.class.getName()); @AfterAll void tearDown() throws IOException { diff --git a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java index d834b1c..68379d3 100644 --- a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java @@ -13,8 +13,8 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.rest.api.ITagManager; -import org.phoebus.channelfinder.rest.controller.TagManager; +import org.phoebus.channelfinder.rest.api.ITag; +import org.phoebus.channelfinder.rest.controller.TagController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; @@ -22,12 +22,13 @@ import org.springframework.web.server.ResponseStatusException; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@WebMvcTest(TagManager.class) +@WebMvcTest(TagController.class) @WithMockUser(roles = "CF-ADMINS") @TestPropertySource(value = "classpath:application_test.properties") class TagValidationIT { - @Autowired ITagManager tagManager; + @Autowired + ITag tagManager; @Autowired ElasticConfig esService; @Autowired ChannelRepository channelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java index bc7ef51..b0a60e1 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java @@ -29,7 +29,7 @@ import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; -import org.phoebus.channelfinder.rest.controller.ChannelManager; +import org.phoebus.channelfinder.rest.controller.ChannelController; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -39,7 +39,7 @@ * CFResourceDescriptors#CHANNEL_RESOURCE_URI}. * * @author Lars Johansson - * @see ChannelManager + * @see ChannelController * @see org.phoebus.channelfinder.docker.ITTestFixture * @see org.phoebus.channelfinder.docker.ITUtil * @see org.phoebus.channelfinder.docker.ITUtilChannels diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java index be2fdcc..9f1c934 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java @@ -30,7 +30,7 @@ import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; -import org.phoebus.channelfinder.rest.controller.PropertyManager; +import org.phoebus.channelfinder.rest.controller.PropertyController; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -40,7 +40,7 @@ * CFResourceDescriptors#PROPERTY_RESOURCE_URI}. * * @author Lars Johansson - * @see PropertyManager + * @see PropertyController * @see org.phoebus.channelfinder.docker.ITUtil * @see org.phoebus.channelfinder.docker.ITUtilProperties */ diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java index fbd1217..32e9687 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test; import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.entity.Scroll; -import org.phoebus.channelfinder.rest.controller.ChannelScroll; +import org.phoebus.channelfinder.rest.controller.ChannelScrollController; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -36,7 +36,7 @@ * CFResourceDescriptors#SCROLL_RESOURCE_URI}. * * @author Lars Johansson - * @see ChannelScroll + * @see ChannelScrollController * @see org.phoebus.channelfinder.docker.ITUtil * @see org.phoebus.channelfinder.docker.ITUtilScroll */ diff --git a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java index 38621f4..abe968c 100644 --- a/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java +++ b/src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java @@ -30,7 +30,7 @@ import org.phoebus.channelfinder.docker.ITUtil.AuthorizationChoice; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.rest.controller.TagManager; +import org.phoebus.channelfinder.rest.controller.TagController; import org.testcontainers.containers.ComposeContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -40,7 +40,7 @@ * CFResourceDescriptors#TAG_RESOURCE_URI}. * * @author Lars Johansson - * @see TagManager + * @see TagController * @see org.phoebus.channelfinder.docker.ITUtil * @see org.phoebus.channelfinder.docker.ITUtilTags */ diff --git a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java index 3113711..8f594a5 100644 --- a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java +++ b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java @@ -19,9 +19,9 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.rest.api.IChannelManager; -import org.phoebus.channelfinder.rest.api.IPropertyManager; -import org.phoebus.channelfinder.rest.api.ITagManager; +import org.phoebus.channelfinder.rest.api.IChannel; +import org.phoebus.channelfinder.rest.api.IProperty; +import org.phoebus.channelfinder.rest.api.ITag; import org.phoebus.channelfinder.service.ChannelFinderEpicsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -61,11 +61,14 @@ public static void cleanup() { pvaClient.getChannel(ChannelFinderEpicsService.SERVICE_DESC); ; - @Autowired IChannelManager channelManager; + @Autowired + IChannel channelManager; - @Autowired IPropertyManager propertyManager; + @Autowired + IProperty propertyManager; - @Autowired ITagManager tagManager; + @Autowired + ITag tagManager; @Test void testRPCService() throws ExecutionException, InterruptedException, TimeoutException { diff --git a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorControllerIT.java similarity index 97% rename from src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java rename to src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorControllerIT.java index 367c9a4..020a5ea 100644 --- a/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorManagerIT.java +++ b/src/test/java/org/phoebus/channelfinder/processors/ChannelProcessorControllerIT.java @@ -12,7 +12,7 @@ import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.entity.Scroll; import org.phoebus.channelfinder.rest.api.IChannelScroll; -import org.phoebus.channelfinder.rest.controller.ChannelProcessorManager; +import org.phoebus.channelfinder.rest.controller.ChannelProcessorController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -24,11 +24,11 @@ import org.springframework.util.Base64Utils; @ExtendWith(SpringExtension.class) -@WebMvcTest(ChannelProcessorManager.class) +@WebMvcTest(ChannelProcessorController.class) @TestPropertySource( value = "classpath:application_test.properties", properties = {"elasticsearch.create.indices = false"}) -class ChannelProcessorManagerIT { +class ChannelProcessorControllerIT { protected static final String AUTHORIZATION = "Basic " + Base64Utils.encodeToString("admin:adminPass".getBytes()); diff --git a/src/test/resources/logging.properties b/src/test/resources/logging.properties index 4fd2c90..6b651fd 100644 --- a/src/test/resources/logging.properties +++ b/src/test/resources/logging.properties @@ -2,7 +2,7 @@ handlers= java.util.logging.ConsoleHandler .level = SEVERE -org.phoebus.channelfinder.rest.controller.ChannelManager = SEVERE +org.phoebus.channelfinder.rest.controller.ChannelController = SEVERE o.p.channelfinder.ChannelManager = SEVERE org.phoebus.channelfinder.respository.ChannelRepository = SEVERE o.p.channelfinder.ChannelRepository = SEVERE \ No newline at end of file From 3324bc6d6c37efd7f9c8339a1fa388142e4b4a73 Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Thu, 4 Dec 2025 11:05:40 +0100 Subject: [PATCH 09/13] Fix linting - Some classes had incorrect linting that has been fixed --- .../rest/controller/ChannelProcessorController.java | 3 +-- .../org/phoebus/channelfinder/ChannelControllerIT.java | 3 +-- .../channelfinder/ChannelScrollControllerSearchIT.java | 3 ++- .../org/phoebus/channelfinder/ChannelValidationIT.java | 3 +-- .../org/phoebus/channelfinder/PropertyControllerIT.java | 3 +-- .../org/phoebus/channelfinder/PropertyValidationIT.java | 3 +-- .../java/org/phoebus/channelfinder/TagControllerIT.java | 3 +-- .../java/org/phoebus/channelfinder/TagValidationIT.java | 3 +-- .../phoebus/channelfinder/epics/EpicsRPCRequestIT.java | 9 +++------ 9 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java index f2162fa..21f6a88 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java @@ -27,8 +27,7 @@ @RestController @EnableAutoConfiguration -public class ChannelProcessorController - implements IChannelProcessor { +public class ChannelProcessorController implements IChannelProcessor { private static final Logger logger = Logger.getLogger(ChannelProcessorController.class.getName()); diff --git a/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java index b328a6d..0de3534 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java @@ -34,8 +34,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class ChannelControllerIT { - @Autowired - IChannel channelManager; + @Autowired IChannel channelManager; @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java index f5414d3..2627d37 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java @@ -27,7 +27,8 @@ @TestPropertySource(value = "classpath:application_test.properties") class ChannelScrollControllerSearchIT { - private static final Logger logger = Logger.getLogger(ChannelScrollControllerSearchIT.class.getName()); + private static final Logger logger = + Logger.getLogger(ChannelScrollControllerSearchIT.class.getName()); @Autowired IChannelScroll channelScroll; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java index b678324..3714381 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java @@ -31,8 +31,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class ChannelValidationIT { - @Autowired - IChannel channelManager; + @Autowired IChannel channelManager; @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java b/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java index 6abd79b..d74f910 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java @@ -37,8 +37,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class PropertyControllerIT { - @Autowired - IProperty propertyManager; + @Autowired IProperty propertyManager; @Autowired PropertyRepository propertyRepository; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java index c0a2bff..44901e6 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java @@ -28,8 +28,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class PropertyValidationIT { - @Autowired - IProperty propertyManager; + @Autowired IProperty propertyManager; @Autowired ChannelRepository channelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/TagControllerIT.java b/src/test/java/org/phoebus/channelfinder/TagControllerIT.java index 790fbe5..6bc2aff 100644 --- a/src/test/java/org/phoebus/channelfinder/TagControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagControllerIT.java @@ -39,8 +39,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class TagControllerIT { - @Autowired - ITag tagManager; + @Autowired ITag tagManager; @Autowired TagRepository tagRepository; diff --git a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java index 68379d3..0306f32 100644 --- a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java @@ -27,8 +27,7 @@ @TestPropertySource(value = "classpath:application_test.properties") class TagValidationIT { - @Autowired - ITag tagManager; + @Autowired ITag tagManager; @Autowired ElasticConfig esService; @Autowired ChannelRepository channelRepository; diff --git a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java index 8f594a5..3ee3bc8 100644 --- a/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java +++ b/src/test/java/org/phoebus/channelfinder/epics/EpicsRPCRequestIT.java @@ -61,14 +61,11 @@ public static void cleanup() { pvaClient.getChannel(ChannelFinderEpicsService.SERVICE_DESC); ; - @Autowired - IChannel channelManager; + @Autowired IChannel channelManager; - @Autowired - IProperty propertyManager; + @Autowired IProperty propertyManager; - @Autowired - ITag tagManager; + @Autowired ITag tagManager; @Test void testRPCService() throws ExecutionException, InterruptedException, TimeoutException { From 2b647481363fa224343ccfe9d1334a2f834c50e5 Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Fri, 5 Dec 2025 15:55:23 +0100 Subject: [PATCH 10/13] Adjust controllers - Remove swagger related annotations from the controllers (as the documentation layer is moved to the interface level) --- .../rest/controller/ChannelController.java | 32 ++++++------------- .../ChannelProcessorController.java | 15 ++------- .../controller/ChannelScrollController.java | 14 ++------ .../rest/controller/PropertyController.java | 28 +++++----------- .../rest/controller/TagController.java | 24 +++++--------- 5 files changed, 29 insertions(+), 84 deletions(-) diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java index 84da878..9e7c13b 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java @@ -1,10 +1,7 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.common.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; - import com.google.common.collect.FluentIterable; import com.google.common.collect.Lists; -import io.swagger.v3.oas.annotations.Parameter; import java.text.MessageFormat; import java.util.List; import java.util.Map; @@ -32,9 +29,6 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @@ -60,28 +54,22 @@ public class ChannelController implements IChannel { @Autowired ChannelProcessorService channelProcessorService; @Override - public List query( - @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam - MultiValueMap allRequestParams) { + public List query(MultiValueMap allRequestParams) { return channelRepository.search(allRequestParams).channels(); } @Override - public SearchResult combinedQuery( - @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam - MultiValueMap allRequestParams) { + public SearchResult combinedQuery(MultiValueMap allRequestParams) { return channelRepository.search(allRequestParams); } @Override - public long queryCount( - @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam - MultiValueMap allRequestParams) { + public long queryCount(MultiValueMap allRequestParams) { return channelRepository.count(allRequestParams); } @Override - public Channel read(@PathVariable("channelName") String channelName) { + public Channel read(String channelName) { channelManagerAudit.log( Level.INFO, () -> MessageFormat.format(TextUtil.FIND_CHANNEL, channelName)); @@ -95,8 +83,7 @@ public Channel read(@PathVariable("channelName") String channelName) { } @Override - public Channel create( - @PathVariable("channelName") String channelName, @RequestBody Channel channel) { + public Channel create(String channelName, Channel channel) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_CHANNEL)) { @@ -147,7 +134,7 @@ public Channel create( } @Override - public Iterable create(@RequestBody Iterable channels) { + public Iterable create(Iterable channels) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_CHANNEL)) { @@ -238,8 +225,7 @@ private void resetOwnersToExisting(Iterable channels) { } @Override - public Channel update( - @PathVariable("channelName") String channelName, @RequestBody Channel channel) { + public Channel update(String channelName, Channel channel) { if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_CHANNEL)) { long start = System.currentTimeMillis(); @@ -308,7 +294,7 @@ public Channel update( } @Override - public Iterable update(@RequestBody Iterable channels) { + public Iterable update(Iterable channels) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_CHANNEL)) { @@ -368,7 +354,7 @@ public Iterable update(@RequestBody Iterable channels) { } @Override - public void remove(@PathVariable("channelName") String channelName) { + public void remove(String channelName) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_CHANNEL)) { diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java index 21f6a88..201b210 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelProcessorController.java @@ -1,8 +1,5 @@ package org.phoebus.channelfinder.rest.controller; -import static org.phoebus.channelfinder.common.CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION; - -import io.swagger.v3.oas.annotations.Parameter; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -20,8 +17,6 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @@ -72,9 +67,7 @@ public long processAllChannels() { } @Override - public long processChannels( - @Parameter(description = SEARCH_PARAM_DESCRIPTION) @RequestParam - MultiValueMap allRequestParams) { + public long processChannels(MultiValueMap allRequestParams) { long channelCount = 0; Scroll scrollResult = channelScroll.query(allRequestParams); channelCount += scrollResult.getChannels().size(); @@ -93,11 +86,7 @@ public void processChannels(List channels) { } @Override - public void setProcessorEnabled( - @PathVariable("processorName") String processorName, - @Parameter(description = "Value of enabled to set, default value: true") - @RequestParam(required = false, name = "enabled", defaultValue = "true") - Boolean enabled) { + public void setProcessorEnabled(String processorName, Boolean enabled) { channelProcessorService.setProcessorEnabled(processorName, enabled); } } diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScrollController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScrollController.java index 2919f3a..893d17b 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScrollController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelScrollController.java @@ -8,7 +8,6 @@ import co.elastic.clients.elasticsearch.core.SearchRequest; import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.elasticsearch.core.search.Hit; -import io.swagger.v3.oas.annotations.Parameter; import java.text.MessageFormat; import java.util.Comparator; import java.util.List; @@ -17,7 +16,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; -import org.phoebus.channelfinder.common.CFResourceDescriptors; import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; @@ -28,8 +26,6 @@ import org.springframework.http.HttpStatus; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @@ -47,18 +43,12 @@ public class ChannelScrollController implements org.phoebus.channelfinder.rest.a ElasticsearchClient client; @Override - public Scroll query( - @Parameter(description = CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION) @RequestParam - MultiValueMap allRequestParams) { + public Scroll query(MultiValueMap allRequestParams) { return search(null, allRequestParams); } @Override - public Scroll query( - @Parameter(description = "Scroll ID from previous query") @PathVariable("scrollId") - String scrollId, - @Parameter(description = CFResourceDescriptors.SEARCH_PARAM_DESCRIPTION) @RequestParam - MultiValueMap searchParameters) { + public Scroll query(String scrollId, MultiValueMap searchParameters) { return search(scrollId, searchParameters); } diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java index d454ae5..c3fe85c 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java @@ -25,9 +25,6 @@ import org.springframework.http.HttpStatus; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @@ -54,9 +51,7 @@ public Iterable list() { } @Override - public Property read( - @PathVariable("propertyName") String propertyName, - @RequestParam(value = "withChannels", defaultValue = "true") boolean withChannels) { + public Property read(String propertyName, boolean withChannels) { propertyManagerAudit.log( Level.INFO, () -> MessageFormat.format(TextUtil.FIND_PROPERTY, propertyName)); @@ -76,8 +71,7 @@ public Property read( } @Override - public Property create( - @PathVariable("propertyName") String propertyName, @RequestBody Property property) { + public Property create(String propertyName, Property property) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_PROPERTY)) { @@ -128,7 +122,7 @@ public Property create( } @Override - public Iterable create(@RequestBody Iterable properties) { + public Iterable create(Iterable properties) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_PROPERTY)) { @@ -183,10 +177,7 @@ public Iterable create(@RequestBody Iterable properties) { } @Override - public Property addSingle( - @PathVariable("propertyName") String propertyName, - @PathVariable("channelName") String channelName, - @RequestBody Property property) { + public Property addSingle(String propertyName, String channelName, Property property) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_PROPERTY)) { @@ -236,8 +227,7 @@ public Property addSingle( } @Override - public Property update( - @PathVariable("propertyName") String propertyName, @RequestBody Property property) { + public Property update(String propertyName, Property property) { // check if authorized role if (!authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_PROPERTY)) { @@ -329,7 +319,7 @@ public Property update( } @Override - public Iterable update(@RequestBody Iterable properties) { + public Iterable update(Iterable properties) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_PROPERTY)) { @@ -425,7 +415,7 @@ private void checkPropertyAuthorization(Optional existingProperty) { } @Override - public void remove(@PathVariable("propertyName") String propertyName) { + public void remove(String propertyName) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_PROPERTY)) { @@ -455,9 +445,7 @@ public void remove(@PathVariable("propertyName") String propertyName) { } @Override - public void removeSingle( - @PathVariable("propertyName") final String propertyName, - @PathVariable("channelName") String channelName) { + public void removeSingle(final String propertyName, String channelName) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_PROPERTY)) { diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java index 0e4c7fb..d8ada8d 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java @@ -25,9 +25,6 @@ import org.springframework.http.HttpStatus; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @@ -52,9 +49,7 @@ public Iterable list() { } @Override - public Tag read( - @PathVariable("tagName") String tagName, - @RequestParam(value = "withChannels", defaultValue = "true") boolean withChannels) { + public Tag read(String tagName, boolean withChannels) { tagManagerAudit.log(Level.INFO, () -> MessageFormat.format(TextUtil.FIND_TAG, tagName)); if (withChannels) { @@ -79,7 +74,7 @@ public Tag read( } @Override - public Tag create(@PathVariable("tagName") String tagName, @RequestBody Tag tag) { + public Tag create(String tagName, Tag tag) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_TAG)) { @@ -135,7 +130,7 @@ public Tag create(@PathVariable("tagName") String tagName, @RequestBody Tag tag) } @Override - public Iterable create(@RequestBody Iterable tags) { + public Iterable create(Iterable tags) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_TAG)) { @@ -211,8 +206,7 @@ public Iterable create(@RequestBody Iterable tags) { } @Override - public Tag addSingle( - @PathVariable("tagName") String tagName, @PathVariable("channelName") String channelName) { + public Tag addSingle(String tagName, String channelName) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_TAG)) { @@ -256,7 +250,7 @@ public Tag addSingle( } @Override - public Tag update(@PathVariable("tagName") String tagName, @RequestBody Tag tag) { + public Tag update(String tagName, Tag tag) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_TAG)) { @@ -332,7 +326,7 @@ public Tag update(@PathVariable("tagName") String tagName, @RequestBody Tag tag) } @Override - public Iterable update(@RequestBody Iterable tags) { + public Iterable update(Iterable tags) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_TAG)) { @@ -401,7 +395,7 @@ public Iterable update(@RequestBody Iterable tags) { } @Override - public void remove(@PathVariable("tagName") String tagName) { + public void remove(String tagName) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_TAG)) { @@ -430,9 +424,7 @@ public void remove(@PathVariable("tagName") String tagName) { } @Override - public void removeSingle( - @PathVariable("tagName") final String tagName, - @PathVariable("channelName") String channelName) { + public void removeSingle(final String tagName, String channelName) { // check if authorized role if (authorizationService.isAuthorizedRole( SecurityContextHolder.getContext().getAuthentication(), ROLES.CF_TAG)) { From 1079bfae8bb60a90ad825844161e021634e1a9ff Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Fri, 5 Dec 2025 16:04:00 +0100 Subject: [PATCH 11/13] Adjust scopes - Wind down scope for loggers --- .../java/org/phoebus/channelfinder/Application.java | 2 +- .../channelfinder/rest/controller/InfoController.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/phoebus/channelfinder/Application.java b/src/main/java/org/phoebus/channelfinder/Application.java index 0d7716d..ac5c778 100644 --- a/src/main/java/org/phoebus/channelfinder/Application.java +++ b/src/main/java/org/phoebus/channelfinder/Application.java @@ -43,7 +43,7 @@ @SpringBootApplication public class Application implements ApplicationRunner { - public static final Logger logger = Logger.getLogger(Application.class.getName()); + private static final Logger logger = Logger.getLogger(Application.class.getName()); public static void main(String[] args) { // Set the java truststore used by channelfinder diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/InfoController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoController.java index ad1cb65..3a0a96c 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/InfoController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/InfoController.java @@ -10,7 +10,7 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Level; -import org.phoebus.channelfinder.Application; +import java.util.logging.Logger; import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.rest.api.IInfo; import org.springframework.beans.factory.annotation.Autowired; @@ -24,6 +24,8 @@ @EnableAutoConfiguration public class InfoController implements IInfo { + private static final Logger logger = Logger.getLogger(InfoController.class.getName()); + @Value("${channelfinder.version:4.7.0}") private String version; @@ -51,16 +53,14 @@ public String info() { ElasticsearchVersionInfo elasticVersion = response.version(); elasticInfo.put("version", elasticVersion.number()); } catch (IOException e) { - Application.logger.log( - Level.WARNING, "Failed to create ChannelFinder service info resource.", e); + logger.log(Level.WARNING, "Failed to create ChannelFinder service info resource.", e); elasticInfo.put("status", "Failed to connect to elastic " + e.getLocalizedMessage()); } cfServiceInfo.put("elastic", elasticInfo); try { return objectMapper.writeValueAsString(cfServiceInfo); } catch (JsonProcessingException e) { - Application.logger.log( - Level.WARNING, "Failed to create ChannelFinder service info resource.", e); + logger.log(Level.WARNING, "Failed to create ChannelFinder service info resource.", e); return "Failed to gather ChannelFinder service info"; } } From f81163418d5a69acd86b3910a8c3c9f0da5eea6d Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Fri, 5 Dec 2025 16:11:57 +0100 Subject: [PATCH 12/13] Create extra package - Create external sub package for ArchiverClient --- .../phoebus/channelfinder/configuration/AAChannelProcessor.java | 2 +- .../channelfinder/service/{ => external}/ArchiverClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/main/java/org/phoebus/channelfinder/service/{ => external}/ArchiverClient.java (99%) diff --git a/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java b/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java index 45b8211..b0636c0 100644 --- a/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java +++ b/src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java @@ -14,7 +14,7 @@ import org.apache.commons.lang3.StringUtils; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; -import org.phoebus.channelfinder.service.ArchiverClient; +import org.phoebus.channelfinder.service.external.ArchiverClient; import org.phoebus.channelfinder.service.model.archiver.ChannelProcessorInfo; import org.phoebus.channelfinder.service.model.archiver.aa.ArchiveAction; import org.phoebus.channelfinder.service.model.archiver.aa.ArchivePVOptions; diff --git a/src/main/java/org/phoebus/channelfinder/service/ArchiverClient.java b/src/main/java/org/phoebus/channelfinder/service/external/ArchiverClient.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/service/ArchiverClient.java rename to src/main/java/org/phoebus/channelfinder/service/external/ArchiverClient.java index 17772fa..7f15b70 100644 --- a/src/main/java/org/phoebus/channelfinder/service/ArchiverClient.java +++ b/src/main/java/org/phoebus/channelfinder/service/external/ArchiverClient.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.service; +package org.phoebus.channelfinder.service.external; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; From b0900ba91f697ebfa3a3476dd58e275119eb764b Mon Sep 17 00:00:00 2001 From: Imre Toth Date: Mon, 8 Dec 2025 08:59:05 +0100 Subject: [PATCH 13/13] Fix typo in package name - Fix type in 'repository' package name --- .../{respository => repository}/ChannelRepository.java | 2 +- .../{respository => repository}/PropertyRepository.java | 2 +- .../{respository => repository}/TagRepository.java | 2 +- .../channelfinder/rest/controller/ChannelController.java | 6 +++--- .../channelfinder/rest/controller/PropertyController.java | 6 +++--- .../channelfinder/rest/controller/TagController.java | 4 ++-- .../channelfinder/service/ChannelFinderEpicsService.java | 2 +- .../org/phoebus/channelfinder/service/MetricsService.java | 6 +++--- .../java/org/phoebus/channelfinder/ChannelControllerIT.java | 6 +++--- .../java/org/phoebus/channelfinder/ChannelRepositoryIT.java | 6 +++--- .../phoebus/channelfinder/ChannelRepositorySearchIT.java | 6 +++--- .../phoebus/channelfinder/ChannelScrollControllerIT.java | 6 +++--- .../channelfinder/ChannelScrollControllerSearchIT.java | 4 ++-- .../java/org/phoebus/channelfinder/ChannelValidationIT.java | 6 +++--- .../java/org/phoebus/channelfinder/MetricsServiceIT.java | 6 +++--- .../org/phoebus/channelfinder/PropertyControllerIT.java | 4 ++-- .../org/phoebus/channelfinder/PropertyRepositoryIT.java | 4 ++-- .../org/phoebus/channelfinder/PropertyValidationIT.java | 2 +- .../java/org/phoebus/channelfinder/TagControllerIT.java | 4 ++-- .../java/org/phoebus/channelfinder/TagRepositoryIT.java | 4 ++-- .../java/org/phoebus/channelfinder/TagValidationIT.java | 2 +- .../channelfinder/performance/ExistsPerformanceIT.java | 2 +- src/test/resources/logging.properties | 2 +- 23 files changed, 47 insertions(+), 47 deletions(-) rename src/main/java/org/phoebus/channelfinder/{respository => repository}/ChannelRepository.java (99%) rename src/main/java/org/phoebus/channelfinder/{respository => repository}/PropertyRepository.java (99%) rename src/main/java/org/phoebus/channelfinder/{respository => repository}/TagRepository.java (99%) diff --git a/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java b/src/main/java/org/phoebus/channelfinder/repository/ChannelRepository.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java rename to src/main/java/org/phoebus/channelfinder/repository/ChannelRepository.java index ef6bfdf..d2f8d90 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/ChannelRepository.java +++ b/src/main/java/org/phoebus/channelfinder/repository/ChannelRepository.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.respository; +package org.phoebus.channelfinder.repository; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchException; diff --git a/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java b/src/main/java/org/phoebus/channelfinder/repository/PropertyRepository.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java rename to src/main/java/org/phoebus/channelfinder/repository/PropertyRepository.java index 640174a..696616d 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/PropertyRepository.java +++ b/src/main/java/org/phoebus/channelfinder/repository/PropertyRepository.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.respository; +package org.phoebus.channelfinder.repository; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchException; diff --git a/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java b/src/main/java/org/phoebus/channelfinder/repository/TagRepository.java similarity index 99% rename from src/main/java/org/phoebus/channelfinder/respository/TagRepository.java rename to src/main/java/org/phoebus/channelfinder/repository/TagRepository.java index 58be445..37a3049 100644 --- a/src/main/java/org/phoebus/channelfinder/respository/TagRepository.java +++ b/src/main/java/org/phoebus/channelfinder/repository/TagRepository.java @@ -1,4 +1,4 @@ -package org.phoebus.channelfinder.respository; +package org.phoebus.channelfinder.repository; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchException; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java index 9e7c13b..1fbb4a9 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/ChannelController.java @@ -16,9 +16,9 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.rest.api.IChannel; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.AuthorizationService.ROLES; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java index c3fe85c..e6ce6ae 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/PropertyController.java @@ -14,9 +14,9 @@ import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.rest.api.IProperty; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.AuthorizationService.ROLES; diff --git a/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java b/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java index d8ada8d..7bc542e 100644 --- a/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java +++ b/src/main/java/org/phoebus/channelfinder/rest/controller/TagController.java @@ -15,8 +15,8 @@ import org.phoebus.channelfinder.common.TextUtil; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.rest.api.ITag; import org.phoebus.channelfinder.service.AuthorizationService; import org.phoebus.channelfinder.service.AuthorizationService.ROLES; diff --git a/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java b/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java index 4b93779..a1a3dc7 100644 --- a/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java +++ b/src/main/java/org/phoebus/channelfinder/service/ChannelFinderEpicsService.java @@ -20,7 +20,7 @@ import org.epics.pva.server.RPCService; import org.epics.pva.server.ServerPV; import org.phoebus.channelfinder.entity.Channel; -import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.stereotype.Service; diff --git a/src/main/java/org/phoebus/channelfinder/service/MetricsService.java b/src/main/java/org/phoebus/channelfinder/service/MetricsService.java index 1eb5d21..0d78df1 100644 --- a/src/main/java/org/phoebus/channelfinder/service/MetricsService.java +++ b/src/main/java/org/phoebus/channelfinder/service/MetricsService.java @@ -13,9 +13,9 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; import javax.annotation.PostConstruct; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java index 0de3534..2726265 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java @@ -17,9 +17,9 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.rest.api.IChannel; import org.phoebus.channelfinder.rest.controller.ChannelController; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java index 9b13ab4..2225cbc 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java @@ -20,9 +20,9 @@ import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.SearchResult; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +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.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java index 0fcbd22..db0591b 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java @@ -19,9 +19,9 @@ import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.entity.SearchResult; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +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; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java index 98a0301..d3404f7 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java @@ -9,9 +9,9 @@ import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Scroll; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.rest.api.IChannelScroll; import org.phoebus.channelfinder.rest.controller.ChannelScrollController; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java index 2627d37..24907f6 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java @@ -12,8 +12,8 @@ import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; import org.phoebus.channelfinder.entity.Scroll; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.rest.api.IChannelScroll; import org.phoebus.channelfinder.rest.controller.ChannelScrollController; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java index 3714381..dc992dd 100644 --- a/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java @@ -14,9 +14,9 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.rest.api.IChannel; import org.phoebus.channelfinder.rest.controller.ChannelController; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java index 0fd4701..ed89133 100644 --- a/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java +++ b/src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java @@ -17,9 +17,9 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; +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; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java b/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java index d74f910..0923c1c 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java @@ -19,8 +19,8 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.PropertyRepository; import org.phoebus.channelfinder.rest.api.IProperty; import org.phoebus.channelfinder.rest.controller.PropertyController; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java index 151d440..83ff891 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java @@ -17,8 +17,8 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.PropertyRepository; +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.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java index 44901e6..530248a 100644 --- a/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java @@ -13,7 +13,7 @@ import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Property; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; import org.phoebus.channelfinder.rest.api.IProperty; import org.phoebus.channelfinder.rest.controller.PropertyController; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/phoebus/channelfinder/TagControllerIT.java b/src/test/java/org/phoebus/channelfinder/TagControllerIT.java index 6bc2aff..951b1e3 100644 --- a/src/test/java/org/phoebus/channelfinder/TagControllerIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagControllerIT.java @@ -19,8 +19,8 @@ import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.TagRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; +import org.phoebus.channelfinder.repository.TagRepository; import org.phoebus.channelfinder.rest.api.ITag; import org.phoebus.channelfinder.rest.controller.TagController; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java b/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java index 7e93223..df0e9d4 100644 --- a/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagRepositoryIT.java @@ -15,8 +15,8 @@ import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; -import org.phoebus.channelfinder.respository.TagRepository; +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.test.context.TestPropertySource; diff --git a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java index 0306f32..77a9b33 100644 --- a/src/test/java/org/phoebus/channelfinder/TagValidationIT.java +++ b/src/test/java/org/phoebus/channelfinder/TagValidationIT.java @@ -12,7 +12,7 @@ import org.phoebus.channelfinder.configuration.ElasticConfig; import org.phoebus.channelfinder.entity.Channel; import org.phoebus.channelfinder.entity.Tag; -import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; import org.phoebus.channelfinder.rest.api.ITag; import org.phoebus.channelfinder.rest.controller.TagController; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java b/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java index 2d74309..a46667c 100644 --- a/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java +++ b/src/test/java/org/phoebus/channelfinder/performance/ExistsPerformanceIT.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.phoebus.channelfinder.configuration.PopulateDBConfiguration; -import org.phoebus.channelfinder.respository.ChannelRepository; +import org.phoebus.channelfinder.repository.ChannelRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; diff --git a/src/test/resources/logging.properties b/src/test/resources/logging.properties index 6b651fd..3ca30b4 100644 --- a/src/test/resources/logging.properties +++ b/src/test/resources/logging.properties @@ -4,5 +4,5 @@ handlers= java.util.logging.ConsoleHandler org.phoebus.channelfinder.rest.controller.ChannelController = SEVERE o.p.channelfinder.ChannelManager = SEVERE -org.phoebus.channelfinder.respository.ChannelRepository = SEVERE +org.phoebus.channelfinder.repository.ChannelRepository = SEVERE o.p.channelfinder.ChannelRepository = SEVERE \ No newline at end of file