Skip to content
Snippets Groups Projects
Commit b6c33db1 authored by Krzysztof Witukiewicz's avatar Krzysztof Witukiewicz
Browse files

OZG-7811 OZG-8114 Adjust properties

parent e0836d64
No related branches found
No related tags found
1 merge request!23Ozg 7811 vorgaenge zur landesebene schicken
Showing
with 22 additions and 70 deletions
/*
* Copyright (C) 2025 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
package de.ozgcloud.aggregation;
import org.springframework.boot.context.properties.ConfigurationProperties;
import lombok.Getter;
import lombok.Setter;
@ConfigurationProperties(prefix = "aggregation-manager")
@Getter
@Setter
public class AggregationManagerConfiguration {
private int fetchingBatchSize;
}
......@@ -43,6 +43,7 @@ import net.devh.boot.grpc.client.inject.GrpcClientBean;
@GrpcClientBean(clazz = VorgangServiceGrpc.VorgangServiceBlockingStub.class, beanName = "vorgangServiceBlockingStub", client = @GrpcClient("vorgang-manager"))
@GrpcClientBean(clazz = AggregationDataServiceGrpc.AggregationDataServiceStub.class, beanName = "aggregationDataServiceStub", client = @GrpcClient("aggregation-manager"))
public class AggregationManagerGrpcConfiguration {
@GrpcClient("vorgang-manager")
VorgangServiceGrpc.VorgangServiceBlockingStub vorgangServiceBlockingStub;
@GrpcClient("aggregation-manager")
......@@ -58,8 +59,7 @@ public class AggregationManagerGrpcConfiguration {
@Bean
@ConditionalOnProperty("grpc.client.aggregation-manager.address")
AggregationDataRemoteService aggregationDataRemoteService(AggregationManagerProperties properties,
AggregationManagerConfiguration configuration, GrpcAggregationDataMapper grpcAggregationDataMapper) {
return new AggregationDataRemoteService(aggregationDataServiceStub, properties, configuration, grpcAggregationDataMapper);
AggregationDataRemoteService aggregationDataRemoteService(AggregationManagerProperties properties, GrpcAggregationDataMapper grpcAggregationDataMapper) {
return new AggregationDataRemoteService(aggregationDataServiceStub, properties, grpcAggregationDataMapper);
}
}
......@@ -39,5 +39,6 @@ import lombok.extern.log4j.Log4j2;
@Log4j2
public class AggregationManagerProperties {
private int fetchingBatchSize;
private String mandant;
}
......@@ -49,7 +49,7 @@ public abstract class AggregationManagerRunner implements CommandLineRunner {
private static final String MDC_EXECUTION = "execution";
private final AggregationManagerConfiguration config;
private final AggregationManagerProperties aggregationManagerProperties;
private final TransformationProperties transformationProperties;
private final TransformationService transformationService;
private final AggregationDataLoaderRegistry loaderRegistry;
......@@ -91,7 +91,7 @@ public abstract class AggregationManagerRunner implements CommandLineRunner {
Aggregator createAggregator(AggregationMapping.Scope scope) {
return createAggregator()
.withBatchSize(config.getFetchingBatchSize())
.withBatchSize(aggregationManagerProperties.getFetchingBatchSize())
.withLoader(loaderRegistry.getLoader(scope));
}
......
......@@ -29,7 +29,6 @@ import java.util.concurrent.Future;
import java.util.stream.Stream;
import de.ozgcloud.aggregation.Aggregation;
import de.ozgcloud.aggregation.AggregationManagerConfiguration;
import de.ozgcloud.aggregation.AggregationManagerProperties;
import de.ozgcloud.aggregation.data.AggregationDataServiceGrpc;
import de.ozgcloud.aggregation.data.GrpcAggregationData;
......@@ -49,7 +48,6 @@ public class AggregationDataRemoteService {
@GrpcClient("aggregation-manager")
private final AggregationDataServiceGrpc.AggregationDataServiceStub serviceStub;
private final AggregationManagerProperties properties;
private final AggregationManagerConfiguration configuration;
private final GrpcAggregationDataMapper grpcAggregationDataMapper;
public Future<Void> sendAggregationData(Aggregation aggregation) {
......@@ -61,7 +59,7 @@ public class AggregationDataRemoteService {
SendAggregationDataResponseObserver buildSendAggregationDataResponseObserver(Aggregation aggregation) {
var requestData = new RequestData(properties.getMandant(), aggregation.aggregationName(),
toGrpcAggregationDataStream(aggregation.documentEntries()).iterator());
return new SendAggregationDataResponseObserver(configuration.getFetchingBatchSize(), requestData);
return new SendAggregationDataResponseObserver(properties.getFetchingBatchSize(), requestData);
}
Stream<GrpcAggregationData> toGrpcAggregationDataStream(Stream<DocumentEntry> documentEntries) {
......
......@@ -14,10 +14,6 @@ spring:
database: aggregation-manager-job
ozgcloud:
vorgang-manager:
address: static://127.0.0.1:9090
negotiationType: PLAINTEXT
aggregation-manager:
fetching-batch-size: 5
mandant: "Landeshauptstadt Kiel"
......@@ -39,6 +39,7 @@ spring:
application:
name: OzgCloud_AggregationManager
aggregation-manager:
ozgcloud:
fetching-batch-size: 100
aggregation:
identifier: "id.value"
......@@ -53,7 +53,7 @@ import de.ozgcloud.aggregation.transformation.TransformationService;
class AggregationManagerRunnerTest {
@Mock
private AggregationManagerConfiguration config;
private AggregationManagerProperties aggregationManagerProperties;
@Mock
private TransformationProperties transformationProperties;
@Mock
......@@ -332,7 +332,7 @@ class AggregationManagerRunnerTest {
@BeforeEach
void init() {
when(config.getFetchingBatchSize()).thenReturn(batchSize);
when(aggregationManagerProperties.getFetchingBatchSize()).thenReturn(batchSize);
when(loaderRegistry.getLoader(any())).thenReturn(loader);
when(aggregator.withBatchSize(anyInt())).thenReturn(aggregator);
when(aggregator.withLoader(any())).thenReturn(aggregator);
......@@ -342,7 +342,7 @@ class AggregationManagerRunnerTest {
void shouldGetBatchSize() {
runner.createAggregator(scope);
verify(config).getFetchingBatchSize();
verify(aggregationManagerProperties).getFetchingBatchSize();
}
@Test
......@@ -376,9 +376,9 @@ class AggregationManagerRunnerTest {
static class AggregationManagerRunnerImpl extends AggregationManagerRunner {
public AggregationManagerRunnerImpl(AggregationManagerConfiguration config, TransformationProperties transformationProperties,
public AggregationManagerRunnerImpl(AggregationManagerProperties aggregationManagerProperties, TransformationProperties transformationProperties,
TransformationService transformationService, AggregationDataLoaderRegistry loaderRegistry) {
super(config, transformationProperties, transformationService, loaderRegistry);
super(aggregationManagerProperties, transformationProperties, transformationService, loaderRegistry);
}
@Override
......
......@@ -46,7 +46,6 @@ import org.mockito.Spy;
import com.thedeanda.lorem.LoremIpsum;
import de.ozgcloud.aggregation.Aggregation;
import de.ozgcloud.aggregation.AggregationManagerConfiguration;
import de.ozgcloud.aggregation.AggregationManagerProperties;
import de.ozgcloud.aggregation.AggregationTestFactory;
import de.ozgcloud.aggregation.data.AggregationDataServiceGrpc;
......@@ -65,8 +64,6 @@ class AggregationDataRemoteServiceTest {
@Mock
private AggregationManagerProperties properties;
@Mock
private AggregationManagerConfiguration configuration;
@Mock
private GrpcAggregationDataMapper grpcAggregationDataMapper;
@InjectMocks
@Spy
......@@ -124,7 +121,7 @@ class AggregationDataRemoteServiceTest {
@BeforeEach
void init() {
doReturn(Stream.of(GrpcAggregationDataTestFactory.create())).when(service).toGrpcAggregationDataStream(any());
when(configuration.getFetchingBatchSize()).thenReturn(BATCH_SIZE);
when(properties.getFetchingBatchSize()).thenReturn(BATCH_SIZE);
}
@Test
......@@ -146,7 +143,7 @@ class AggregationDataRemoteServiceTest {
void shouldGetBatchSize() {
service.buildSendAggregationDataResponseObserver(AggregationTestFactory.create());
verify(configuration).getFetchingBatchSize();
verify(properties).getFetchingBatchSize();
}
@Test
......
......@@ -10,14 +10,11 @@ spring:
banner-mode: "off"
ozgcloud:
vorgang-manager:
address: static://127.0.0.1:9090
negotiationType: PLAINTEXT
command:
line:
runner:
enabled: false
aggregation-manager:
mandant: "Landeshauptstadt Kiel"
fetching-batch-size: 2
aggregation:
identifier: "id.value"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment