From b0227b3532baff1980783267a8d19ed005eb89eb Mon Sep 17 00:00:00 2001
From: Christos Tranoris <tranoris@ece.upatras.gr>
Date: Wed, 19 Jun 2024 12:16:59 +0300
Subject: [PATCH] fixes to run tests in ide also. related to #41

(cherry picked from commit 113bab7c99a2dc6600e4f6633423cec1f793cd1b)
---
 pom.xml                                                    | 7 +++++++
 .../osl/services/api/ResourceCatalogIntegrationTest.java   | 3 ++-
 .../osl/services/api/ServiceInventoryIntegrationTest.java  | 3 ++-
 .../osl/services/api/sim638/ServiceApiControllerTest.java  | 3 ++-
 .../scm633/ServiceSpecificationRepoServiceTest.java        | 3 ++-
 5 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 681a724..885c306 100644
--- a/pom.xml
+++ b/pom.xml
@@ -261,6 +261,13 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>
 			<scope>test</scope>
+		    <exclusions>
+		        <exclusion>
+		            <groupId>com.vaadin.external.google</groupId>
+		            <artifactId>android-json</artifactId>
+		        </exclusion>
+		    </exclusions>
+			
 		</dependency>
 		<dependency>
 			<groupId>org.springframework.security</groupId>
diff --git a/src/test/java/org/etsi/osl/services/api/ResourceCatalogIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ResourceCatalogIntegrationTest.java
index 926f88a..02aa8e0 100644
--- a/src/test/java/org/etsi/osl/services/api/ResourceCatalogIntegrationTest.java
+++ b/src/test/java/org/etsi/osl/services/api/ResourceCatalogIntegrationTest.java
@@ -76,6 +76,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
 import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.http.MediaType;
@@ -95,7 +96,7 @@ import net.minidev.json.JSONObject;
 @RunWith(SpringRunner.class)
 @Transactional
 @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.MOCK , classes = OpenAPISpringBoot.class)
-//@AutoConfigureTestDatabase //this automatically uses h2
+@AutoConfigureTestDatabase //this automatically uses h2
 @AutoConfigureMockMvc 
 @ActiveProfiles("testing")
 //@TestPropertySource(
diff --git a/src/test/java/org/etsi/osl/services/api/ServiceInventoryIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ServiceInventoryIntegrationTest.java
index d31dd72..16ad168 100644
--- a/src/test/java/org/etsi/osl/services/api/ServiceInventoryIntegrationTest.java
+++ b/src/test/java/org/etsi/osl/services/api/ServiceInventoryIntegrationTest.java
@@ -66,6 +66,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
 import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.http.MediaType;
@@ -83,7 +84,7 @@ import org.springframework.web.context.WebApplicationContext;
 @RunWith(SpringRunner.class)
 @Transactional
 @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.MOCK , classes = OpenAPISpringBoot.class)
-//@AutoConfigureTestDatabase //this automatically uses h2
+@AutoConfigureTestDatabase //this automatically uses h2
 @AutoConfigureMockMvc 
 @ActiveProfiles("testing")
 //@TestPropertySource(
diff --git a/src/test/java/org/etsi/osl/services/api/sim638/ServiceApiControllerTest.java b/src/test/java/org/etsi/osl/services/api/sim638/ServiceApiControllerTest.java
index afdebd6..5c59431 100644
--- a/src/test/java/org/etsi/osl/services/api/sim638/ServiceApiControllerTest.java
+++ b/src/test/java/org/etsi/osl/services/api/sim638/ServiceApiControllerTest.java
@@ -17,6 +17,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
 import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.http.HttpStatus;
@@ -51,7 +52,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 @RunWith(SpringRunner.class)
 @Transactional
 @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.MOCK , classes = OpenAPISpringBoot.class)
-//@AutoConfigureTestDatabase //this automatically uses h2
+@AutoConfigureTestDatabase //this automatically uses h2
 @AutoConfigureMockMvc
 @ActiveProfiles("testing")
 //@TestPropertySource(
diff --git a/src/test/java/org/etsi/osl/services/reposervices/scm633/ServiceSpecificationRepoServiceTest.java b/src/test/java/org/etsi/osl/services/reposervices/scm633/ServiceSpecificationRepoServiceTest.java
index a3ea0b3..c5e3082 100644
--- a/src/test/java/org/etsi/osl/services/reposervices/scm633/ServiceSpecificationRepoServiceTest.java
+++ b/src/test/java/org/etsi/osl/services/reposervices/scm633/ServiceSpecificationRepoServiceTest.java
@@ -446,7 +446,8 @@ public class ServiceSpecificationRepoServiceTest {
         alias = v.getAlias();
 
         assertEquals("PrimitivesList", serviceSpecCharacteristic.getName());
-        assertEquals("{\"vnfs\":[{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vnf1\",\"vdu-configs\":[{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vdu1\"},{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vdu2\"}]},{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vnf2\",\"vdu-configs\":[{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vdu1\"},{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vdu2\"}]}]}", value);
+//        assertEquals("{\"vnfs\":[{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vnf1\",\"vdu-configs\":[{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vdu1\"},{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vdu2\"}]},{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vnf2\",\"vdu-configs\":[{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vdu1\"},{\"config-primitive\":[{\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}],\"name\":\"run-touch-command\"}],\"id\":\"vdu2\"}]}]}", value);
+        assertEquals("{\"vnfs\":[{\"config-primitive\":[{\"name\":\"run-touch-command\",\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}]}],\"id\":\"vnf1\",\"vdu-configs\":[{\"config-primitive\":[{\"name\":\"run-touch-command\",\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}]}],\"id\":\"vdu1\"},{\"config-primitive\":[{\"name\":\"run-touch-command\",\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}]}],\"id\":\"vdu2\"}]},{\"config-primitive\":[{\"name\":\"run-touch-command\",\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}]}],\"id\":\"vnf2\",\"vdu-configs\":[{\"config-primitive\":[{\"name\":\"run-touch-command\",\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}]}],\"id\":\"vdu1\"},{\"config-primitive\":[{\"name\":\"run-touch-command\",\"parameter\":[{\"name\":\"filename\",\"data-type\":\"STRING\"}]}],\"id\":\"vdu2\"}]}]}", value);
         assertEquals("", alias);
 
 
-- 
GitLab