From: Fiete Ostkamp Date: Tue, 8 Jul 2025 13:30:12 +0000 (+0200) Subject: Add so-simulator integration test X-Git-Tag: 1.15.6~3 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=7c222abb50d709287a6f126e9a58ef15ff023366;p=so.git Add so-simulator integration test - define integration test to assert that the so-simulator has a working application context - change spring.boot.version to springboot.version in so-simulator module to override the global property of the same name. This ensures that all spring boot deps of this module are in version 2.0.9 (before, some were in 2.4.12 which lead to incompatibilities) - add dependency management for spring cloud in so-simulator module to make sure that it is in a spring boot 2.0.9-compatible version - override javassist version (3.22.0-GA -> 3.25.0-GA) to have a java 11 compatible version - downgrade h2 dependency (2.1.214 -> 1.4.200) to be compatible with the citrus-simulator dependencies - update logback (1.2.7 -> 1.2.11) Issue-ID: SO-4200 Change-Id: I2e58cc0c59193a0a1268958a398699e577f25b1d Signed-off-by: Fiete Ostkamp --- diff --git a/pom.xml b/pom.xml index 8579dfc3a6..f51fd3a208 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ 1.6.9 2.14.3 1.25.0 - 1.2.7 + 1.2.11 diff --git a/so-simulator/pom.xml b/so-simulator/pom.xml index 323cf7df09..eddb8fed46 100644 --- a/so-simulator/pom.xml +++ b/so-simulator/pom.xml @@ -17,17 +17,39 @@ UTF-8 UTF-8 1.1.0 - 2.0.9.RELEASE + 2.0.9.RELEASE + Finchley.RC2 + 5.6.0 org.springframework.boot spring-boot-dependencies - ${spring.boot.version} + ${springboot.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} pom import + + + org.javassist + javassist + 3.25.0-GA + + + com.h2database + h2 + 1.4.200 + @@ -39,6 +61,28 @@ org.springframework.boot spring-boot-starter + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.jupiter + junit-jupiter + ${junit-jupiter.version} + + + org.junit.platform + junit-platform-commons + 1.6.0 + compile + + + org.testng + testng + test + 6.14.3 + com.consol.citrus @@ -55,6 +99,7 @@ aai-client ${project.version} + org.glassfish.jersey.core jersey-client @@ -112,6 +157,18 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + org.apache.maven.surefire + surefire-testng + 3.1.2 + + + diff --git a/so-simulator/src/test/java/org/onap/so/simulator/SimulatorIntegrationTest.java b/so-simulator/src/test/java/org/onap/so/simulator/SimulatorIntegrationTest.java new file mode 100644 index 0000000000..18a36f49bb --- /dev/null +++ b/so-simulator/src/test/java/org/onap/so/simulator/SimulatorIntegrationTest.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2025 Deutsche Telekom. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.simulator; + +import static org.junit.Assert.assertTrue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.SpringApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatus; +import org.springframework.test.context.ContextConfiguration; +import org.testng.annotations.Test; +import com.consol.citrus.annotations.CitrusTest; +import com.consol.citrus.dsl.runner.TestRunner; +import com.consol.citrus.dsl.runner.TestRunnerBeforeSuiteSupport; +import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner; +import com.consol.citrus.http.client.HttpClient; + +@Test +@ContextConfiguration(classes = org.onap.so.simulator.SimulatorIntegrationTest.EndpointConfig.class) +public class SimulatorIntegrationTest extends TestNGCitrusTestDesigner { + + @Autowired + @Qualifier("simulatorClient") + private HttpClient apiClient; + + @CitrusTest + public void thatRequestCanBeMade() { + http().client(apiClient).send().get("/sim/v1/tenantOne/stacks/network_dummy_id/stackId"); + http().client(apiClient).receive().response(HttpStatus.OK); + assertTrue(true); + } + + @Configuration + public static class EndpointConfig { + @Bean + public TestRunnerBeforeSuiteSupport startEmbeddedSimulator() { + return new TestRunnerBeforeSuiteSupport() { + @Override + public void beforeSuite(TestRunner runner) { + SpringApplication.run(Simulator.class); + } + }; + } + } +} diff --git a/so-simulator/src/test/resources/citrus-context.xml b/so-simulator/src/test/resources/citrus-context.xml index f491dbcb7e..dd1b8ea235 100644 --- a/so-simulator/src/test/resources/citrus-context.xml +++ b/so-simulator/src/test/resources/citrus-context.xml @@ -8,16 +8,10 @@ http://www.citrusframework.org/schema/http/config http://www.citrusframework.org/schema/http/config/citrus-http-config.xsd http://www.citrusframework.org/schema/config http://www.citrusframework.org/schema/config/citrus-config.xsd"> - - - - - - - \ No newline at end of file + diff --git a/so-simulator/src/test/resources/logback-spring.xml b/so-simulator/src/test/resources/logback-spring.xml new file mode 100644 index 0000000000..02d6a80d35 --- /dev/null +++ b/so-simulator/src/test/resources/logback-spring.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + ${debugPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + + +