diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-06-10 10:53:20 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-06-10 11:50:01 +0200 |
commit | 1efee417abaaa07344f4dbb239d2456841faa091 (patch) | |
tree | a517097a508ad21bb948c3891d9b97fbeeeb11da /sparkybe-onap-service | |
parent | f71b22fc3411442c6398866f0c29cbf8f129f26c (diff) |
Add sparky-be integration test
- run spring-boot integration test for the AggregateSummaryProcessor in the main sparkybe-onap-application module [1]
[1] this is specifically ensuring the proper creation of the beans in the spring context which is done using the spring-beans xml files.
In order to replace this outdated approach some time in the future, there have to be integration tests to ensure the proper injection
Issue-ID: AAI-3860
Change-Id: Id1488482ba852cce7407aba3e700fba5dd48ae99
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'sparkybe-onap-service')
7 files changed, 27 insertions, 128 deletions
diff --git a/sparkybe-onap-service/pom.xml b/sparkybe-onap-service/pom.xml index 7647010..80b50f9 100644 --- a/sparkybe-onap-service/pom.xml +++ b/sparkybe-onap-service/pom.xml @@ -1,7 +1,7 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <parent> + <parent> <groupId>org.onap.aai</groupId> <artifactId>sparky-be</artifactId> <version>2.0.5-SNAPSHOT</version> @@ -62,7 +62,7 @@ some of the depedencies should probably have a scope of provided so they don't a --> - <dependencies> +<dependencies> <!-- Spring dependencies --> <dependency> @@ -351,14 +351,11 @@ some of the depedencies should probably have a scope of provided so they don't a <scope>test</scope> </dependency> - </dependencies> - - <build> +</dependencies> +<build> <pluginManagement> <plugins> - - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> @@ -367,40 +364,7 @@ some of the depedencies should probably have a scope of provided so they don't a <release>11</release> <!--or <release>10</release>--> </configuration> </plugin> - -<!-- <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>2.7</version> - <executions> - <execution> - <id>copy-docker-file</id> - <phase>package</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>target</outputDirectory> - <overwrite>true</overwrite> - <resources> - <resource> - <directory>${basedir}/src/main/docker</directory> - <filtering>true</filtering> - <includes> - <include>**/*</include> - </includes> - </resource> - <resource> - <directory>${basedir}/src/main/scripts/</directory> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> --> - </plugins> - </pluginManagement> <plugins> @@ -424,84 +388,16 @@ some of the depedencies should probably have a scope of provided so they don't a </reportPlugins> </configuration> </plugin> - - <!-- <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>2.7</version> - <executions> - <execution> - <id>copy-docker-file</id> - <phase>package</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>target</outputDirectory> - <overwrite>true</overwrite> - <resources> - <resource> - <directory>${basedir}/src/main/docker</directory> - <filtering>true</filtering> - <includes> - <include>**/*</include> - </includes> - </resource> - <resource> - <directory>${basedir}/src/main/scripts/</directory> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> --> - -<!-- <plugin> - <groupId>com.spotify</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>0.4.11</version> - <configuration> - <verbose>true</verbose> - <serverId>docker-hub</serverId> - <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName> - <dockerDirectory>${docker.location}</dockerDirectory> - <imageTags> - <imageTag>latest</imageTag> - </imageTags> - <forceTags>true</forceTags> - </configuration> - </plugin> --> - <!-- license plugin --> -<!-- <plugin> - <groupId>com.mycila</groupId> - <artifactId>license-maven-plugin</artifactId> - <version>3.0</version> - <configuration> - <header>LICENSE</header> - <includes> - <include>src/main/java/**</include> - </includes> - </configuration> - <executions> - <execution> - <goals> - <goal>format</goal> - </goals> - <phase>process-sources</phase> - </execution> - </executions> - </plugin> - --> -<plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-deploy-plugin</artifactId> - <version>2.8.2</version> - </plugin> - </plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8.2</version> + </plugin> + </plugins> </build> - <distributionManagement> +<distributionManagement> <repository> <id>ecomp-releases</id> <name>ECOMP Release Repository</name> @@ -516,9 +412,9 @@ some of the depedencies should probably have a scope of provided so they don't a <id>ecomp-site</id> <url>dav:${onap.nexus.url}${sitePath}</url> </site> - </distributionManagement> +</distributionManagement> - <repositories> +<repositories> <repository> <id>central</id> <name>Maven 2 repository 2</name> @@ -539,8 +435,5 @@ some of the depedencies should probably have a scope of provided so they don't a <name>ECOMP Snapshot Repository</name> <url>${onap.nexus.url}/content/repositories/snapshots/</url> </repository> - </repositories> - - - +</repositories> </project> diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/SparkyResourceLoader.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/SparkyResourceLoader.java index 6bb0c45..aec2b3f 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/SparkyResourceLoader.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/SparkyResourceLoader.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ResourceLoaderAware; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; @@ -34,7 +35,8 @@ public class SparkyResourceLoader implements ResourceLoaderAware { private static final String FILE_URI = "file:"; private ResourceLoader resourceLoader; - private String configHomeEnvVar; + + @Value("${CONFIG_HOME}") private String configHomeEnvVar; // private static Logger LOG = LoggerFactory.getInstance().getLogger(SparkyResourceLoader.class); @@ -44,7 +46,7 @@ public class SparkyResourceLoader implements ResourceLoaderAware { } public String getFullFileUri(String uriFilePath) { - return FILE_URI + System.getProperty(configHomeEnvVar) + uriFilePath; + return FILE_URI + configHomeEnvVar + "/" + uriFilePath; } public String getAbsolutePath(String uriFilePath) { diff --git a/sparkybe-onap-service/src/main/resources/application.properties b/sparkybe-onap-service/src/main/resources/application.properties new file mode 100644 index 0000000..41bb8d8 --- /dev/null +++ b/sparkybe-onap-service/src/main/resources/application.properties @@ -0,0 +1 @@ +CONFIG_HOME=./config
\ No newline at end of file diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizerTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizerTest.java index d8833e3..269e867 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizerTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizerTest.java @@ -62,7 +62,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(SpringJUnit4ClassRunner.class) @TestPropertySource(properties = { -"schemaIngestPropLoc = src/test/resources/oxm-reader/schema-ingest-single-oxm.properties" }) +"schemaIngestPropLoc = src/test/resources/oxm-reader/schema-ingest-single-oxm.properties", +"CONFIG_HOME = ./config" }) @ContextConfiguration(locations = { "classpath:oxm-reader/oxm-reader-bean.xml" }) diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java index 1de7263..9b086c5 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java @@ -67,10 +67,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @TestPropertySource(properties = { -"schemaIngestPropLoc = src/test/resources/oxm-reader/schema-ingest-single-oxm.properties" }) +"schemaIngestPropLoc = src/test/resources/oxm-reader/schema-ingest-single-oxm.properties", +"CONFIG_HOME = ./config" }) @ContextConfiguration(locations = { "classpath:oxm-reader/oxm-reader-bean.xml" }) - - public class BaseVisualizationContextTest { private static SecureRandom secureRandom = new SecureRandom(); diff --git a/sparkybe-onap-service/src/test/resources/application.properties b/sparkybe-onap-service/src/test/resources/application.properties new file mode 100644 index 0000000..41bb8d8 --- /dev/null +++ b/sparkybe-onap-service/src/test/resources/application.properties @@ -0,0 +1 @@ +CONFIG_HOME=./config
\ No newline at end of file diff --git a/sparkybe-onap-service/src/test/resources/oxm-reader/schema-ingest-single-oxm.properties b/sparkybe-onap-service/src/test/resources/oxm-reader/schema-ingest-single-oxm.properties index 897f7da..d66500a 100644 --- a/sparkybe-onap-service/src/test/resources/oxm-reader/schema-ingest-single-oxm.properties +++ b/sparkybe-onap-service/src/test/resources/oxm-reader/schema-ingest-single-oxm.properties @@ -17,4 +17,6 @@ schema.version.depth.start=v11 schema.version.related.link.start=v11 schema.version.app.root.start=v11 schema.version.namespace.change.start=v11 -schema.version.edge.label.start=v11
\ No newline at end of file +schema.version.edge.label.start=v11 + +CONFIG_HOME=./config
\ No newline at end of file |