summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml379
-rw-r--r--rulemgt-frontend/pom.xml6
-rw-r--r--rulemgt-standalone/linux64-assembly.xml7
-rw-r--r--rulemgt-standalone/pom.xml158
-rw-r--r--rulemgt-standalone/src/main/assembly/Dockerfile78
-rw-r--r--rulemgt-standalone/src/main/assembly/bin/run.sh20
-rw-r--r--rulemgt-standalone/src/main/assembly/nginx-http.conf4
-rw-r--r--rulemgt-standalone/src/main/assembly/nginx-https.conf4
-rw-r--r--rulemgt/pom.xml330
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java11
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/msb/EngineInsQueryTool.java34
-rw-r--r--rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleActiveAppTest.java13
-rw-r--r--rulemgt/src/test/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java23
-rw-r--r--rulemgt/src/test/java/org/onap/holmes/rulemgt/send/RuleAllocatorTest.java7
-rw-r--r--rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java23
16 files changed, 399 insertions, 700 deletions
diff --git a/pom.xml b/pom.xml
index 8e3537a..07b5f60 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2017 ZTE Corporation.
+ ~ Copyright 2017-2020 ZTE Corporation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
- <version>2.1.0</version>
+ <version>3.0.0</version>
</parent>
<groupId>org.onap.holmes.rule-management</groupId>
@@ -34,135 +34,286 @@
</modules>
<properties>
+ <packagename>onap-holmes-rulemgt</packagename>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.test.skip>false</maven.test.skip>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
- <finalName>${project.artifactId}-${project.version}</finalName>
+
<release.dir>${basedir}/target</release.dir>
<bundle.name>${project.artifactId}-${project.version}</bundle.name>
- <pkgzip.dir>${basedir}/../release/pkgzip</pkgzip.dir>
- <excludesFile>**/*$*</excludesFile>
- <nexusproxy>https://nexus.open-o.org/content</nexusproxy>
- <powermock.version>1.6.5</powermock.version>
-
- <stringtemplate.version>3.2.1</stringtemplate.version>
- <dropwizard.version>1.3.9</dropwizard.version>
- <reflections.version>0.9.9</reflections.version>
- <swagger.version>1.5.3</swagger.version>
- <lombok.version>1.16.8</lombok.version>
- <jersey.version>2.22.2</jersey.version>
- <jaxrs.consumer.version>5.0</jaxrs.consumer.version>
+ <powermock.version>2.0.7</powermock.version>
+ <dropwizard.version>2.0.9</dropwizard.version>
+ <jersey.version>2.30.1</jersey.version>
+ <jacoco.version>0.8.5</jacoco.version>
<slf4j.version>1.7.25</slf4j.version>
- <postgres.jdbc.driver.version>42.2.5</postgres.jdbc.driver.version>
-
- <packagename>onap-holmes-rulemgt</packagename>
<linux64id>linux64</linux64id>
- <win64id>win64</win64id>
<linux64outputdir>target/assembly/${linux64id}</linux64outputdir>
- <win64outputdir>target/assembly/${win64id}</win64outputdir>
<version.output>target/version</version.output>
- <jacoco.version>0.8.5</jacoco.version>
<sonar.coverage.jacoco.xmlReportPaths>
${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
</properties>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.msb.java-sdk</groupId>
- <artifactId>msb-java-sdk</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.reflections</groupId>
- <artifactId>reflections</artifactId>
- <version>${reflections.version}</version>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>3.0</version>
- </dependency>
- <dependency>
- <groupId>org.onap.holmes.common</groupId>
- <artifactId>holmes-actions</artifactId>
- <version>1.2.13</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-core</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-db</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-jdbi</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>${swagger.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>${lombok.version}</version>
- </dependency>
-
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>${postgres.jdbc.driver.version}</version>
- </dependency>
-
-
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>stringtemplate</artifactId>
- <version>${stringtemplate.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.2</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- <version>1.3</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <version>1.6.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.msb.java-sdk</groupId>
+ <artifactId>msb-java-sdk</artifactId>
+ <version>1.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <version>0.9.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.holmes.common</groupId>
+ <artifactId>holmes-actions</artifactId>
+ <version>1.2.13</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ <version>${dropwizard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-db</artifactId>
+ <version>${dropwizard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-jdbi</artifactId>
+ <version>2.0.0-rc9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>stringtemplate</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>3.14.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>42.2.5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <version>1.5.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-easymock</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>2.18.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-core</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4-rule</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.24.1-GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-classloading-xstream</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.reactivex.rxjava2</groupId>
+ <artifactId>rxjava</artifactId>
+ <version>2.1.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>2.4</version>
+ <classifier>jdk15</classifier>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ <version>1.2.49</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-server</artifactId>
+ <version>${jersey.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-common</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ </dependencies>
<build>
<plugins>
diff --git a/rulemgt-frontend/pom.xml b/rulemgt-frontend/pom.xml
index 7901753..22e7ce0 100644
--- a/rulemgt-frontend/pom.xml
+++ b/rulemgt-frontend/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
- Copyright 2018 ZTE Corporation.
+ Copyright 2018-2020 ZTE Corporation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
limitations under the License.
-->
+
<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/maven-v4_0_0.xsd">
@@ -35,7 +36,7 @@
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
- <version>1.6</version>
+ <version>1.10.0</version>
<executions>
<execution>
<id>install node and npm</id>
@@ -51,6 +52,7 @@
</goals>
<phase>generate-resources</phase>
<configuration>
+ <npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
<arguments>install</arguments>
</configuration>
</execution>
diff --git a/rulemgt-standalone/linux64-assembly.xml b/rulemgt-standalone/linux64-assembly.xml
index 56676c8..3efa765 100644
--- a/rulemgt-standalone/linux64-assembly.xml
+++ b/rulemgt-standalone/linux64-assembly.xml
@@ -1,6 +1,6 @@
<!--
- Copyright 2017 ZTE Corporation.
+ Copyright 2017-2020 ZTE Corporation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,6 +26,11 @@
<fileSet>
<directory>target/assembly/linux64</directory>
<outputDirectory></outputDirectory>
+ <excludes>
+ <exclude>
+ lib/holmes-rulemgt-frontend-*.tar.gz
+ </exclude>
+ </excludes>
</fileSet>
</fileSets>
</assembly>
diff --git a/rulemgt-standalone/pom.xml b/rulemgt-standalone/pom.xml
index 54901dc..95a0c03 100644
--- a/rulemgt-standalone/pom.xml
+++ b/rulemgt-standalone/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
- Copyright 2017 ZTE Corporation.
+ Copyright 2017-2020 ZTE Corporation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
limitations under the License.
-->
+
<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">
@@ -36,47 +37,50 @@
<build.number>${maven.build.timestamp}</build.number>
</properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.holmes.rule-management</groupId>
+ <artifactId>holmes-rulemgt</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.holmes.rule-management</groupId>
+ <artifactId>holmes-rulemgt-frontend</artifactId>
+ <version>${project.version}</version>
+ <type>tar.gz</type>
+ </dependency>
+ </dependencies>
+
<build>
<plugins>
<plugin>
- <artifactId>maven-resources-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
- <id>copy-resources-${linux64id}</id>
+ <id>copy-dependencies</id>
<phase>process-resources</phase>
<goals>
- <goal>copy-resources</goal>
+ <goal>copy-dependencies</goal>
</goals>
- <configuration>
- <outputDirectory>${linux64outputdir}</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/assembly/</directory>
- <filtering>false</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- <excludes>
- <exclude>**/*.bat</exclude>
- <exclude>Dockerfile</exclude>
- </excludes>
- </resource>
- <resource>
- <directory>../rulemgt/src/main/resources</directory>
- <filtering>false</filtering>
- </resource>
- </resources>
- <overwrite>true</overwrite>
- </configuration>
</execution>
+ </executions>
+ <configuration>
+ <outputDirectory>${linux64outputdir}/lib</outputDirectory>
+ <includeScope>runtime</includeScope>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
<execution>
- <id>copy-resources-${win64id}</id>
+ <id>copy-resources-${linux64id}</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${win64outputdir}</outputDirectory>
+ <outputDirectory>${linux64outputdir}</outputDirectory>
<resources>
<resource>
<directory>src/main/assembly/</directory>
@@ -85,8 +89,7 @@
<include>**/*</include>
</includes>
<excludes>
- <exclude>**/*.sh</exclude>
- <exclude>Dockerfile</exclude>
+ <exclude>**/*.bat</exclude>
</excludes>
</resource>
<resource>
@@ -155,41 +158,6 @@
<artifactItems>
<artifactItem>
<groupId>org.onap.holmes.rule-management</groupId>
- <artifactId>holmes-rulemgt</artifactId>
- <type>jar</type>
- <overWrite>true</overWrite>
- <outputDirectory>${linux64outputdir}</outputDirectory>
- <destFileName>holmes-rulemgt.jar</destFileName>
- </artifactItem>
- <artifactItem>
- <groupId>org.onap.holmes.rule-management</groupId>
- <artifactId>holmes-rulemgt-frontend</artifactId>
- <type>tar.gz</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/version</outputDirectory>
- <destFileName>holmes-rulemgt-frontend-${project.version}.tar.gz</destFileName>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- <execution>
- <id>copy-artifacts-${win64id}</id>
- <goals>
- <goal>copy</goal>
- </goals>
- <phase>prepare-package</phase>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.onap.holmes.rule-management</groupId>
- <artifactId>holmes-rulemgt</artifactId>
- <type>jar</type>
- <overWrite>true</overWrite>
- <outputDirectory>${win64outputdir}</outputDirectory>
- <destFileName>holmes-rulemgt.jar</destFileName>
- </artifactItem>
- <artifactItem>
- <groupId>org.onap.holmes.rule-management</groupId>
<artifactId>holmes-rulemgt-frontend</artifactId>
<type>tar.gz</type>
<overWrite>true</overWrite>
@@ -219,25 +187,11 @@
<goal>attached</goal>
</goals>
</execution>
- <execution>
- <id>win64</id>
- <configuration>
- <descriptors>
- <descriptor>win64-assembly.xml</descriptor>
- </descriptors>
- <appendAssemblyId>true</appendAssemblyId>
- <outputDirectory>target/version</outputDirectory>
- </configuration>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
</executions>
</plugin>
<plugin>
- <groupId>org.codehaus.groovy.maven</groupId>
- <artifactId>gmaven-plugin</artifactId>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>groovy-maven-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
@@ -316,48 +270,4 @@
</build>
</profile>
</profiles>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.holmes.rule-management</groupId>
- <artifactId>holmes-rulemgt</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.holmes.rule-management</groupId>
- <artifactId>holmes-rulemgt-frontend</artifactId>
- <version>${project.version}</version>
- <type>tar.gz</type>
- </dependency>
- </dependencies>
</project>
diff --git a/rulemgt-standalone/src/main/assembly/Dockerfile b/rulemgt-standalone/src/main/assembly/Dockerfile
index 7d02c68..03630eb 100644
--- a/rulemgt-standalone/src/main/assembly/Dockerfile
+++ b/rulemgt-standalone/src/main/assembly/Dockerfile
@@ -1,57 +1,39 @@
-FROM openresty/openresty:alpine
+FROM onap/integration-java11:7.0.0
MAINTAINER "Guangrong Fu" <fu.guangrong@zte.com.cn>
+USER root
+
+# 9101 - service port
+# 9104 - GUI port
+# 9201 - debugging port
EXPOSE 9101 9104 9201
ENV HOSTNAME=holmes-rule-mgmt \
- LANG=C.UTF-8 \
- JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk \
- PATH=$PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin \
- JAVA_ALPINE_VERSION=8.242.08-r0 \
- PG_VERSION=12.2-r0
-
-#add the backend package to the docker image
-WORKDIR /home/holmes
-ADD holmes-rulemgt-standalone-*-linux64.tar.gz /home/holmes/
-
-#RUN mkdir /etc/ssl/private
-ADD holmes-rulemgt-frontend-*.tar.gz /usr/local/openresty/nginx/html/
-ADD nginx-https.conf /usr/local/openresty/nginx/conf
-ADD nginx-http.conf /usr/local/openresty/nginx/conf
-ADD holmes-frontend.key /etc/ssl/private
-ADD holmes-frontend-selfsigned.crt /etc/ssl/certs
-ADD dhparam.pem /etc/ssl/certs
-
-#install java-1.8-openjdk
-
-# add a simple script that can auto-detect the appropriate JAVA_HOME value
-# based on whether the JDK or only the JRE is installed
-RUN { \
- echo '#!/bin/sh'; \
- echo 'set -e'; \
- echo; \
- echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
- } > /usr/local/bin/docker-java-home \
- && chmod +x /usr/local/bin/docker-java-home \
- && set -x \
- && apk upgrade \
- && apk update \
- && apk add --no-cache openjdk8="$JAVA_ALPINE_VERSION" \
- && [ "$JAVA_HOME" = "$(docker-java-home)" ] \
- #install neccessary tools
- && apk add --no-cache curl \
- && apk add --no-cache postgresql-client="$PG_VERSION" \
- && apk add --no-cache nss \
- #add the frontend pacakge to the docker images
- && rm /etc/nginx/conf.d/default.conf \
- && chmod -R 777 /usr/local/openresty/nginx/ \
- #switch the user to holmes
- && addgroup -S holmes && adduser -S -G holmes holmes \
- && chmod -R a+rw /home/holmes/ \
+ LANG=C.UTF-8
+
+RUN apt-get upgrade \
+ && apt-get update \
+ && apt-get install -y curl postgresql-client-11 nginx
+
+
+ADD holmes-rulemgt-standalone-*-linux64.tar.gz /opt/onap/
+ADD holmes-rulemgt-frontend-*.tar.gz /usr/share/nginx/html/
+ADD nginx-https.conf /etc/nginx/conf.d/
+ADD nginx-http.conf /etc/nginx/conf.d/
+ADD holmes-frontend.key /etc/ssl/private/
+ADD holmes-frontend-selfsigned.crt /etc/ssl/certs/
+ADD dhparam.pem /etc/ssl/certs/
+
+RUN mkdir -p /usr/share/nginx/logs \
+ && chmod -R 777 /usr/share/nginx/ \
+ && chmod -R 777 /var/lib/nginx/ \
+ && chmod -R 755 /etc/ssl/private/ \
+ && chmod -R 777 /etc/nginx/conf.d/ \
+ && chmod -R a+rw /opt/onap/ \
&& chmod -R a+rw /var/log/ \
- && chmod 755 /home/holmes/bin/*.sh
+ && chmod 755 /opt/onap/bin/*.sh
-USER holmes
-CMD ["sh", "/home/holmes/bin/run.sh"]
+USER onap
+ENTRYPOINT ["sh", "/opt/onap/bin/run.sh"]
diff --git a/rulemgt-standalone/src/main/assembly/bin/run.sh b/rulemgt-standalone/src/main/assembly/bin/run.sh
index d500e5e..fbc7e21 100644
--- a/rulemgt-standalone/src/main/assembly/bin/run.sh
+++ b/rulemgt-standalone/src/main/assembly/bin/run.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright 2017 ZTE Corporation.
+# Copyright 2017-2020 ZTE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,10 +27,10 @@ main_path=$RUNHOME/..
cd $main_path
JAVA_OPTS="-Xms50m -Xmx128m"
port=9201
-#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n"
+#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=*:$port,server=y,suspend=n"
echo @JAVA_OPTS@ $JAVA_OPTS
-class_path="$main_path/:$main_path/holmes-rulemgt.jar"
+class_path="$main_path/lib/*"
echo @class_path@ $class_path
if [ -z ${JDBC_USERNAME} ]; then
@@ -56,7 +56,7 @@ sed -i "s|msbServerAddr:.*|msbServerAddr: http://$MSB_ADDR|" "$main_path/conf/ru
export SERVICE_IP=`hostname -i`
echo SERVICE_IP=${SERVICE_IP}
-if [ ! -z ${TESTING} ] && [ ${TESTING} == 1 ]; then
+if [ ! -z ${TESTING} -a ${TESTING} = 1 ]; then
if [ ! -z ${HOST_IP} ]; then
export HOSTNAME=${HOST_IP}:9101
else
@@ -65,7 +65,7 @@ if [ ! -z ${TESTING} ] && [ ${TESTING} == 1 ]; then
fi
export DB_PORT=5432
-if [ ! -z ${URL_JDBC} ] && [ `expr index $URL_JDBC :` != 0 ]; then
+if [ ! -z ${URL_JDBC} -a `expr index $URL_JDBC :` != 0 ]; then
export DB_PORT="${URL_JDBC##*:}"
fi
echo DB_PORT=$DB_PORT
@@ -73,7 +73,7 @@ echo DB_PORT=$DB_PORT
if [ -z ${ENABLE_ENCRYPT} ]; then
export ENABLE_ENCRYPT=true
fi
-echo ENABLE_ENCRYPT=$ENABLE_ENCRYPT
+echo ENABLE_ENCRYPT=${ENABLE_ENCRYPT}
KEY_PATH="$main_path/conf/holmes.keystore"
KEY_PASSWORD="holmes"
@@ -81,7 +81,7 @@ KEY_PASSWORD="holmes"
sed -i "s|keyStorePath:.*|keyStorePath: $KEY_PATH|" "$main_path/conf/rulemgt.yml"
sed -i "s|keyStorePassword:.*|keyStorePassword: $KEY_PASSWORD|" "$main_path/conf/rulemgt.yml"
-if [ ${ENABLE_ENCRYPT} == true ]; then
+if [ ${ENABLE_ENCRYPT} = true ]; then
sed -i "s|type:\s*https\?$|type: https|" "$main_path/conf/rulemgt.yml"
sed -i "s|#\?keyStorePath|keyStorePath|" "$main_path/conf/rulemgt.yml"
sed -i "s|#\?keyStorePassword|keyStorePassword|" "$main_path/conf/rulemgt.yml"
@@ -106,10 +106,10 @@ fi
#echo Registered UI to MSB.
-if [ ${ENABLE_ENCRYPT} == true ]; then
- nginx -c /usr/local/openresty/nginx/conf/nginx-https.conf
+if [ ${ENABLE_ENCRYPT} = true ]; then
+ nginx -c /etc/nginx/conf.d/nginx-https.conf
else
- nginx -c /usr/local/openresty/nginx/conf/nginx-http.conf
+ nginx -c /etc/nginx/conf.d/nginx-http.conf
fi
echo nginx started.
diff --git a/rulemgt-standalone/src/main/assembly/nginx-http.conf b/rulemgt-standalone/src/main/assembly/nginx-http.conf
index 717d5cf..856ad0d 100644
--- a/rulemgt-standalone/src/main/assembly/nginx-http.conf
+++ b/rulemgt-standalone/src/main/assembly/nginx-http.conf
@@ -14,7 +14,7 @@ events {
http {
- include mime.types;
+ include ../mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
@@ -32,7 +32,7 @@ http {
server_name _;
location / {
- root /usr/local/openresty/nginx/html;
+ root /usr/share/nginx/html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
diff --git a/rulemgt-standalone/src/main/assembly/nginx-https.conf b/rulemgt-standalone/src/main/assembly/nginx-https.conf
index e4facf1..02384bb 100644
--- a/rulemgt-standalone/src/main/assembly/nginx-https.conf
+++ b/rulemgt-standalone/src/main/assembly/nginx-https.conf
@@ -14,7 +14,7 @@ events {
http {
- include mime.types;
+ include ../mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
@@ -35,7 +35,7 @@ http {
server_name _;
location / {
- root /usr/local/openresty/nginx/html;
+ root /usr/share/nginx/html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
diff --git a/rulemgt/pom.xml b/rulemgt/pom.xml
index f08de1d..deedb06 100644
--- a/rulemgt/pom.xml
+++ b/rulemgt/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2017 ZTE Corporation.
+ ~ Copyright 2017-2020 ZTE Corporation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -31,305 +31,10 @@
<jetty.version>9.4.18.v20190429</jetty.version>
</properties>
- <dependencies>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>5.4.2.Final</version>
- </dependency>
- <dependency>
- <groupId>org.onap.msb.java-sdk</groupId>
- <artifactId>msb-java-sdk</artifactId>
- <exclusions>
- <exclusion>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>okhttp</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.reflections</groupId>
- <artifactId>reflections</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.holmes.common</groupId>
- <artifactId>holmes-actions</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-servlet-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-db</artifactId>
- </dependency>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>stringtemplate</artifactId>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>okhttp</artifactId>
- <version>3.14.1</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-jdbi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- </dependency>
- <dependency>
- <groupId>org.postgresql</groupId>
- <artifactId>postgresql</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-xml</artifactId>
- </exclusion>
- </exclusions>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-easymock</artifactId>
- <version>1.6.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>1.7.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4-rule</artifactId>
- <version>1.6.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-classloading-xstream</artifactId>
- <version>1.6.5</version>
- <exclusions>
- <exclusion>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.4.10</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>1.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>3.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.20.0-GA</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.6</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>net.sf.json-lib</groupId>
- <artifactId>json-lib</artifactId>
- <version>2.4</version>
- <classifier>jdk15</classifier>
- <exclusions>
- <exclusion>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.2</version>
- </dependency>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>1.2.49</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-server</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-common</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-servlet-core</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- </manifest>
- </archive>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
@@ -337,39 +42,6 @@
<target>1.8</target>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <configuration>
- <createDependencyReducedPom>true</createDependencyReducedPom>
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>META-INF/*.SF</exclude>
- <exclude>META-INF/*.DSA</exclude>
- <exclude>META-INF/*.RSA</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass>org.onap.holmes.rulemgt.RuleActiveApp</mainClass>
- </transformer>
- </transformers>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
<resources>
<resource>
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
index 058aea7..21855f8 100644
--- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
@@ -17,7 +17,6 @@
package org.onap.holmes.rulemgt;
import io.dropwizard.setup.Environment;
-import lombok.extern.slf4j.Slf4j;
import org.onap.holmes.common.config.MicroServiceConfig;
import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;
import org.onap.holmes.common.exception.CorrelationException;
@@ -29,6 +28,8 @@ import org.onap.holmes.rulemgt.msb.MsbQuery;
import org.onap.holmes.rulemgt.resources.RuleMgtResources;
import org.onap.msb.sdk.discovery.entity.MicroServiceInfo;
import org.onap.msb.sdk.discovery.entity.Node;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.DispatcherType;
import java.util.EnumSet;
@@ -38,19 +39,15 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-@Slf4j
public class RuleActiveApp extends IOCApplication<RuleAppConfig> {
+ private Logger log = LoggerFactory.getLogger(RuleActiveApp.class);
+
public static void main(String[] args) throws Exception {
new RuleActiveApp().run(args);
}
@Override
- public String getName() {
- return "Holmes Rule Management ActiveApp APP ";
- }
-
- @Override
public void run(RuleAppConfig configuration, Environment environment) throws Exception {
super.run(configuration, environment);
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java
index b0f0b96..104f74d 100644
--- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java
@@ -97,7 +97,7 @@ public class CorrelationRuleQueryDao {
if (field.getName().contains("jacoco")) {
continue;
}
- PropertyDescriptor pd = new PropertyDescriptor(field.getName(),
+ PropertyDescriptor pd = new PropertyDescriptor((String)field.getName(),
clazz);
Method getMethod = pd.getReadMethod();
Object o = getMethod.invoke(ruleQueryCondition);
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/msb/EngineInsQueryTool.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/msb/EngineInsQueryTool.java
index a0eee1f..36b5b6f 100644
--- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/msb/EngineInsQueryTool.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/msb/EngineInsQueryTool.java
@@ -46,24 +46,24 @@ public class EngineInsQueryTool {
}
public List<String> getInstanceList() throws Exception {
- String response;
- HttpGet httpGet = new HttpGet(url);
- try (CloseableHttpClient httpClient = HttpsUtils.getConditionalHttpsClient(HttpsUtils.DEFUALT_TIMEOUT)) {
- HttpResponse httpResponse = HttpsUtils.get(httpGet, new HashMap<>(), httpClient);
- response = HttpsUtils.extractResponseEntity(httpResponse);
- } catch (Exception e) {
- throw e;
- } finally {
- httpGet.releaseConnection();
+ String response;
+ HttpGet httpGet = new HttpGet(url);
+ try (CloseableHttpClient httpClient = HttpsUtils.getConditionalHttpsClient(HttpsUtils.DEFUALT_TIMEOUT)) {
+ HttpResponse httpResponse = HttpsUtils.get(httpGet, new HashMap<>(), httpClient);
+ response = HttpsUtils.extractResponseEntity(httpResponse);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ httpGet.releaseConnection();
- }
- ServiceEntity service = GsonUtil.jsonToBean(response, ServiceEntity.class);
- List<ServiceNode4Query> nodesList = service.getNodes();
- List<String> ipList = new ArrayList<>();
- for (ServiceNode4Query node : nodesList) {
- ipList.add(node.getIp());
- }
- return ipList;
+ }
+ ServiceEntity service = GsonUtil.jsonToBean(response, ServiceEntity.class);
+ List<ServiceNode4Query> nodesList = service.getNodes();
+ List<String> ipList = new ArrayList<>();
+ for (ServiceNode4Query node : nodesList) {
+ ipList.add(node.getIp());
+ }
+ return ipList;
}
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleActiveAppTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleActiveAppTest.java
index 287d5a3..e34643a 100644
--- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleActiveAppTest.java
+++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleActiveAppTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2020 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,19 +16,8 @@
package org.onap.holmes.rulemgt;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsEqual.equalTo;
-
-import org.junit.Test;
-
public class RuleActiveAppTest {
- @Test
- public void getName() throws Exception {
- RuleActiveApp app = new RuleActiveApp();
- assertThat(app.getName(), equalTo("Holmes Rule Management ActiveApp APP "));
- }
-
public static void main(String[] args) throws Exception {
String filePath = "E:\\Codes\\ONAP\\holmes\\rule-management\\rulemgt-standalone\\src\\main\\assembly\\conf\\rulemgt.yml";
new RuleActiveApp().run(new String[]{"server", filePath});
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java
index e028a2c..0e97e3a 100644
--- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java
+++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2020 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,38 +16,35 @@
package org.onap.holmes.rulemgt.db;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
import org.onap.holmes.common.api.entity.CorrelationRule;
import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.utils.DbDaoUtil;
import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition;
import org.powermock.api.easymock.PowerMock;
-import org.powermock.modules.junit4.rule.PowerMockRule;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import org.skife.jdbi.v2.Handle;
import org.skife.jdbi.v2.Query;
+import java.util.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({DbDaoUtil.class, Handle.class, Query.class})
public class CorrelationRuleQueryDaoTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
- @Rule
- public PowerMockRule powerMockRule = new PowerMockRule();
private DbDaoUtil dbDaoUtil;
private Handle handle;
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/send/RuleAllocatorTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/send/RuleAllocatorTest.java
index 5dc8281..09fcf93 100644
--- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/send/RuleAllocatorTest.java
+++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/send/RuleAllocatorTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2020 ZTE Corporation.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,6 @@ import org.onap.holmes.rulemgt.wrapper.RuleQueryWrapper;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.modules.junit4.rule.PowerMockRule;
import java.util.ArrayList;
import java.util.Calendar;
@@ -46,6 +45,7 @@ import java.util.stream.Collectors;
import static org.onap.holmes.rulemgt.send.RuleAllocator.ENABLE;
+@RunWith(PowerMockRunner.class)
@PrepareForTest({ServiceLocator.class, RuleMgtWrapper.class, RuleQueryWrapper.class, EngineWrapper.class,
EngineInsQueryTool.class, DbDaoUtil.class, ServiceLocatorHolder.class})
public class RuleAllocatorTest {
@@ -53,9 +53,6 @@ public class RuleAllocatorTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
- @Rule
- public PowerMockRule rule = new PowerMockRule();
-
private RuleMgtWrapper ruleMgtWrapperMock;
private RuleQueryWrapper ruleQueryWrapperMock;
private EngineWrapper engineWrapperMock;
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java
index 4b3e60f..90384ce 100644
--- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java
+++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java
@@ -16,37 +16,34 @@
package org.onap.holmes.rulemgt.wrapper;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
-import org.onap.holmes.rulemgt.db.CorrelationRuleDao;
import org.onap.holmes.common.api.entity.CorrelationRule;
import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.utils.DbDaoUtil;
-import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
-import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;
-import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest;
-import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition;
-import org.onap.holmes.rulemgt.bean.request.RuleUpdateRequest;
+import org.onap.holmes.rulemgt.bean.request.*;
import org.onap.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse;
import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse;
import org.onap.holmes.rulemgt.bolt.enginebolt.EngineWrapper;
+import org.onap.holmes.rulemgt.db.CorrelationRuleDao;
import org.onap.holmes.rulemgt.db.CorrelationRuleQueryDao;
import org.onap.holmes.rulemgt.send.Ip4AddingRule;
import org.powermock.api.easymock.PowerMock;
import org.powermock.modules.junit4.rule.PowerMockRule;
import org.powermock.reflect.Whitebox;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+
public class RuleMgtWrapperTest {
@Rule