Merge branch 'DEVELOP' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.gridFailureInformation.backend into MIGRATE_TO_ORACLE
diff --git a/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/config/SwaggerConfig.java b/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/config/SwaggerConfig.java
deleted file mode 100644
index 8368afa..0000000
--- a/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/config/SwaggerConfig.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *******************************************************************************
- * Copyright (c) 2019 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *******************************************************************************
- */
-package org.eclipse.openk.gridfailureinformation.samointerface.config;
-
-import lombok.extern.log4j.Log4j2;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Profile;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.paths.RelativePathProvider;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-import javax.servlet.ServletContext;
-
-@Log4j2
-@Configuration
-@EnableSwagger2
-@Profile({"!test","!prod"})
-public class SwaggerConfig {
-
- @Value("${swagger.baseUrl:}")
- public String baseUrl;
- @Value("${swagger.proxyUrl:}")
- public String proxyUrl;
-
- @Bean
- public Docket api(ServletContext servletContext) {
- return new Docket(DocumentationType.SWAGGER_2).pathProvider(new RelativePathProvider(servletContext) {
- @Override
- public String getApplicationBasePath() {
- return baseUrl + super.getApplicationBasePath();
- }
- }).host(proxyUrl);
- }
-}
diff --git a/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/dtos/ForeignFailureDataDto.java b/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/dtos/ForeignFailureDataDto.java
index fb596bf..0733732 100644
--- a/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/dtos/ForeignFailureDataDto.java
+++ b/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/dtos/ForeignFailureDataDto.java
@@ -30,6 +30,14 @@
@Data
public class ForeignFailureDataDto implements Serializable {
+ private boolean isAutopublish;
+
+ private boolean isOnceOnlyImport;
+
+ private boolean isExcludeEquals;
+
+ private boolean isExcludeAlreadyEdited;
+
@NotNull
private boolean isPlanned;
diff --git a/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/service/ImportService.java b/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/service/ImportService.java
index e652684..b8a7acf 100644
--- a/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/service/ImportService.java
+++ b/SAMO-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/samointerface/service/ImportService.java
@@ -24,6 +24,7 @@
import org.eclipse.openk.gridfailureinformation.samointerface.exceptions.InternalServerErrorException;
import org.eclipse.openk.gridfailureinformation.samointerface.mapper.SAMOMapper;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.messaging.MessageChannel;
@@ -45,6 +46,15 @@
@Autowired
SAMOMapper samoMapper;
+ @Value("${gridFailureInformation.autopublish:false}")
+ private boolean autopublish;
+ @Value("${gridFailureInformation.onceOnlyImport:false}")
+ private boolean onceOnlyImport;
+ @Value("${gridFailureInformation.excludeEquals:true}")
+ private boolean excludeEquals;
+ @Value("${gridFailureInformation.excludeAlreadyEdited:true}")
+ private boolean excludeAlreadyEdited;
+
public void importSAMOOutage(String samoOutageJson) {
try {
SAMOOutage samoOutage = objectMapper.readValue(samoOutageJson, SAMOOutage.class);
@@ -69,6 +79,10 @@
private ForeignFailureDataDto createForeignFailureData(SAMOOutage samoOutage) {
ForeignFailureDataDto foreignFailureDataDto = samoMapper.toForeignFailureDataDto(samoOutage);
+ foreignFailureDataDto.setAutopublish(autopublish);
+ foreignFailureDataDto.setOnceOnlyImport(onceOnlyImport);
+ foreignFailureDataDto.setExcludeEquals(excludeEquals);
+ foreignFailureDataDto.setExcludeAlreadyEdited(excludeAlreadyEdited);
foreignFailureDataDto.setBranch(Constants.BRANCH_ELECTRICITY); //fixme klärung: logik einbauen
foreignFailureDataDto.setPlanned(false); //fixme klärung
return foreignFailureDataDto;
diff --git a/SAMO-Interface/src/main/resources/application.yml b/SAMO-Interface/src/main/resources/application.yml
index 6e307cb..fba97c3 100644
--- a/SAMO-Interface/src/main/resources/application.yml
+++ b/SAMO-Interface/src/main/resources/application.yml
@@ -29,12 +29,15 @@
org.springframework.web: ERROR
server:
+ port: 9198
max-http-header-size: 262144
+
sftp:
enable-polling: true
host: 169.50.13.154
#privateKey: classpath:/keys/privateOpenKQServer_key-SAMO-Interface
+ #privateKey: file:C:\keys\privateOpenKQServer_key-SAMO-Interface
privateKey:
privateKeyPassphrase:
user: ${GFI_SAMO_SFTP_USERNAME}
@@ -43,6 +46,12 @@
directory: /opt/transfer/SAMOInterfaceDEVsftpTest/
fileFilter: '*.json'
cron: 0/10 * * ? * * # Check for new file in directory every 'cron' time
+
+gridFailureInformation:
+ autopublish: false
+ onceOnlyImport: false
+ excludeEquals: true
+ excludeAlreadyEdited: false
---
spring:
@@ -100,9 +109,6 @@
session:
tracking-modes: cookie
-swagger:
- baseUrl: /test-stoerungsauskunft-interface
-
sftp:
enable-polling: false
host: 169.50.13.154
diff --git a/SAMO-Interface/src/main/resources/application_localdev.yml b/SAMO-Interface/src/main/resources/application_localdev.yml
index cc1bc56..35c8064 100644
--- a/SAMO-Interface/src/main/resources/application_localdev.yml
+++ b/SAMO-Interface/src/main/resources/application_localdev.yml
@@ -36,7 +36,10 @@
tracking-modes: cookie
gridFailureInformation:
- maxListSize: 2000
+ autopublish: false
+ onceOnlyImport: false
+ excludeEquals: true
+ excludeAlreadyEdited: true
logging.level.org.eclipse.openk.gridfailureinformation.jobs.stoerauskunftinterface.api.StoerauskunftApi: DEBUG
diff --git a/SARIS-Interface/pom.xml b/SARIS-Interface/pom.xml
index 6d05fa6..cc8a30c 100644
--- a/SARIS-Interface/pom.xml
+++ b/SARIS-Interface/pom.xml
@@ -57,6 +57,10 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
@@ -113,6 +117,15 @@
<version>4.2.1.RELEASE</version>
</dependency>
+ <!-- https://mvnrepository.com/artifact/org.springframework.ws/spring-ws-test -->
+ <dependency>
+ <groupId>org.springframework.ws</groupId>
+ <artifactId>spring-ws-test</artifactId>
+ <version>3.0.10.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
+
+
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId>
@@ -147,6 +160,12 @@
<artifactId>spring-cloud-stream-test-support</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-test</artifactId>
+ <version>5.3.2.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
@@ -214,8 +233,6 @@
<generatePackage>org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl</generatePackage>
<schemaIncludes>
<include>*.wsdl</include>
- <!-- <include>countries.wsdl</include> -->
- <!-- <include>Stoerungenservice.wsdl</include> -->
</schemaIncludes>
<catalog>${project.basedir}/src/main/resources/catalog.cat</catalog>
</configuration>
@@ -226,6 +243,39 @@
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>ftp</id>
+ <phase>install</phase>
+ <configuration>
+ <tasks>
+ <scp todir="fdietrich@169.50.13.154:/opt/mics/sarisInterface/"
+ sftp="true" port="22" trust="true"
+ keyfile="${user.home}/.ssh/privateOpenKQServer.ppk"
+ failonerror="false" verbose="true" passphrase="">
+ <fileset dir="${project.build.directory}">
+ <include name="*.jar" />
+ </fileset>
+ </scp>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-jsch</artifactId>
+ <version>1.9.4</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
</plugins>
</build>
diff --git a/SARIS-Interface/sarisRealMockResponse.xml b/SARIS-Interface/sarisRealMockResponse.xml
new file mode 100644
index 0000000..973412b
--- /dev/null
+++ b/SARIS-Interface/sarisRealMockResponse.xml
@@ -0,0 +1,131 @@
+<GetAktuelleGVUsInfoAllgemeinResponse xmlns="http://tempuri.org/">
+ <GetAktuelleGVUsInfoAllgemeinResult>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95674</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T09:00:00</Beginn>
+ <Ende>2020-02-11T11:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Jesteburg</Ort>
+ <Ortsteil>Jesteburg </Ortsteil>
+ <Strasse>Kleckerwaldweg</Strasse>
+ <Hausnummern>56-58</Hausnummern>
+ <Bemerkung>ON Umschwenken in neue Trafostation
+ Kabelarbeiten</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>335587</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286047</Stoerung>
+ <Plz>21266</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95709</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T09:00:00</Beginn>
+ <Ende>2020-02-11T11:30:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Hollern-Twielenfleth</Ort>
+ <Strasse>Feriendorf Altes Land</Strasse>
+ <Hausnummern>75,77</Hausnummern>
+ <Bemerkung>Wasserschaden bei Hs.Nr.77
+ HAK von der Wand nehmen damit die Wand erneuert werden kann.</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>333815</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286453</Stoerung>
+ <Plz>21723</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95733</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T10:30:00</Beginn>
+ <Ende>2020-02-11T15:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Bülkau</Ort>
+ <Ortsteil>Bülkau </Ortsteil>
+ <Strasse>Süderende</Strasse>
+ <Hausnummern>29-48</Hausnummern>
+ <Bemerkung>Kabelstörung bei Hs. Nr.33</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>312795</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286625</Stoerung>
+ <Plz>21782</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95687</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T12:00:00</Beginn>
+ <Ende>2020-02-11T15:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Schwanewede</Ort>
+ <Ortsteil>Schwanewede </Ortsteil>
+ <Strasse>Lindenstr.</Strasse>
+ <Hausnummern>23-29</Hausnummern>
+ <Bemerkung>Austausch eines defekten Kabelverteilers (Beschädigung). </Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>362161</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286118</Stoerung>
+ <Plz>28790</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95647</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T13:00:00</Beginn>
+ <Ende>2020-02-11T14:30:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Dörpen</Ort>
+ <Ortsteil>Neudörpen </Ortsteil>
+ <Strasse>Neudörpen</Strasse>
+ <Hausnummern>14a; 15; 16; 17; 31; 34</Hausnummern>
+ <Bemerkung>KVS Wechsel bei Hs.Nr.: Neudörpen 15</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>317353</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>285933</Stoerung>
+ <Plz>26892</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95661</VersorgungsunterbrechungID>
+ <Beginn>2020-02-12T09:00:00</Beginn>
+ <Ende>2020-02-12T11:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Lathen</Ort>
+ <Ortsteil>Lathen </Ortsteil>
+ <Strasse>Zur Düne</Strasse>
+ <Hausnummern>10+15</Hausnummern>
+ <Bemerkung>KVS tausch</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>339961</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>285988</Stoerung>
+ <Plz>49762</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95743</VersorgungsunterbrechungID>
+ <Beginn>2020-02-12T10:00:00</Beginn>
+ <Ende>2020-02-12T12:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Grasberg</Ort>
+ <Ortsteil>Meinershausen </Ortsteil>
+ <Strasse>Meinershauser Str.</Strasse>
+ <Hausnummern>150-174</Hausnummern>
+ <Bemerkung/>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>327076</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286676</Stoerung>
+ <Plz>28879</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ </GetAktuelleGVUsInfoAllgemeinResult>
+</GetAktuelleGVUsInfoAllgemeinResponse>
diff --git a/SARIS-Interface/sonar-project.properties b/SARIS-Interface/sonar-project.properties
index 542718f..525d25e 100644
--- a/SARIS-Interface/sonar-project.properties
+++ b/SARIS-Interface/sonar-project.properties
@@ -1,7 +1,7 @@
# must be unique in a given SonarQube instance
-sonar.projectKey=openk.pta.de:stoerungsauskunftinterface
+sonar.projectKey=openk.pta.de:sarisinterface
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
-sonar.projectName=grid-failure-information.stoerungsauskunftinterface
+sonar.projectName=grid-failure-information.sarisinterface
sonar.projectVersion=0.0.1_Snapshot
sonar.java.binaries=target/classes
@@ -10,10 +10,10 @@
sonar.sourceEncoding=UTF-8
sonar.sources=src/main
-sonar.exclusions=**/model/*.java,**/viewmodel/*.java,**/dtos/*.java, **/RabbitMqConfig.java
+sonar.exclusions=**/model/*.java,**/viewmodel/*.java,**/dtos/*.java, **/RabbitMqConfig.java, **/WebServiceMessageSenderWithAuth.java
sonar.tests=src/test
#sonar.test.inclusions=**/*.spec.ts
-sonar.test.exclusions=**/model/**,**/viewmodel/**,**/dtos/*.java, **/RabbitMqConfig.java
+sonar.test.exclusions=**/model/**,**/viewmodel/**,**/dtos/*.java, **/RabbitMqConfig.java, **/WebServiceMessageSenderWithAuth.java
#sonar.ts.tslintconfigpath=tslint.json
sonar.typescript.lcov.reportPaths=coverage/lcov.info
\ No newline at end of file
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/api/StoerungsauskunftApi.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/api/StoerungsauskunftApi.java
deleted file mode 100644
index e5bccd0..0000000
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/api/StoerungsauskunftApi.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *******************************************************************************
- * Copyright (c) 2019 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *******************************************************************************
-*/
-package org.eclipse.openk.gridfailureinformation.sarisinterface.api;
-
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.StoerungsauskunftOutage;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.StoerungsauskunftUserNotification;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.List;
-
-
-@FeignClient(name="Stoerauskunft.de", url= "${stoerungsauskunft.apiUrl}")
-public interface StoerungsauskunftApi {
-
- @PostMapping(value= "/outage")
- feign.Response postOutage(@RequestBody List<StoerungsauskunftOutage> outage);
-
- @GetMapping(value= "/reports")
- List<StoerungsauskunftUserNotification> getUserNotification(@RequestParam(value="sectorType") Integer sectorType);
-
-}
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/FeignClientConfig.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/FeignClientConfig.java
deleted file mode 100644
index c10a547..0000000
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/FeignClientConfig.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.openk.gridfailureinformation.sarisinterface.config;
-
-import feign.RequestInterceptor;
-import feign.auth.BasicAuthRequestInterceptor;
-import lombok.extern.log4j.Log4j2;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Log4j2
-@Configuration
-public class FeignClientConfig {
-
- @Value("${stoerungsauskunft.user}")
- public String user;
- @Value("${stoerungsauskunft.password}")
- public String password;
-
- @Bean
- public RequestInterceptor basicAuthRequestInterceptor() {
- return new BasicAuthRequestInterceptor(user, password);
- }
-
-}
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/ImportSchedulerConfig.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/ImportSchedulerConfig.java
index a7f9df9..6b278b6 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/ImportSchedulerConfig.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/ImportSchedulerConfig.java
@@ -1,6 +1,7 @@
package org.eclipse.openk.gridfailureinformation.sarisinterface.config;
import lombok.extern.log4j.Log4j2;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.constants.Constants;
import org.eclipse.openk.gridfailureinformation.sarisinterface.service.ImportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -13,26 +14,28 @@
@Log4j2
@Configuration
@EnableScheduling
-@ConditionalOnProperty(prefix = "stoerungsauskunft.scheduling-import", name = "enabled", havingValue = "true", matchIfMissing = false)
+@ConditionalOnProperty(prefix = "saris.scheduling-import", name = "enabled", havingValue = "true", matchIfMissing = false)
public class ImportSchedulerConfig {
- private static final String SCHEDULER_NAME = "Stoerauskunftimport-Scheduler";
+ private static final String SCHEDULER_NAME = "SARIS-Import-Scheduler";
@Autowired
ImportService importService;
- @Value("${stoerungsauskunft.scheduling-import.cron}")
+ @Value("${saris.scheduling-import.cron}")
private String cronExpression;
@Bean
- public void logConfigLdap() {
+ public void logConfigScheduler() {
log.info(SCHEDULER_NAME + " is enabled with cron expression: " + cronExpression);
}
- @Scheduled(cron = "${stoerungsauskunft.scheduling-import.cron}")
- public void scheduleTaskImportUserNotifications() {
- log.info("Executing" + SCHEDULER_NAME + " task: Importing available usernotifications from stoerungsauskunft.de");
- importService.importUserNotifications();
- log.info("Finished " + SCHEDULER_NAME + " task: Importing available usernotifications from stoerungsauskunft.de");
+ @Scheduled(cron = "${saris.scheduling-import.cron}")
+ public void scheduleTaskImportMessages() {
+ log.info("Executing" + SCHEDULER_NAME + " task: Importing available messages from SARIS");
+ importService.importForeignFailures(Constants.SARIS_ELECTRICITY_BRANCH_ID);
+ importService.importForeignFailures(Constants.SARIS_WATER_BRANCH_ID);
+ importService.importForeignFailures(Constants.SARIS_GAS_BRANCH_ID);
+ log.info("Finished " + SCHEDULER_NAME + " task: Importing available messages from SARIS");
}
}
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SecurityConfig.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SecurityConfig.java
new file mode 100644
index 0000000..f1e9426
--- /dev/null
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SecurityConfig.java
@@ -0,0 +1,68 @@
+/*
+ *******************************************************************************
+ * Copyright (c) 2019 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************
+ */
+package org.eclipse.openk.gridfailureinformation.sarisinterface.config;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.factory.PasswordEncoderFactories;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+
+@Configuration
+@EnableWebSecurity
+@EnableGlobalMethodSecurity(
+ prePostEnabled = true,
+ securedEnabled = true,
+ jsr250Enabled = true)
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Value("${security.endpoint.user}")
+ private String user;
+ @Value("${security.endpoint.password}")
+ private String password;
+
+ @Override
+ protected void configure(HttpSecurity http ) throws Exception {
+ http
+ .csrf().disable()
+ .authorizeRequests().anyRequest().authenticated()
+ .and()
+ .httpBasic();
+ }
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+ return PasswordEncoderFactories.createDelegatingPasswordEncoder();
+ }
+
+ @Autowired
+ public void configureGlobal(AuthenticationManagerBuilder auth)
+ throws Exception
+ {
+ auth.inMemoryAuthentication()
+ .withUser(user)
+ .password(passwordEncoder().encode(password))
+ .roles("USER");
+ }
+
+
+}
+
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SoapClientConfig.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SoapClientConfig.java
deleted file mode 100644
index e9888d4..0000000
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SoapClientConfig.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.openk.gridfailureinformation.sarisinterface.config;
-/*
-import com.sun.xml.internal.ws.developer.JAXBContextFactory;
-import feign.codec.Decoder;
-import feign.codec.Encoder;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class SoapClientConfig {
-
- private static final JAXBContextFactory jaxbFactory = new JAXBContextFactory.Builder()
- .withMarshallerJAXBEncoding("UTF-8")
- .withMarshallerSchemaLocation("http://apihost http://apihost/schema.xsd")
- .build();
-
- @Bean
- public Encoder feignEncoder() {
- return new SOAPEncoder(jaxbFactory);
- }
- @Bean
- public Decoder feignDecoder() {
- return new SOAPDecoder(jaxbFactory);
- }
-}*/
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SoapConfiguration.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SoapConfiguration.java
index bbb1d82..2c33b76 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SoapConfiguration.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/SoapConfiguration.java
@@ -2,6 +2,7 @@
package org.eclipse.openk.gridfailureinformation.sarisinterface.config;
import org.eclipse.openk.gridfailureinformation.sarisinterface.service.SarisWebservice;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
@@ -9,11 +10,13 @@
@Configuration
public class SoapConfiguration {
+ @Value("${saris.apiUrl}")
+ public String sarisApiUrl;
+
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
- // this package must match the package in the <generatePackage> specified in
- // pom.xml
+ // this package must match the package in the <generatePackage> specified in pom.xml
marshaller.setContextPath("org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl");
return marshaller;
}
@@ -21,7 +24,7 @@
@Bean
public SarisWebservice sarisWebservice(Jaxb2Marshaller marshaller) {
SarisWebservice sarisWebservice = new SarisWebservice();
-// sarisWebservice.setDefaultUri("http://localhost:8080/ws");
+ sarisWebservice.setDefaultUri(sarisApiUrl);
sarisWebservice.setMarshaller(marshaller);
sarisWebservice.setUnmarshaller(marshaller);
return sarisWebservice;
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitMq/RabbitMqConfig.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitmq/RabbitMqConfig.java
similarity index 95%
rename from SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitMq/RabbitMqConfig.java
rename to SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitmq/RabbitMqConfig.java
index 5884433..2dd2644 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitMq/RabbitMqConfig.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitmq/RabbitMqConfig.java
@@ -1,4 +1,4 @@
-package org.eclipse.openk.gridfailureinformation.sarisinterface.config.rabbitMq;
+package org.eclipse.openk.gridfailureinformation.sarisinterface.config.rabbitmq;
import lombok.Data;
import lombok.extern.log4j.Log4j2;
@@ -32,7 +32,7 @@
private RabbitTemplate rabbitTemplate;
@Autowired
- private RabbitMqProperties rabbitMqProperties;
+ private org.eclipse.openk.gridfailureinformation.sarisinterface.config.rabbitmq.RabbitMqProperties rabbitMqProperties;
@Bean
public MessageChannel failureImportChannel() {
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitMq/RabbitMqProperties.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitmq/RabbitMqProperties.java
similarity index 97%
rename from SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitMq/RabbitMqProperties.java
rename to SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitmq/RabbitMqProperties.java
index cac6c93..a129a1a 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitMq/RabbitMqProperties.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/rabbitmq/RabbitMqProperties.java
@@ -1,4 +1,4 @@
-package org.eclipse.openk.gridfailureinformation.sarisinterface.config.rabbitMq;
+package org.eclipse.openk.gridfailureinformation.sarisinterface.config.rabbitmq;
import lombok.Getter;
import lombok.Setter;
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/constants/Constants.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/constants/Constants.java
index 6af0a63..bc05ff9 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/constants/Constants.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/constants/Constants.java
@@ -13,18 +13,25 @@
*******************************************************************************
*/
package org.eclipse.openk.gridfailureinformation.sarisinterface.constants;
-
public final class Constants {
public static final String SRC_SARIS = "SARIS";
+ public static final String BRANCH_WATER = "W";
+ public static final String BRANCH_GAS = "G";
public static final String BRANCH_ELECTRICITY = "S";
+ public static final String BRANCH_OTHER = "OS";
+
+ public static final int SARIS_GAS_BRANCH_ID = 2898;
+ public static final int SARIS_ELECTRICITY_BRANCH_ID = 2899;
+ public static final int SARIS_WATER_BRANCH_ID = 2900;
+
+
+
public static final String VOLTAGE_LVL_LOW = "NS";
public static final String PLANNED_OUTAGE = "planned";
public static final String UNPLANNED_OUTAGE = "unplanned";
- public static final String SRC_STOERUNGSAUSKUNFT_DE = "stoerungsauskunft.de";
-
private Constants() {
// empty Constructor for the sake of SONAR
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/controller/ImportController.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/controller/ImportController.java
index 985eaf2..8ad134d 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/controller/ImportController.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/controller/ImportController.java
@@ -18,19 +18,20 @@
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.constants.Constants;
import org.eclipse.openk.gridfailureinformation.sarisinterface.service.ImportService;
import org.eclipse.openk.gridfailureinformation.sarisinterface.service.SarisWebservice;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemein;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.ArrayOfViewGeplanteVU;
import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemeinResponse;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetCountryResponse;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.ViewGeplanteVU;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import java.io.File;
+import java.util.List;
@Log4j2
@RestController
@@ -43,7 +44,7 @@
@Autowired
private SarisWebservice sarisWebservice;
- @GetMapping("/usernotification-import-test")
+ @GetMapping("/import-test")
@ApiOperation(value = "Import einer externen Störungsinformation von Störungsauskunft.de zu SIT")
@ApiResponses(value = {
@ApiResponse(code = 201, message = "Störungsinformation erfolgreich importiert"),
@@ -51,33 +52,29 @@
})
@ResponseStatus(HttpStatus.OK)
public void importUserNotification() {
- importService.importUserNotifications();
+ importService.importForeignFailures(Constants.SARIS_ELECTRICITY_BRANCH_ID);
+ importService.importForeignFailures(Constants.SARIS_GAS_BRANCH_ID);
+ importService.importForeignFailures(Constants.SARIS_WATER_BRANCH_ID);
}
- @GetMapping("/soap-test")
+ @GetMapping("/response-test")
@ApiOperation(value = "Import von Störungsinformationen von SARIS zu SIT")
@ApiResponses(value = {
@ApiResponse(code = 201, message = "Störungsinformation erfolgreich importiert"),
@ApiResponse(code = 500, message = "Konnte nicht durchgeführt werden")
})
@ResponseStatus(HttpStatus.OK)
- public void testSoap() throws JAXBException {
- GetCountryResponse response = sarisWebservice.getCountry("Spain");
- System.err.println(response.getCountry().getCurrency());
- }
-
- @GetMapping("/importForeignFailures-test")
- @ApiOperation(value = "Import von Störungsinformationen von SARIS zu SIT")
- @ApiResponses(value = {
- @ApiResponse(code = 201, message = "Störungsinformation erfolgreich importiert"),
- @ApiResponse(code = 500, message = "Konnte nicht durchgeführt werden")
- })
- @ResponseStatus(HttpStatus.OK)
- public void importForeignFailures() throws JAXBException {
-
- importService.importForeignFailures();
- GetCountryResponse response = sarisWebservice.getCountry("Spain");
- System.err.println(response.getCountry().getCurrency());
+ public void responsetest() {
+ log.info("response-test");
+ GetAktuelleGVUsInfoAllgemeinResponse response = sarisWebservice.getAktuelleGVU(Constants.SARIS_ELECTRICITY_BRANCH_ID,true);
+ log.info("RESPONSE received import-test: " + response);
+ ArrayOfViewGeplanteVU getAktuelleGVUsInfoAllgemeinResult = response.getGetAktuelleGVUsInfoAllgemeinResult();
+ if (getAktuelleGVUsInfoAllgemeinResult != null) {
+ List<ViewGeplanteVU> viewGeplanteVU = response.getGetAktuelleGVUsInfoAllgemeinResult().getViewGeplanteVU();
+ for (ViewGeplanteVU geplanteVU : viewGeplanteVU) {
+ log.info("VersorgungsunterbrechungID: " + geplanteVU.getVersorgungsunterbrechungID());
+ }
+ }
}
}
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/ForeignFailureDataDto.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/ForeignFailureDataDto.java
index cf0bf46..2202cbf 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/ForeignFailureDataDto.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/ForeignFailureDataDto.java
@@ -32,6 +32,12 @@
private boolean isAutopublish;
+ private boolean isOnceOnlyImport;
+
+ private boolean isExcludeEquals;
+
+ private boolean isExcludeAlreadyEdited;
+
@NotNull
private boolean isPlanned;
@@ -75,7 +81,7 @@
private String street;
@Size(max=10)
- @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/()-]+")
+ @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/(),.;:-]+")
private String housenumber;
@Size(max=200)
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/StoerungsauskunftOutage.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/StoerungsauskunftOutage.java
deleted file mode 100644
index 2f4cf93..0000000
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/StoerungsauskunftOutage.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.openk.gridfailureinformation.sarisinterface.dtos;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-@Data
-public class StoerungsauskunftOutage implements Serializable {
-
- private String id;
- private String operatorID;
- private String type;
- private Integer origin;
- private Integer geoType;
- private String date;
- private String estimatedEnding;
- private String postcode;
- private String city;
- private String district;
- private String ags;
- private Integer radius;
- private String coordinates;
- private String liveInfo;
- private Integer social;
- private String socialText;
-
-}
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/StoerungsauskunftUserNotification.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/StoerungsauskunftUserNotification.java
deleted file mode 100644
index 196de63..0000000
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/dtos/StoerungsauskunftUserNotification.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.openk.gridfailureinformation.sarisinterface.dtos;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import lombok.Data;
-
-import java.io.Serializable;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@Data
-public class StoerungsauskunftUserNotification implements Serializable {
-
- private String id;
- private String date;
- private String postcode;
- private String city;
- private String street;
- private String houseNo;
- private String district;
- private String ags;
- private String lat;
- private String lng;
- private String comment;
-
-}
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/mapper/SARISMapper.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/mapper/SARISMapper.java
index 9f52736..00751e8 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/mapper/SARISMapper.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/mapper/SARISMapper.java
@@ -15,30 +15,18 @@
package org.eclipse.openk.gridfailureinformation.sarisinterface.mapper;
import org.eclipse.openk.gridfailureinformation.sarisinterface.constants.Constants;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.FailureInformationDto;
import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.ForeignFailureDataDto;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.StoerungsauskunftOutage;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.StoerungsauskunftUserNotification;
import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.ViewGeplanteVU;
import org.mapstruct.AfterMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;
-import org.mapstruct.Named;
import org.mapstruct.ReportingPolicy;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SARISMapper {
- Pattern STREET_HOUSENUMBER_PATTERN = Pattern.compile("(^\\D+)(\\d.*)");
-
@Mappings({
@Mapping(target = "description", source = "bemerkung"),
@Mapping(target = "failureBegin", source = "beginn", dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"),
@@ -47,35 +35,29 @@
@Mapping(target = "city", source = "ort"),
@Mapping(target = "district", source = "ortsteil"),
@Mapping(target = "street", source = "strasse"),
- @Mapping(target = "housenumber", source = "hausnummern"), //TODO Mehrere Hausnummern möglich
- @Mapping(target = "branch", source = "sparte", qualifiedByName = "branchMapperToForeignFailureDataDto"),
+ @Mapping(target = "housenumber", source = "hausnummern")
})
ForeignFailureDataDto toForeignFailureDataDto(ViewGeplanteVU srcEntity);
@AfterMapping
default void afterMappingProcess(ViewGeplanteVU srcEntity, @MappingTarget ForeignFailureDataDto targetEntity){
+ if (targetEntity.getDistrict() != null) {
+ targetEntity.setDistrict(targetEntity.getDistrict().trim());
+ }
targetEntity.setRadiusInMeters(0L);
- targetEntity.setVoltageLevel(Constants.VOLTAGE_LVL_LOW); //TODO abhängig von Sparte, s. Sparte TODO
- }
-
- @Named("branchMapperToForeignFailureDataDto")
- default String branchMapperToForeignFailureDataDto(String sparteViewGeplanteVU) {
- if (sparteViewGeplanteVU == null || sparteViewGeplanteVU.isEmpty()) return "";
- //TODO logik implementieren. Was sind mögliche Sparten-Werte von SARIS?
- return sparteViewGeplanteVU;
- }
-
- @Named("housenumberMapperToForeignFailureDataDto")
- default String housenumberMapperToForeignFailureDataDto(String streetFromUserNotification) {
- if (streetFromUserNotification == null || streetFromUserNotification.isEmpty()) return "";
- String housenumber = "";
- Matcher matcher = STREET_HOUSENUMBER_PATTERN.matcher(streetFromUserNotification);
- if (matcher.matches()) {
- housenumber = matcher.group(2).trim();
+ targetEntity.setBranch(Constants.BRANCH_OTHER);
+ if (srcEntity.getSparteID() == 2899) {
+ targetEntity.setBranch(Constants.BRANCH_ELECTRICITY);
+ targetEntity.setVoltageLevel(Constants.VOLTAGE_LVL_LOW);
}
- return housenumber;
+ if (srcEntity.getSparteID() == 2900) {
+ targetEntity.setBranch(Constants.BRANCH_WATER);
+ }
+ if (srcEntity.getSparteID() == 2898) {
+ targetEntity.setBranch(Constants.BRANCH_GAS);
+ }
}
}
\ No newline at end of file
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/mapper/StoerungsauskunftMapper.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/mapper/StoerungsauskunftMapper.java
deleted file mode 100644
index 24bf71d..0000000
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/mapper/StoerungsauskunftMapper.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *******************************************************************************
- * Copyright (c) 2019 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *******************************************************************************
- */
-package org.eclipse.openk.gridfailureinformation.sarisinterface.mapper;
-
-import org.eclipse.openk.gridfailureinformation.sarisinterface.constants.Constants;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.FailureInformationDto;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.ForeignFailureDataDto;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.StoerungsauskunftOutage;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.StoerungsauskunftUserNotification;
-import org.mapstruct.*;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
-public interface StoerungsauskunftMapper {
-
- final Pattern STREET_HOUSENUMBER_PATTERN = Pattern.compile("(^\\D+)(\\d.*)");
-
- @Mappings({
- @Mapping(target = "description", source = "comment"),
- @Mapping(target = "failureBegin", source = "date", dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"),
- @Mapping(target = "longitude", source = "lng"),
- @Mapping(target = "latitude", source = "lat"),
- @Mapping(target = "street", source = "street", qualifiedByName = "streetMapperToForeignFailureDataDto"),
- @Mapping(target = "housenumber", source = "houseNo"),
- })
- ForeignFailureDataDto toForeignFailureDataDto(StoerungsauskunftUserNotification srcEntity);
-
-
- @AfterMapping
- default void afterMappingProcess(StoerungsauskunftUserNotification srcEntity, @MappingTarget ForeignFailureDataDto targetEntity){
- if (targetEntity.getHousenumber() == null || targetEntity.getHousenumber().isEmpty()){
- targetEntity.setHousenumber(housenumberMapperToForeignFailureDataDto(srcEntity.getStreet()));
- }
- targetEntity.setRadiusInMeters(0L);
- targetEntity.setVoltageLevel(Constants.VOLTAGE_LVL_LOW);
- }
-
- @Named("streetMapperToForeignFailureDataDto")
- default String streetMapperToForeignFailureDataDto(String streetFromUserNotification) {
- if (streetFromUserNotification == null || streetFromUserNotification.isEmpty()) return "";
- String street = streetFromUserNotification;
- Matcher matcher = STREET_HOUSENUMBER_PATTERN.matcher(streetFromUserNotification);
- if (matcher.matches()) {
- street = matcher.group(1).trim();
- }
- return street;
- }
-
- @Named("housenumberMapperToForeignFailureDataDto")
- default String housenumberMapperToForeignFailureDataDto(String streetFromUserNotification) {
- if (streetFromUserNotification == null || streetFromUserNotification.isEmpty()) return "";
- String housenumber = "";
- Matcher matcher = STREET_HOUSENUMBER_PATTERN.matcher(streetFromUserNotification);
- if (matcher.matches()) {
- housenumber = matcher.group(2).trim();
- }
- return housenumber;
- }
-
- /* Exportmapper */
-
- @AfterMapping
- default void setCoordinates(@MappingTarget StoerungsauskunftOutage target, FailureInformationDto srcEntity) {
-
- //Störungsauskunft.de Koordinatenformat: LNG,LAT;LNG,LAT; …
-
- List<ArrayList<BigDecimal>> addressPolygonPoints = srcEntity.getAddressPolygonPoints();
- if (addressPolygonPoints != null && !addressPolygonPoints.isEmpty()) {
- String coordinatesResult = "";
- for (ArrayList<BigDecimal> addressPolygonPoint : addressPolygonPoints) {
- //index 0: = Lat / index 1:= Lng
- coordinatesResult = coordinatesResult.concat(addressPolygonPoint.get(1).toString() + "," + addressPolygonPoint.get(0).toString() +";");
- }
- target.setCoordinates(coordinatesResult);
- } else {
- target.setCoordinates(srcEntity.getLongitude()+ "," + srcEntity.getLatitude());
- }
-
- }
-
- @Mappings({
- @Mapping(target = "liveInfo", source = "description"),
- @Mapping(target = "date", source = "failureBegin", dateFormat = "dd.MM.yyyy HH:mm:ss"),
- @Mapping(target = "estimatedEnding", source = "failureEndPlanned", dateFormat = "dd.MM.yyyy HH:mm:ss"),
- })
- StoerungsauskunftOutage toStoerungsauskunftOutage(FailureInformationDto srcEntity);
-
-
-
-}
\ No newline at end of file
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/ImportService.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/ImportService.java
index ab83b58..1adad7f 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/ImportService.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/ImportService.java
@@ -16,14 +16,11 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.log4j.Log4j2;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.constants.Constants;
import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.ForeignFailureDataDto;
import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.ForeignFailureMessageDto;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.api.StoerungsauskunftApi;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.constants.Constants;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.StoerungsauskunftUserNotification;
import org.eclipse.openk.gridfailureinformation.sarisinterface.exceptions.InternalServerErrorException;
import org.eclipse.openk.gridfailureinformation.sarisinterface.mapper.SARISMapper;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.mapper.StoerungsauskunftMapper;
import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.ArrayOfViewGeplanteVU;
import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemeinResponse;
import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.ViewGeplanteVU;
@@ -39,6 +36,7 @@
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
@Service
@@ -48,18 +46,12 @@
public class ImportService {
@Autowired
- private StoerungsauskunftApi stoerungsauskunftApi;
-
- @Autowired
private MessageChannel failureImportChannel;
@Autowired
private ObjectMapper objectMapper;
@Autowired
- StoerungsauskunftMapper stoerungsauskunftMapper;
-
- @Autowired
SARISMapper sarisMapper;
@Autowired
@@ -67,41 +59,48 @@
@Value("${gridFailureInformation.autopublish:false}")
private boolean autopublish;
+ @Value("${gridFailureInformation.onceOnlyImport:false}")
+ private boolean onceOnlyImport;
+ @Value("${gridFailureInformation.excludeEquals:true}")
+ private boolean excludeEquals;
+ @Value("${gridFailureInformation.excludeAlreadyEdited:true}")
+ private boolean excludeAlreadyEdited;
- public void importForeignFailures() throws JAXBException {
+ public void importForeignFailures(int sarisSparteId) {
-// GetAktuelleGVUsInfoAllgemeinResponse sarisResponse = sarisWebservice.getAktuelleGVU();
+ GetAktuelleGVUsInfoAllgemeinResponse sarisResponse = sarisWebservice.getAktuelleGVU(sarisSparteId, false);
- GetAktuelleGVUsInfoAllgemeinResponse sarisResponse = getMockedSarisResponse();
+ //GetAktuelleGVUsInfoAllgemeinResponse sarisResponse = getMockedSarisResponse("sarisRealMockResponse.xml");
- ArrayOfViewGeplanteVU getAktuelleGVUsInfoAllgemeinResult = sarisResponse.getGetAktuelleGVUsInfoAllgemeinResult();
+ ArrayOfViewGeplanteVU getAktuelleGVUsInfoAllgemeinResult =
+ sarisResponse.getGetAktuelleGVUsInfoAllgemeinResult();
if (getAktuelleGVUsInfoAllgemeinResult != null) {
- List<ViewGeplanteVU> viewGeplanteVU = sarisResponse.getGetAktuelleGVUsInfoAllgemeinResult().getViewGeplanteVU();
+ List<ViewGeplanteVU> viewGeplanteVU =
+ sarisResponse.getGetAktuelleGVUsInfoAllgemeinResult().getViewGeplanteVU();
+ List<ForeignFailureMessageDto> messageDtoList = new ArrayList<>();
for (ViewGeplanteVU geplanteVU : viewGeplanteVU) {
pushForeignFailure(createForeignFailureMessageDto(geplanteVU));
ForeignFailureMessageDto foreignFailureMessageDto = createForeignFailureMessageDto(geplanteVU);
- log.info("VersorgungsunterbrechungID: " + geplanteVU.getVersorgungsunterbrechungID());
+ messageDtoList.add(foreignFailureMessageDto);
+ log.trace("foreignFailureMessageDto" + foreignFailureMessageDto);
}
+ log.debug(messageDtoList);
}
}
- private GetAktuelleGVUsInfoAllgemeinResponse getMockedSarisResponse() throws JAXBException {
- JAXBContext jaxbContext = JAXBContext.newInstance(GetAktuelleGVUsInfoAllgemeinResponse.class);
- Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
+ private GetAktuelleGVUsInfoAllgemeinResponse getMockedSarisResponse(String xmlResponseFile) {
+ GetAktuelleGVUsInfoAllgemeinResponse response = null;
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance(GetAktuelleGVUsInfoAllgemeinResponse.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
+ File file = new File(xmlResponseFile);
+ response = (GetAktuelleGVUsInfoAllgemeinResponse) jaxbUnmarshaller.unmarshal(file);
- File file = new File("sarisMockResponse.xml");
- return (GetAktuelleGVUsInfoAllgemeinResponse) jaxbUnmarshaller.unmarshal(file);
- }
-
- public void importUserNotifications() {
-
-// List<StoerungsauskunftUserNotification> userNotificationList =
-// stoerungsauskunftApi.getUserNotification(1);
-//
-// for (StoerungsauskunftUserNotification userNotification : userNotificationList) {
-// pushForeignFailure(createForeignFailureMessageDto(userNotification));
-// }
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ }
+ return response;
}
private ForeignFailureMessageDto createForeignFailureMessageDto(ViewGeplanteVU viewGeplanteVU) {
@@ -115,9 +114,11 @@
private ForeignFailureDataDto createForeignFailureData(ViewGeplanteVU viewGeplanteVU) {
ForeignFailureDataDto foreignFailureDataDto = sarisMapper.toForeignFailureDataDto(viewGeplanteVU);
- foreignFailureDataDto.setBranch(Constants.BRANCH_ELECTRICITY);
foreignFailureDataDto.setPlanned(true);
foreignFailureDataDto.setAutopublish(autopublish);
+ foreignFailureDataDto.setOnceOnlyImport(onceOnlyImport);
+ foreignFailureDataDto.setExcludeEquals(excludeEquals);
+ foreignFailureDataDto.setExcludeAlreadyEdited(excludeAlreadyEdited);
return foreignFailureDataDto;
}
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/SarisWebservice.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/SarisWebservice.java
index 6799b72..62a5a1b 100644
--- a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/SarisWebservice.java
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/SarisWebservice.java
@@ -2,56 +2,74 @@
package org.eclipse.openk.gridfailureinformation.sarisinterface.service;
+import lombok.extern.log4j.Log4j2;
import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemein;
import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemeinResponse;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetCountryRequest;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetCountryResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.ws.client.core.WebServiceTemplate;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
+import org.springframework.ws.soap.client.core.SoapActionCallback;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import java.io.File;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.GregorianCalendar;
+@Log4j2
public class SarisWebservice extends WebServiceGatewaySupport {
- private static final Logger log = LoggerFactory.getLogger(SarisWebservice.class);
+ @Value("${saris.apiUrl}")
+ public String sarisApiUrl;
- public GetCountryResponse getCountry(String country) {
+ @Value("${saris.user}")
+ public String sarisUser;
+ @Value("${saris.password}")
+ public String sarisPassword;
- GetCountryRequest request = new GetCountryRequest();
- request.setName(country);
+ @Value("${saris.bisToleranz}")
+ public int sarisBisToleranz;
+ @Value("${saris.vonToleranz}")
+ public int sarisVonToleranz;
- log.info("Requesting location for " + country);
+ @Value("${saris.testIntegration.year}")
+ public int testYearIntegration;
+ @Value("${saris.testIntegration.month}")
+ public int testMonthIntegration;
+ @Value("${saris.testIntegration.day}")
+ public int testDayIntegration;
- /*GetCountryResponse response = (GetCountryResponse) getWebServiceTemplate()
- .marshalSendAndReceive("http://localhost:8080/ws/countries", request,
- new SoapActionCallback(
- "http://spring.io/guides/gs-producing-web-service/GetCountryRequest"));*/
-
- GetCountryResponse response = (GetCountryResponse) getWebServiceTemplate()
- .marshalSendAndReceive("http://localhost:8080/ws/countries", request);
-
- return response;
- }
-
- public GetAktuelleGVUsInfoAllgemeinResponse getAktuelleGVU() {
+ public GetAktuelleGVUsInfoAllgemeinResponse getAktuelleGVU(int sarisSparteId, boolean testCall) {
log.info("getAktuelleGVU called");
+ LocalDate localDate = LocalDate.now(ZoneId.of("Europe/Berlin"));
+ if (testCall) localDate = LocalDate.of(testYearIntegration, testMonthIntegration, testDayIntegration);
+
+ GregorianCalendar gcal = GregorianCalendar.from(localDate.atStartOfDay(ZoneId.of("Europe/Berlin")));
+ XMLGregorianCalendar xcal = null;
+ try {
+ xcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal);
+ } catch (DatatypeConfigurationException e) {
+ log.error("Error while trying to convert to newXMLGregorianCalendar", e);
+ }
GetAktuelleGVUsInfoAllgemein request = new GetAktuelleGVUsInfoAllgemein();
+ request.setBisToleranz(sarisBisToleranz);
+ request.setVonToleranz(sarisVonToleranz);
+ request.setSparteId(sarisSparteId);
+ request.setDienstplanId(0);
+ request.setDateTime(xcal);
- GetAktuelleGVUsInfoAllgemeinResponse response = (GetAktuelleGVUsInfoAllgemeinResponse) getWebServiceTemplate()
- .marshalSendAndReceive("http://sariskon/sariskon/services/Stoerungenservice.asmx", request);
+ WebServiceTemplate webServiceTemplate = getWebServiceTemplate();
+ webServiceTemplate.setCheckConnectionForFault(true);
+ webServiceTemplate.setCheckConnectionForError(true);
+ webServiceTemplate.setMessageSender(new WebServiceMessageSenderWithAuth(sarisUser, sarisPassword));
-/* GetAktuelleGVUsInfoAllgemeinResponse response = (GetAktuelleGVUsInfoAllgemeinResponse) getWebServiceTemplate()
- .marshalSendAndReceive("http://sariskon/sariskon/services/Stoerungenservice.asmx", request, new SoapActionCallback(
- "http://tempuri.org/GetAktuelleGVUsInfoAllgemein"));*/
+ GetAktuelleGVUsInfoAllgemeinResponse response = (GetAktuelleGVUsInfoAllgemeinResponse) webServiceTemplate
+ .marshalSendAndReceive(sarisApiUrl, request, new SoapActionCallback(
+ "http://tempuri.org/GetAktuelleGVUsInfoAllgemein"));
return response;
}
-
-
}
diff --git a/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/WebServiceMessageSenderWithAuth.java b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/WebServiceMessageSenderWithAuth.java
new file mode 100644
index 0000000..a243544
--- /dev/null
+++ b/SARIS-Interface/src/main/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/WebServiceMessageSenderWithAuth.java
@@ -0,0 +1,32 @@
+package org.eclipse.openk.gridfailureinformation.sarisinterface.service;
+
+import lombok.extern.log4j.Log4j2;
+import org.springframework.ws.transport.http.HttpUrlConnectionMessageSender;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+@Log4j2
+public class WebServiceMessageSenderWithAuth extends HttpUrlConnectionMessageSender {
+
+
+ private final String user;
+ private final String password;
+
+ public WebServiceMessageSenderWithAuth(String user, String password) {
+ this.user = user;
+ this.password = password;
+ }
+
+ @Override
+ protected void prepareConnection(HttpURLConnection connection)
+ throws IOException {
+ Base64.Encoder enc = Base64.getEncoder();
+ String userpassword = user +":"+ password;
+ String encodedAuthorization = enc.encodeToString(userpassword.getBytes(StandardCharsets.UTF_8));
+ connection.setRequestProperty("Authorization", "Basic " + encodedAuthorization); // NOSONAR Basic Authorization is used on the server side of this interface
+ super.prepareConnection(connection);
+ }
+}
diff --git a/SARIS-Interface/src/main/resources/Stoerungenservice.wsdl b/SARIS-Interface/src/main/resources/Stoerungenservice.wsdl
index f08b388..a4960ca 100644
--- a/SARIS-Interface/src/main/resources/Stoerungenservice.wsdl
+++ b/SARIS-Interface/src/main/resources/Stoerungenservice.wsdl
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
-<wsdl:definitions xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s1="http://tempuri.org/AbstractTypes" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="GetAktuelleGVUsInfoAllgemein">
diff --git a/SARIS-Interface/src/main/resources/application.yml b/SARIS-Interface/src/main/resources/application.yml
index aedb437..566947e 100644
--- a/SARIS-Interface/src/main/resources/application.yml
+++ b/SARIS-Interface/src/main/resources/application.yml
@@ -29,6 +29,7 @@
org.springframework.web: ERROR
server:
+ port: 9196
max-http-header-size: 262144
feign:
@@ -38,29 +39,46 @@
connectTimeout: 60000
readTimeout: 60000
-stoerungsauskunft:
- apiUrl: https://stage-api-operator.stoerungsauskunft.de/api/v1.0/
- user: ${GFI_STOERUNGSAUSKUNFT_USERNAME}
- password: ${GFI_STOERUNGSAUSKUNFT_PASSWORD}
+saris:
+ apiUrl: https://twh.ewe.de/sariskon/sariskon/services/Stoerungenservice.asmx
+ user: ${GFI_SARIS_USERNAME}
+ password: ${GFI_SARIS_PASSWORD}
+ bisToleranz: 1440
+ vonToleranz: 1440
scheduling-import:
enabled: false
cron: 0 */15 * ? * *
+ testIntegration:
+ day: 11
+ month: 2
+ year: 2020
gridFailureInformation:
autopublish: false
+ onceOnlyImport: false
+ excludeEquals: true
+ excludeAlreadyEdited: true
+
+security.endpoint:
+ user: ${GFI_MANUAL_ENDPOINTS_USERNAME}
+ password: ${GFI_MANUAL_ENDPOINTS_PASSWORD}
---
spring:
profiles: test
-stoerungsauskunft:
- apiUrl: https://stage-api-operator.stoerungsauskunft.de/api/v1.0/
+saris:
+ apiUrl: https://apiTestUrl
user: userName
password: secPwd
scheduling-import:
enabled: true
cron: 0 */15 * ? * *
+
+security.endpoint:
+ user: userName
+ password: secPwd
---
spring:
@@ -118,14 +136,15 @@
level:
root: INFO
org.eclipse.openk: DEBUG
- org.springframework.web: ERROR
+ org.springframework.web: TRACE
+ org.springframework.ws: TRACE
server:
- port: 9195
+ port: 9196
max-http-header-size: 262144
servlet:
session:
tracking-modes: cookie
swagger:
- baseUrl: /test-stoerungsauskunft-interface
\ No newline at end of file
+ baseUrl: /test-saris-interface
\ No newline at end of file
diff --git a/SARIS-Interface/src/main/resources/application_localdev.yml b/SARIS-Interface/src/main/resources/application_localdev.yml
index 6c42049..3eb7c08 100644
--- a/SARIS-Interface/src/main/resources/application_localdev.yml
+++ b/SARIS-Interface/src/main/resources/application_localdev.yml
@@ -46,19 +46,27 @@
readTimeout: 5000
loggerLevel: FULL
-logging.level.org.eclipse.openk.gridfailureinformation.jobs.stoerauskunftinterface.api.StoerauskunftApi: DEBUG
-
-stoerungsauskunft:
- apiUrl: https://stage-api-operator.stoerungsauskunft.de/api/v1.0/
- user: ${GFI_STOERUNGSAUSKUNFT_USERNAME}
- password: ${GFI_STOERUNGSAUSKUNFT_PASSWORD}
+saris:
+ apiUrl: https://twh.ewe.de/sariskon/sariskon/services/Stoerungenservice.asmx
+ user: ${GFI_SARIS_USERNAME}
+ password: ${GFI_SARIS_PASSWORD}
+ bisToleranz: 1440
+ vonToleranz: 1440
scheduling-import:
enabled: false
cron: 0 */15 * ? * *
-
+ testIntegration:
+ day: 11
+ month: 2
+ year: 2020
+
gridFailureInformation:
autopublish: false
+ onceOnlyImport: false
+security.endpoint:
+ user: ${GFI_MANUAL_ENDPOINTS_USERNAME}
+ password: ${GFI_MANUAL_ENDPOINTS_PASSWORD}
---
spring:
@@ -75,6 +83,10 @@
# importkey: sitImportExchange.failureImportKey_localdev_simon
# Importkanal
- importExchange: sitImportExchange
- importQueue: sitImportQueue
- importkey: sitImportExchange.failureImportKey
+# importExchange: sitImportExchange
+# importQueue: sitImportQueue
+# importkey: sitImportExchange.failureImportKey
+
+ importExchange: sitImportExchange_localdev
+ importQueue: sitImportQueue_localdev
+ importkey: sitImportExchange.failureImportKey_localdev
\ No newline at end of file
diff --git a/SARIS-Interface/src/main/resources/countries.wsdl b/SARIS-Interface/src/main/resources/countries.wsdl
deleted file mode 100644
index 8b56dcc..0000000
--- a/SARIS-Interface/src/main/resources/countries.wsdl
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://spring.io/guides/gs-producing-web-service" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.io/guides/gs-producing-web-service" targetNamespace="http://spring.io/guides/gs-producing-web-service">
- <wsdl:types>
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://spring.io/guides/gs-producing-web-service">
-
- <xs:element name="getCountryRequest">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="name" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="getCountryResponse">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="country" type="tns:country"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="country">
- <xs:sequence>
- <xs:element name="name" type="xs:string"/>
- <xs:element name="population" type="xs:int"/>
- <xs:element name="capital" type="xs:string"/>
- <xs:element name="currency" type="tns:currency"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:simpleType name="currency">
- <xs:restriction base="xs:string">
- <xs:enumeration value="GBP"/>
- <xs:enumeration value="EUR"/>
- <xs:enumeration value="PLN"/>
- </xs:restriction>
- </xs:simpleType>
-</xs:schema>
- </wsdl:types>
- <wsdl:message name="getCountryResponse">
- <wsdl:part element="tns:getCountryResponse" name="getCountryResponse">
- </wsdl:part>
- </wsdl:message>
- <wsdl:message name="getCountryRequest">
- <wsdl:part element="tns:getCountryRequest" name="getCountryRequest">
- </wsdl:part>
- </wsdl:message>
- <wsdl:portType name="CountriesPort">
- <wsdl:operation name="getCountry">
- <wsdl:input message="tns:getCountryRequest" name="getCountryRequest">
- </wsdl:input>
- <wsdl:output message="tns:getCountryResponse" name="getCountryResponse">
- </wsdl:output>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="CountriesPortSoap11" type="tns:CountriesPort">
- <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getCountry">
- <soap:operation soapAction=""/>
- <wsdl:input name="getCountryRequest">
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="getCountryResponse">
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="CountriesPortService">
- <wsdl:port binding="tns:CountriesPortSoap11" name="CountriesPortSoap11">
- <soap:address location="http://localhost:8080/ws"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
\ No newline at end of file
diff --git a/SARIS-Interface/src/main/resources/logback-spring.xml b/SARIS-Interface/src/main/resources/logback-spring.xml
index c7cacfb..c4132d4 100644
--- a/SARIS-Interface/src/main/resources/logback-spring.xml
+++ b/SARIS-Interface/src/main/resources/logback-spring.xml
@@ -6,7 +6,7 @@
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
- %black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%c{60}): %msg%n%throwable
+ %d{ISO8601} %highlight(%-5level) [%blue(%t)] %yellow(%c{60}): %msg%n%throwable
</Pattern>
</layout>
</appender>
@@ -24,19 +24,6 @@
</rollingPolicy>
</appender>
- <appender name="RollingFileFeign" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${LOGS}/feignclient.log</file>
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <Pattern>%d %p %c{60} [%t] %m%n</Pattern>
- </encoder>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOGS}/archived/feignclient-%d{yyyy-MM-dd}.gz</fileNamePattern>
- <MaxHistory>30</MaxHistory>
- <cleanHistoryOnStart>true</cleanHistoryOnStart>
- </rollingPolicy>
- </appender>
-
<!-- LOG everything at INFO level -->
<root level="info">
<appender-ref ref="RollingFileStd"/>
@@ -49,8 +36,4 @@
<appender-ref ref="Console"/>
</logger>
- <logger name="org.eclipse.openk.gridfailureinformation.sarisinterface.api.StoerungsauskunftApi" level="info" additivity="false">
- <appender-ref ref="RollingFileFeign"/>
- </logger>
-
</configuration>
\ No newline at end of file
diff --git a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/ImportSchedulerConfigTest.java b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/ImportSchedulerConfigTest.java
index 74bc188..61393fa 100644
--- a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/ImportSchedulerConfigTest.java
+++ b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/ImportSchedulerConfigTest.java
@@ -1,8 +1,10 @@
package org.eclipse.openk.gridfailureinformation.sarisinterface.config;
import org.eclipse.openk.gridfailureinformation.sarisinterface.SarisInterfaceApplication;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.api.StoerungsauskunftApi;
import org.eclipse.openk.gridfailureinformation.sarisinterface.service.ImportService;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.service.SarisWebservice;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.support.MockDataHelper;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemeinResponse;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -10,26 +12,36 @@
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
+
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
@SpringBootTest(classes = SarisInterfaceApplication.class)
@ContextConfiguration(classes = {TestConfiguration.class})
@ActiveProfiles("test")
public class ImportSchedulerConfigTest {
+ @MockBean
+ private SarisWebservice sarisWebservice;
+
@SpyBean
private ImportService importService;
- @MockBean
- private StoerungsauskunftApi stoerungsauskunftApi;
-
@Autowired
private ImportSchedulerConfig importSchedulerConfig;
@Test
public void shoulImportUserNotification() {
- importSchedulerConfig.scheduleTaskImportUserNotifications();
- verify(importService, times(1)).importUserNotifications();
+
+ GetAktuelleGVUsInfoAllgemeinResponse mockedSarisResponse = MockDataHelper.getMockedSarisResponse(
+ "sarisRealMockResponse.xml");
+
+ when(sarisWebservice.getAktuelleGVU(anyInt(), anyBoolean())).thenReturn(mockedSarisResponse);
+
+ importSchedulerConfig.scheduleTaskImportMessages();
+ verify(importService, times(3)).importForeignFailures(anyInt());
}
}
diff --git a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/TestConfiguration.java b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/TestConfiguration.java
index 7ad433f..f30151a 100644
--- a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/TestConfiguration.java
+++ b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/config/TestConfiguration.java
@@ -18,8 +18,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.Channel;
import org.eclipse.openk.gridfailureinformation.sarisinterface.SarisInterfaceApplication;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.config.rabbitMq.RabbitMqConfig;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.mapper.StoerungsauskunftMapperImpl;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.config.rabbitmq.RabbitMqConfig;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.mapper.SARISMapperImpl;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.connection.Connection;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
@@ -50,7 +50,7 @@
ObjectMapper objectMapper() { return new ObjectMapper(); }
@Bean
- public StoerungsauskunftMapperImpl stoerungsauskunftMapper() {return new StoerungsauskunftMapperImpl();}
+ public SARISMapperImpl sarisMapper() {return new SARISMapperImpl();}
@Bean
public MessageChannel failureImportChannel() {return mock(MessageChannel.class);}
diff --git a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/controller/ImportControllerTest.java b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/controller/ImportControllerTest.java
index f34c4e6..da52550 100644
--- a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/controller/ImportControllerTest.java
+++ b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/controller/ImportControllerTest.java
@@ -14,19 +14,27 @@
*/
package org.eclipse.openk.gridfailureinformation.sarisinterface.controller;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.openk.gridfailureinformation.sarisinterface.SarisInterfaceApplication;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.api.StoerungsauskunftApi;
import org.eclipse.openk.gridfailureinformation.sarisinterface.service.ImportService;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.service.SarisWebservice;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.support.MockDataHelper;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemeinResponse;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -37,7 +45,7 @@
public class ImportControllerTest {
@MockBean
- private StoerungsauskunftApi stoerungsauskunftApi;
+ private SarisWebservice sarisWebservice;
@MockBean
private ImportService importService;
@@ -47,11 +55,48 @@
@Test
+ @WithMockUser(value = "mockedUser")
public void shouldCallImport() throws Exception {
- mockMvc.perform(get("/stoerungsauskunft/usernotification-import-test"))
+ mockMvc.perform(get("/saris/import-test"))
.andExpect(status().is2xxSuccessful());
- verify(importService, times(1)).importUserNotifications();
+ verify(importService, times(3)).importForeignFailures(anyInt());
+ }
+
+ @Test
+ public void shouldCallImportAndReturnUnauthorized() throws Exception {
+
+ mockMvc.perform(get("/saris/import-test"))
+ .andExpect(status().isUnauthorized());
+
+ verify(importService, times(0)).importForeignFailures(anyInt());
+ }
+
+ @Test
+ @WithMockUser(value = "mockedUser")
+ public void shouldCallResponseTest() throws Exception {
+
+ GetAktuelleGVUsInfoAllgemeinResponse mockedSarisResponse = MockDataHelper.getMockedSarisResponse(
+ "sarisRealMockResponse.xml");
+
+ when(sarisWebservice.getAktuelleGVU(anyInt(), anyBoolean())).thenReturn(mockedSarisResponse);
+
+ mockMvc.perform(get("/saris/response-test"))
+ .andExpect(status().is2xxSuccessful());
+
+ verify(sarisWebservice, times(1)).getAktuelleGVU( anyInt(), anyBoolean());
+ }
+
+ @Test
+ @WithMockUser(value = "mockedUser")
+ public void shouldCallResponseTest2() throws Exception {
+
+ when(sarisWebservice.getAktuelleGVU(anyInt(), anyBoolean())).thenReturn(new GetAktuelleGVUsInfoAllgemeinResponse());
+
+ mockMvc.perform(get("/saris/response-test"))
+ .andExpect(status().is2xxSuccessful());
+
+ verify(sarisWebservice, times(1)).getAktuelleGVU( anyInt(), anyBoolean());
}
}
\ No newline at end of file
diff --git a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/ImportServiceTest.java b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/ImportServiceTest.java
index fc8f6ce..6ea27f6 100644
--- a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/ImportServiceTest.java
+++ b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/ImportServiceTest.java
@@ -16,16 +16,25 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.openk.gridfailureinformation.sarisinterface.SarisInterfaceApplication;
-import org.eclipse.openk.gridfailureinformation.sarisinterface.api.StoerungsauskunftApi;
import org.eclipse.openk.gridfailureinformation.sarisinterface.config.TestConfiguration;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.constants.Constants;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.ForeignFailureMessageDto;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.support.MockDataHelper;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemeinResponse;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.core.io.ClassPathResource;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
+import java.io.IOException;
+import java.io.InputStream;
+
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.*;
@SpringBootTest(classes = SarisInterfaceApplication.class)
@ContextConfiguration(classes = {TestConfiguration.class})
@@ -35,43 +44,25 @@
@Autowired
private ImportService importService;
- @Autowired
- ObjectMapper objectMapper;
-
@MockBean
- StoerungsauskunftApi stoerungsauskunftApi;
-
- /* @Test
- public void shoulImportUserNotification() throws IOException {
-
- ImportService importExportServicSpy = spy(importService);
-
- InputStream is = new ClassPathResource("UsernotificationJsonResponse.json").getInputStream();
- List<StoerungsauskunftUserNotification> userNotificationList =
- objectMapper.readValue(is, new TypeReference<List<StoerungsauskunftUserNotification>>() {
- });
- when(stoerungsauskunftApi.getUserNotification(any(Integer.class))).thenReturn(userNotificationList);
-
- importExportServicSpy.importUserNotifications();
-
- verify(importExportServicSpy, times(userNotificationList.size())).pushForeignFailure(any(ForeignFailureMessageDto.class));
- }
+ SarisWebservice sarisWebservice;
@Test
- public void shoulImportUserNotificationMapperTest1() throws IOException {
+ public void shoulImportUserNotification() {
- ImportService importExportServicSpy = spy(importService);
+ ImportService importServiceSpy = spy(this.importService);
- InputStream is = new ClassPathResource("UsernotificationJsonResponse.json").getInputStream();
- List<StoerungsauskunftUserNotification> userNotificationList =
- objectMapper.readValue(is, new TypeReference<List<StoerungsauskunftUserNotification>>() {
- });
- when(stoerungsauskunftApi.getUserNotification(any(Integer.class))).thenReturn(userNotificationList);
+ GetAktuelleGVUsInfoAllgemeinResponse mockedSarisResponse = MockDataHelper.getMockedSarisResponse(
+ "sarisRealMockResponse.xml");
- importExportServicSpy.importUserNotifications();
+ when(sarisWebservice.getAktuelleGVU(anyInt(), anyBoolean())).thenReturn(mockedSarisResponse);
- verify(importExportServicSpy, times(userNotificationList.size())).pushForeignFailure(any(ForeignFailureMessageDto.class));
- }*/
+ int mockedSarisResponseListSize = mockedSarisResponse.getGetAktuelleGVUsInfoAllgemeinResult().getViewGeplanteVU().size();
+
+ importServiceSpy.importForeignFailures(Constants.SARIS_ELECTRICITY_BRANCH_ID);
+
+ verify(importServiceSpy, times(mockedSarisResponseListSize)).pushForeignFailure(any(ForeignFailureMessageDto.class));
+ }
}
diff --git a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/SarisWebServiceTest.java b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/SarisWebServiceTest.java
new file mode 100644
index 0000000..06994cc
--- /dev/null
+++ b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/service/SarisWebServiceTest.java
@@ -0,0 +1,88 @@
+/*
+ *******************************************************************************
+ * Copyright (c) 2019 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************
+ */
+package org.eclipse.openk.gridfailureinformation.sarisinterface.service;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.SarisInterfaceApplication;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.config.TestConfiguration;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.constants.Constants;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.support.MockDataHelper;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.util.ResourceLoaderBase;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemeinResponse;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.ViewGeplanteVU;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.context.annotation.Primary;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.ws.client.core.WebServiceMessageCallback;
+import org.springframework.ws.client.core.WebServiceTemplate;
+import org.springframework.ws.test.client.MockWebServiceServer;
+import org.springframework.ws.test.client.RequestMatchers;
+import org.springframework.xml.transform.StringSource;
+
+import javax.xml.transform.Source;
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.springframework.ws.test.client.RequestMatchers.payload;
+import static org.springframework.ws.test.client.ResponseCreators.withPayload;
+
+@SpringBootTest(classes = SarisInterfaceApplication.class)
+@ContextConfiguration(classes = {TestConfiguration.class})
+@ActiveProfiles("test")
+public class SarisWebServiceTest {
+
+ @MockBean
+ WebServiceTemplate webServiceTemplate;
+
+ @Autowired
+ private SarisWebservice sarisWebservice;
+
+ @Test
+ public void shouldGetAktuelleGVU() throws IOException {
+
+ SarisWebservice sarisWebservice = spy(this.sarisWebservice);
+
+ GetAktuelleGVUsInfoAllgemeinResponse mockedSarisResponse = MockDataHelper.getMockedSarisResponse(
+ "sarisRealMockResponse.xml");
+
+ when(webServiceTemplate.marshalSendAndReceive(anyString(), any(), any())).thenReturn(mockedSarisResponse);
+ when(sarisWebservice.getWebServiceTemplate()).thenReturn(webServiceTemplate);
+
+ GetAktuelleGVUsInfoAllgemeinResponse aktuelleGVU =
+ sarisWebservice.getAktuelleGVU(Constants.SARIS_ELECTRICITY_BRANCH_ID, false);
+
+ assertFalse(aktuelleGVU.getGetAktuelleGVUsInfoAllgemeinResult().getViewGeplanteVU().isEmpty());
+ assertEquals(mockedSarisResponse, aktuelleGVU);
+
+ }
+
+
+}
diff --git a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/support/MockDataHelper.java b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/support/MockDataHelper.java
index 6f82c6b..3c3acce 100644
--- a/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/support/MockDataHelper.java
+++ b/SARIS-Interface/src/test/java/org/eclipse/openk/gridfailureinformation/sarisinterface/support/MockDataHelper.java
@@ -18,7 +18,12 @@
import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.FailureInformationDto;
import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.ForeignFailureDataDto;
import org.eclipse.openk.gridfailureinformation.sarisinterface.dtos.ForeignFailureMessageDto;
+import org.eclipse.openk.gridfailureinformation.sarisinterface.wsdl.GetAktuelleGVUsInfoAllgemeinResponse;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import java.io.File;
import java.math.BigDecimal;
import java.sql.Date;
import java.text.ParseException;
@@ -37,7 +42,7 @@
public static ForeignFailureMessageDto mockForeignFailureDto() throws ParseException {
ForeignFailureMessageDto foreignFailureMessageDto = new ForeignFailureMessageDto();
foreignFailureMessageDto.setMetaId("a4509482-3be2-4402-a9bd-ff91649b9c1e");
- foreignFailureMessageDto.setSource(Constants.SRC_STOERUNGSAUSKUNFT_DE);
+ foreignFailureMessageDto.setSource(Constants.SRC_SARIS);
foreignFailureMessageDto.setDescription("Rohrbruch");
ForeignFailureDataDto dataDto = new ForeignFailureDataDto();
@@ -55,7 +60,7 @@
public static ForeignFailureMessageDto mockForeignFailureDtoWithCoordinates() throws ParseException {
ForeignFailureMessageDto foreignFailureMessageDto = new ForeignFailureMessageDto();
foreignFailureMessageDto.setMetaId("a4509482-3be2-4402-a9bd-ff91649b9c1e");
- foreignFailureMessageDto.setSource(Constants.SRC_STOERUNGSAUSKUNFT_DE);
+ foreignFailureMessageDto.setSource(Constants.SRC_SARIS);
foreignFailureMessageDto.setDescription("Rohrbruch");
ForeignFailureDataDto dataDto = new ForeignFailureDataDto();
@@ -159,4 +164,18 @@
return cordinatesList;
}
+ public static GetAktuelleGVUsInfoAllgemeinResponse getMockedSarisResponse(String xmlResponseFile) {
+ GetAktuelleGVUsInfoAllgemeinResponse response = null;
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance(GetAktuelleGVUsInfoAllgemeinResponse.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
+ File file = new File(xmlResponseFile);
+ response = (GetAktuelleGVUsInfoAllgemeinResponse) jaxbUnmarshaller.unmarshal(file);
+
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ }
+ return response;
+ }
+
}
diff --git a/SARIS-Interface/src/test/resources/UsernotificationJsonResponse.json b/SARIS-Interface/src/test/resources/UsernotificationJsonResponse.json
deleted file mode 100644
index fb469bf..0000000
--- a/SARIS-Interface/src/test/resources/UsernotificationJsonResponse.json
+++ /dev/null
@@ -1,69 +0,0 @@
-[
- {
- "id": 24,
- "date": "28.5.2020 14:49:11",
- "postcode": "55237",
- "city": "Bornheim",
- "ags": null,
- "district": null,
- "street": "Bahnhofstraße 27",
- "lat": "49.8031615",
- "lng": "8.1932478",
- "comment": "Licht aus",
- "operatorOutageInArea": 0
- },
- {
- "id": 23,
- "date": "28.5.2020 14:49:11",
- "postcode": "55237",
- "city": "Flonheim",
- "ags": null,
- "district": null,
- "street": "Am Obertor",
- "lat": "49.8031615",
- "lng": "8.1932478",
- "comment": "Zappenduster",
- "operatorOutageInArea": 0,
- "houseNo": "13"
- },
- {
- "id": 23,
- "date": "28.5.2020 14:49:11",
- "postcode": "55237",
- "city": "Flonheim",
- "ags": null,
- "district": null,
- "lat": "49.8031615",
- "lng": "8.1932478",
- "comment": "Zappenduster",
- "operatorOutageInArea": 0
- },
- {
- "id": 23,
- "date": "28.5.2020 14:49:11",
- "postcode": "55237",
- "city": "Flonheim",
- "ags": null,
- "street": "",
- "district": null,
- "lat": "49.8031615",
- "lng": "8.1932478",
- "comment": "Zappenduster",
- "operatorOutageInArea": 0,
- "houseNo": ""
- },
- {
- "id": 23,
- "date": "28.5.2020 14:49:11",
- "postcode": "55237",
- "city": "Flonheim",
- "ags": null,
- "district": null,
- "street": "Am Obertor",
- "lat": "49.8031615",
- "lng": "8.1932478",
- "comment": "Zappenduster",
- "phone": "01520123456",
- "operatorOutageInArea": 0
- }
-]
\ No newline at end of file
diff --git a/SARIS-Interface/src/test/resources/application.yml b/SARIS-Interface/src/test/resources/application.yml
index 843be83..654aaeb 100644
--- a/SARIS-Interface/src/test/resources/application.yml
+++ b/SARIS-Interface/src/test/resources/application.yml
@@ -31,15 +31,6 @@
server:
max-http-header-size: 262144
-jwt:
- tokenHeader: Authorization
- useStaticJwt: false
- staticJwt: x
-
-gridFailureInformation:
- maxListSize: 2000
-
-
feign:
client:
config:
@@ -49,26 +40,34 @@
cors:
corsEnabled: false
-stoerungsauskunft:
- apiUrl: https://stage-api-operator.stoerungsauskunft.de/api/v1.0/
+saris:
+ apiUrl: https://apiTestUrl/api/v1.0/
user: userName
password: secPwd
+ bisToleranz: 1440
+ vonToleranz: 1440
scheduling-import:
enabled: false
cron: 0 */15 * ? * *
+ testIntegration:
+ year: 2020
+ month: 2
+ day: 11
+
+gridFailureInformation:
+ autopublish: false
+
+security.endpoint:
+ user: userName
+ password: secPwd
---
spring:
profiles: test
-jwt:
- tokenHeader: Authorization
- useStaticJwt: true
- staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYjQyZTNkNjNiOGEiLCJleHAiOjE1Nzg2NTU3OTUsIm5iZiI6MCwiaWF0IjoxNTc4NjU1NDk1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiODYyNjY5NmYtZjFhMi00ZGI1LTkyZWYtZTlhMjQ2Njg1YTU0IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjJmMWIzODE5LWZjNjQtNDEzNC1iNWQxLWY3ZWY4NzU5NDBkNCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsia29uLWFkbWluIiwia29uLXdyaXRlciIsImtvbi1hY2Nlc3MiLCJrb24tcmVhZGVyIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSBUZXN0ZXJMYXN0bmFtZV9yd2EiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ0ZXN0dXNlcl9yd2EiLCJnaXZlbl9uYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSIsImZhbWlseV9uYW1lIjoiVGVzdGVyTGFzdG5hbWVfcndhIn0.DAYXuv4tKn8RXqO1jyttnD-tF4nShUBQyfe4bKbAiPAyY2x5YbAf3M4eXnLrGqo8-loGKldICC28bL0LaMA3KKkQEOfW5sfpGqoN6212vs89mOklt0TJYc5PMXwFgJ5WC_TKjdwq7-aaDafOEWehV0U1ut3s-94ovNYIEn29nzXm2W1ldoXJEq03F880jlysQ5zlRvGF7eXEEpFfI2URyyNQ2UWh0Ssfq-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg
-
-stoerungsauskunft:
- apiUrl: https://stage-api-operator.stoerungsauskunft.de/api/v1.0/
+saris:
+ apiUrl: https://apiTestUrl
user: userName
password: secPwd
scheduling-import:
diff --git a/SARIS-Interface/src/test/resources/sarisRealMockResponse.xml b/SARIS-Interface/src/test/resources/sarisRealMockResponse.xml
new file mode 100644
index 0000000..973412b
--- /dev/null
+++ b/SARIS-Interface/src/test/resources/sarisRealMockResponse.xml
@@ -0,0 +1,131 @@
+<GetAktuelleGVUsInfoAllgemeinResponse xmlns="http://tempuri.org/">
+ <GetAktuelleGVUsInfoAllgemeinResult>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95674</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T09:00:00</Beginn>
+ <Ende>2020-02-11T11:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Jesteburg</Ort>
+ <Ortsteil>Jesteburg </Ortsteil>
+ <Strasse>Kleckerwaldweg</Strasse>
+ <Hausnummern>56-58</Hausnummern>
+ <Bemerkung>ON Umschwenken in neue Trafostation
+ Kabelarbeiten</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>335587</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286047</Stoerung>
+ <Plz>21266</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95709</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T09:00:00</Beginn>
+ <Ende>2020-02-11T11:30:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Hollern-Twielenfleth</Ort>
+ <Strasse>Feriendorf Altes Land</Strasse>
+ <Hausnummern>75,77</Hausnummern>
+ <Bemerkung>Wasserschaden bei Hs.Nr.77
+ HAK von der Wand nehmen damit die Wand erneuert werden kann.</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>333815</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286453</Stoerung>
+ <Plz>21723</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95733</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T10:30:00</Beginn>
+ <Ende>2020-02-11T15:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Bülkau</Ort>
+ <Ortsteil>Bülkau </Ortsteil>
+ <Strasse>Süderende</Strasse>
+ <Hausnummern>29-48</Hausnummern>
+ <Bemerkung>Kabelstörung bei Hs. Nr.33</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>312795</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286625</Stoerung>
+ <Plz>21782</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95687</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T12:00:00</Beginn>
+ <Ende>2020-02-11T15:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Schwanewede</Ort>
+ <Ortsteil>Schwanewede </Ortsteil>
+ <Strasse>Lindenstr.</Strasse>
+ <Hausnummern>23-29</Hausnummern>
+ <Bemerkung>Austausch eines defekten Kabelverteilers (Beschädigung). </Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>362161</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286118</Stoerung>
+ <Plz>28790</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95647</VersorgungsunterbrechungID>
+ <Beginn>2020-02-11T13:00:00</Beginn>
+ <Ende>2020-02-11T14:30:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Dörpen</Ort>
+ <Ortsteil>Neudörpen </Ortsteil>
+ <Strasse>Neudörpen</Strasse>
+ <Hausnummern>14a; 15; 16; 17; 31; 34</Hausnummern>
+ <Bemerkung>KVS Wechsel bei Hs.Nr.: Neudörpen 15</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>317353</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>285933</Stoerung>
+ <Plz>26892</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95661</VersorgungsunterbrechungID>
+ <Beginn>2020-02-12T09:00:00</Beginn>
+ <Ende>2020-02-12T11:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Lathen</Ort>
+ <Ortsteil>Lathen </Ortsteil>
+ <Strasse>Zur Düne</Strasse>
+ <Hausnummern>10+15</Hausnummern>
+ <Bemerkung>KVS tausch</Bemerkung>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>339961</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>285988</Stoerung>
+ <Plz>49762</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ <ViewGeplanteVU>
+ <VersorgungsunterbrechungID>95743</VersorgungsunterbrechungID>
+ <Beginn>2020-02-12T10:00:00</Beginn>
+ <Ende>2020-02-12T12:00:00</Ende>
+ <AnzahlKunden>0</AnzahlKunden>
+ <Ort>Grasberg</Ort>
+ <Ortsteil>Meinershausen </Ortsteil>
+ <Strasse>Meinershauser Str.</Strasse>
+ <Hausnummern>150-174</Hausnummern>
+ <Bemerkung/>
+ <Realisiert>false</Realisiert>
+ <StrassenAbschnittID>327076</StrassenAbschnittID>
+ <LetzteAenderungAm>0001-01-01T00:00:00</LetzteAenderungAm>
+ <Stoerung>286676</Stoerung>
+ <Plz>28879</Plz>
+ <SparteID>2899</SparteID>
+ <Sparte>GVU Strom</Sparte>
+ </ViewGeplanteVU>
+ </GetAktuelleGVUsInfoAllgemeinResult>
+</GetAktuelleGVUsInfoAllgemeinResponse>
diff --git a/addressImport/pom.xml b/addressImport/pom.xml
index 3a71380..5434452 100644
--- a/addressImport/pom.xml
+++ b/addressImport/pom.xml
@@ -145,7 +145,21 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>com.oracle.database.jdbc</groupId>
+ <artifactId>ojdbc8</artifactId>
+ <version>19.6.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.oracle.database.jdbc</groupId>
+ <artifactId>ucp</artifactId>
+ <version>19.6.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>5.4.2.Final</version>
+ </dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
diff --git a/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/config/OracleConfig.java b/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/config/OracleConfig.java
new file mode 100644
index 0000000..5bbe4cd
--- /dev/null
+++ b/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/config/OracleConfig.java
@@ -0,0 +1,60 @@
+package org.eclipse.openk.gridfailureinformation.importadresses.config;
+
+import lombok.SneakyThrows;
+import lombok.extern.log4j.Log4j2;
+import oracle.ucp.jdbc.PoolDataSource;
+import oracle.ucp.jdbc.PoolDataSourceFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+@Log4j2
+@Configuration
+@ConditionalOnProperty(
+ value="spring.datasource.enable-oracle-configuration",
+ havingValue = "true",
+ matchIfMissing = false)
+public class OracleConfig {
+ @Value("${spring.datasource.url}")
+ private String url;
+ @Value("${spring.datasource.username}")
+ private String username;
+ @Value("${spring.datasource.password}")
+ private String password;
+ @Value("${oracle.ucp.minPoolSize}")
+ private String minPoolSize;
+
+ @Value("${oracle.ucp.maxPoolSize}")
+ private String maxPoolSize;
+
+ @Value("${spring.datasource.driver-class-name:oracle.jdbc.pool.OracleDataSource}")
+ private String driverClassName;
+
+ @SneakyThrows
+ @Bean(name = "OracleUniversalConnectionPool")
+ @Primary
+ public DataSource getDataSource() {
+ PoolDataSource pds = null;
+ try {
+ pds = PoolDataSourceFactory.getPoolDataSource();
+
+ pds.setConnectionFactoryClassName(driverClassName);
+ pds.setURL(url);
+ pds.setUser(username);
+ pds.setPassword(password);
+ pds.setMinPoolSize(Integer.valueOf(minPoolSize));
+ pds.setInitialPoolSize(10);
+ pds.setMaxPoolSize(Integer.valueOf(maxPoolSize));
+
+ } catch (SQLException ea) {
+ log.error("Error connecting to the database: " + ea.getMessage());
+ }
+
+ return pds;
+ }
+}
\ No newline at end of file
diff --git a/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/model/TblAddress.java b/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/model/TblAddress.java
index 0499eb2..06a97cd 100644
--- a/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/model/TblAddress.java
+++ b/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/model/TblAddress.java
@@ -21,7 +21,8 @@
import java.util.UUID;
@Data
-@Entity(name = "TBL_GFI_ADDRESS")
+@Entity
+@Table(name = "TBL_GFI_ADDRESS")
public class TblAddress {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TBL_GFI_ADDRESS_ID_SEQ")
diff --git a/addressImport/src/main/resources/application.yml b/addressImport/src/main/resources/application.yml
index 7abdedd..091e612 100644
--- a/addressImport/src/main/resources/application.yml
+++ b/addressImport/src/main/resources/application.yml
@@ -12,11 +12,28 @@
# *******************************************************************************
spring:
datasource:
- url: jdbc:postgresql://entopticadirx:5432/GridFailureInfoDevServer
- username: ${GFI_DB_USERNAME}
- password: ${GFI_DB_PASSWORD}
+## ---- postgres ---------------------------------------------------
+# url: jdbc:postgresql://entopticadirx:5432/GridFailureInfoDevServer
+# username: ${GFI_DB_USERNAME}
+# password: ${GFI_DB_PASSWORD}
+# ------------------------------------------------------------------
+## ---- oracle -----------------------------------------------------
+ enable-oracle-configuration: true
+ url: jdbc:oracle:thin:@LIDLORADB2.PTA.DE:1521:NAPDB00
+ username: dietricf
+ password: dietricf000
+ jpa:
+ database-platform: org.hibernate.dialect.Oracle10gDialect
+ show-sql: false
+
+oracle:
+ ucp:
+ minPoolSize: 2
+ maxPoolSize: 10
+# End Orale Config---------------------------------------------------
server:
+ port: 9164
max-http-header-size: 262144
error:
include-message: never
@@ -172,4 +189,76 @@
gas-connections: /opt/mics/addressImport/importFiles/EREP_CSV_GAS_HAUSANSCHLUSS.csv
telecommunication-connections: /opt/mics/addressImport/importFiles/EREP_CSV_TELEKOMMUNIKATION_HAUSANSCHLUSS.csv
districtheating-connections: /opt/mics/addressImport/importFiles/EREP_CSV_FERNWAERME_HAUSANSCHLUSS.csv
- power-stations: /opt/mics/addressImport/importFiles/EREP_CSV_STROM_STATION.csv
\ No newline at end of file
+ power-stations: /opt/mics/addressImport/importFiles/EREP_CSV_STROM_STATION.csv
+
+---
+
+
+spring:
+ profiles: localdev
+ datasource:
+ ## ---- postgres ---------------------------------------------------
+ # url: jdbc:postgresql://entopticadirx:5432/GridFailureInfoDevelop
+ # username: ${GFI_DB_USERNAME}
+ # password: ${GFI_DB_PASSWORD}
+ # ------------------------------------------------------------------
+ ## ---- oracle -----------------------------------------------------
+ enable-oracle-configuration: true
+ url: jdbc:oracle:thin:@LIDLORADB2.PTA.DE:1521:NAPDB00
+ username: dietricf
+ password: dietricf000
+ jpa:
+ database-platform: org.hibernate.dialect.Oracle10gDialect
+ show-sql: false
+
+oracle:
+ ucp:
+ minPoolSize: 2
+ maxPoolSize: 10
+# End Orale Config---------------------------------------------------
+
+adressimport:
+ cleanup: true
+ cron: 0 1 0 1 * ?
+ file:
+ addresses: C:/jworkspace/openKonsequenz/grid-failure-information/gridFailureInformation.backend/addressImport/importFiles/EREP_CSV_ADRESSEN.csv
+ power-connections: C:/jworkspace/openKonsequenz/grid-failure-information/gridFailureInformation.backend/addressImport/importFiles/EREP_CSV_STROM_HAUSANSCHLUSS.csv
+ water-connections: C:/jworkspace/openKonsequenz/grid-failure-information/gridFailureInformation.backend/addressImport/importFiles/EREP_CSV_WASSER_HAUSANSCHLUSS.csv
+ gas-connections: C:/jworkspace/openKonsequenz/grid-failure-information/gridFailureInformation.backend/addressImport/importFiles/EREP_CSV_GAS_HAUSANSCHLUSS.csv
+ telecommunication-connections: C:/jworkspace/openKonsequenz/grid-failure-information/gridFailureInformation.backend/addressImport/importFiles/EREP_CSV_TELEKOMMUNIKATION_HAUSANSCHLUSS.csv
+ districtheating-connections: C:/jworkspace/openKonsequenz/grid-failure-information/gridFailureInformation.backend/addressImport/importFiles/EREP_CSV_FERNWAERME_HAUSANSCHLUSS.csv
+ power-stations: C:/jworkspace/openKonsequenz/grid-failure-information/gridFailureInformation.backend/addressImport/importFiles/EREP_CSV_STROM_STATION.csv
+
+server:
+ port: 9164
+ max-http-header-size: 262144
+ servlet:
+ session:
+ tracking-modes: cookie
+
+jwt:
+ tokenHeader: Authorization
+ useStaticJwt: false
+ staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYjQyZTNkNjNiOGEiLCJleHAiOjE1Nzg2NTU3OTUsIm5iZiI6MCwiaWF0IjoxNTc4NjU1NDk1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiODYyNjY5NmYtZjFhMi00ZGI1LTkyZWYtZTlhMjQ2Njg1YTU0IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjJmMWIzODE5LWZjNjQtNDEzNC1iNWQxLWY3ZWY4NzU5NDBkNCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsia29uLWFkbWluIiwia29uLXdyaXRlciIsImtvbi1hY2Nlc3MiLCJrb24tcmVhZGVyIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSBUZXN0ZXJMYXN0bmFtZV9yd2EiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ0ZXN0dXNlcl9yd2EiLCJnaXZlbl9uYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSIsImZhbWlseV9uYW1lIjoiVGVzdGVyTGFzdG5hbWVfcndhIn0.DAYXuv4tKn8RXqO1jyttnD-tF4nShUBQyfe4bKbAiPAyY2x5YbAf3M4eXnLrGqo8-loGKldICC28bL0LaMA3KKkQEOfW5sfpGqoN6212vs89mOklt0TJYc5PMXwFgJ5WC_TKjdwq7-aaDafOEWehV0U1ut3s-94ovNYIEn29nzXm2W1ldoXJEq03F880jlysQ5zlRvGF7eXEEpFfI2URyyNQ2UWh0Ssfq-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg
+
+services:
+ authNAuth:
+ name: authNAuthService
+
+authNAuthService:
+ ribbon:
+ listOfServers: http://localhost:8080
+
+cors:
+ corsEnabled: true
+
+logging:
+ level:
+ root: INFO
+ org.eclipse.openk: DEBUG
+ org.springframework.web: ERROR
+ org.hibernate: ERROR
+
+swagger:
+ baseUrl: /addressImporter
+
diff --git a/gfsBackendService/pom.xml b/gfsBackendService/pom.xml
index a00189d..39a17de 100644
--- a/gfsBackendService/pom.xml
+++ b/gfsBackendService/pom.xml
@@ -174,7 +174,21 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
- <!-- https://mvnrepository.com/artifact/com.icegreen/greenmail-spring -->
+ <dependency>
+ <groupId>com.oracle.database.jdbc</groupId>
+ <artifactId>ojdbc8</artifactId>
+ <version>19.6.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.oracle.database.jdbc</groupId>
+ <artifactId>ucp</artifactId>
+ <version>19.6.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>5.4.2.Final</version>
+ </dependency>
<dependency>
<groupId>com.icegreen</groupId>
<artifactId>greenmail-spring</artifactId>
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/OracleConfig.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/OracleConfig.java
new file mode 100644
index 0000000..5729eb1
--- /dev/null
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/OracleConfig.java
@@ -0,0 +1,60 @@
+package org.eclipse.openk.gridfailureinformation.config;
+
+import lombok.SneakyThrows;
+import lombok.extern.log4j.Log4j2;
+import oracle.ucp.jdbc.PoolDataSource;
+import oracle.ucp.jdbc.PoolDataSourceFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+@Log4j2
+@Configuration
+@ConditionalOnProperty(
+ value="spring.datasource.enable-oracle-configuration",
+ havingValue = "true",
+ matchIfMissing = false)
+public class OracleConfig {
+ @Value("${spring.datasource.url}")
+ private String url;
+ @Value("${spring.datasource.username}")
+ private String username;
+ @Value("${spring.datasource.password}")
+ private String password;
+ @Value("${oracle.ucp.minPoolSize}")
+ private String minPoolSize;
+
+ @Value("${oracle.ucp.maxPoolSize}")
+ private String maxPoolSize;
+
+ @Value("${spring.datasource.driver-class-name:oracle.jdbc.pool.OracleDataSource}")
+ private String driverClassName;
+
+ @SneakyThrows
+ @Bean(name = "OracleUniversalConnectionPool")
+ @Primary
+ public DataSource getDataSource() {
+ PoolDataSource pds = null;
+ try {
+ pds = PoolDataSourceFactory.getPoolDataSource();
+
+ pds.setConnectionFactoryClassName(driverClassName);
+ pds.setURL(url);
+ pds.setUser(username);
+ pds.setPassword(password);
+ pds.setMinPoolSize(Integer.valueOf(minPoolSize));
+ pds.setInitialPoolSize(10);
+ pds.setMaxPoolSize(Integer.valueOf(maxPoolSize));
+
+ } catch (SQLException ea) {
+ log.error("Error connecting to the database: " + ea.getMessage());
+ }
+
+ return pds;
+ }
+}
\ No newline at end of file
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/SwaggerConfig.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/SwaggerConfig.java
index 6f23bb0..5c004e9 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/SwaggerConfig.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/SwaggerConfig.java
@@ -16,6 +16,7 @@
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@@ -30,6 +31,7 @@
@Configuration
@EnableSwagger2
@Profile({"!test","!prod"})
+@ConditionalOnProperty(prefix = "swagger", name = "enabled", havingValue = "true", matchIfMissing = false)
public class SwaggerConfig {
@Value("${swagger.baseUrl:}")
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationController.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationController.java
index 1ef3b89..410be1a 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationController.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationController.java
@@ -185,7 +185,7 @@
@PathVariable UUID failureInfoUuid,
@RequestParam String publicationChannel) {
- return failureInformationService.insertPublicationChannelForFailureInfo(failureInfoUuid, publicationChannel);
+ return failureInformationService.insertPublicationChannelForFailureInfo(failureInfoUuid, publicationChannel, false);
}
@DeleteMapping("/{failureInfoUuid}/channels")
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/HtblFailureInformation.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/HtblFailureInformation.java
index 8bb0f25..b47d637 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/HtblFailureInformation.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/HtblFailureInformation.java
@@ -68,6 +68,7 @@
private String stationCoords;
private BigDecimal longitude;
private BigDecimal latitude;
+ @Column( name = "object_ref_ext_system")
private String objectReferenceExternalSystem;
private String publicationStatus;
private String publicationFreetext;
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/HtblFailureInformationStation.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/HtblFailureInformationStation.java
index 8e93977..5ef216e 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/HtblFailureInformationStation.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/HtblFailureInformationStation.java
@@ -22,10 +22,12 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
import java.util.Date;
@Data
-@Entity( name = "HTBL_FAILINFO_STATION")
+@Entity
+@Table( name = "HTBL_FAILINFO_STATION")
public class HtblFailureInformationStation {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "HTBL_FAILINFO_STATION_ID_SEQ")
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/RefBranch.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/RefBranch.java
index 9adbace..0b513cb 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/RefBranch.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/RefBranch.java
@@ -16,11 +16,18 @@
import lombok.Data;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
import java.util.UUID;
@Data
-@Entity( name = "REF_GFI_BRANCH")
+@Entity
+@Table( name = "REF_GFI_BRANCH")
public class RefBranch {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ref_gfi_branch_id_seq")
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblAddress.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblAddress.java
index 7cf0198..1d1a5c2 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblAddress.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblAddress.java
@@ -16,12 +16,19 @@
import lombok.Data;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.UUID;
@Data
-@Entity(name = "TBL_GFI_ADDRESS")
+@Entity
+@Table(name = "TBL_GFI_ADDRESS")
public class TblAddress {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TBL_GFI_ADDRESS_ID_SEQ")
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationDistributionGroup.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationDistributionGroup.java
index 63c84b1..3065fd9 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationDistributionGroup.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationDistributionGroup.java
@@ -16,10 +16,19 @@
import lombok.Data;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
@Data
-@Entity( name = "tbl_failinfo_distgroup")
+@Entity
+@Table( name = "tbl_failinfo_distgroup")
public class TblFailureInformationDistributionGroup {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TBL_FAILINFO_DISTGROUP_ID_SEQ")
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationPublicationChannel.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationPublicationChannel.java
index f0dcf06..c7c4621 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationPublicationChannel.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationPublicationChannel.java
@@ -14,16 +14,24 @@
*/
package org.eclipse.openk.gridfailureinformation.model;
-import lombok.Data;
import lombok.Getter;
import lombok.Setter;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
//@Data
@Getter
@Setter
-@Entity( name="tbl_failinfo_pub_channel")
+@Entity
+@Table( name="tbl_failinfo_pub_channel")
public class TblFailureInformationPublicationChannel {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tbl_fi_pub_channel_seq")
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationReminderMailSent.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationReminderMailSent.java
index fddf3ca..75276ec 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationReminderMailSent.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/TblFailureInformationReminderMailSent.java
@@ -16,11 +16,20 @@
import lombok.Data;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
import java.util.Date;
@Data
-@Entity( name = "tbl_failinfo_remind_mail_sent" )
+@Entity
+@Table( name = "tbl_failinfo_remind_mail_sent" )
public class TblFailureInformationReminderMailSent {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tbl_failinfo_reminsent_id_seq")
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/AddressService.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/AddressService.java
index 518de9d..839688b 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/AddressService.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/AddressService.java
@@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
import java.util.TreeSet;
import java.util.UUID;
@@ -138,7 +139,7 @@
communityList = addressRepository.findAllCommunitys();
}
- return communityList.stream().filter(c -> !c.isEmpty()).collect(toCollection(ArrayList::new));
+ return communityList.stream().filter(Objects::nonNull).filter(c -> !c.isEmpty()).collect(toCollection(ArrayList::new));
}
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ExportService.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ExportService.java
index 397533e..28c3afd 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ExportService.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ExportService.java
@@ -39,6 +39,8 @@
import org.eclipse.openk.gridfailureinformation.repository.FailureInformationDistributionGroupRepository;
import org.eclipse.openk.gridfailureinformation.repository.FailureInformationPublicationChannelRepository;
import org.eclipse.openk.gridfailureinformation.repository.FailureInformationRepository;
+import org.eclipse.openk.gridfailureinformation.repository.StatusRepository;
+import org.eclipse.openk.gridfailureinformation.util.ExternalStatusCalculator;
import org.eclipse.openk.gridfailureinformation.util.GroupMemberPlzFilter;
import org.eclipse.openk.gridfailureinformation.viewmodel.DistributionGroupMemberDto;
import org.eclipse.openk.gridfailureinformation.viewmodel.DistributionTextPlaceholderDto;
@@ -100,6 +102,9 @@
private FailureInformationRepository failureInformationRepository;
@Autowired
+ private StatusRepository statusRepository;
+
+ @Autowired
private FailureInformationPublicationChannelRepository publicationChannelRepository;
@Autowired
@@ -430,6 +435,11 @@
contentReplaceMap.put(placeholderDto.getStatusIntern(), statusIntern.getStatus());
}
+ String statusExtern = getStatusExtern(tblFailureInfo);
+ if (statusExtern != null) {
+ contentReplaceMap.put(placeholderDto.getStatusExtern(), statusExtern);
+ }
+
String publicationStatus = tblFailureInfo.getPublicationStatus();
if (publicationStatus != null) {
contentReplaceMap.put(placeholderDto.getPublicationStatus(), publicationStatus);
@@ -521,11 +531,17 @@
}
+ private String getStatusExtern(TblFailureInformation tblFailureInfo) {
+ FailureInformationDto failureInformationDto = failureInformationMapper.toFailureInformationDto(tblFailureInfo);
+ return ExternalStatusCalculator.addExternalStatus(statusRepository, failureInformationDto);
+ }
+
private void initContentReplaceMap(DistributionTextPlaceholderDto placeholderDto) {
contentReplaceMap.put(placeholderDto.getFailureClassification(), "");
contentReplaceMap.put(placeholderDto.getInternalRemark(), "");
contentReplaceMap.put(placeholderDto.getResponsibility(), "");
contentReplaceMap.put(placeholderDto.getStatusIntern(), "");
+ contentReplaceMap.put(placeholderDto.getStatusExtern(), "");
contentReplaceMap.put(placeholderDto.getPublicationStatus(), "");
contentReplaceMap.put(placeholderDto.getBranch(), "");
contentReplaceMap.put(placeholderDto.getVoltageLevel(), "");
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java
index 5e84fa7..66c8ad3 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java
@@ -33,10 +33,10 @@
import org.eclipse.openk.gridfailureinformation.model.RefExpectedReason;
import org.eclipse.openk.gridfailureinformation.model.RefStatus;
import org.eclipse.openk.gridfailureinformation.model.TblAddress;
+import org.eclipse.openk.gridfailureinformation.model.TblFailinfoStation;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformation;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformationPublicationChannel;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformationReminderMailSent;
-import org.eclipse.openk.gridfailureinformation.model.TblFailinfoStation;
import org.eclipse.openk.gridfailureinformation.model.TblStation;
import org.eclipse.openk.gridfailureinformation.repository.AddressRepository;
import org.eclipse.openk.gridfailureinformation.repository.BranchRepository;
@@ -708,7 +708,7 @@
failureInformationStationRepository.findUuidByFkTblFailureInformation(failureInformationDto.getUuid());
if(stationUuids.isEmpty()) {
- log.debug("No station ids found for failureInfo: " + failureInformationDto.getUuid().toString());
+ log.trace("No station ids found for failureInfo: " + failureInformationDto.getUuid().toString());
return;
}
@@ -773,7 +773,7 @@
return addressPolygonPoints;
}
- public FailureInformationPublicationChannelDto insertPublicationChannelForFailureInfo(UUID failureInfoUuid, String publicationChannel){
+ public FailureInformationPublicationChannelDto insertPublicationChannelForFailureInfo(UUID failureInfoUuid, String publicationChannel, boolean isPublished){
TblFailureInformation existingTblFailureInformation = failureInformationRepository
.findByUuid(failureInfoUuid)
@@ -788,7 +788,7 @@
TblFailureInformationPublicationChannel tfiPublicationChannelToSave = new TblFailureInformationPublicationChannel();
tfiPublicationChannelToSave.setTblFailureInformation(existingTblFailureInformation);
tfiPublicationChannelToSave.setPublicationChannel(publicationChannel);
- tfiPublicationChannelToSave.setPublished(false);
+ tfiPublicationChannelToSave.setPublished(isPublished);
TblFailureInformationPublicationChannel savedTfiPublicationChannel = failureInformationPublicationChannelRepository.save(tfiPublicationChannelToSave);
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ImportService.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ImportService.java
index 51e798b..c169faf 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ImportService.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ImportService.java
@@ -14,6 +14,8 @@
*/
package org.eclipse.openk.gridfailureinformation.service;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.StringUtils;
import org.eclipse.openk.gridfailureinformation.bpmn.impl.GfiProcessState;
@@ -32,11 +34,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
@@ -72,6 +76,9 @@
@Autowired
ProcessHelper processHelper;
+ @Autowired
+ ObjectMapper objectMapper;
+
public boolean validateAndImport(ImportDataDto importDataDto) {
ForeignFailureDataDto foreignFailureDataDto = importDataValidator.readSafeForeignFailureInfo(importDataDto);
@@ -86,81 +93,122 @@
@Transactional
- private FailureInformationDto doImport(ImportDataDto importDataDto, ForeignFailureDataDto foreignFailureDataDto) {
+ public FailureInformationDto doImport(ImportDataDto importDataDto, ForeignFailureDataDto foreignFailureDataDto) {
FailureInformationDto existingDto = failureInformationService.findByObjectReferenceExternalSystem(importDataDto.getAssembledRefId());
- FailureInformationDto failureInformationDto;
-
if( existingDto == null ) {
- failureInformationDto = setNewFromForeignDto(importDataDto, foreignFailureDataDto);
-
- GfiProcessState gfiProcessState;
- if (foreignFailureDataDto.isPlanned()) {
- gfiProcessState = GfiProcessState.PLANNED;
- } else {
- gfiProcessState = GfiProcessState.NEW;
- }
-
- if (foreignFailureDataDto.isAutopublish()) {
- gfiProcessState = GfiProcessState.QUALIFIED;
- failureInformationDto.setPublicationStatus(Constants.PUB_STATUS_VEROEFFENTLICHT);
- }
-
- FailureInformationDto retVal = failureInformationService.insertFailureInfo(failureInformationDto, gfiProcessState);
- log.info("External failure information [MetaId: " + importDataDto.getMetaId() + "] from " + importDataDto.getSource() + " imported (inserted).");
-
- if (foreignFailureDataDto.isAutopublish()) {
- failureInformationService.insertPublicationChannelForFailureInfo(retVal.getUuid(), Constants.PUBLICATION_CHANNEL_OWNDMZ);
- log.info("External failure information [MetaId: " + importDataDto.getMetaId() + "] from "
- + importDataDto.getSource() + "is prepared for autopublish to channel: " + Constants.PUBLICATION_CHANNEL_OWNDMZ);
- }
- return retVal;
+ return importNewFailureInfo(importDataDto, foreignFailureDataDto);
} else {
- UUID statusInternIdExistingDto = existingDto.getStatusInternId();
-
- //When status of already existing failureinformation completed or canceled do not update but log it.
- if (statusInternIdExistingDto.equals(statusService.getStatusFromId(GfiProcessState.COMPLETED.getStatusValue()).getUuid()) ||
- statusInternIdExistingDto.equals(statusService.getStatusFromId(GfiProcessState.CANCELED.getStatusValue()).getUuid())) {
- log.info("External failure information [MetaId: " + importDataDto.getMetaId() + "] from " + importDataDto.getSource() +
- " tried to update already existing failure information [UUID: "+ existingDto.getUuid() + "]" +
- " but was ignored since its status is already CANCELED or COMPLETED.");
- return null;
- }
-
- FailureInformationDto updatedDto = setUpdateFromForeignDto(importDataDto, foreignFailureDataDto, existingDto);
-
- if(!foreignFailureDataDto.isAutopublish() && statusInternIdExistingDto.equals(
- statusService.getStatusFromId(GfiProcessState.QUALIFIED.getStatusValue()).getUuid()
- )) {
- updatedDto.setStatusInternId(
- statusService.getStatusFromId(GfiProcessState.UPDATED.getStatusValue()).getUuid()
- );
- } else {
- if (foreignFailureDataDto.isAutopublish()) {
- processHelper.resetPublishedStateForChannels(updatedDto);
- log.info("Autopublish for external failure information [" + importDataDto.getMetaId() + "] from " + importDataDto.getSource() + " is true, current status remains unchanged.");
- }
- }
-
- FailureInformationDto retVal = failureInformationService.updateFailureInfo(updatedDto);
- log.info("External failure information [" + importDataDto.getMetaId() + "] from " + importDataDto.getSource() + " imported (updated).");
- return retVal;
+ return importExistingDto(importDataDto, foreignFailureDataDto, existingDto);
}
}
- private FailureInformationDto setNewFromForeignDto(ImportDataDto importDataDto, ForeignFailureDataDto foreignFailureDataDto) {
+ private FailureInformationDto importExistingDto(ImportDataDto importDataDto, ForeignFailureDataDto foreignFailureDataDto, FailureInformationDto existingDto) {
+ if (foreignFailureDataDto.isOnceOnlyImport()) {
+ log.debug("External failure information [MetaId: " + importDataDto.getMetaId() + "] from "
+ + importDataDto.getSource() + " won't be imported because it has already been imported" +
+ " once and flag isOnceOnlyImport is true.");
+ return null;
+ }
+
+ UUID statusInternIdExistingDto = existingDto.getStatusInternId();
+
+ //When status of already existing failureinformation completed or canceled do not update but log it.
+ if (statusInternIdExistingDto.equals(statusService.getStatusFromId(GfiProcessState.COMPLETED.getStatusValue()).getUuid()) ||
+ statusInternIdExistingDto.equals(statusService.getStatusFromId(GfiProcessState.CANCELED.getStatusValue()).getUuid())) {
+ log.info("External failure information [MetaId: " + importDataDto.getMetaId() + "] from " + importDataDto.getSource() +
+ " tried to update already existing failure information [UUID: "+ existingDto.getUuid() + "]" +
+ " but was ignored since its status is already CANCELED or COMPLETED.");
+ return null;
+ }
+
+ FailureInformationDto existingDtoClone = null;
+ try {
+ existingDtoClone = objectMapper
+ .readValue(objectMapper.writeValueAsString(existingDto), FailureInformationDto.class);
+ } catch (JsonProcessingException e) {
+ log.error("Error parsing object (JSON)", e);
+ }
+
+ FailureInformationDto updatedDto = setUpdateFromForeignDto(importDataDto, foreignFailureDataDto, existingDto);
+
+ //Is the content of the new failureinformation different compared to the already existing one
+ if (foreignFailureDataDto.isExcludeEquals() && updatedDto.equals(existingDtoClone)){
+ log.debug("External failure information [MetaId: " + importDataDto.getMetaId() + "] from "
+ + importDataDto.getSource() + " hasn't changed, no update will be executed.");
+ return null;
+ }
+
+
+ Assert.notNull(existingDtoClone, "existingDtoClone was null");
+ //Don't update if the failureinformation was already edited by an user
+ if (foreignFailureDataDto.isExcludeAlreadyEdited() && !Objects.equals(updatedDto.getModUser(), existingDtoClone.getModUser())){ //NOSONAR assertion for existingDtoClone exists and logically existingDtoClone must be valid
+ log.debug("External failure information [MetaId: " + importDataDto.getMetaId() + "] from "
+ + importDataDto.getSource() + " has already been edited in SIT by an user, no update will be executed.");
+ return null;
+ }
+
+ if(!foreignFailureDataDto.isAutopublish() && statusInternIdExistingDto.equals(
+ statusService.getStatusFromId(GfiProcessState.QUALIFIED.getStatusValue()).getUuid()
+ )) {
+ updatedDto.setStatusInternId(
+ statusService.getStatusFromId(GfiProcessState.UPDATED.getStatusValue()).getUuid()
+ );
+ } else {
+ if (foreignFailureDataDto.isAutopublish()) {
+ log.info("Autopublish for external failure information [MetaId: " + importDataDto.getMetaId() + "] from "
+ + importDataDto.getSource() + " is true, current status remains unchanged.");
+ }
+ }
+
+ FailureInformationDto retVal = failureInformationService.updateFailureInfo(updatedDto);
+ log.info("External failure information [" + importDataDto.getMetaId() + "] from " + importDataDto.getSource() + " imported (updated).");
+ return retVal;
+ }
+
+ private FailureInformationDto importNewFailureInfo(ImportDataDto importDataDto, ForeignFailureDataDto foreignFailureDataDto) {
+ FailureInformationDto failureInformationDto;
+ failureInformationDto = setNewFromForeignDto(importDataDto, foreignFailureDataDto);
+
+ GfiProcessState gfiProcessState;
+ if (foreignFailureDataDto.isPlanned()) {
+ gfiProcessState = GfiProcessState.PLANNED;
+ } else {
+ gfiProcessState = GfiProcessState.NEW;
+ }
+
+ if (foreignFailureDataDto.isAutopublish()) {
+ gfiProcessState = GfiProcessState.QUALIFIED;
+ failureInformationDto.setPublicationStatus(Constants.PUB_STATUS_VEROEFFENTLICHT);
+ }
+
+ FailureInformationDto retVal = failureInformationService.insertFailureInfo(failureInformationDto, gfiProcessState);
+ log.info("External failure information [MetaId: " + importDataDto.getMetaId() + "] from "
+ + importDataDto.getSource() + " imported (inserted).");
+
+ if (foreignFailureDataDto.isAutopublish()) {
+ failureInformationService.insertPublicationChannelForFailureInfo(retVal.getUuid(), Constants.PUBLICATION_CHANNEL_OWNDMZ, true);
+ log.info("External failure information [MetaId: " + importDataDto.getMetaId() + "] from "
+ + importDataDto.getSource() + " is prepared for autopublish to channel: " + Constants.PUBLICATION_CHANNEL_OWNDMZ);
+ }
+ return retVal;
+ }
+
+ public FailureInformationDto setNewFromForeignDto(ImportDataDto importDataDto, ForeignFailureDataDto foreignFailureDataDto) {
FailureInformationDto failureInformationDto = failureInformationMapper.mapForeignFiDtoToGfiDto(foreignFailureDataDto);
setFromForeignDto(importDataDto, foreignFailureDataDto, failureInformationDto);
failureInformationDto.setCreateUser(importDataDto.getSource());
+ failureInformationDto.setModUser(importDataDto.getSource());
return failureInformationDto;
}
- private FailureInformationDto setUpdateFromForeignDto(ImportDataDto importDataDto, ForeignFailureDataDto foreignFailureDataDto, FailureInformationDto failureInformationDto) {
+ public FailureInformationDto setUpdateFromForeignDto(ImportDataDto importDataDto, ForeignFailureDataDto foreignFailureDataDto, FailureInformationDto failureInformationDto) {
setFromForeignDto(importDataDto, foreignFailureDataDto, failureInformationDto);
+ failureInformationDto.setModUser(importDataDto.getSource());
return failureInformationDto;
}
@@ -182,10 +230,11 @@
failureInformationDto.setHousenumber(foreignFailureDataDto.getHousenumber());
setCoordinates(foreignFailureDataDto, failureInformationDto);
- setLoationType(failureInformationDto);
+ setLocationType(failureInformationDto);
failureInformationDto.setStationIds(new LinkedList<>());
if( foreignStationId != null && !foreignStationId.isEmpty()) {
+ failureInformationDto.setFaultLocationArea(Constants.LOCATION_TYPE_STATION);
importStation(failureInformationDto.getStationIds(), foreignStationId);
}
@@ -203,7 +252,7 @@
failureInformationDto.setObjectReferenceExternalSystem(importDataDto.getAssembledRefId());
}
- private void setLoationType(FailureInformationDto failureInformationDto) {
+ private void setLocationType(FailureInformationDto failureInformationDto) {
failureInformationDto.setFaultLocationArea(Constants.LOCATION_TYPE_ADDRESS);
if (failureInformationDto.getLatitude() != null && failureInformationDto.getLongitude() != null
&& StringUtils.isBlank(failureInformationDto.getStreet())) {
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/util/ExternalStatusCalculator.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/util/ExternalStatusCalculator.java
index b43403a..a707e83 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/util/ExternalStatusCalculator.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/util/ExternalStatusCalculator.java
@@ -24,12 +24,14 @@
import java.time.ZoneId;
import java.util.Date;
-import static org.eclipse.openk.gridfailureinformation.constants.Constants.*;
+import static org.eclipse.openk.gridfailureinformation.constants.Constants.EXT_STATUS_FINISHED;
+import static org.eclipse.openk.gridfailureinformation.constants.Constants.EXT_STATUS_IN_WORK;
+import static org.eclipse.openk.gridfailureinformation.constants.Constants.EXT_STATUS_PLANNED;
public class ExternalStatusCalculator {
private ExternalStatusCalculator() {}
- public static void addExternalStatus(StatusRepository statusRepository, FailureInformationDto failureInformationDto){
+ public static String addExternalStatus(StatusRepository statusRepository, FailureInformationDto failureInformationDto){
Long statusInternId = statusRepository.findByUuid(
failureInformationDto.getStatusInternId())
.orElseThrow(() -> new NotFoundException("status.not.found"))
@@ -49,10 +51,10 @@
ldtFailureEndPlanned = LocalDateTime.ofInstant(failureEndPlanned.toInstant(), ZoneId.systemDefault());
}
- failureInformationDto.setStatusExtern(
- ExternalStatusCalculator.calculate(
- statusInternId, publicationStatus, ldtFailureBegin,
- ldtFailureEndPlanned));
+ String statusExtern = ExternalStatusCalculator.calculate(statusInternId, publicationStatus, ldtFailureBegin,
+ ldtFailureEndPlanned);
+ failureInformationDto.setStatusExtern(statusExtern);
+ return statusExtern;
}
public static String calculate(Long statusInternId, String publicationStatus, LocalDateTime ldtFailureBegin, LocalDateTime ldtFailureEndPlanned) {
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/FailureInformationDto.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/FailureInformationDto.java
index 11ae178..a68aed9 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/FailureInformationDto.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/FailureInformationDto.java
@@ -17,6 +17,8 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
@@ -102,4 +104,21 @@
private List<ArrayList<BigDecimal>> addressPolygonPoints;
private List<UUID> stationIds;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+
+ if (!(o instanceof FailureInformationDto)) return false;
+
+ FailureInformationDto that = (FailureInformationDto) o;
+
+ return new EqualsBuilder().append(isPlanned, that.isPlanned).append(uuid, that.uuid).append(title,
+ that.title).append(description, that.description).append(versionNumber, that.versionNumber).append(responsibility, that.responsibility).append(voltageLevel, that.voltageLevel).append(pressureLevel, that.pressureLevel).append(failureBegin, that.failureBegin).append(failureEndPlanned, that.failureEndPlanned).append(failureEndResupplied, that.failureEndResupplied).append(internalRemark, that.internalRemark).append(postcode, that.postcode).append(city, that.city).append(district, that.district).append(street, that.street).append(housenumber, that.housenumber).append(stationId, that.stationId).append(stationDescription, that.stationDescription).append(stationCoords, that.stationCoords).append(freetextPostcode, that.freetextPostcode).append(freetextCity, that.freetextCity).append(freetextDistrict, that.freetextDistrict).append(longitude, that.longitude).append(latitude, that.latitude).append(objectReferenceExternalSystem, that.objectReferenceExternalSystem).append(publicationStatus, that.publicationStatus).append(publicationFreetext, that.publicationFreetext).append(condensed, that.condensed).append(condensedCount, that.condensedCount).append(faultLocationArea, that.faultLocationArea).append(createUser, that.createUser).append(modUser, that.modUser).append(failureClassificationId, that.failureClassificationId).append(failureClassification, that.failureClassification).append(failureTypeId, that.failureTypeId).append(failureType, that.failureType).append(statusInternId, that.statusInternId).append(statusIntern, that.statusIntern).append(statusExtern, that.statusExtern).append(branchId, that.branchId).append(branch, that.branch).append(branchDescription, that.branchDescription).append(radiusId, that.radiusId).append(radius, that.radius).append(expectedReasonId, that.expectedReasonId).append(expectedReasonText, that.expectedReasonText).append(failureInformationCondensedId, that.failureInformationCondensedId).append(addressPolygonPoints, that.addressPolygonPoints).append(stationIds, that.stationIds).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(17, 37).append(uuid).append(title).append(description).append(versionNumber).append(responsibility).append(voltageLevel).append(pressureLevel).append(failureBegin).append(failureEndPlanned).append(failureEndResupplied).append(internalRemark).append(postcode).append(city).append(district).append(street).append(housenumber).append(stationId).append(stationDescription).append(stationCoords).append(freetextPostcode).append(freetextCity).append(freetextDistrict).append(longitude).append(latitude).append(objectReferenceExternalSystem).append(publicationStatus).append(publicationFreetext).append(condensed).append(condensedCount).append(faultLocationArea).append(createUser).append(modUser).append(failureClassificationId).append(failureClassification).append(isPlanned).append(failureTypeId).append(failureType).append(statusInternId).append(statusIntern).append(statusExtern).append(branchId).append(branch).append(branchDescription).append(radiusId).append(radius).append(expectedReasonId).append(expectedReasonText).append(failureInformationCondensedId).append(addressPolygonPoints).append(stationIds).toHashCode();
+ }
}
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/ForeignFailureDataDto.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/ForeignFailureDataDto.java
index 80ebf19..1971e55 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/ForeignFailureDataDto.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/ForeignFailureDataDto.java
@@ -32,6 +32,12 @@
private boolean isAutopublish;
+ private boolean isOnceOnlyImport;
+
+ private boolean isExcludeEquals;
+
+ private boolean isExcludeAlreadyEdited;
+
@NotNull
private boolean isPlanned;
@@ -64,19 +70,19 @@
private String postcode;
@Size(max=200)
- @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/()-]+")
+ @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/(),.+-]+")
private String city;
@Size(max=200)
- @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/()-]+")
+ @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/(),.+-]+")
private String district;
@Size(max=200)
- @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/()-]+")
+ @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/()&,.+-]+")
private String street;
- @Size(max=10)
- @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/()-]+")
+ @Size(max=200)
+ @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/()&,.;:+-]+")
private String housenumber;
@Size(max=200)
@@ -84,7 +90,7 @@
private String stationId;
@Size(max=200)
- @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/(),.;:-]+")
+ @Pattern(regexp="^$|[A-Za-z0-9ÄäÖöÜüß\\s_/(),.;:+-]+")
private String stationDescription;
private BigDecimal longitude;
diff --git a/gfsBackendService/src/main/resources/application.yml b/gfsBackendService/src/main/resources/application.yml
index 14bd04a..ea97878 100644
--- a/gfsBackendService/src/main/resources/application.yml
+++ b/gfsBackendService/src/main/resources/application.yml
@@ -19,18 +19,20 @@
max-active: 20
flyway:
enabled: false
+
+ # RabbitMQ configuration
rabbitmq:
host: entdockergss
port: 5672
username: ${GFI_RABBITMQ_USERNAME}
password: ${GFI_RABBITMQ_PASSWORD}
- # Importkanal
+ # Importchannel
importExchange: sitImportExchange
importQueue: sitImportQueue
importkey: sitImportExchange.failureImportKey
- # Exportkanäle
+ # Exportchannels
exportExchange: sitExportExchange
channels:
- name: Mail
@@ -44,7 +46,7 @@
exportQueue: sit_own_export_queue
exportKey: sit_own_export_key
- # UI Setting (Map)
+ # UI setting (Map)
settings:
overviewMapInitialZoom: 10
detailMapInitialZoom: 10
@@ -52,7 +54,8 @@
overviewMapInitialLongitude: 8.423207
daysInPastToShowClosedInfos: 365
dataExternInitialVisibility: hide
- # Initial emailsubject and content
+
+ # Mail settings (Default templates)
emailSubjectPublishInit: "Die Störung (Sparte: $Sparte$) mit Beginn: $Störungsbeginn_gemeldet$ wurde in den Status veröffentlicht geändert."
emailContentPublishInit: "Veröffentlicht [TEST]\n
@@ -149,6 +152,7 @@
org.hibernate: ERROR
server:
+ port: 9165
max-http-header-size: 262144
jwt:
@@ -159,6 +163,7 @@
gridFailureInformation:
maxListSize: 2000
+# Services configuration
services:
authNAuth:
name: authNAuthService
@@ -212,6 +217,9 @@
export-to-dmz:
enabled: true
cron: 0 */1 * ? * *
+
+swagger:
+ enabled: true
---
spring:
@@ -294,6 +302,8 @@
cors:
corsEnabled: true
+swagger:
+ enabled: true
---
@@ -326,6 +336,9 @@
export-to-dmz:
enabled: false
+swagger:
+ enabled: true
+
---
spring:
@@ -373,6 +386,67 @@
cors:
corsEnabled: true
+swagger:
+ enabled: true
+---
+
+spring:
+ profiles: oracle
+ datasource:
+ enable-oracle-configuration: true
+ url: jdbc:oracle:thin:@LIDLORADB2.PTA.DE:1521:NAPDB00
+ username: dietricf
+ password: dietricf000
+ jpa:
+ database-platform: org.hibernate.dialect.Oracle10gDialect
+ show-sql: false
+
+ rabbitmq:
+ # Importkanal
+ importExchange: sitImportExchange_branch
+ importQueue: sitImportQueue_branch
+ importkey: sitImportExchange.failureImportKey
+
+ # Exportkanäle
+ exportExchange: sitExportExchange_branch
+ channels:
+ - name: Mail
+ exportQueue: sit_mail_export_queue_branch
+ exportKey: sit_mail_export_key
+ isMailType: true
+ - name: Störungsauskunft.de
+ exportQueue: sit_stoerungsauskunft_export_queue_branch
+ exportKey: sit_stoerungsauskunft_export_key
+ - name: Störinfotool-eigene-Web-Komponenten
+ exportQueue: sit_own_export_queue
+ exportKey: sit_own_export_key
+
+oracle:
+ ucp:
+ minPoolSize: 2
+ maxPoolSize: 10
+
+logging:
+ level:
+ root: INFO
+ org.eclipse.openk: DEBUG
+ org.springframework.web: ERROR
+ org.hibernate: ERROR
+
+jwt:
+ tokenHeader: Authorization
+ useStaticJwt: false
+ staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiJlMmQ2YjE3Zi1iMWUyLTQxMzUtOTM1YS0zOWRiMmFkMzE5MjYiLCJleHAiOjE1ODYwMTI1MzUsIm5iZiI6MCwiaWF0IjoxNTg2MDEyMjM1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiMzMzMmRmOWItYmYyMy00Nzg5LThmMmQtM2JhZTM2MzA4YzNkIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjYxMzRmN2RhLTdlNjQtNDJjNy05NjYyLTY0ZGNhZTk1MjQ5YSIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiZ3JpZC1mYWlsdXJlLXF1YWxpZmllciIsImdyaWQtZmFpbHVyZS1jcmVhdG9yIiwiZ3JpZC1mYWlsdXJlLWFjY2VzcyIsImdyaWQtZmFpbHVyZS1hZG1pbiIsImdyaWQtZmFpbHVyZS1wdWJsaXNoZXIiXX0sInJlc291cmNlX2FjY2VzcyI6e30sIm5hbWUiOiJTdGF0aWMgSldUIiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJfZ2ZpX3N0YXRpY2p3dCIsImdpdmVuX25hbWUiOiJTdGF0aWMiLCJmYW1pbHlfbmFtZSI6IkpXVCJ9.SWpekZHxlDNWbaaZ2fHlts00c1Xi6yIb0ZMr9f8ujSI_6LVYuHx8FTt6g9tinyVcx5gQKfrooRW28Cdq1EVuexNtTtZ7ciKk4iEo_kgqUgRvHCwO7HQl2igpoGErheYD0kj3-u4Te6NPHKtXWIEfGyl0ZQBD2c4vtaCTQAy5Ilb146G7p_IcLYaZgpJPlGG0Bf2oZ0UqTQsrXxRJkXWARDz8D4lIrN84lAbqNlPlSZDN-8xp_z6mXgWpvgeZuFoYHItJMg2cjR0SXH-ycbWVXctRNQJfTWR0acIhp_nB_Xe6JlUx2vls99EVw-WUrd0hc8Y9658HdeyktvpQLDxP2g
+
+server:
+ port: 9165
+
+cors:
+ corsEnabled: true
+
+swagger:
+ enabled: true
+
---
spring:
@@ -457,4 +531,5 @@
corsEnabled: true
swagger:
+ enabled: true
baseUrl: /gridfailureinformation/api
\ No newline at end of file
diff --git a/gfsBackendService/src/main/resources/application_localdev.yml b/gfsBackendService/src/main/resources/application_localdev.yml
index 3121113..ecc1e0b 100644
--- a/gfsBackendService/src/main/resources/application_localdev.yml
+++ b/gfsBackendService/src/main/resources/application_localdev.yml
@@ -209,6 +209,9 @@
export-to-dmz:
enabled: false
cron: 0 */1 * ? * *
+
+swagger:
+ enabled: false
---
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java
index 4463056..255f79e 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java
@@ -41,6 +41,7 @@
import static org.hamcrest.Matchers.is;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.doNothing;
@@ -185,7 +186,7 @@
FailureInformationPublicationChannelDto publicationChannel = MockDataHelper.mockFailureInformationPublicationChannelDto();
- when (failureInformationService.insertPublicationChannelForFailureInfo(any(UUID.class),anyString())).thenReturn(publicationChannel);
+ when (failureInformationService.insertPublicationChannelForFailureInfo(any(UUID.class),anyString(), anyBoolean())).thenReturn(publicationChannel);
mockMvc.perform(post("/grid-failure-informations/{uuid}/channels?publicationChannel=MOCKMAIL", UUID.randomUUID().toString())
.contentType(MediaType.APPLICATION_JSON)
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/DistributionTextPlacehoderServiceTest.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/DistributionTextPlacehoderServiceTest.java
index ad83170..e90e9f0 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/DistributionTextPlacehoderServiceTest.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/DistributionTextPlacehoderServiceTest.java
@@ -42,6 +42,7 @@
assertEquals("$Spannungsebene$", placeholderDto.getVoltageLevel());
assertEquals("$Störungsbeginn_gemeldet$", placeholderDto.getFailureBegin());
assertEquals("$Voraussichtlicher_Grund$", placeholderDto.getExpectedReason());
+ assertEquals("$Status_extern$", placeholderDto.getStatusExtern());
}
}
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/ExportServiceTest.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/ExportServiceTest.java
index 9fac1fb..dabf293 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/ExportServiceTest.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/ExportServiceTest.java
@@ -20,7 +20,7 @@
import org.eclipse.openk.gridfailureinformation.config.rabbitMq.RabbitMqConfig;
import org.eclipse.openk.gridfailureinformation.config.rabbitMq.RabbitMqProperties;
import org.eclipse.openk.gridfailureinformation.exceptions.NotFoundException;
-import org.eclipse.openk.gridfailureinformation.mapper.FailureInformationMapper;
+import org.eclipse.openk.gridfailureinformation.model.RefStatus;
import org.eclipse.openk.gridfailureinformation.model.TblDistributionGroup;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformation;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformationDistributionGroup;
@@ -29,6 +29,7 @@
import org.eclipse.openk.gridfailureinformation.repository.FailureInformationDistributionGroupRepository;
import org.eclipse.openk.gridfailureinformation.repository.FailureInformationPublicationChannelRepository;
import org.eclipse.openk.gridfailureinformation.repository.FailureInformationRepository;
+import org.eclipse.openk.gridfailureinformation.repository.StatusRepository;
import org.eclipse.openk.gridfailureinformation.support.MockDataHelper;
import org.eclipse.openk.gridfailureinformation.viewmodel.DistributionGroupMemberDto;
import org.eclipse.openk.gridfailureinformation.viewmodel.FailureInformationDto;
@@ -46,9 +47,18 @@
import java.util.Optional;
import java.util.UUID;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyLong;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.when;
@DataJpaTest
@ContextConfiguration(classes = {TestConfiguration.class})
@@ -76,10 +86,13 @@
private DistributionGroupRepository distributionGroupRepository;
@MockBean
- private MessageChannel mailExportChannel;
+ private StatusRepository statusRepository;
@MockBean
- private FailureInformationMapper failureInformationMapper;
+ private MessageChannel mailExportChannel;
+
+ /*@MockBean
+ private FailureInformationMapper failureInformationMapper;*/
@MockBean
RabbitTemplate rabbitTemplate;
@@ -175,6 +188,8 @@
List<DistributionGroupMemberDto> listTblDistributionGroupMemberDtos = MockDataHelper.mockDistributionGroupMemberDtoList();
+ RefStatus refStatus = MockDataHelper.mockRefStatusQUALIFIED();
+ when(statusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refStatus));
when (failureInformationRepository.findByUuid( any(UUID.class))).thenReturn(Optional.of(tblFailureInformation));
when(distributionGroupMemberService.getMembersByGroupId(any(UUID.class))).thenReturn(listTblDistributionGroupMemberDtos);
when(failureInformationDistributionGroupRepository.findByFailureInformationId(anyLong())).thenReturn(listTblDistributionGroups);
@@ -212,7 +227,8 @@
List<TblFailureInformationDistributionGroup> listTblDistributionGroups= MockDataHelper.mockTblFailureInformationDistributionGroupList();
when(failureInformationDistributionGroupRepository.findByFailureInformationId(anyLong())).thenReturn(listTblDistributionGroups);
List<DistributionGroupMemberDto> listTblDistributionGroupMemberDtos = MockDataHelper.mockDistributionGroupMemberDtoList();
-
+ RefStatus refStatus = MockDataHelper.mockRefStatusQUALIFIED();
+ when(statusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refStatus));
when (failureInformationRepository.findByUuid( any(UUID.class))).thenReturn(Optional.of(tblFailureInformation));
when(distributionGroupMemberService.getMembersByGroupId(any(UUID.class))).thenReturn(listTblDistributionGroupMemberDtos);
when(publicationChannelRepository.save(any(TblFailureInformationPublicationChannel.class))).thenReturn(new TblFailureInformationPublicationChannel());
@@ -251,7 +267,9 @@
tblFailureInformation.setPostcode("112233");
tblFailureInformation.setHousenumber("10-1");
+ RefStatus refStatus = MockDataHelper.mockRefStatusQUALIFIED();
List<TblFailureInformationDistributionGroup> listTblDistributionGroups= MockDataHelper.mockTblFailureInformationDistributionGroupList();
+ when(statusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refStatus));
when(failureInformationDistributionGroupRepository.findByFailureInformationId(anyLong())).thenReturn(listTblDistributionGroups);
List<DistributionGroupMemberDto> listTblDistributionGroupMemberDtos = MockDataHelper.mockDistributionGroupMemberDtoList();
@@ -389,6 +407,8 @@
RabbitMqChannel rabbitMqChannel = MockDataHelper.mockRabbitMqChannelMail();
+ RefStatus refStatus = MockDataHelper.mockRefStatusQUALIFIED();
+ when(statusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refStatus));
when (failureInformationRepository.findByUuid( any(UUID.class))).thenReturn(Optional.of(tblFailureInformation));
when(distributionGroupRepository.findByName(any(String.class))).thenReturn(Optional.of(tblDistributionGroup));
when(distributionGroupMemberService.getMembersByGroupId(any(UUID.class))).thenReturn(listTblDistributionGroupMemberDtos);
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java
index 867980b..d06bfea 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java
@@ -29,11 +29,11 @@
import org.eclipse.openk.gridfailureinformation.model.RefStatus;
import org.eclipse.openk.gridfailureinformation.model.TblAddress;
import org.eclipse.openk.gridfailureinformation.model.TblDistributionGroup;
+import org.eclipse.openk.gridfailureinformation.model.TblFailinfoStation;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformation;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformationDistributionGroup;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformationPublicationChannel;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformationReminderMailSent;
-import org.eclipse.openk.gridfailureinformation.model.TblFailinfoStation;
import org.eclipse.openk.gridfailureinformation.model.TblStation;
import org.eclipse.openk.gridfailureinformation.repository.AddressRepository;
import org.eclipse.openk.gridfailureinformation.repository.BranchRepository;
@@ -1032,7 +1032,7 @@
when(failureInformationPublicationChannelRepository.countByTblFailureInformationAndPublicationChannel(any(TblFailureInformation.class), anyString())).thenReturn(0);
when(failureInformationPublicationChannelRepository.save(any(TblFailureInformationPublicationChannel.class))).thenReturn(tblChannel);
- FailureInformationPublicationChannelDto channelDto = failureInformationService.insertPublicationChannelForFailureInfo(tblFailureInformation.getUuid(), tblChannel.getPublicationChannel() );
+ FailureInformationPublicationChannelDto channelDto = failureInformationService.insertPublicationChannelForFailureInfo(tblFailureInformation.getUuid(), tblChannel.getPublicationChannel() , false );
assertEquals(tblChannel.getTblFailureInformation().getUuid(), channelDto.getFailureInformationId());
assertEquals(tblChannel.getPublicationChannel(), channelDto.getPublicationChannel());
@@ -1048,7 +1048,7 @@
when(failureInformationPublicationChannelRepository.countByTblFailureInformationAndPublicationChannel(any(TblFailureInformation.class), anyString())).thenReturn(1);
when(failureInformationPublicationChannelRepository.save(any(TblFailureInformationPublicationChannel.class))).thenReturn(tblChannel);
- assertThrows(BadRequestException.class, () -> failureInformationService.insertPublicationChannelForFailureInfo(tblFailureInformation.getUuid(), tblChannel.getPublicationChannel()));
+ assertThrows(BadRequestException.class, () -> failureInformationService.insertPublicationChannelForFailureInfo(tblFailureInformation.getUuid(), tblChannel.getPublicationChannel(), false));
}
@Test
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/ImportServiceTest.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/ImportServiceTest.java
index aab6a28..9f02457 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/ImportServiceTest.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/ImportServiceTest.java
@@ -15,11 +15,17 @@
package org.eclipse.openk.gridfailureinformation.service;
import org.eclipse.openk.gridfailureinformation.bpmn.impl.GfiProcessState;
+import org.eclipse.openk.gridfailureinformation.bpmn.impl.tasks.ProcessHelper;
import org.eclipse.openk.gridfailureinformation.config.TestConfiguration;
import org.eclipse.openk.gridfailureinformation.exceptions.InternalServerErrorException;
import org.eclipse.openk.gridfailureinformation.support.MockDataHelper;
import org.eclipse.openk.gridfailureinformation.util.ImportDataValidator;
-import org.eclipse.openk.gridfailureinformation.viewmodel.*;
+import org.eclipse.openk.gridfailureinformation.viewmodel.BranchDto;
+import org.eclipse.openk.gridfailureinformation.viewmodel.FailureInformationDto;
+import org.eclipse.openk.gridfailureinformation.viewmodel.ForeignFailureDataDto;
+import org.eclipse.openk.gridfailureinformation.viewmodel.ImportDataDto;
+import org.eclipse.openk.gridfailureinformation.viewmodel.RadiusDto;
+import org.eclipse.openk.gridfailureinformation.viewmodel.StatusDto;
import org.junit.jupiter.api.Test;
import org.mockito.stubbing.Answer;
import org.powermock.reflect.Whitebox;
@@ -35,8 +41,17 @@
import java.util.List;
import java.util.UUID;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Mockito.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyLong;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
@DataJpaTest
@ContextConfiguration(classes = {TestConfiguration.class})
@@ -61,6 +76,9 @@
@MockBean
private FailureInformationService failureInformationService;
+ @MockBean
+ private ProcessHelper processHelper;
+
@Test
public void shouldImportDifferentRadiiProperly() throws Exception {
List<RadiusDto> radiusDtos = getRadiusDtoList();
@@ -314,7 +332,6 @@
" \"radiusInMeters\": 678,\n" +
" \"stationDescription\": null,\n" +
" \"stationId\": null,\n" +
- " \"street\": \"Oxfordstreet\",\n" +
" \"voltageLevel\": \"HS\"\n" +
" }");
@@ -434,4 +451,238 @@
.updateFailureInfo(any( FailureInformationDto.class));
}
+ @Test
+ public void shouldImportMessagesCorrectlyWithNewAutopublish() {
+ ImportDataDto dto = MockDataHelper.mockImportDataDto();
+ dto.setMessageContent("{\n" +
+ " \"branch\": \"S\",\n" + // invalid branch
+ " \"city\": \"Belfast\",\n" +
+ " \"description\": \"Schlimmer Fehler im System\",\n" +
+ " \"district\": \"\",\n" +
+ " \"failureBegin\": \"2020-11-19T14:13:15.666Z\",\n" +
+ " \"housenumber\": \"10b\",\n" +
+ " \"latitude\": 12.345,\n" +
+ " \"longitude\": 0,\n" +
+ " \"planned\": false,\n" +
+ " \"postcode\": \"3456\",\n" +
+ " \"pressureLevel\": null,\n" +
+ " \"radiusInMeters\": 678,\n" +
+ " \"stationDescription\": null,\n" +
+ " \"stationId\": null,\n" +
+ " \"street\": \"Oxfordstreet\",\n" +
+ " \"voltageLevel\": \"HS\",\n" +
+ " \"autopublish\": \"true\"\n" +
+ " }");
+
+ BranchDto branchStromDto = MockDataHelper.mockBranchDto();
+ branchStromDto.setName("S");
+ when( branchService.findByName(eq("S"))).thenReturn(branchStromDto);
+
+ FailureInformationDto savedFailureInformationDto = MockDataHelper.mockFailureInformationDto();
+ when( radiusService.getRadii() ).thenReturn(getRadiusDtoList());
+ when( failureInformationService.insertFailureInfo(any(), any())).thenReturn(savedFailureInformationDto);
+ //when( failureInformationService.insertPublicationChannelForFailureInfo(any(), anyString(), anyBoolean())).thenReturn(new FailureInformationPublicationChannelDto());
+
+ importService.validateAndImport(dto);
+
+ verify(failureInformationService, times(1))
+ .insertFailureInfo(any( FailureInformationDto.class), eq(GfiProcessState.QUALIFIED));
+ }
+
+ @Test
+ public void shouldImportUpdateMessageAutopublish() {
+ ImportDataDto dto = MockDataHelper.mockImportDataDto();
+ dto.setMessageContent("{\n" +
+ " \"branch\": \"S\",\n" + // invalid branch
+ " \"city\": \"Belfast\",\n" +
+ " \"description\": \"Schlimmer Fehler im System\",\n" +
+ " \"district\": \"\",\n" +
+ " \"failureBegin\": \"2020-11-19T14:13:15.666Z\",\n" +
+ " \"housenumber\": \"10b\",\n" +
+ " \"latitude\": 12.345,\n" +
+ " \"longitude\": 0,\n" +
+ " \"planned\": false,\n" +
+ " \"postcode\": \"3456\",\n" +
+ " \"pressureLevel\": null,\n" +
+ " \"radiusInMeters\": 678,\n" +
+ " \"stationDescription\": null,\n" +
+ " \"stationId\": null,\n" +
+ " \"street\": \"Oxfordstreet\",\n" +
+ " \"voltageLevel\": \"HS\",\n" +
+ " \"autopublish\": \"true\"\n" +
+ " }");
+
+ BranchDto branchStromDto = MockDataHelper.mockBranchDto();
+ branchStromDto.setName("S");
+ when( branchService.findByName(eq("S"))).thenReturn(branchStromDto);
+ StatusDto qualifiedStatusDto = MockDataHelper.mockStatusDto("qualified", UUID.randomUUID());
+ StatusDto canceledStatusDto = MockDataHelper.mockStatusDto("canceled", UUID.randomUUID());
+ StatusDto completedStatusDto = MockDataHelper.mockStatusDto("completed", UUID.randomUUID());
+ StatusDto udpatedStatusDto = MockDataHelper.mockStatusDto("updated", UUID.randomUUID());
+
+ when( statusService.getStatusFromId( GfiProcessState.QUALIFIED.getStatusValue()) ).thenReturn(qualifiedStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.COMPLETED.getStatusValue()) ).thenReturn(completedStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.CANCELED.getStatusValue()) ).thenReturn(canceledStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.UPDATED.getStatusValue()) ).thenReturn(udpatedStatusDto);
+ when( radiusService.getRadii() ).thenReturn(getRadiusDtoList());
+
+ FailureInformationDto existingDto = MockDataHelper.mockFailureInformationDto();
+ existingDto.setStatusInternId(qualifiedStatusDto.getUuid());
+ when( failureInformationService.findByObjectReferenceExternalSystem(anyString())).thenReturn(existingDto);
+
+ importService.validateAndImport(dto);
+
+ verify(failureInformationService, times(1))
+ .updateFailureInfo(any( FailureInformationDto.class));
+ }
+
+ @Test
+ public void shouldImportUpdateMessageOnceOnly() {
+ ImportDataDto dto = MockDataHelper.mockImportDataDto();
+ dto.setMessageContent("{\n" +
+ " \"branch\": \"S\",\n" + // invalid branch
+ " \"city\": \"Belfast\",\n" +
+ " \"description\": \"Schlimmer Fehler im System\",\n" +
+ " \"district\": \"\",\n" +
+ " \"failureBegin\": \"2020-11-19T14:13:15.666Z\",\n" +
+ " \"housenumber\": \"10b\",\n" +
+ " \"latitude\": 12.345,\n" +
+ " \"longitude\": 0,\n" +
+ " \"planned\": false,\n" +
+ " \"postcode\": \"3456\",\n" +
+ " \"pressureLevel\": null,\n" +
+ " \"radiusInMeters\": 678,\n" +
+ " \"stationDescription\": null,\n" +
+ " \"stationId\": null,\n" +
+ " \"street\": \"Oxfordstreet\",\n" +
+ " \"voltageLevel\": \"HS\",\n" +
+ " \"onceOnlyImport\": \"true\",\n" +
+ " \"autopublish\": \"false\"\n" +
+ " }");
+
+ BranchDto branchStromDto = MockDataHelper.mockBranchDto();
+ branchStromDto.setName("S");
+ when( branchService.findByName(eq("S"))).thenReturn(branchStromDto);
+ StatusDto qualifiedStatusDto = MockDataHelper.mockStatusDto("qualified", UUID.randomUUID());
+ StatusDto canceledStatusDto = MockDataHelper.mockStatusDto("canceled", UUID.randomUUID());
+ StatusDto completedStatusDto = MockDataHelper.mockStatusDto("completed", UUID.randomUUID());
+ StatusDto udpatedStatusDto = MockDataHelper.mockStatusDto("updated", UUID.randomUUID());
+
+ when( statusService.getStatusFromId( GfiProcessState.QUALIFIED.getStatusValue()) ).thenReturn(qualifiedStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.COMPLETED.getStatusValue()) ).thenReturn(completedStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.CANCELED.getStatusValue()) ).thenReturn(canceledStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.UPDATED.getStatusValue()) ).thenReturn(udpatedStatusDto);
+ when( radiusService.getRadii() ).thenReturn(getRadiusDtoList());
+
+ FailureInformationDto existingDto = MockDataHelper.mockFailureInformationDto();
+ existingDto.setStatusInternId(qualifiedStatusDto.getUuid());
+ when( failureInformationService.findByObjectReferenceExternalSystem(anyString())).thenReturn(existingDto);
+
+ importService.validateAndImport(dto);
+
+ verify(failureInformationService, times(0))
+ .updateFailureInfo(any( FailureInformationDto.class));
+ }
+
+ @Test
+ public void shouldImportUpdateMessageExcludeEquals() {
+ ImportDataDto dto = MockDataHelper.mockImportDataDto();
+ dto.setMessageContent("{\n" +
+ " \"branch\": \"S\",\n" + // invalid branch
+ " \"city\": \"Belfast\",\n" +
+ " \"description\": \"Schlimmer Fehler im System\",\n" +
+ " \"district\": \"\",\n" +
+ " \"failureBegin\": \"2020-11-19T14:13:15.666Z\",\n" +
+ " \"housenumber\": \"10b\",\n" +
+ " \"latitude\": 12.345,\n" +
+ " \"longitude\": 0,\n" +
+ " \"planned\": false,\n" +
+ " \"postcode\": \"3456\",\n" +
+ " \"pressureLevel\": null,\n" +
+ " \"radiusInMeters\": 678,\n" +
+ " \"stationDescription\": null,\n" +
+ " \"stationId\": null,\n" +
+ " \"street\": \"Oxfordstreet\",\n" +
+ " \"voltageLevel\": \"HS\",\n" +
+ " \"excludeEquals\": \"true\",\n" +
+ " \"excludeAlreadyEdited\": \"true\",\n" +
+ " \"autopublish\": \"false\"\n" +
+ " }");
+
+ ForeignFailureDataDto foreignFailureDataDto = importDataValidator.readSafeForeignFailureInfo(dto);
+
+ BranchDto branchStromDto = MockDataHelper.mockBranchDto();
+ branchStromDto.setName("S");
+ when( branchService.findByName(eq("S"))).thenReturn(branchStromDto);
+ StatusDto qualifiedStatusDto = MockDataHelper.mockStatusDto("qualified", UUID.randomUUID());
+ StatusDto canceledStatusDto = MockDataHelper.mockStatusDto("canceled", UUID.randomUUID());
+ StatusDto completedStatusDto = MockDataHelper.mockStatusDto("completed", UUID.randomUUID());
+ StatusDto udpatedStatusDto = MockDataHelper.mockStatusDto("updated", UUID.randomUUID());
+
+ when( statusService.getStatusFromId( GfiProcessState.QUALIFIED.getStatusValue()) ).thenReturn(qualifiedStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.COMPLETED.getStatusValue()) ).thenReturn(completedStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.CANCELED.getStatusValue()) ).thenReturn(canceledStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.UPDATED.getStatusValue()) ).thenReturn(udpatedStatusDto);
+ when( radiusService.getRadii() ).thenReturn(getRadiusDtoList());
+
+ FailureInformationDto existingDto = importService.setNewFromForeignDto(dto, foreignFailureDataDto);
+ existingDto.setStatusInternId(qualifiedStatusDto.getUuid());
+ when( failureInformationService.findByObjectReferenceExternalSystem(anyString())).thenReturn(existingDto);
+
+ importService.validateAndImport(dto);
+
+ verify(failureInformationService, times(0))
+ .updateFailureInfo(any( FailureInformationDto.class));
+ }
+
+ @Test
+ public void shouldImportUpdateMessageExcludeAlreadyEdited() {
+ ImportDataDto dto = MockDataHelper.mockImportDataDto();
+ dto.setMessageContent("{\n" +
+ " \"branch\": \"S\",\n" + // invalid branch
+ " \"city\": \"Belfast\",\n" +
+ " \"description\": \"Schlimmer Fehler im System\",\n" +
+ " \"district\": \"\",\n" +
+ " \"failureBegin\": \"2020-11-19T14:13:15.666Z\",\n" +
+ " \"housenumber\": \"10b\",\n" +
+ " \"latitude\": 12.345,\n" +
+ " \"longitude\": 0,\n" +
+ " \"planned\": false,\n" +
+ " \"postcode\": \"3456\",\n" +
+ " \"pressureLevel\": null,\n" +
+ " \"radiusInMeters\": 678,\n" +
+ " \"stationDescription\": null,\n" +
+ " \"stationId\": null,\n" +
+ " \"street\": \"Oxfordstreet\",\n" +
+ " \"voltageLevel\": \"HS\",\n" +
+ " \"excludeEquals\": \"true\",\n" +
+ " \"excludeAlreadyEdited\": \"true\",\n" +
+ " \"autopublish\": \"false\"\n" +
+ " }");
+
+ BranchDto branchStromDto = MockDataHelper.mockBranchDto();
+ branchStromDto.setName("S");
+ when( branchService.findByName(eq("S"))).thenReturn(branchStromDto);
+ StatusDto qualifiedStatusDto = MockDataHelper.mockStatusDto("qualified", UUID.randomUUID());
+ StatusDto canceledStatusDto = MockDataHelper.mockStatusDto("canceled", UUID.randomUUID());
+ StatusDto completedStatusDto = MockDataHelper.mockStatusDto("completed", UUID.randomUUID());
+ StatusDto udpatedStatusDto = MockDataHelper.mockStatusDto("updated", UUID.randomUUID());
+
+ when( statusService.getStatusFromId( GfiProcessState.QUALIFIED.getStatusValue()) ).thenReturn(qualifiedStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.COMPLETED.getStatusValue()) ).thenReturn(completedStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.CANCELED.getStatusValue()) ).thenReturn(canceledStatusDto);
+ when( statusService.getStatusFromId( GfiProcessState.UPDATED.getStatusValue()) ).thenReturn(udpatedStatusDto);
+ when( radiusService.getRadii() ).thenReturn(getRadiusDtoList());
+
+ FailureInformationDto existingDto = MockDataHelper.mockFailureInformationDto();
+ existingDto.setStatusInternId(qualifiedStatusDto.getUuid());
+ when( failureInformationService.findByObjectReferenceExternalSystem(anyString())).thenReturn(existingDto);
+
+ importService.validateAndImport(dto);
+
+ verify(failureInformationService, times(0))
+ .updateFailureInfo(any( FailureInformationDto.class));
+ verify(processHelper, times(0)).resetPublishedStateForChannels(any());
+ }
+
}
diff --git a/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/api/StoerungsauskunftApi.java b/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/api/StoerungsauskunftApi.java
index 8fc8b14..bb22ef3 100644
--- a/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/api/StoerungsauskunftApi.java
+++ b/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/api/StoerungsauskunftApi.java
@@ -29,8 +29,10 @@
@FeignClient(name="Stoerauskunft.de", url= "${stoerungsauskunft.apiUrl}")
public interface StoerungsauskunftApi {
+ //Example call: "https://stage-api-operator.stoerungsauskunft.de/api/v1.0/outage?additiveMode=false"
@PostMapping(value= "/outage")
- feign.Response postOutage(@RequestBody List<StoerungsauskunftOutage> outage);
+ feign.Response postOutage(@RequestBody List<StoerungsauskunftOutage> outage,
+ @RequestParam("additiveMode") boolean additiveMode);
@GetMapping(value= "/reports")
List<StoerungsauskunftUserNotification> getUserNotification(@RequestParam(value="sectorType") Integer sectorType);
diff --git a/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/dtos/ForeignFailureDataDto.java b/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/dtos/ForeignFailureDataDto.java
index b6d4e1e..b00cd70 100644
--- a/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/dtos/ForeignFailureDataDto.java
+++ b/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/dtos/ForeignFailureDataDto.java
@@ -30,6 +30,14 @@
@Data
public class ForeignFailureDataDto implements Serializable {
+ private boolean isAutopublish;
+
+ private boolean isOnceOnlyImport;
+
+ private boolean isExcludeEquals;
+
+ private boolean isExcludeAlreadyEdited;
+
@NotNull
private boolean isPlanned;
diff --git a/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/service/ImportExportService.java b/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/service/ImportExportService.java
index 9b352ba..fcbbfdf 100644
--- a/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/service/ImportExportService.java
+++ b/stoerungsauskunftInterface/src/main/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/service/ImportExportService.java
@@ -23,6 +23,7 @@
import org.eclipse.openk.gridfailureinformation.stoerauskunftinterface.exceptions.InternalServerErrorException;
import org.eclipse.openk.gridfailureinformation.stoerauskunftinterface.mapper.StoerungsauskunftMapper;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.messaging.MessageChannel;
@@ -50,6 +51,18 @@
@Autowired
StoerungsauskunftMapper stoerungsauskunftMapper;
+ @Value("${gridFailureInformation.autopublish:false}")
+ private boolean autopublish;
+ @Value("${gridFailureInformation.onceOnlyImport:false}")
+ private boolean onceOnlyImport;
+ @Value("${gridFailureInformation.excludeEquals:true}")
+ private boolean excludeEquals;
+ @Value("${gridFailureInformation.excludeAlreadyEdited:true}")
+ private boolean excludeAlreadyEdited;
+
+ @Value("${stoerungsauskunft.additiveMode:false}")
+ private boolean additiveMode;
+
public void importUserNotifications() {
List<StoerungsauskunftUserNotification> userNotificationList =
@@ -73,6 +86,10 @@
ForeignFailureDataDto foreignFailureDataDto = stoerungsauskunftMapper.toForeignFailureDataDto(userNotification);
foreignFailureDataDto.setBranch(Constants.BRANCH_ELECTRICITY);
foreignFailureDataDto.setPlanned(false);
+ foreignFailureDataDto.setAutopublish(autopublish);
+ foreignFailureDataDto.setOnceOnlyImport(onceOnlyImport);
+ foreignFailureDataDto.setExcludeEquals(excludeEquals);
+ foreignFailureDataDto.setExcludeAlreadyEdited(excludeAlreadyEdited);
return foreignFailureDataDto;
}
@@ -106,7 +123,7 @@
List<StoerungsauskunftOutage> stoerungsauskunftOutageExportList = new ArrayList<>();
stoerungsauskunftOutageExportList.add(stoerungsauskunftOutageExport);
- Response response = stoerungsauskunftApi.postOutage(stoerungsauskunftOutageExportList);
+ Response response = stoerungsauskunftApi.postOutage(stoerungsauskunftOutageExportList, additiveMode);
if (response.status() >= 400) {
log.error("Error while trying to post message to stoerungsauskunft.de with metaId: " + failureInformationDto.getUuid());
throw new InternalServerErrorException("could.not.post.message.to.external.service");
diff --git a/stoerungsauskunftInterface/src/main/resources/application.yml b/stoerungsauskunftInterface/src/main/resources/application.yml
index 3bdd438..1c97053 100644
--- a/stoerungsauskunftInterface/src/main/resources/application.yml
+++ b/stoerungsauskunftInterface/src/main/resources/application.yml
@@ -11,12 +11,6 @@
# SPDX-License-Identifier: EPL-2.0
# *******************************************************************************
spring:
- datasource:
- url: jdbc:postgresql://entopticadirx:5432/GridFailureInfoDevServer
- username: ${GFI_DB_USERNAME}
- password: ${GFI_DB_PASSWORD}
- flyway:
- enabled: false
rabbitmq:
host: entdockergss
port: 5672
@@ -52,12 +46,19 @@
stoerungsauskunft:
apiUrl: https://stage-api-operator.stoerungsauskunft.de/api/v1.0/
+ additiveMode: false
user: ${GFI_STOERUNGSAUSKUNFT_USERNAME}
password: ${GFI_STOERUNGSAUSKUNFT_PASSWORD}
scheduling-import:
enabled: false
cron: 0 */15 * ? * *
+gridFailureInformation:
+ autopublish: false
+ onceOnlyImport: false
+ excludeEquals: true
+ excludeAlreadyEdited: true
+
security.endpoint:
user: ${GFI_MANUAL_ENDPOINTS_USERNAME}
password: ${GFI_MANUAL_ENDPOINTS_PASSWORD}
diff --git a/stoerungsauskunftInterface/src/main/resources/application_localdev.yml b/stoerungsauskunftInterface/src/main/resources/application_localdev.yml
index 2cac6a3..00e5fca 100644
--- a/stoerungsauskunftInterface/src/main/resources/application_localdev.yml
+++ b/stoerungsauskunftInterface/src/main/resources/application_localdev.yml
@@ -11,8 +11,6 @@
# SPDX-License-Identifier: EPL-2.0
# *******************************************************************************
spring:
- flyway:
- enabled: false
rabbitmq:
host: entdockergss
port: 5672
@@ -73,6 +71,12 @@
enabled: false
cron: 0 */15 * ? * *
+gridFailureInformation:
+ autopublish: false
+ onceOnlyImport: false
+ excludeEquals: true
+ excludeAlreadyEdited: false
+
security.endpoint:
user: ${GFI_MANUAL_ENDPOINTS_USERNAME}
password: ${GFI_MANUAL_ENDPOINTS_PASSWORD}
diff --git a/stoerungsauskunftInterface/src/test/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/service/ImportExportServiceTest.java b/stoerungsauskunftInterface/src/test/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/service/ImportExportServiceTest.java
index 8d938dd..babf06c 100644
--- a/stoerungsauskunftInterface/src/test/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/service/ImportExportServiceTest.java
+++ b/stoerungsauskunftInterface/src/test/java/org/eclipse/openk/gridfailureinformation/stoerauskunftinterface/service/ImportExportServiceTest.java
@@ -82,9 +82,9 @@
Request request = mock(Request.class);
Response mockResponse = Response.builder().status(200).request(request).body("Test", StandardCharsets.UTF_8).build();
- when(stoerungsauskunftApi.postOutage(any())).thenReturn(mockResponse);
+ when(stoerungsauskunftApi.postOutage(any(), anyBoolean())).thenReturn(mockResponse);
importExportService.exportStoerungsauskunftOutage(rabbitMqMessageDto);
- verify(stoerungsauskunftApi, times(1)).postOutage(anyList());
+ verify(stoerungsauskunftApi, times(1)).postOutage(anyList(), anyBoolean());
}
@Test
@@ -97,9 +97,9 @@
Request request = mock(Request.class);
Response mockResponse = Response.builder().status(200).request(request).body("Test", StandardCharsets.UTF_8).build();
- when(stoerungsauskunftApi.postOutage(any())).thenReturn(mockResponse);
+ when(stoerungsauskunftApi.postOutage(any(), anyBoolean())).thenReturn(mockResponse);
importExportService.exportStoerungsauskunftOutage(rabbitMqMessageDto);
- verify(stoerungsauskunftApi, times(1)).postOutage(anyList());
+ verify(stoerungsauskunftApi, times(1)).postOutage(anyList(), anyBoolean());
}
@Test
@@ -112,9 +112,9 @@
Request request = mock(Request.class);
Response mockResponse = Response.builder().status(200).request(request).body("Test", StandardCharsets.UTF_8).build();
- when(stoerungsauskunftApi.postOutage(any())).thenReturn(mockResponse);
+ when(stoerungsauskunftApi.postOutage(any(), anyBoolean())).thenReturn(mockResponse);
importExportService.exportStoerungsauskunftOutage(rabbitMqMessageDto);
- verify(stoerungsauskunftApi, times(1)).postOutage(anyList());
+ verify(stoerungsauskunftApi, times(1)).postOutage(anyList(), anyBoolean());
}
@Test
@@ -124,7 +124,7 @@
Request request = mock(Request.class);
Response mockResponse = Response.builder().status(400).request(request).body("Test", StandardCharsets.UTF_8).build();
- when(stoerungsauskunftApi.postOutage(any())).thenReturn(mockResponse);
+ when(stoerungsauskunftApi.postOutage(any(), anyBoolean())).thenReturn(mockResponse);
assertThrows(InternalServerErrorException.class, () -> importExportService.exportStoerungsauskunftOutage(rabbitMqMessageDto));
}