aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2021-01-22 14:55:52 +0000
committerGerrit Code Review <gerrit@onap.org>2021-01-22 14:55:52 +0000
commit95d02d13cceb78b6d8d2fe24f72a8544e1d862f2 (patch)
treef1e1ca48730227a7171f740bd150cf4016bf1e17
parent31f6f737a191455918a6e5bbf396ecc939d8b173 (diff)
parent078c34d0c2e439d8a148a2cd4d7545c6b7f56acb (diff)
Merge "First integration of Policy model PdpGroups"
-rw-r--r--pom.xml2375
-rw-r--r--src/main/docker/frontend/nginx/default.conf2
-rw-r--r--src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java20
-rw-r--r--src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java58
-rw-r--r--src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroup.java92
-rw-r--r--src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java94
-rw-r--r--src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpSubgroup.java56
-rw-r--r--src/main/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKey.java125
-rw-r--r--src/main/resources/clds/camel/routes/policy-flows.xml38
-rw-r--r--src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java58
-rw-r--r--src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupAnalyzerTest.java130
-rw-r--r--src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupTest.java86
-rw-r--r--src/test/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKeyTest.java55
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policies/.file2
14 files changed, 1519 insertions, 1672 deletions
diff --git a/pom.xml b/pom.xml
index 99f8c05ed..6125e686d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,1217 +21,1236 @@
===================================================================
-->
<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>
- <groupId>org.onap.policy</groupId>
- <artifactId>clamp</artifactId>
- <version>6.0.0-SNAPSHOT</version>
- <name>policy-clamp</name>
+ 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>
+ <groupId>org.onap.policy</groupId>
+ <artifactId>clamp</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ <name>policy-clamp</name>
<parent>
- <groupId>org.onap.policy.parent</groupId>
- <artifactId>integration</artifactId>
- <version>3.3.0-SNAPSHOT</version>
- <relativePath />
+ <groupId>org.onap.policy.parent</groupId>
+ <artifactId>integration</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ <relativePath/>
</parent>
- <description>
- This is the MAVEN project that builds everything for ONAP POLICY-CLAMP.
- Docker engine is normally requires to perfom all possible tasks (including integration tests)
+ <description>
+ This is the MAVEN project that builds everything for ONAP POLICY-CLAMP.
+ Docker engine is normally requires to perfom all possible tasks (including integration tests)
- It can build:
- - The ONAP POLICY-CLAMP JAR that contains CLAMP back-end code.
- - The DOCKER images for:
- * POLICY-CLAMP backend (Java Spring)
- * POLICY-CLAMP frontend (Javscript React)
+ It can build:
+ - The ONAP POLICY-CLAMP JAR that contains CLAMP back-end code.
+ - The DOCKER images for:
+ * POLICY-CLAMP backend (Java Spring)
+ * POLICY-CLAMP frontend (Javscript React)
- It can test:
- - The POLICY-CLAMP backend, JAVA unit testing
- - The POLICY-CLAMP backend, JAVA integration tests (with Spring + docker mariadb database + docker policy/dcae emulator written in python)
- - The POLICY-CLAMP frontend, Javascrip tests (NodeJS(NPM) + JEST + Enzyme fro React)
+ It can test:
+ - The POLICY-CLAMP backend, JAVA unit testing
+ - The POLICY-CLAMP backend, JAVA integration tests (with Spring + docker mariadb database + docker policy/dcae
+ emulator written in python)
+ - The POLICY-CLAMP frontend, Javascrip tests (NodeJS(NPM) + JEST and Enzyme for React)
- The test coverage for dev's can be found after a "clean install" build in:
- - Clamp backend: target/jacoco-dev.exec (unit tests + integration tests merged)
- or separately target/coverage-reports/jacoco.exec and target/coverage-reports/jacoco-it.exec
- - Clamp frontend: target/ui-react/coverage
+ The test coverage for dev's can be found after a "clean install" build in:
+ - Clamp backend: target/jacoco-dev.exec (unit tests + integration tests merged)
+ or separately target/coverage-reports/jacoco.exec and target/coverage-reports/jacoco-it.exec
+ - Clamp frontend: target/ui-react/coverage
- Useful mvn commands:
- - mvn clean install: Build Clamp backend JAR + unit tests + integration tests + NPM tests (+coverage for all)
- - mvn clean install -DskipITs=true: Build Clamp backend JAR + unit tests + NPM tests (+coverage for all), it does not require a DOCKER engine
- - mvn clean install -DskipTests -P docker: Build Clamp backend JAR + all docker images
+ Useful mvn commands:
+ - mvn clean install: Build Clamp backend JAR + unit tests + integration tests + NPM tests (+coverage for all)
+ - mvn clean install -DskipITs=true: Build Clamp backend JAR + unit tests + NPM tests (+coverage for all), it
+ does not require a DOCKER engine
+ - mvn clean install -DskipTests -P docker: Build Clamp backend JAR + all docker images
- To start POLICY-CLAMP (Build it before):
- - Use docker-compose file in ./extra/docker/clamp/docker-compose.yml
- - Use the script located in ./extra/bin/start-backend.sh + start-frontend.sh
- - Use your IDE to use the Jar or start NVM/NPM
+ To start POLICY-CLAMP (Build it before):
+ - Use docker-compose file in ./extra/docker/clamp/docker-compose.yml
+ - Use the script located in ./extra/bin/start-backend.sh + start-frontend.sh
+ - Use your IDE to use the Jar or start NVM/NPM
- </description>
+ </description>
- <properties>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
- <clamp.project.version>${project.version}</clamp.project.version>
- <clamp.build.timestamp>${maven.build.timestamp}</clamp.build.timestamp>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <properties>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <clamp.project.version>${project.version}</clamp.project.version>
+ <clamp.build.timestamp>${maven.build.timestamp}</clamp.build.timestamp>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <eelf.core.version>1.0.0</eelf.core.version>
- <camel.version>2.25.2</camel.version>
- <springboot.version>2.2.10.RELEASE</springboot.version>
+ <eelf.core.version>1.0.0</eelf.core.version>
+ <camel.version>2.25.2</camel.version>
+ <springboot.version>2.2.10.RELEASE</springboot.version>
- <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
- <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
- <sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/jacoco-html-xml-reports/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
- <sonar.projectVersion>${project.version}</sonar.projectVersion>
- <sonar.log.level>DEBUG</sonar.log.level>
- <sonar.nodejs.executable>${project.build.directory}/${ui.react.src}/node/node</sonar.nodejs.executable>
- <sonar.verbose>true</sonar.verbose>
- <sonar.sources>src/main,${project.build.directory}/${ui.react.src}/src</sonar.sources>
- <sonar.exclusions>src/main/resources/**</sonar.exclusions>
- <sonar.scm.exclusions.disabled>true</sonar.scm.exclusions.disabled>
- <sonar.javascript.lcov.reportPaths>${project.build.directory}/${ui.react.src}/coverage/lcov.info</sonar.javascript.lcov.reportPaths>
- <sonar.coverage.exclusions>src/main/resources/**,target/ui-react/src/**/*.test.js,target/ui-react/src/setupTests.js</sonar.coverage.exclusions>
- <docker.push.registry>localhost:5000</docker.push.registry>
- <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
- <docker.skip.build>true</docker.skip.build>
- <docker.skip.push>true</docker.skip.push>
- <docker.skip.tag>true</docker.skip.tag>
- <skip.staging.artifacts>false</skip.staging.artifacts>
- <python.http.proxy.param />
- <tomcat.version>9.0.37</tomcat.version>
- <ui.react.src>ui-react</ui.react.src>
- <ui.react.lib.src>ui-react-lib</ui.react.lib.src>
- <npm.publish.url>https://nexus3.onap.org/repository/npm.snapshot/</npm.publish.url>
- </properties>
+ <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
+ <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
+ <sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/jacoco-html-xml-reports/jacoco.xml
+ </sonar.coverage.jacoco.xmlReportPaths>
+ <sonar.projectVersion>${project.version}</sonar.projectVersion>
+ <sonar.log.level>DEBUG</sonar.log.level>
+ <sonar.nodejs.executable>${project.build.directory}/${ui.react.src}/node/node</sonar.nodejs.executable>
+ <sonar.verbose>true</sonar.verbose>
+ <sonar.sources>src/main,${project.build.directory}/${ui.react.src}/src</sonar.sources>
+ <sonar.exclusions>src/main/resources/**</sonar.exclusions>
+ <sonar.scm.exclusions.disabled>true</sonar.scm.exclusions.disabled>
+ <sonar.javascript.lcov.reportPaths>${project.build.directory}/${ui.react.src}/coverage/lcov.info
+ </sonar.javascript.lcov.reportPaths>
+ <sonar.coverage.exclusions>
+ src/main/resources/**,target/ui-react/src/**/*.test.js,target/ui-react/src/setupTests.js
+ </sonar.coverage.exclusions>
+ <docker.push.registry>localhost:5000</docker.push.registry>
+ <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
+ <docker.skip.build>true</docker.skip.build>
+ <docker.skip.push>true</docker.skip.push>
+ <docker.skip.tag>true</docker.skip.tag>
+ <skip.staging.artifacts>false</skip.staging.artifacts>
+ <python.http.proxy.param/>
+ <tomcat.version>9.0.37</tomcat.version>
+ <ui.react.src>ui-react</ui.react.src>
+ <ui.react.lib.src>ui-react-lib</ui.react.lib.src>
+ <npm.publish.url>https://nexus3.onap.org/repository/npm.snapshot/</npm.publish.url>
+ </properties>
- <profiles>
- <!-- BEGIN: NOT USABLE profiles, those are defined when specific flags are enabled -->
- <profile>
- <id>without-test</id>
- <activation>
- <property>
- <name>maven.test.skip</name>
- <value>true</value>
- </property>
- </activation>
- <properties>
- <docker.skip.run>true</docker.skip.run>
- <docker.skip>true</docker.skip>
- </properties>
- </profile>
- <profile>
- <id>without-IT-only</id>
- <activation>
- <property>
- <name>skipITs</name>
- <value>true</value>
- </property>
- </activation>
- <properties>
- <docker.skip.run>true</docker.skip.run>
- <docker.skip>true</docker.skip>
- </properties>
- </profile>
- <profile>
- <id>without-IT-only2</id>
- <activation>
- <property>
- <name>skipTests</name>
- <value>true</value>
- </property>
- </activation>
- <properties>
- <docker.skip.run>true</docker.skip.run>
- <docker.skip>true</docker.skip>
- </properties>
- </profile>
- <!-- END: NOT USABLE profiles, those are defined when specific flags are enabled -->
- <profile>
- <id>docker</id>
- <properties>
- <skip.staging.artifacts>true</skip.staging.artifacts>
- <docker.skip.build>false</docker.skip.build>
- <docker.skip.tag>false</docker.skip.tag>
- <docker.skip.push>false</docker.skip.push>
- <docker.skip>false</docker.skip>
- </properties>
- </profile>
- </profiles>
+ <profiles>
+ <!-- BEGIN: NOT USABLE profiles, those are defined when specific flags are enabled -->
+ <profile>
+ <id>without-test</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <docker.skip.run>true</docker.skip.run>
+ <docker.skip>true</docker.skip>
+ </properties>
+ </profile>
+ <profile>
+ <id>without-IT-only</id>
+ <activation>
+ <property>
+ <name>skipITs</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <docker.skip.run>true</docker.skip.run>
+ <docker.skip>true</docker.skip>
+ </properties>
+ </profile>
+ <profile>
+ <id>without-IT-only2</id>
+ <activation>
+ <property>
+ <name>skipTests</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <docker.skip.run>true</docker.skip.run>
+ <docker.skip>true</docker.skip>
+ </properties>
+ </profile>
+ <!-- END: NOT USABLE profiles, those are defined when specific flags are enabled -->
+ <profile>
+ <id>docker</id>
+ <properties>
+ <skip.staging.artifacts>true</skip.staging.artifacts>
+ <docker.skip.build>false</docker.skip.build>
+ <docker.skip.tag>false</docker.skip.tag>
+ <docker.skip.push>false</docker.skip.push>
+ <docker.skip>false</docker.skip>
+ </properties>
+ </profile>
+ </profiles>
- <distributionManagement>
- <repository>
- <id>ecomp-releases</id>
- <name>ONAP Release Repository</name>
- <url>https://nexus.onap.org/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>ecomp-snapshots</id>
- <name>ONAP Snapshot Repository</name>
- <url>https://nexus.onap.org/content/repositories/snapshots/</url>
- </snapshotRepository>
- <site>
- <id>ecomp-site</id>
- <url>dav:https://nexus.onap.org/content/sites/site/org/onap/policy/clamp/${project.version}</url>
- </site>
- </distributionManagement>
+ <distributionManagement>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>ONAP Release Repository</name>
+ <url>https://nexus.onap.org/content/repositories/releases/</url>
+ </repository>
+ <snapshotRepository>
+ <id>ecomp-snapshots</id>
+ <name>ONAP Snapshot Repository</name>
+ <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+ </snapshotRepository>
+ <site>
+ <id>ecomp-site</id>
+ <url>dav:https://nexus.onap.org/content/sites/site/org/onap/policy/clamp/${project.version}</url>
+ </site>
+ </distributionManagement>
- <repositories>
- <repository>
- <id>onap-public</id>
- <name>onap-public</name>
- <url>https://nexus.onap.org/content/repositories/public/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>ecomp-releases</id>
- <name>ONAP Release Repository</name>
- <url>https://nexus.onap.org/content/repositories/releases/</url>
- </repository>
- <repository>
- <id>ecomp-staging</id>
- <name>ONAP Staging Repository</name>
- <url>https://nexus.onap.org/content/repositories/staging/</url>
- </repository>
- <repository>
- <id>ecomp-snapshots</id>
- <name>ONAP Snapshot Repository</name>
- <url>https://nexus.onap.org/content/repositories/snapshots/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- <repository>
- <id>central</id>
- <url>http://repo1.maven.org/maven2/</url>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>onap-public</id>
- <name>onap-public</name>
- <url>https://nexus.onap.org/content/repositories/public/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- <pluginRepository>
- <id>central</id>
- <url>http://repo1.maven.org/maven2/</url>
- </pluginRepository>
- </pluginRepositories>
+ <repositories>
+ <repository>
+ <id>onap-public</id>
+ <name>onap-public</name>
+ <url>https://nexus.onap.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>ONAP Release Repository</name>
+ <url>https://nexus.onap.org/content/repositories/releases/</url>
+ </repository>
+ <repository>
+ <id>ecomp-staging</id>
+ <name>ONAP Staging Repository</name>
+ <url>https://nexus.onap.org/content/repositories/staging/</url>
+ </repository>
+ <repository>
+ <id>ecomp-snapshots</id>
+ <name>ONAP Snapshot Repository</name>
+ <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ <repository>
+ <id>central</id>
+ <url>http://repo1.maven.org/maven2/</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>onap-public</id>
+ <name>onap-public</name>
+ <url>https://nexus.onap.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>central</id>
+ <url>http://repo1.maven.org/maven2/</url>
+ </pluginRepository>
+ </pluginRepositories>
- <dependencyManagement>
- <dependencies>
- <!-- Spring Boot BOM -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${springboot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <!-- Camel BOM -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring-boot-dependencies</artifactId>
- <version>${camel.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <dependencyManagement>
+ <dependencies>
+ <!-- Spring Boot BOM -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${springboot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <!-- Camel BOM -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-dependencies</artifactId>
+ <version>${camel.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf.core.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.codehaus.janino</groupId>
- <artifactId>janino</artifactId>
- <version>3.0.8</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-el</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-websocket</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-annotations-api</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <!-- For CAMEL -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-http4-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring-boot-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jaxb-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-servlet-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-gson-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-swagger-java-starter</artifactId>
- <exclusions>
- <exclusion>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-ext</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- Spring famework -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-json</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-tomcat</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-autoconfigure</artifactId>
- </dependency>
- <dependency>
- <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.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <!-- Others dependencies -->
- <!-- Jaxws is required for AAF -->
- <dependency>
- <groupId>javax.xml.ws</groupId>
- <artifactId>jaxws-api</artifactId>
- <version>2.3.1</version>
- </dependency>
- <dependency>
- <groupId>org.onap.aaf.authz</groupId>
- <artifactId>aaf-cadi-aaf</artifactId>
- <version>2.1.15</version>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>1.2.3</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.2.3</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.6</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-vfs2</artifactId>
- <version>2.2</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0.2</version>
- </dependency>
- <!-- Other dependencies to fix nexus IQ reported vulnerabilities -->
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.14</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-web</artifactId>
- <version>5.2.3.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>3.0.24</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.ws.rs</groupId>
- <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
- <version>1.0.1.Final</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>27.0-jre</version>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>${eelf.core.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.janino</groupId>
+ <artifactId>janino</artifactId>
+ <version>3.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-el</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-websocket</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-annotations-api</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <!-- For CAMEL -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http4-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jaxb-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-servlet-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-gson-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-swagger-java-starter</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-ext</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- Spring famework -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-json</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
+ </dependency>
+ <dependency>
+ <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.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+ <!-- Policy dependencies mainly for the models required -->
+ <dependency>
+ <groupId>org.onap.policy.models</groupId>
+ <artifactId>policy-models-pdp</artifactId>
+ <version>2.3.5</version>
+ </dependency>
- <!-- Remove the MYSQL connector and replace it by Mariadb -->
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- <version>2.6.2</version>
- </dependency>
- <!-- For SDC Controller -->
- <dependency>
- <groupId>org.onap.sdc.sdc-distribution-client</groupId>
- <artifactId>sdc-distribution-client</artifactId>
- <version>1.4.1</version>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.sdc-tosca</groupId>
- <artifactId>sdc-tosca</artifactId>
- <version>1.5.1</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.26</version>
- </dependency>
- <dependency>
- <groupId>org.dom4j</groupId>
- <artifactId>dom4j</artifactId>
- <version>2.1.3</version>
- </dependency>
+ <!-- Others dependencies -->
+ <!-- Jaxws is required for AAF -->
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aaf.authz</groupId>
+ <artifactId>aaf-cadi-aaf</artifactId>
+ <version>2.1.15</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-vfs2</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ <!-- Other dependencies to fix nexus IQ reported vulnerabilities -->
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.14</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-web</artifactId>
+ <version>5.2.3.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>3.0.24</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.ws.rs</groupId>
+ <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
+ <version>1.0.1.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>27.0-jre</version>
+ </dependency>
- <!-- TESTING -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>3.10.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>2.28.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <version>2.0.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <version>2.0.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.github.docker-java</groupId>
- <artifactId>docker-java-core</artifactId>
- <version>3.2.1</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.github.docker-java</groupId>
- <artifactId>docker-java</artifactId>
- <version>3.2.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <!-- Remove the MYSQL connector and replace it by Mariadb -->
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+ <!-- For SDC Controller -->
+ <dependency>
+ <groupId>org.onap.sdc.sdc-distribution-client</groupId>
+ <artifactId>sdc-distribution-client</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.sdc.sdc-tosca</groupId>
+ <artifactId>sdc-tosca</artifactId>
+ <version>1.5.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.26</version>
+ </dependency>
+ <dependency>
+ <groupId>org.dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>2.1.3</version>
+ </dependency>
- <build>
- <finalName>policy-clamp-backend</finalName>
+ <!-- TESTING -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>3.10.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>2.28.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <version>2.0.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>2.0.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.github.docker-java</groupId>
+ <artifactId>docker-java-core</artifactId>
+ <version>3.2.1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.github.docker-java</groupId>
+ <artifactId>docker-java</artifactId>
+ <version>3.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <testResources>
- <testResource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <excludes>
- <exclude>clds/aaf/**</exclude>
- </excludes>
- </testResource>
- <testResource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <includes>
- <include>clds/aaf/**</include>
- </includes>
- </testResource>
- <testResource>
- <directory>src/test/resources</directory>
- <excludes>
- <exclude>**/*.jks</exclude>
- <exclude>**/*.csar</exclude>
- </excludes>
- <filtering>true</filtering>
- </testResource>
- <testResource>
- <directory>src/test/resources/https</directory>
- <includes>
- <include>**.jks</include>
- </includes>
- <filtering>false</filtering>
- <targetPath>https</targetPath>
- </testResource>
- <testResource>
- <directory>src/test/resources/example/sdc</directory>
- <includes>
- <include>**.csar</include>
- </includes>
- <filtering>false</filtering>
- <targetPath>example/sdc</targetPath>
- </testResource>
- </testResources>
- <resources>
- <!-- For AAF folder maven should not try to filter Keystores/Truststores ... Otherwise
- they will be broken and unreadable -->
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <excludes>
- <exclude>clds/aaf/**</exclude>
- </excludes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <includes>
- <include>clds/aaf/**</include>
- </includes>
- </resource>
- <resource>
- <directory>${ui.react.src}</directory>
- <excludes>
- <exclude>node_modules</exclude>
- </excludes>
- <includes>
- <include>src/**</include>
- <include>public/**</include>
- <include>package.json</include>
- <include>package-lock.json</include>
- </includes>
- <filtering>true</filtering>
- <targetPath>${project.build.directory}/${ui.react.src}</targetPath>
- </resource>
- <resource>
- <directory>${ui.react.src}</directory>
- <includes>
- <include>src/**</include>
- </includes>
- <excludes>
- <exclude>**/__snapshots__/**</exclude>
- <exclude>**/**.test.js</exclude>
- </excludes>
- <filtering>true</filtering>
- <targetPath>${project.build.directory}/${ui.react.lib.src}</targetPath>
- </resource>
- <resource>
- <directory>${ui.react.lib.src}</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>node_modules/**</exclude>
- <exclude>package-lock.json</exclude>
- </excludes>
- <filtering>true</filtering>
- <targetPath>${project.build.directory}/${ui.react.lib.src}</targetPath>
- </resource>
- </resources>
+ <build>
+ <finalName>policy-clamp-backend</finalName>
- <plugins>
- <plugin>
- <groupId>de.jpdigital</groupId>
- <artifactId>hibernate52-ddl-maven-plugin</artifactId>
- <version>2.2.0</version>
- <dependencies>
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.3.0</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>gen-ddl</goal>
- </goals>
- <configuration>
- <packages>
- <param>org.onap.policy.clamp</param>
- </packages>
- <dialects>
- <param>MARIADB53</param>
- </dialects>
- <outputDirectory>${project.basedir}/extra/sql/bulkload/</outputDirectory>
- <outputFileNameSuffix>create-tables</outputFileNameSuffix>
- <!-- <createDropStatements>true</createDropStatements> -->
- <omitDialectFromFileName>true</omitDialectFromFileName>
- </configuration>
- </execution>
- </executions>
+ <testResources>
+ <testResource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>clds/aaf/**</exclude>
+ </excludes>
+ </testResource>
+ <testResource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>clds/aaf/**</include>
+ </includes>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <excludes>
+ <exclude>**/*.jks</exclude>
+ <exclude>**/*.csar</exclude>
+ </excludes>
+ <filtering>true</filtering>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources/https</directory>
+ <includes>
+ <include>**.jks</include>
+ </includes>
+ <filtering>false</filtering>
+ <targetPath>https</targetPath>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources/example/sdc</directory>
+ <includes>
+ <include>**.csar</include>
+ </includes>
+ <filtering>false</filtering>
+ <targetPath>example/sdc</targetPath>
+ </testResource>
+ </testResources>
+ <resources>
+ <!-- For AAF folder maven should not try to filter Keystores/Truststores ... Otherwise
+ they will be broken and unreadable -->
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>clds/aaf/**</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>clds/aaf/**</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${ui.react.src}</directory>
+ <excludes>
+ <exclude>node_modules</exclude>
+ </excludes>
+ <includes>
+ <include>src/**</include>
+ <include>public/**</include>
+ <include>package.json</include>
+ <include>package-lock.json</include>
+ </includes>
+ <filtering>true</filtering>
+ <targetPath>${project.build.directory}/${ui.react.src}</targetPath>
+ </resource>
+ <resource>
+ <directory>${ui.react.src}</directory>
+ <includes>
+ <include>src/**</include>
+ </includes>
+ <excludes>
+ <exclude>**/__snapshots__/**</exclude>
+ <exclude>**/**.test.js</exclude>
+ </excludes>
+ <filtering>true</filtering>
+ <targetPath>${project.build.directory}/${ui.react.lib.src}</targetPath>
+ </resource>
+ <resource>
+ <directory>${ui.react.lib.src}</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>node_modules/**</exclude>
+ <exclude>package-lock.json</exclude>
+ </excludes>
+ <filtering>true</filtering>
+ <targetPath>${project.build.directory}/${ui.react.lib.src}</targetPath>
+ </resource>
+ </resources>
- </plugin>
- <!-- Read the swagger.json file and the definition from SwaggerConfig.java; generate
- a list of .adoc files containing the APIs info in more structured way -->
- <plugin>
- <groupId>io.github.swagger2markup</groupId>
- <artifactId>swagger2markup-maven-plugin</artifactId>
- <version>1.3.3</version>
- <dependencies>
- <dependency>
- <groupId>io.github.swagger2markup</groupId>
- <artifactId>swagger2markup-import-files-ext</artifactId>
- <version>1.3.3</version>
- </dependency>
- <dependency>
- <groupId>io.github.swagger2markup</groupId>
- <artifactId>swagger2markup-spring-restdocs-ext</artifactId>
- <version>1.3.3</version>
- </dependency>
- </dependencies>
- <configuration>
- <swaggerInput>${project.basedir}/docs/swagger/swagger.json</swaggerInput>
- <outputDir>${project.build.directory}/asciidoc/generated</outputDir>
- <config>
- <swagger2markup.markupLanguage>ASCIIDOC</swagger2markup.markupLanguage>
- </config>
- </configuration>
- <executions>
- <execution>
- <phase>post-integration-test</phase>
- <goals>
- <goal>convertSwagger2markup</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <plugins>
+ <plugin>
+ <groupId>de.jpdigital</groupId>
+ <artifactId>hibernate52-ddl-maven-plugin</artifactId>
+ <version>2.2.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>gen-ddl</goal>
+ </goals>
+ <configuration>
+ <packages>
+ <param>org.onap.policy.clamp</param>
+ </packages>
+ <dialects>
+ <param>MARIADB53</param>
+ </dialects>
+ <outputDirectory>${project.basedir}/extra/sql/bulkload/</outputDirectory>
+ <outputFileNameSuffix>create-tables</outputFileNameSuffix>
+ <!-- <createDropStatements>true</createDropStatements> -->
+ <omitDialectFromFileName>true</omitDialectFromFileName>
+ </configuration>
+ </execution>
+ </executions>
- <!-- Run the generated asciidoc through Asciidoctor to generate other documentation
- types, such as PDFs or HTML5 -->
- <plugin>
- <groupId>org.asciidoctor</groupId>
- <artifactId>asciidoctor-maven-plugin</artifactId>
- <version>1.5.7.1</version>
- <dependencies>
- <dependency>
- <groupId>org.asciidoctor</groupId>
- <artifactId>asciidoctorj-pdf</artifactId>
- <version>1.5.0-alpha.10.1</version>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDirectory>${project.basedir}/src/main/resources/asciidoc</sourceDirectory>
- <sourceDocumentName>swagger.adoc</sourceDocumentName>
- <attributes>
- <doctype>book</doctype>
- <toc>left</toc>
- <toclevels>3</toclevels>
- <numbered />
- <hardbreaks />
- <sectlinks />
- <sectanchors />
- <generated>${project.build.directory}/asciidoc/generated</generated>
- </attributes>
- </configuration>
+ </plugin>
+ <!-- Read the swagger.json file and the definition from SwaggerConfig.java; generate
+ a list of .adoc files containing the APIs info in more structured way -->
+ <plugin>
+ <groupId>io.github.swagger2markup</groupId>
+ <artifactId>swagger2markup-maven-plugin</artifactId>
+ <version>1.3.3</version>
+ <dependencies>
+ <dependency>
+ <groupId>io.github.swagger2markup</groupId>
+ <artifactId>swagger2markup-import-files-ext</artifactId>
+ <version>1.3.3</version>
+ </dependency>
+ <dependency>
+ <groupId>io.github.swagger2markup</groupId>
+ <artifactId>swagger2markup-spring-restdocs-ext</artifactId>
+ <version>1.3.3</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <swaggerInput>${project.basedir}/docs/swagger/swagger.json</swaggerInput>
+ <outputDir>${project.build.directory}/asciidoc/generated</outputDir>
+ <config>
+ <swagger2markup.markupLanguage>ASCIIDOC</swagger2markup.markupLanguage>
+ </config>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>convertSwagger2markup</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
- <executions>
- <execution>
- <id>output-html</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>process-asciidoc</goal>
- </goals>
- <configuration>
- <backend>html5</backend>
- <outputDirectory>${project.basedir}/docs/swagger</outputDirectory>
- <outputDirectory>${project.basedir}/src/main/resources/META-INF/resources/</outputDirectory>
- </configuration>
- </execution>
- <execution>
- <id>output-pdf</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>process-asciidoc</goal>
- </goals>
- <configuration>
- <backend>pdf</backend>
- <outputDirectory>${project.basedir}/docs/swagger</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.groovy.maven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>docker-tags</id>
- <phase>validate</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>${project.basedir}/src/main/script/TagVersion.groovy</source>
- </configuration>
- </execution>
- <execution>
- <id>npm-repos-selection</id>
- <phase>validate</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>${project.basedir}/src/main/script/SelectNpmRepo.groovy</source>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.0.2</version>
- <executions>
- <execution>
- <id>jar-with-only-classes</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>classes</classifier>
- <includes>
- <include>org/**</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>3.0.0</version>
- <executions>
- <execution>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <artifacts>
- <artifact>
- <file>${project.build.directory}/policy-clamp-backend-classes.jar</file>
- <type>jar</type>
- <classifier>classes</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- <execution>
- <id>reserve-port-for-tests</id>
- <phase>process-resources</phase>
- <goals>
- <goal>reserve-network-port</goal>
- </goals>
- <configuration>
- <portNames>
- <portName>docker.mariadb.port.host</portName>
- <portName>docker.http-cache.port.host</portName>
- <portName>clamp.it.tests.http-redirected</portName>
- <portName>clamp.it.tests.robotframework.http</portName>
- <portName>clamp.it.tests.https</portName>
- <portName>clamp.it.tests.http</portName>
- </portNames>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <!-- Run the generated asciidoc through Asciidoctor to generate other documentation
+ types, such as PDFs or HTML5 -->
+ <plugin>
+ <groupId>org.asciidoctor</groupId>
+ <artifactId>asciidoctor-maven-plugin</artifactId>
+ <version>1.5.7.1</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.asciidoctor</groupId>
+ <artifactId>asciidoctorj-pdf</artifactId>
+ <version>1.5.0-alpha.10.1</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDirectory>${project.basedir}/src/main/resources/asciidoc</sourceDirectory>
+ <sourceDocumentName>swagger.adoc</sourceDocumentName>
+ <attributes>
+ <doctype>book</doctype>
+ <toc>left</toc>
+ <toclevels>3</toclevels>
+ <numbered/>
+ <hardbreaks/>
+ <sectlinks/>
+ <sectanchors/>
+ <generated>${project.build.directory}/asciidoc/generated</generated>
+ </attributes>
+ </configuration>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <version>${springboot.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.22.2</version>
- <configuration>
- <forkCount>1C</forkCount>
- <reuseForks>true</reuseForks>
- <useSystemClassLoader>false</useSystemClassLoader>
- <argLine>${surefireArgLine}</argLine>
- </configuration>
- </plugin>
+ <executions>
+ <execution>
+ <id>output-html</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>process-asciidoc</goal>
+ </goals>
+ <configuration>
+ <backend>html5</backend>
+ <outputDirectory>${project.basedir}/docs/swagger</outputDirectory>
+ <outputDirectory>${project.basedir}/src/main/resources/META-INF/resources/</outputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>output-pdf</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>process-asciidoc</goal>
+ </goals>
+ <configuration>
+ <backend>pdf</backend>
+ <outputDirectory>${project.basedir}/docs/swagger</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>docker-tags</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${project.basedir}/src/main/script/TagVersion.groovy</source>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm-repos-selection</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${project.basedir}/src/main/script/SelectNpmRepo.groovy</source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.0.2</version>
+ <executions>
+ <execution>
+ <id>jar-with-only-classes</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>classes</classifier>
+ <includes>
+ <include>org/**</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.0.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/policy-clamp-backend-classes.jar</file>
+ <type>jar</type>
+ <classifier>classes</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ <execution>
+ <id>reserve-port-for-tests</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>reserve-network-port</goal>
+ </goals>
+ <configuration>
+ <portNames>
+ <portName>docker.mariadb.port.host</portName>
+ <portName>docker.http-cache.port.host</portName>
+ <portName>clamp.it.tests.http-redirected</portName>
+ <portName>clamp.it.tests.robotframework.http</portName>
+ <portName>clamp.it.tests.https</portName>
+ <portName>clamp.it.tests.http</portName>
+ </portNames>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.22.2</version>
- <executions>
- <execution>
- <id>integration-tests</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- <configuration>
- <additionalClasspathElements>
- <additionalClasspathElement>${project.build.directory}/classes</additionalClasspathElement>
- </additionalClasspathElements>
- <includes>
- <include>**/*ItCase.java</include>
- </includes>
- <forkCount>1C</forkCount>
- <reuseForks>true</reuseForks>
- <useSystemClassLoader>false</useSystemClassLoader>
- <argLine>${failsafeArgLine}</argLine>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.31.0</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.5</version>
- </dependency>
- </dependencies>
- <configuration>
- <verbose>true</verbose>
- <apiVersion>1.35</apiVersion>
- <images>
- <image>
- <name>docker.io/mariadb:10.5.4</name>
- <alias>mariadb</alias>
- <run>
- <env>
- <MYSQL_ROOT_PASSWORD>strong_pitchou</MYSQL_ROOT_PASSWORD>
- </env>
- <hostname>mariadb</hostname>
- <volumes>
- <bind>
- <volume>${project.basedir}/extra/sql/:/docker-entrypoint-initdb.d:rw</volume>
- <volume>${project.basedir}/extra/docker/mariadb/conf1:/etc/mysql/conf.d</volume>
- </bind>
- </volumes>
- <wait>
- <log>socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution</log>
- <time>300000</time>
- <exec>
- <preStop>/docker-entrypoint-initdb.d/dump/backup-data-only.sh</preStop>
- </exec>
- </wait>
- <ports>
- <port>${docker.mariadb.port.host}:3306</port>
- </ports>
- <network>
- <mode>bridge</mode>
- </network>
- </run>
- </image>
- <image>
- <name>docker.io/python:2-slim</name>
- <alias>python</alias>
- <run>
- <hostname>python</hostname>
- <volumes>
- <bind>
- <volume>${project.basedir}/src/test/resources/http-cache/:/usr/src/http-cache-app</volume>
- <volume>${project.basedir}/src/test/resources/http-cache/example/:/usr/src/http-cache-app/data-cache</volume>
- </bind>
- </volumes>
- <wait>
- <tcp>
- <ports>
- <port>8080</port>
- </ports>
- <mode>direct</mode>
- </tcp>
- <time>120000</time>
- </wait>
- <ports>
- <port>${docker.http-cache.port.host}:8080</port>
- </ports>
- <workingDir>/usr/src/http-cache-app</workingDir>
- <cmd>
- <shell>./start_http_cache.sh ${python.http.proxy.param}
- --python_proxyaddress=localhost:${docker.http-cache.port.host}</shell>
- </cmd>
- <network>
- <mode>bridge</mode>
- </network>
- </run>
- </image>
- <image>
- <name>onap/policy-clamp-backend</name>
- <alias>onap-policy-clamp-backend</alias>
- <run>
- <skip>true</skip>
- </run>
- <build>
- <cleanup>true</cleanup>
- <tags>
- <tag>latest</tag>
- <tag>${project.docker.latesttagtimestamp.version}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <!-- A relative path is looked up in ${project.basedir}/src/main/docker by
- default -->
- <dockerFile>backend/Dockerfile</dockerFile>
- <assembly>
- <descriptor>backend/backend-files.xml</descriptor>
- <name>onap-policy-clamp-backend</name>
- </assembly>
- </build>
- </image>
- <image>
- <name>onap/policy-clamp-frontend</name>
- <alias>onap-policy-clamp-frontend</alias>
- <run>
- <skip>true</skip>
- </run>
- <build>
- <cleanup>true</cleanup>
- <tags>
- <tag>latest</tag>
- <tag>${project.docker.latesttagtimestamp.version}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <!-- A relative path is looked up in ${project.basedir}/src/main/docker by
- default -->
- <dockerFile>frontend/Dockerfile</dockerFile>
- <assembly>
- <descriptor>frontend/frontend-files.xml</descriptor>
- <name>onap-policy-clamp-frontend</name>
- </assembly>
- </build>
- </image>
- </images>
- </configuration>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${springboot.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.22.2</version>
+ <configuration>
+ <forkCount>1C</forkCount>
+ <reuseForks>true</reuseForks>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <argLine>${surefireArgLine}</argLine>
+ </configuration>
+ </plugin>
- <executions>
- <execution>
- <id>generate-images</id>
- <phase>install</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- <execution>
- <id>push-images</id>
- <phase>deploy</phase>
- <goals>
- <goal>push</goal>
- </goals>
- </execution>
- <execution>
- <id>docker-start-for-it</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>docker-stop-for-it</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.22.2</version>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${project.build.directory}/classes
+ </additionalClasspathElement>
+ </additionalClasspathElements>
+ <includes>
+ <include>**/*ItCase.java</include>
+ </includes>
+ <forkCount>1C</forkCount>
+ <reuseForks>true</reuseForks>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <argLine>${failsafeArgLine}</argLine>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.31.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.5.5</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.35</apiVersion>
+ <images>
+ <image>
+ <name>docker.io/mariadb:10.5.4</name>
+ <alias>mariadb</alias>
+ <run>
+ <env>
+ <MYSQL_ROOT_PASSWORD>strong_pitchou</MYSQL_ROOT_PASSWORD>
+ </env>
+ <hostname>mariadb</hostname>
+ <volumes>
+ <bind>
+ <volume>${project.basedir}/extra/sql/:/docker-entrypoint-initdb.d:rw</volume>
+ <volume>${project.basedir}/extra/docker/mariadb/conf1:/etc/mysql/conf.d</volume>
+ </bind>
+ </volumes>
+ <wait>
+ <log>socket: '/run/mysqld/mysqld.sock'</log>
+ <time>300000</time>
+ <exec>
+ <preStop>/docker-entrypoint-initdb.d/dump/backup-data-only.sh</preStop>
+ </exec>
+ </wait>
+ <ports>
+ <port>${docker.mariadb.port.host}:3306</port>
+ </ports>
+ <network>
+ <mode>bridge</mode>
+ </network>
+ </run>
+ </image>
+ <image>
+ <name>docker.io/python:2-slim</name>
+ <alias>python</alias>
+ <run>
+ <hostname>python</hostname>
+ <volumes>
+ <bind>
+ <volume>
+ ${project.basedir}/src/test/resources/http-cache/:/usr/src/http-cache-app
+ </volume>
+ <volume>
+ ${project.basedir}/src/test/resources/http-cache/example/:/usr/src/http-cache-app/data-cache
+ </volume>
+ </bind>
+ </volumes>
+ <wait>
+ <tcp>
+ <ports>
+ <port>8080</port>
+ </ports>
+ <mode>direct</mode>
+ </tcp>
+ <time>120000</time>
+ </wait>
+ <ports>
+ <port>${docker.http-cache.port.host}:8080</port>
+ </ports>
+ <workingDir>/usr/src/http-cache-app</workingDir>
+ <cmd>
+ <shell>./start_http_cache.sh ${python.http.proxy.param}
+ --python_proxyaddress=localhost:${docker.http-cache.port.host}
+ </shell>
+ </cmd>
+ <network>
+ <mode>bridge</mode>
+ </network>
+ </run>
+ </image>
+ <image>
+ <name>onap/policy-clamp-backend</name>
+ <alias>onap-policy-clamp-backend</alias>
+ <run>
+ <skip>true</skip>
+ </run>
+ <build>
+ <cleanup>true</cleanup>
+ <tags>
+ <tag>latest</tag>
+ <tag>${project.docker.latesttagtimestamp.version}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <!-- A relative path is looked up in ${project.basedir}/src/main/docker by
+ default -->
+ <dockerFile>backend/Dockerfile</dockerFile>
+ <assembly>
+ <descriptor>backend/backend-files.xml</descriptor>
+ <name>onap-policy-clamp-backend</name>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>onap/policy-clamp-frontend</name>
+ <alias>onap-policy-clamp-frontend</alias>
+ <run>
+ <skip>true</skip>
+ </run>
+ <build>
+ <cleanup>true</cleanup>
+ <tags>
+ <tag>latest</tag>
+ <tag>${project.docker.latesttagtimestamp.version}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <!-- A relative path is looked up in ${project.basedir}/src/main/docker by
+ default -->
+ <dockerFile>frontend/Dockerfile</dockerFile>
+ <assembly>
+ <descriptor>frontend/frontend-files.xml</descriptor>
+ <name>onap-policy-clamp-frontend</name>
+ </assembly>
+ </build>
+ </image>
+ </images>
+ </configuration>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.5</version>
- <configuration>
- <dumpOnExit>true</dumpOnExit>
- <append>true</append>
- <includes>
- <include>org/onap/policy/clamp/**</include>
- </includes>
- </configuration>
- <executions>
- <execution>
- <id>pre-unit-test</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- <configuration>
- <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
- <propertyName>surefireArgLine</propertyName>
- <!-- <append>true</append> -->
- </configuration>
- </execution>
- <execution>
- <id>pre-integration-test</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- <configuration>
- <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
- <propertyName>failsafeArgLine</propertyName>
- <!-- <append>true</append> -->
- <!-- Need to overwrite the policy integration parent flag -->
- <skip>false</skip>
- </configuration>
- </execution>
- <execution>
- <goals>
- <goal>merge</goal>
- </goals>
- <phase>post-integration-test</phase>
- <configuration>
- <fileSets>
- <fileSet
- implementation="org.apache.maven.shared.model.fileset.FileSet">
- <directory>${project.build.directory}/coverage-reports</directory>
- <includes>
- <include>*.exec</include>
- </includes>
- </fileSet>
- </fileSets>
- <destFile>${project.build.directory}/jacoco.exec</destFile>
- </configuration>
- </execution>
- <execution>
- <id>report-xml</id>
- <goals>
- <goal>report</goal>
- </goals>
- <configuration>
- <!-- Setting explicit path, so that we remember where it picks them up from -->
- <dataFile>${project.build.directory}/jacoco.exec</dataFile>
- <outputDirectory>${project.build.directory}/jacoco-html-xml-reports</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <executions>
+ <execution>
+ <id>generate-images</id>
+ <phase>install</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>docker-start-for-it</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>docker-stop-for-it</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.8.5</version>
+ <configuration>
+ <dumpOnExit>true</dumpOnExit>
+ <append>true</append>
+ <includes>
+ <include>org/onap/policy/clamp/**</include>
+ </includes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>pre-unit-test</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
+ <propertyName>surefireArgLine</propertyName>
+ <!-- <append>true</append> -->
+ </configuration>
+ </execution>
+ <execution>
+ <id>pre-integration-test</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
+ <propertyName>failsafeArgLine</propertyName>
+ <!-- <append>true</append> -->
+ <!-- Need to overwrite the policy integration parent flag -->
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ <execution>
+ <goals>
+ <goal>merge</goal>
+ </goals>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <fileSets>
+ <fileSet
+ implementation="org.apache.maven.shared.model.fileset.FileSet">
+ <directory>${project.build.directory}/coverage-reports</directory>
+ <includes>
+ <include>*.exec</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <destFile>${project.build.directory}/jacoco.exec</destFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>report-xml</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <!-- Setting explicit path, so that we remember where it picks them up from -->
+ <dataFile>${project.build.directory}/jacoco.exec</dataFile>
+ <outputDirectory>${project.build.directory}/jacoco-html-xml-reports</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <!-- This plugin will be useful when we will have multi-modules project -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>versions-maven-plugin</artifactId>
- <version>1.3.1</version>
- </plugin>
+ <!-- This plugin will be useful when we will have multi-modules project -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>versions-maven-plugin</artifactId>
+ <version>1.3.1</version>
+ </plugin>
- <plugin>
- <groupId>com.github.eirslett</groupId>
- <artifactId>frontend-maven-plugin</artifactId>
- <version>1.8.0</version>
- <configuration>
- <installDirectory>${project.build.directory}/${ui.react.src}</installDirectory>
- </configuration>
- <executions>
- <execution>
- <id>install_node_and_npm</id>
- <goals>
- <goal>install-node-and-npm</goal>
- </goals>
- <phase>generate-sources</phase>
- <configuration>
- <nodeVersion>v12.13.0</nodeVersion>
- <npmVersion>6.13.0</npmVersion>
- </configuration>
- </execution>
- <execution>
- <id>npm_install</id>
- <goals>
- <goal>npm</goal>
- </goals>
- <phase>compile</phase>
- <configuration>
- <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
- <arguments>install</arguments>
- </configuration>
- </execution>
- <execution>
- <id>npm_test</id>
- <goals>
- <goal>npm</goal>
- </goals>
- <phase>test</phase>
- <configuration>
- <skip>${maven.test.skip}</skip>
- <arguments>run-script test:coverage</arguments>
- <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
- </configuration>
- </execution>
- <execution>
- <id>npm_install_lib</id>
- <goals>
- <goal>npm</goal>
- </goals>
- <phase>deploy</phase>
- <configuration>
- <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
- <arguments>install</arguments>
- </configuration>
- </execution>
- <execution>
- <id>npm_build_lib</id>
- <goals>
- <goal>npm</goal>
- </goals>
- <phase>deploy</phase>
- <configuration>
- <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
- <arguments>run build</arguments>
- </configuration>
- </execution>
- <execution>
- <id>npm_publish</id>
- <goals>
- <goal>npm</goal>
- </goals>
- <phase>deploy</phase>
- <configuration>
- <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
- <arguments>publish</arguments>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.1</version>
- <configuration>
- <source>11</source>
- <target>11</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.sonarsource.scanner.maven</groupId>
- <artifactId>sonar-maven-plugin</artifactId>
- <version>3.7.0.1746</version>
- </plugin>
+ <plugin>
+ <groupId>com.github.eirslett</groupId>
+ <artifactId>frontend-maven-plugin</artifactId>
+ <version>1.8.0</version>
+ <configuration>
+ <installDirectory>${project.build.directory}/${ui.react.src}</installDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>install_node_and_npm</id>
+ <goals>
+ <goal>install-node-and-npm</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ <configuration>
+ <nodeVersion>v12.13.0</nodeVersion>
+ <npmVersion>6.13.0</npmVersion>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_install</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>compile</phase>
+ <configuration>
+ <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
+ <arguments>install</arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_test</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>test</phase>
+ <configuration>
+ <skip>${maven.test.skip}</skip>
+ <arguments>run-script test:coverage</arguments>
+ <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_install_lib</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
+ <arguments>install</arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_build_lib</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
+ <arguments>run build</arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_publish</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
+ <arguments>publish</arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>11</source>
+ <target>11</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.sonarsource.scanner.maven</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
+ <version>3.7.0.1746</version>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>1.3.2</version>
- <executions>
+ <version>1.3.2</version>
+ <executions>
<execution>
<id>libIndexCheck</id>
<phase>validate</phase>
@@ -1246,7 +1265,7 @@
<argument>${project.basedir}/src/main/script/checkLibIndex.sh</argument>
</arguments>
</configuration>
- </plugin>
- </plugins>
- </build>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/src/main/docker/frontend/nginx/default.conf b/src/main/docker/frontend/nginx/default.conf
index b15429c74..570806034 100644
--- a/src/main/docker/frontend/nginx/default.conf
+++ b/src/main/docker/frontend/nginx/default.conf
@@ -6,7 +6,7 @@ server {
ssl_certificate_key /etc/ssl/clamp.key;
ssl_verify_client optional_no_ca;
location /restservices/clds/ {
- proxy_pass https://clamp-backend:8443;
+ proxy_pass https://policy-clamp-backend:8443;
proxy_set_header X-SSL-Cert $ssl_client_escaped_cert;
}
diff --git a/src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java b/src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java
index bc6a68286..46c55ea45 100644
--- a/src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java
+++ b/src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -39,7 +39,8 @@ import org.onap.policy.clamp.clds.sdc.controller.installer.BlueprintMicroService
import org.onap.policy.clamp.clds.util.JsonUtils;
import org.onap.policy.clamp.loop.template.PolicyModel;
import org.onap.policy.clamp.loop.template.PolicyModelsService;
-import org.onap.policy.clamp.policy.pdpgroup.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.DumperOptions;
@@ -50,6 +51,8 @@ import org.yaml.snakeyaml.Yaml;
* The class implements the communication with the Policy Engine to retrieve
* policy models (tosca). It mainly delegates the physical calls to Camel
* engine.
+ * It supports a retry mechanism for these calls, configurations can be specified in the
+ * application.properties "policy.retry.interval"(default 0) and "policy.retry.limit"(default 1).
*/
@Component
public class PolicyEngineServices {
@@ -192,18 +195,7 @@ public class PolicyEngineServices {
return;
}
- JsonObject jsonObj = JsonUtils.GSON.fromJson(responseBody, JsonObject.class);
-
- List<PdpGroup> pdpGroupList = new LinkedList<>();
- JsonArray itemsArray = (JsonArray) jsonObj.get("groups");
-
- for (com.google.gson.JsonElement jsonElement : itemsArray) {
- JsonObject item = (JsonObject) jsonElement;
- PdpGroup pdpGroup = JsonUtils.GSON.fromJson(item.toString(), PdpGroup.class);
- pdpGroupList.add(pdpGroup);
- }
-
- policyModelsService.updatePdpGroupInfo(pdpGroupList);
+ policyModelsService.updatePdpGroupInfo(JsonUtils.GSON.fromJson(responseBody, PdpGroups.class));
}
private String callCamelRoute(Exchange exchange, String camelFlow, String logMsg) {
diff --git a/src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java b/src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java
index 8670ab73e..f0830360e 100644
--- a/src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java
+++ b/src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,13 +30,18 @@ import java.util.Collections;
import java.util.List;
import org.onap.policy.clamp.clds.tosca.ToscaSchemaConstants;
import org.onap.policy.clamp.clds.tosca.ToscaYamlToJsonConvertor;
-import org.onap.policy.clamp.policy.pdpgroup.PdpGroup;
+import org.onap.policy.clamp.policy.pdpgroup.PdpGroupsAnalyzer;
import org.onap.policy.clamp.util.SemanticVersioning;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
+/**
+ * This class contains the methods to access the policyModel object in db.
+ */
@Service
public class PolicyModelsService {
private final PolicyModelsRepository policyModelsRepository;
@@ -44,7 +49,7 @@ public class PolicyModelsService {
@Autowired
public PolicyModelsService(PolicyModelsRepository policyModelrepo,
- ToscaYamlToJsonConvertor convertor) {
+ ToscaYamlToJsonConvertor convertor) {
policyModelsRepository = policyModelrepo;
toscaYamlToJsonConvertor = convertor;
}
@@ -78,31 +83,31 @@ public class PolicyModelsService {
public PolicyModel createNewPolicyModelFromTosca(String policyModelTosca) {
JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(policyModelTosca);
String policyModelTypeFromTosca = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
- ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE);
+ ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE);
Iterable<PolicyModel> models = getAllPolicyModelsByType(policyModelTypeFromTosca);
Collections.sort((List<PolicyModel>) models);
PolicyModel newPolicyModel = new PolicyModel(policyModelTypeFromTosca, policyModelTosca,
- SemanticVersioning.incrementMajorVersion(((ArrayList) models).isEmpty() ? null
- : ((ArrayList<PolicyModel>) models).get(0).getVersion()),
- toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
- ToscaSchemaConstants.METADATA_ACRONYM));
+ SemanticVersioning.incrementMajorVersion(((ArrayList) models).isEmpty() ? null
+ : ((ArrayList<PolicyModel>) models).get(0).getVersion()),
+ toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
+ ToscaSchemaConstants.METADATA_ACRONYM));
return saveOrUpdatePolicyModel(newPolicyModel);
}
/**
* Update an existing Tosca Policy Model.
*
- * @param policyModelType The policy Model type in Tosca yaml
+ * @param policyModelType The policy Model type in Tosca yaml
* @param policyModelVersion The policy Version to update
- * @param policyModelTosca The Policy Model tosca
+ * @param policyModelTosca The Policy Model tosca
* @return The Policy Model updated
*/
public PolicyModel updatePolicyModelTosca(String policyModelType, String policyModelVersion,
- String policyModelTosca) {
+ String policyModelTosca) {
JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(policyModelTosca);
PolicyModel thePolicyModel = getPolicyModel(policyModelType, policyModelVersion);
thePolicyModel.setPolicyAcronym(toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
- ToscaSchemaConstants.METADATA_ACRONYM));
+ ToscaSchemaConstants.METADATA_ACRONYM));
thePolicyModel.setPolicyModelTosca(policyModelTosca);
return saveOrUpdatePolicyModel(thePolicyModel);
}
@@ -126,13 +131,13 @@ public class PolicyModelsService {
/**
* Retrieves the Tosca model Yaml string.
*
- * @param type The Policy Model Type
+ * @param type The Policy Model Type
* @param version The policy model version
* @return The Tosca model Yaml string
*/
public String getPolicyModelTosca(String type, String version) {
return policyModelsRepository.findById(new PolicyModelId(type, version))
- .orElse(new PolicyModel()).getPolicyModelTosca();
+ .orElse(new PolicyModel()).getPolicyModelTosca();
}
/**
@@ -148,26 +153,11 @@ public class PolicyModelsService {
/**
* Update the Pdp Group info in Policy Model DB.
*
- * @param pdpGroupList The list of Pdp Group info received from Policy Engine
+ * @param pdpGroups The list of Pdp Group info received from Policy Engine
*/
- public void updatePdpGroupInfo(List<PdpGroup> pdpGroupList) {
- List<PolicyModel> policyModelList = policyModelsRepository.findAll();
- for (PolicyModel policyModel : policyModelList) {
- JsonArray supportedPdpGroups = new JsonArray();
- for (PdpGroup pdpGroup : pdpGroupList) {
- JsonObject supportedPdpGroup = pdpGroup.getSupportedSubgroups(
- policyModel.getPolicyModelType(), policyModel.getVersion());
- if (supportedPdpGroup != null) {
- supportedPdpGroups.add(supportedPdpGroup);
- }
- }
-
- if (supportedPdpGroups.size() > 0) {
- JsonObject supportedPdpJson = new JsonObject();
- supportedPdpJson.add("supportedPdpGroups", supportedPdpGroups);
- policyModel.setPolicyPdpGroup(supportedPdpJson);
- policyModelsRepository.saveAndFlush(policyModel);
- }
- }
+ public void updatePdpGroupInfo(PdpGroups pdpGroups) {
+ List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
+ PdpGroupsAnalyzer.updatePdpGroup(policyModelsList, pdpGroups);
+ this.policyModelsRepository.saveAll(policyModelsList);
}
}
diff --git a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroup.java b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroup.java
deleted file mode 100644
index 9cbeec109..000000000
--- a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroup.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * 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.policy.clamp.policy.pdpgroup;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.annotations.Expose;
-import java.util.List;
-
-/**
- * This class maps the get Pdp Group response to a nice pojo.
- */
-public class PdpGroup {
-
- @Expose
- private String name;
-
- @Expose
- private String pdpGroupState;
-
- @Expose
- private List<PdpSubgroup> pdpSubgroups;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getPdpGroupState() {
- return pdpGroupState;
- }
-
- public void setPdpGroupState(String pdpGroupState) {
- this.pdpGroupState = pdpGroupState;
- }
-
- public List<PdpSubgroup> getPdpSubgroups() {
- return pdpSubgroups;
- }
-
- public void setPdpSubgroups(List<PdpSubgroup> pdpSubgroups) {
- this.pdpSubgroups = pdpSubgroups;
- }
-
- /**
- * Get supported subGroups based on the defined policy type and version.
- * @param policyType The policy type
- * @param version The version
- * @return The supported subGroup list in Json format
- */
- public JsonObject getSupportedSubgroups(String policyType, String version) {
- if (!pdpGroupState.equalsIgnoreCase("ACTIVE")) {
- return null;
- }
- JsonArray supportedSubgroups = new JsonArray();
- for (PdpSubgroup subGroup : pdpSubgroups) {
- if (subGroup.getSupportedPolicyTypes().contains(new PolicyModelKey(policyType, version))) {
- supportedSubgroups.add(subGroup.getPdpType());
- }
- }
- if (supportedSubgroups.size() > 0) {
- JsonObject supportedPdpGroup = new JsonObject();
- supportedPdpGroup.add(this.name, supportedSubgroups);
- return supportedPdpGroup;
- }
- return null;
- }
-}
diff --git a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java
new file mode 100644
index 000000000..51cdb149e
--- /dev/null
+++ b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2021 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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.policy.clamp.policy.pdpgroup;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.onap.policy.clamp.loop.template.PolicyModel;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
+import org.onap.policy.models.pdp.concepts.PdpSubGroup;
+import org.onap.policy.models.pdp.enums.PdpState;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.sdc.toscaparser.api.elements.PolicyType;
+
+/**
+ * This is an utility class to do searching in pdp groups.
+ */
+public class PdpGroupsAnalyzer {
+ /**
+ * Get supported subGroups based on the defined policy type and version for s specific PDPgroup.
+ * It returns null if the Group is not ACTIVE or if the policytype/version has not been found in the PDPSubgroups.
+ *
+ * @param pdpGroup The pdpGroup that must be analyzed
+ * @param policyType The policy type
+ * @param version The version
+ * @return The supported subGroups list in Json format
+ * @see org.onap.policy.models.pdp.concepts.PdpGroup
+ * @see org.onap.policy.models.pdp.enums.PdpState
+ */
+ private static JsonObject getSupportedSubgroups(PdpGroup pdpGroup, String policyType, String version) {
+ if (!PdpState.ACTIVE.equals(pdpGroup.getPdpGroupState())) {
+ return null;
+ }
+ JsonObject supportedPdpGroup = new JsonObject();
+ JsonArray supportedSubgroups = new JsonArray();
+ supportedPdpGroup.add(pdpGroup.getName(), supportedSubgroups);
+ pdpGroup.getPdpSubgroups().stream().forEach(pdpSubGroup -> {
+ if (pdpSubGroup.getSupportedPolicyTypes().stream().anyMatch(policyTypeIdentifier ->
+ policyType.matches(policyTypeIdentifier.getName().replace(".", "\\.").replace("*", ".*"))
+ && version.equals(policyTypeIdentifier.getVersion()))) {
+ supportedSubgroups.add(pdpSubGroup.getPdpType());
+ }
+ });
+ if (supportedSubgroups.size() == 0) {
+ return null;
+ }
+ return supportedPdpGroup;
+ }
+
+ /**
+ * This method updates each element in the policyModelsList given in argument based on the pdpGroups given.
+ *
+ * @param policyModelsList The list of Policy Models where each PolicyModel will be updated
+ * @param pdpGroups The PdpGroups containing all PDP group definition
+ */
+ public static void updatePdpGroup(List<PolicyModel> policyModelsList, PdpGroups pdpGroups) {
+ policyModelsList.parallelStream().forEach(policyModel -> {
+ JsonObject jsonResult = new JsonObject();
+ JsonArray supportedPdpGroups = new JsonArray();
+ jsonResult.add("supportedPdpGroups", supportedPdpGroups);
+ policyModel.setPolicyPdpGroup(jsonResult);
+ pdpGroups.getGroups().stream().map(pdpGroup -> PdpGroupsAnalyzer.getSupportedSubgroups(pdpGroup,
+ policyModel.getPolicyModelType(), policyModel.getVersion())).filter(Objects::nonNull)
+ .forEach(jsonPdpGroup -> supportedPdpGroups.add(jsonPdpGroup));
+ if (supportedPdpGroups.size() == 0) {
+ policyModel.setPolicyPdpGroup(null);
+ }
+ });
+ }
+} \ No newline at end of file
diff --git a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpSubgroup.java b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpSubgroup.java
deleted file mode 100644
index 890f90775..000000000
--- a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpSubgroup.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * 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.policy.clamp.policy.pdpgroup;
-
-import com.google.gson.annotations.Expose;
-import java.util.List;
-
-/**
- * This class maps the Policy get PDP Group response to a nice pojo.
- */
-public class PdpSubgroup {
-
- @Expose
- private String pdpType;
-
- @Expose
- private List<PolicyModelKey> supportedPolicyTypes;
-
- public String getPdpType() {
- return pdpType;
- }
-
- public void setPdpType(String pdpType) {
- this.pdpType = pdpType;
- }
-
- public List<PolicyModelKey> getSupportedPolicyTypes() {
- return supportedPolicyTypes;
- }
-
- public void setSupportedPolicyTypes(List<PolicyModelKey> supportedPolicyTypes) {
- this.supportedPolicyTypes = supportedPolicyTypes;
- }
-
-}
diff --git a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKey.java b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKey.java
deleted file mode 100644
index df92bfdf9..000000000
--- a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKey.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * 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.policy.clamp.policy.pdpgroup;
-
-import com.google.gson.annotations.Expose;
-import java.io.Serializable;
-
-public class PolicyModelKey implements Serializable {
-
- /**
- * The serial version ID.
- */
- private static final long serialVersionUID = 3307410842013230886L;
-
- @Expose
- private String name;
-
- @Expose
- private String version;
-
- /**
- * Constructor.
- */
- public PolicyModelKey(String name, String version) {
- this.name = name;
- this.version = version;
- }
-
- /**
- * name getter.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * name setter.
- *
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * version getter.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * version setter.
- *
- * @param version the version to set
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((version == null) ? 0 : version.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- PolicyModelKey other = (PolicyModelKey) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- if (!name.matches(other.name)) {
- return false;
- }
- }
- if (version == null) {
- if (other.version != null) {
- return false;
- }
- } else if (!version.equals(other.version)) {
- return false;
- }
- return true;
- }
-}
diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml
index 0ee386eb4..4d1eba614 100644
--- a/src/main/resources/clds/camel/routes/policy-flows.xml
+++ b/src/main/resources/clds/camel/routes/policy-flows.xml
@@ -109,7 +109,7 @@
<log loggingLevel="INFO"
message="Endpoint to get policy deployment status: {{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0"></log>
<toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<doCatch>
<exception>java.lang.Exception</exception>
<handled>
@@ -427,7 +427,41 @@
<log loggingLevel="INFO"
message="Endpoint to get policy model: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps"></log>
<toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <convertBodyTo type="java.lang.String"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="get-all-policies">
+ <from uri="direct:get-all-policies"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting the policies list"/>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policies list')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get policies list: {{clamp.config.policy.api.url}}/policy/api/v1/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
diff --git a/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java
index e7df80cd8..a98291be0 100644
--- a/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java
+++ b/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -43,9 +43,11 @@ import org.onap.policy.clamp.loop.template.PolicyModel;
import org.onap.policy.clamp.loop.template.PolicyModelId;
import org.onap.policy.clamp.loop.template.PolicyModelsRepository;
import org.onap.policy.clamp.loop.template.PolicyModelsService;
-import org.onap.policy.clamp.policy.pdpgroup.PdpGroup;
-import org.onap.policy.clamp.policy.pdpgroup.PdpSubgroup;
-import org.onap.policy.clamp.policy.pdpgroup.PolicyModelKey;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
+import org.onap.policy.models.pdp.concepts.PdpSubGroup;
+import org.onap.policy.models.pdp.enums.PdpState;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@@ -242,54 +244,54 @@ public class PolicyModelServiceItCase {
@Test
@Transactional
public void shouldAddPdpGroupInfo() {
- PolicyModel policyModel1 = getPolicyModel(POLICY_MODEL_TYPE_1, "yaml",
- POLICY_MODEL_TYPE_1_VERSION_1, "TEST", "VARIANT", "user");
- policyModelsService.saveOrUpdatePolicyModel(policyModel1);
- PolicyModel policyModel2 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
- policyModelsService.saveOrUpdatePolicyModel(policyModel2);
- PolicyModel policyModel3 = getPolicyModel(POLICY_MODEL_TYPE_3, "yaml",
- POLICY_MODEL_TYPE_3_VERSION_1, "TEST", "VARIANT", "user");
- policyModelsService.saveOrUpdatePolicyModel(policyModel3);
+ policyModelsService.saveOrUpdatePolicyModel(getPolicyModel(POLICY_MODEL_TYPE_1, "yaml",
+ POLICY_MODEL_TYPE_1_VERSION_1, "TEST", "VARIANT", "user"));
+ policyModelsService.saveOrUpdatePolicyModel(getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
+ POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user"));
+ policyModelsService.saveOrUpdatePolicyModel(getPolicyModel(POLICY_MODEL_TYPE_3, "yaml",
+ POLICY_MODEL_TYPE_3_VERSION_1, "TEST", "VARIANT", "user"));
- PolicyModelKey type1 = new PolicyModelKey("org.onap.testos", "1.0.0");
- PolicyModelKey type2 = new PolicyModelKey("org.onap.testos2", "2.0.0");
+ ToscaPolicyTypeIdentifier type1 = new ToscaPolicyTypeIdentifier("org.onap.testos", "1.0.0");
+ ToscaPolicyTypeIdentifier type2 = new ToscaPolicyTypeIdentifier("org.onap.testos2", "2.0.0");
- PdpSubgroup pdpSubgroup1 = new PdpSubgroup();
+ PdpSubGroup pdpSubgroup1 = new PdpSubGroup();
pdpSubgroup1.setPdpType("subGroup1");
- List<PolicyModelKey> pdpTypeList = new LinkedList<PolicyModelKey>();
+ List<ToscaPolicyTypeIdentifier> pdpTypeList = new LinkedList<>();
pdpTypeList.add(type1);
pdpTypeList.add(type2);
pdpSubgroup1.setSupportedPolicyTypes(pdpTypeList);
- PolicyModelKey type3 = new PolicyModelKey("org.onap.testos3", "2.0.0");
- PdpSubgroup pdpSubgroup2 = new PdpSubgroup();
+ ToscaPolicyTypeIdentifier type3 = new ToscaPolicyTypeIdentifier("org.onap.testos3", "2.0.0");
+ PdpSubGroup pdpSubgroup2 = new PdpSubGroup();
pdpSubgroup2.setPdpType("subGroup2");
- List<PolicyModelKey> pdpTypeList2 = new LinkedList<PolicyModelKey>();
+ List<ToscaPolicyTypeIdentifier> pdpTypeList2 = new LinkedList<>();
pdpTypeList2.add(type2);
pdpTypeList2.add(type3);
pdpSubgroup2.setSupportedPolicyTypes(pdpTypeList2);
- List<PdpSubgroup> pdpSubgroupList = new LinkedList<PdpSubgroup>();
+ List<PdpSubGroup> pdpSubgroupList = new LinkedList<>();
pdpSubgroupList.add(pdpSubgroup1);
PdpGroup pdpGroup1 = new PdpGroup();
pdpGroup1.setName("pdpGroup1");
- pdpGroup1.setPdpGroupState("ACTIVE");
+ pdpGroup1.setPdpGroupState(PdpState.ACTIVE);
pdpGroup1.setPdpSubgroups(pdpSubgroupList);
- List<PdpSubgroup> pdpSubgroupList2 = new LinkedList<PdpSubgroup>();
+ List<PdpSubGroup> pdpSubgroupList2 = new LinkedList<>();
pdpSubgroupList2.add(pdpSubgroup1);
pdpSubgroupList2.add(pdpSubgroup2);
PdpGroup pdpGroup2 = new PdpGroup();
pdpGroup2.setName("pdpGroup2");
- pdpGroup2.setPdpGroupState("ACTIVE");
+ pdpGroup2.setPdpGroupState(PdpState.ACTIVE);
pdpGroup2.setPdpSubgroups(pdpSubgroupList2);
- List<PdpGroup> pdpGroupList = new LinkedList<PdpGroup>();
- pdpGroupList.add(pdpGroup1);
- pdpGroupList.add(pdpGroup2);
- policyModelsService.updatePdpGroupInfo(pdpGroupList);
+ List<PdpGroup> pdpGroupsList = new LinkedList<>();
+ pdpGroupsList.add(pdpGroup1);
+ pdpGroupsList.add(pdpGroup2);
+
+ PdpGroups pdpGroups = new PdpGroups();
+ pdpGroups.setGroups(pdpGroupsList);
+ policyModelsService.updatePdpGroupInfo(pdpGroups);
JsonObject res1 =
policyModelsService.getPolicyModel("org.onap.testos", "1.0.0").getPolicyPdpGroup();
diff --git a/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupAnalyzerTest.java b/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupAnalyzerTest.java
new file mode 100644
index 000000000..1af048da5
--- /dev/null
+++ b/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupAnalyzerTest.java
@@ -0,0 +1,130 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2021 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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.policy.clamp.policy.pdpgroup;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import javax.transaction.Transactional;
+import org.junit.Test;
+import org.onap.policy.clamp.clds.util.JsonUtils;
+import org.onap.policy.clamp.loop.template.PolicyModel;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
+import org.onap.policy.models.pdp.concepts.PdpSubGroup;
+import org.onap.policy.models.pdp.enums.PdpState;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+
+/**
+ * This test class validates the PdpGroupAnalyzer class.
+ */
+public class PdpGroupAnalyzerTest {
+
+ private PolicyModel createPolicyModel(String policyType, String policyModelTosca, String version,
+ String policyAcronym, String policyVariant, String createdBy) {
+ PolicyModel policyModel = new PolicyModel();
+ policyModel.setCreatedBy(createdBy);
+ policyModel.setPolicyAcronym(policyAcronym);
+ policyModel.setPolicyModelTosca(policyModelTosca);
+ policyModel.setPolicyModelType(policyType);
+ policyModel.setUpdatedBy(createdBy);
+ policyModel.setVersion(version);
+ return policyModel;
+ }
+
+ /**
+ * This tests the pdpgroup GSON encode/decode and saving.
+ */
+ @Test
+ @Transactional
+ public void testUpdatePdpGroup() {
+ // Create policyModel
+ PolicyModel policyModel = new PolicyModel();
+ policyModel.setCreatedBy("user");
+ policyModel.setPolicyAcronym("TEST");
+ policyModel.setPolicyModelTosca("yaml");
+ policyModel.setPolicyModelType("org.onap.test");
+ policyModel.setUpdatedBy("user");
+ policyModel.setVersion("1.0.0");
+
+ // Create Pdp Groups
+ // Those that do not work first
+ PdpSubGroup pdpSubgroupBad = new PdpSubGroup();
+ pdpSubgroupBad.setPdpType("subGroupBad");
+ pdpSubgroupBad.setSupportedPolicyTypes(Arrays.asList(new ToscaPolicyTypeIdentifier("org.onap.test", "2.0.0"),
+ new ToscaPolicyTypeIdentifier("org.onap.test.*", "1.0.0"),
+ new ToscaPolicyTypeIdentifier("org.onip.testos", "1.0.0"),
+ new ToscaPolicyTypeIdentifier("org.onap.testos3", "2.0.0"),
+ new ToscaPolicyTypeIdentifier("org.onap.tes", "1.0.0"),
+ new ToscaPolicyTypeIdentifier("org.onap", "1.0.0")
+ ));
+
+
+ PdpSubGroup pdpSubgroup1 = new PdpSubGroup();
+ pdpSubgroup1.setPdpType("subGroup1");
+ pdpSubgroup1.setSupportedPolicyTypes(
+ Arrays.asList(new ToscaPolicyTypeIdentifier("org.onap.*", "1.0.0")));
+
+ PdpSubGroup pdpSubgroup2 = new PdpSubGroup();
+ pdpSubgroup2.setPdpType("subGroup2");
+ pdpSubgroup2.setSupportedPolicyTypes(Arrays.asList(new ToscaPolicyTypeIdentifier("org.onap.test", "1.0.0")));
+
+ PdpSubGroup pdpSubgroup3 = new PdpSubGroup();
+ pdpSubgroup3.setPdpType("subGroup3");
+ pdpSubgroup3.setSupportedPolicyTypes(Arrays.asList(new ToscaPolicyTypeIdentifier("org.onap.test*", "1.0.0")));
+
+
+ PdpGroup pdpGroup1 = new PdpGroup();
+ pdpGroup1.setName("pdpGroup1");
+ pdpGroup1.setPdpGroupState(PdpState.ACTIVE);
+ pdpGroup1.setPdpSubgroups(Arrays.asList(pdpSubgroup1, pdpSubgroupBad));
+
+ PdpGroup pdpGroup2 = new PdpGroup();
+ pdpGroup2.setName("pdpGroup2");
+ pdpGroup2.setPdpGroupState(PdpState.ACTIVE);
+ pdpGroup2.setPdpSubgroups(Arrays.asList(pdpSubgroup1, pdpSubgroup2, pdpSubgroup3, pdpSubgroupBad));
+
+ PdpGroup pdpGroup3 = new PdpGroup();
+ pdpGroup3.setName("pdpGroup3");
+ pdpGroup3.setPdpGroupState(PdpState.ACTIVE);
+ pdpGroup3.setPdpSubgroups(Arrays.asList(pdpSubgroupBad));
+
+ PdpGroup pdpGroup4 = new PdpGroup();
+ pdpGroup4.setName("pdpGroup4");
+ pdpGroup4.setPdpGroupState(PdpState.PASSIVE);
+ pdpGroup4.setPdpSubgroups(Arrays.asList(pdpSubgroup1));
+
+ PdpGroups pdpGroups = new PdpGroups();
+ pdpGroups.setGroups(Arrays.asList(pdpGroup1, pdpGroup2, pdpGroup3, pdpGroup4));
+ PdpGroupsAnalyzer.updatePdpGroup(Arrays.asList(policyModel), pdpGroups);
+
+ assertThat(policyModel.getPolicyPdpGroup().toString()).isEqualTo(
+ "{\"supportedPdpGroups\":[{\"pdpGroup1\":[\"subGroup1\"]},"
+ + "{\"pdpGroup2\":[\"subGroup1\",\"subGroup2\",\"subGroup3\"]}]}");
+ }
+}
diff --git a/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupTest.java b/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupTest.java
deleted file mode 100644
index 699693de0..000000000
--- a/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * 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.policy.clamp.policy.pdpgroup;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import org.junit.Test;
-
-public class PdpGroupTest {
-
-
- @Test
- public void testGetSupportedSubgroups() throws IOException {
- PdpGroup pdpGroup1 = new PdpGroup();
- pdpGroup1.setName("pdpGroup1");
- pdpGroup1.setPdpGroupState("INACTIVE");
- assertThat(pdpGroup1.getSupportedSubgroups("test", "1.0.0")).isNull();
-
- PdpGroup pdpGroup2 = new PdpGroup();
- pdpGroup2.setName("pdpGroup2");
- pdpGroup2.setPdpGroupState("ACTIVE");
-
- PolicyModelKey type1 = new PolicyModelKey("type1", "1.0.0");
- PolicyModelKey type2 = new PolicyModelKey("type2", "2.0.0");
-
- PdpSubgroup pdpSubgroup1 = new PdpSubgroup();
- pdpSubgroup1.setPdpType("subGroup1");
- List<PolicyModelKey> pdpTypeList = new LinkedList<PolicyModelKey>();
- pdpTypeList.add(type1);
- pdpTypeList.add(type2);
- pdpSubgroup1.setSupportedPolicyTypes(pdpTypeList);
-
- PolicyModelKey type3 = new PolicyModelKey("type3", "1.0.0");
- PdpSubgroup pdpSubgroup2 = new PdpSubgroup();
- pdpSubgroup2.setPdpType("subGroup2");
- List<PolicyModelKey> pdpTypeList2 = new LinkedList<PolicyModelKey>();
- pdpTypeList2.add(type2);
- pdpTypeList2.add(type3);
- pdpSubgroup2.setSupportedPolicyTypes(pdpTypeList2);
-
- List<PdpSubgroup> pdpSubgroupList = new LinkedList<PdpSubgroup>();
- pdpSubgroupList.add(pdpSubgroup1);
- pdpSubgroupList.add(pdpSubgroup2);
- pdpGroup2.setPdpSubgroups(pdpSubgroupList);
-
- JsonObject res1 = pdpGroup2.getSupportedSubgroups("type2", "2.0.0");
- assertThat(res1.get("pdpGroup2")).isNotNull();
- JsonArray resSubList = res1.getAsJsonArray("pdpGroup2");
- assertThat(resSubList.size()).isEqualTo(2);
- assertThat(resSubList.toString().contains("subGroup1")).isTrue();
- assertThat(resSubList.toString().contains("subGroup2")).isTrue();
-
- JsonObject res2 = pdpGroup2.getSupportedSubgroups("type1", "1.0.0");
- assertThat(res2.get("pdpGroup2")).isNotNull();
- JsonArray resSubList2 = res2.getAsJsonArray("pdpGroup2");
- assertThat(resSubList2.size()).isEqualTo(1);
-
- assertThat(pdpGroup2.getSupportedSubgroups("type3", "1.0.1")).isNull();
- }
-}
diff --git a/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKeyTest.java b/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKeyTest.java
deleted file mode 100644
index d4cf27392..000000000
--- a/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKeyTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * 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.policy.clamp.policy.pdpgroup;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.IOException;
-import org.junit.Test;
-
-public class PolicyModelKeyTest {
-
- @Test
- public void testEqualsMethod() throws IOException {
- PolicyModelKey key1 = new PolicyModelKey("name1", "1.0.0");
- PolicyModelKey key2 = new PolicyModelKey(null, "1.0.0");
- PolicyModelKey key3 = new PolicyModelKey("name1", null);
-
- assertThat(key1.equals(null)).isFalse();
- assertThat(key1.equals("key2")).isFalse();
-
- assertThat(key2.equals(key1)).isFalse();
- assertThat(key3.equals(key1)).isFalse();
-
- PolicyModelKey key4 = new PolicyModelKey("name2", "1.0.0");
- PolicyModelKey key5 = new PolicyModelKey("name1", "2.0.0");
- assertThat(key1.equals(key4)).isFalse();
- assertThat(key1.equals(key5)).isFalse();
-
- PolicyModelKey key6 = new PolicyModelKey("name(.*)", "1.0.0");
- PolicyModelKey key7 = new PolicyModelKey("name1", "1.0.0");
- assertThat(key1.equals(key6)).isTrue();
- assertThat(key1.equals(key7)).isTrue();
- }
-}
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policies/.file b/src/test/resources/http-cache/example/policy/api/v1/policies/.file
index 431de3e7c..91c3c87de 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policies/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policies/.file
@@ -19,7 +19,7 @@
"thresholdValue": 200,
"closedLoopEventStatus": "ONSET",
"closedLoopControlName": "LOOP_test",
- "direction": "LESS_OR_ElsQUAL",
+ "direction": "LESS_OR_EQUAL",
"fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta"
}
],