From d97deba011fec5a5a9ac6b1de453dac54474d325 Mon Sep 17 00:00:00 2001
From: Joze RIHTARSIC <joze.RIHTARSIC@ext.ec.europa.eu>
Date: Wed, 12 Oct 2022 09:54:53 +0200
Subject: [PATCH] make tests more robust.

---
 pom.xml                                               |  4 ++--
 .../smp/controllers/ServiceGroupControllerTest.java   | 11 ++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index 620436914..4096e2670 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@
         <slf4j.version>1.7.36</slf4j.version>
         <soapui.plugin.version>5.1.2</soapui.plugin.version>
         <spring-modules-jakarta-commons.version>0.8</spring-modules-jakarta-commons.version>
-        <spring.boot.version>2.7.0</spring.boot.version>
+        <spring.boot.version>2.7.4</spring.boot.version>
         <spring.security.version>5.7.2</spring.security.version>
         <spring.version>5.3.21</spring.version>
         <xmlunit.version>2.9.0</xmlunit.version>
@@ -692,7 +692,7 @@
                     <plugin>
                         <groupId>org.owasp</groupId>
                         <artifactId>dependency-check-maven</artifactId>
-                        <version>7.1.1</version>
+                        <version>7.1.2</version>
                         <inherited>false</inherited>
                         <configuration>
                             <skipProvidedScope>true</skipProvidedScope>
diff --git a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java
index 7bfbd7f1a..5be630005 100644
--- a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java
+++ b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java
@@ -52,7 +52,12 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 @ContextConfiguration(classes = {SmpTestWebAppConfig.class})
 @Sql(scripts = {
         "classpath:/cleanup-database.sql",
-        "classpath:/webapp_integration_test_data.sql"},
+        "classpath:/webapp_integration_test_data.sql",
+        },
+        statements = {
+                "update SMP_CONFIGURATION set VALUE='false', LAST_UPDATED_ON=CURRENT_TIMESTAMP() where PROPERTY='identifiersBehaviour.scheme.mandatory';",
+                "update SMP_CONFIGURATION set VALUE='true', LAST_UPDATED_ON=CURRENT_TIMESTAMP() where PROPERTY='smp.automation.authentication.external.tls.clientCert.enabled';"
+        },
         executionPhase = BEFORE_TEST_METHOD)
 public class ServiceGroupControllerTest {
 
@@ -91,8 +96,6 @@ public class ServiceGroupControllerTest {
     @Before
     public void setup() throws IOException {
         forwardedHeaderTransformer.setRemoveOnly(false);
-        configurationDao.setPropertyToDatabase(SMPPropertyEnum.EXTERNAL_TLS_AUTHENTICATION_CLIENT_CERT_HEADER_ENABLED, "true", null);
-        configurationDao.setPropertyToDatabase(SMPPropertyEnum.PARTC_SCH_MANDATORY, "false", null);
         X509CertificateTestUtils.reloadKeystores();
         mvc = MockMvcUtils.initializeMockMvc(webAppContext);
         configurationDao.reloadPropertiesFromDatabase();
@@ -116,8 +119,6 @@ public class ServiceGroupControllerTest {
 
     @Test
     public void adminCanCreateServiceGroupNullScheme() throws Exception {
-        // make sure identifiersBehaviour.scheme.allowNull is set to true in db script
-        // set identifiersBehaviour.scheme.mandatory to false
         mvc.perform(put(URL_PATH_NULL_SCHEME)
                 .with(ADMIN_CREDENTIALS)
                 .header(HTTP_HEADER_KEY_DOMAIN, HTTP_DOMAIN_VALUE)
-- 
GitLab