--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>cps-parent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <relativePath>../cps-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>cps-application</artifactId>
+
+ <properties>
+ <minimum-coverage>0.0</minimum-coverage>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-starter-sleuth</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <id>build</id>
+ <goals>
+ <goal>dockerBuild</goal>
+ </goals>
+ </execution>
+ <execution>
+ <phase>deploy</phase>
+ <id>buildAndPush</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>cps-docker</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>cps-rest</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>xnf-docker</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+
+ <properties>
+ <app>org.onap.cps.Application</app>
+ <repository.name>nexus3.onap.org:10001/onap/cps-nf-proxy</repository.name>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>cps-nf-proxy-rest</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>cps-xnf-docker</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+
+ <properties>
+ <app>org.onap.cps.Application</app>
+ <repository.name>nexus3.onap.org:10001/onap/cps-and-nf-proxy</repository.name><!-- better naming? -->
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>cps-rest</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>cps-nf-proxy-rest</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
\r
rest:\r
api:\r
- base-path: /cps/api\r
+ cps-base-path: /cps/api\r
+ xnf-base-path: /cps-nf-proxy/api\r
\r
spring:\r
main:\r
banner-mode: "off"\r
-# for POC only, later this should move to cpi-ri module\r
jpa:\r
ddl-auto: create\r
open-in-view: false\r
endpoints:\r
web:\r
base-path: /manage\r
- exposure:\r
- include: health,info,loggers\r
+ exposure:\r
+ include: info,health,loggers\r
endpoint:\r
health:\r
show-details: always\r
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.onap.cps</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>cps-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.cps</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>cps-rest</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.cps</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>cps-nf-proxy-rest</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.cps</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>cps-ri</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.cps</groupId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>cps-application</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>checkstyle</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.cps</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>spotbugs</artifactId>
<version>${project.version}</version>
</dependency>
<spock-spring.version>1.3-groovy-2.5</spock-spring.version>
<spotbugs.version>4.2.0</spotbugs.version>
<springboot.version>2.3.8.RELEASE</springboot.version>
+ <springboot.cloud.version>Hoxton.SR9</springboot.cloud.version>
<springfox.version>3.0.0</springfox.version>
<swagger.version>2.1.4</swagger.version>
<testcontainers.version>1.15.1</testcontainers.version>
<type>pom</type>
<scope>import</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-dependencies</artifactId>
+ <version>${springboot.cloud.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-artifacts</artifactId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.version}</version>
</dependency>
+ <!---To be removed once swagger-codegen-maven-plugin is upgraded-->
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.6.2</version>
+ </dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<artifactId>cps-nf-proxy-rest</artifactId>
<properties>
- <app>org.onap.cps.nfproxy.Application</app>
- <repository.name>nexus3.onap.org:10001/onap/cps-nf-proxy</repository.name>
- <minimum-coverage>0.44</minimum-coverage>
+ <minimum-coverage>0.0</minimum-coverage>
</properties>
<dependencies>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<build>
<plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
<!-- Swagger code generation. -->
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<apiPackage>org.onap.cps.nfproxy.rest.api</apiPackage>
<language>spring</language>
<generateSupportingFiles>false</generateSupportingFiles>
+ <configOptions>
+ <sourceFolder>src/gen/java</sourceFolder>
+ <dateLibrary>java11</dateLibrary>
+ <interfaceOnly>true</interfaceOnly>
+ <useTags>true</useTags>
+ </configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
-
- <profiles>
- <profile>
- <id>docker</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>com.google.cloud.tools</groupId>
- <artifactId>jib-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <id>build</id>
- <goals>
- <goal>dockerBuild</goal>
- </goals>
- </execution>
- <execution>
- <phase>deploy</phase>
- <id>buildAndPush</id>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
</project>
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Pantheon.tech
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.cps.nfproxy;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class Application {
- public static void main(final String[] args) {
- SpringApplication.run(Application.class, args);
- }
-}
/**
* Swagger-ui configuration.
*/
- @Bean
+ @Bean("nf-proxy-docket")
public Docket api() {
- return new Docket(DocumentationType.OAS_30).select()
+ return new Docket(DocumentationType.OAS_30)
+ .groupName("nf-proxy-docket")
+ .select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping("${rest.api.base-path}")
+@RequestMapping("${rest.api.xnf-base-path}")
public class NfProxyController implements NfProxyApi {
@Override
+++ /dev/null
-server:
- port: 8080
-
-rest:
- api:
- base-path: /cps-nf-proxy/api
-
-spring:
- main:
- banner-mode: "off"
-# for POC only, later this should move to cpi-ri module
- jpa:
- ddl-auto: create
- open-in-view: false
- properties:
- hibernate:
- enable_lazy_load_no_trans: true
- dialect: org.hibernate.dialect.PostgreSQLDialect
-
- datasource:
- url: jdbc:postgresql://${DB_HOST}:5432/cpsdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driverClassName: org.postgresql.Driver
- initialization-mode: always
-
-# Actuator
-management:
- endpoints:
- web:
- base-path: /manage
- exposure:
- include: info,health,loggers
- endpoint:
- health:
- show-details: always
- # kubernetes probes: liveness and readiness
- probes:
- enabled: true
- loggers:
- enabled: true
-
-logging:
- level:
- org:
- springframework: INFO
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Pantheon.tech
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-package org.onap.cps.nfproxy.config
-
-
-import spock.lang.Specification
-import springfox.documentation.spring.web.plugins.Docket
-
-class NfProxyConfigSpec extends Specification {
- def objectUnderTest = new NfProxyConfig()
-
- def 'xNF Proxy configuration has a Docket API'() {
- expect: 'the CPS configuration has a Docket API'
- objectUnderTest.api() instanceof Docket
- }
-}
@Autowired
MockMvc mvc
- @Value('${rest.api.base-path}')
+ @Value('${rest.api.xnf-base-path}')
def basePath
def 'Hello world method invocation.'(){
<spotbugs.version>4.2.0</spotbugs.version>
<swagger-codegen-maven-plugin.version>3.0.18</swagger-codegen-maven-plugin.version>
<snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
- <tag.version>${project.version}</tag.version>
+ <image.version>${project.version}</image.version>
<jacoco.reportDirectory.aggregate>${project.reporting.outputDirectory}/jacoco-aggregate</jacoco.reportDirectory.aggregate>
<sonar.coverage.jacoco.xmlReportPaths>
../cps-rest/target/site/jacoco-aggregate/jacoco.xml,
../cps-nf-proxy-rest/target/site/jacoco-ut/jacoco.xml,
../cps-nf-proxy-rest/target/site/jacoco-aggregate/jacoco.xml,
+ ../cps-application/target/site/jacoco-ut/jacoco.xml,
+ ../cps-application/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
</properties>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger-codegen-maven-plugin.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${project.basedir}/docs/api/swagger/openapi.yml</inputSpec>
- <invokerPackage>org.onap.cps.rest.controller</invokerPackage>
- <modelPackage>org.onap.cps.rest.model</modelPackage>
- <apiPackage>org.onap.cps.rest.api</apiPackage>
- <language>spring</language>
- <generateSupportingFiles>false</generateSupportingFiles>
- <configOptions>
- <sourceFolder>src/gen/java</sourceFolder>
- <dateLibrary>java11</dateLibrary>
- <interfaceOnly>true</interfaceOnly>
- <useTags>true</useTags>
- </configOptions>
- </configuration>
- </execution>
- </executions>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<image>${base.image}</image>
</from>
<to>
- <image>${repository.name}</image>
- <tags>
- <tag>${tag.version}</tag>
- </tags>
+ <image>${repository.name}:${image.version}</image>
</to>
</configuration>
</plugin>
<artifactId>cps-rest</artifactId>\r
\r
<properties>\r
- <minimum-coverage>0.88</minimum-coverage>\r
+ <minimum-coverage>0.53</minimum-coverage>\r
</properties>\r
\r
<dependencies>\r
<groupId>io.springfox</groupId>\r
<artifactId>springfox-boot-starter</artifactId>\r
</dependency>\r
+ <dependency>\r
+ <groupId>io.swagger</groupId>\r
+ <artifactId>swagger-annotations</artifactId>\r
+ </dependency>\r
<dependency>\r
<groupId>org.apache.commons</groupId>\r
<artifactId>commons-lang3</artifactId>\r
\r
<build>\r
<plugins>\r
- <plugin>\r
- <groupId>org.springframework.boot</groupId>\r
- <artifactId>spring-boot-maven-plugin</artifactId>\r
- </plugin>\r
<!-- Swagger code generation. -->\r
<plugin>\r
<groupId>io.swagger.codegen.v3</groupId>\r
<artifactId>swagger-codegen-maven-plugin</artifactId>\r
+ <executions>\r
+ <execution>\r
+ <goals>\r
+ <goal>generate</goal>\r
+ </goals>\r
+ <configuration>\r
+ <inputSpec>${project.basedir}/docs/api/swagger/openapi.yml</inputSpec>\r
+ <invokerPackage>org.onap.cps.rest.controller</invokerPackage>\r
+ <modelPackage>org.onap.cps.rest.model</modelPackage>\r
+ <apiPackage>org.onap.cps.rest.api</apiPackage>\r
+ <language>spring</language>\r
+ <generateSupportingFiles>false</generateSupportingFiles>\r
+ <configOptions>\r
+ <sourceFolder>src/gen/java</sourceFolder>\r
+ <dateLibrary>java11</dateLibrary>\r
+ <interfaceOnly>true</interfaceOnly>\r
+ <useTags>true</useTags>\r
+ </configOptions>\r
+ </configuration>\r
+ </execution>\r
+ </executions>\r
</plugin>\r
</plugins>\r
</build>\r
-\r
- <profiles>\r
- <profile>\r
- <id>docker</id>\r
- <activation>\r
- <activeByDefault>false</activeByDefault>\r
- </activation>\r
- <build>\r
- <plugins>\r
- <plugin>\r
- <groupId>com.google.cloud.tools</groupId>\r
- <artifactId>jib-maven-plugin</artifactId>\r
- <executions>\r
- <execution>\r
- <phase>package</phase>\r
- <id>build</id>\r
- <goals>\r
- <goal>dockerBuild</goal>\r
- </goals>\r
- </execution>\r
- <execution>\r
- <phase>deploy</phase>\r
- <id>buildAndPush</id>\r
- <goals>\r
- <goal>build</goal>\r
- </goals>\r
- </execution>\r
- </executions>\r
- </plugin>\r
- </plugins>\r
- </build>\r
- </profile>\r
- </profiles>\r
</project>\r
/**\r
* Swagger configuration.\r
*/\r
- @Bean\r
+ @Bean("cps-docket")\r
public Docket api() {\r
- return new Docket(DocumentationType.OAS_30).select().apis(RequestHandlerSelectors.any())\r
+ return new Docket(DocumentationType.OAS_30)\r
+ .groupName("cps-docket")\r
+ .select()\r
+ .apis(RequestHandlerSelectors.any())\r
.paths(PathSelectors.any()).build();\r
}\r
\r
import org.springframework.web.multipart.MultipartFile;
@RestController
-@RequestMapping("${rest.api.base-path}")
+@RequestMapping("${rest.api.cps-base-path}")
public class AdminRestController implements CpsAdminApi {
@Autowired
import org.springframework.web.multipart.MultipartFile;
@RestController
-@RequestMapping("${rest.api.base-path}")
+@RequestMapping("${rest.api.cps-base-path}")
public class DataRestController implements CpsDataApi {
@Autowired
@Autowired
MockMvc mvc
- @Value('${rest.api.base-path}')
+ @Value('${rest.api.cps-base-path}')
def basePath
def anchorsEndpoint = '/v1/dataspaces/my_dataspace/anchors'
@Autowired
MockMvc mvc
- @Value('${rest.api.base-path}')
+ @Value('${rest.api.cps-base-path}')
def basePath
@Shared
-# Docker Compose
+# Docker Compose deployment example for local enviroments, CPS deployment is done via OOM
To run the application locally using `docker-compose`, execute following command from this `docker-compose` folder:
+Generate the containers
+
+```bash
+mvn clean install -Pcps-docker -Pxnf-docker -Pcps-xnf-docker
+```
+or for generate an specific type
+
+```bash
+mvn clean install -Pcps-docker
+```
+Run the containers
+
```bash
-VERSION=0.0.1-SNAPSHOT DB_HOST=dbpostgresql DB_USERNAME=cps DB_PASSWORD=cps docker-compose up
+VERSION=0.0.1-SNAPSHOT DB_HOST=dbpostgresql DB_USERNAME=cps DB_PASSWORD=cps docker-compose up -d
```
\ No newline at end of file
container_name: cps-service
image: nexus3.onap.org:10001/onap/cps-service:${VERSION}
ports:
- - "8080:8080"
+ - "8881:8080"
environment:
DB_HOST: ${DB_HOST}
DB_USERNAME: ${DB_USERNAME}
depends_on:
- dbpostgresql
- cps-nf-proxy:
- container_name: cps-nf-proxy
- image: nexus3.onap.org:10001/onap/cps-nf-proxy:${VERSION}
- ports:
- - "8081:8080"
- environment:
- DB_HOST: ${DB_HOST}
- DB_USERNAME: ${DB_USERNAME}
- DB_PASSWORD: ${DB_PASSWORD}
- restart: unless-stopped
- depends_on:
- - dbpostgresql
dbpostgresql:
container_name: dbpostgresql
<module>cps-ri</module>\r
<module>checkstyle</module>\r
<module>spotbugs</module>\r
+ <module>cps-application</module>\r
</modules>\r
</project>\r