summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai <lukai@chinamobile.com>2021-03-29 11:48:10 +0800
committerRemigiusz Janeczek <remigiusz.janeczek@nokia.com>2021-05-12 17:11:08 +0200
commit9bb841d5faa995c2170057f93cd65303fba7979c (patch)
treeb3fe5deaa60844546984d74adb82b9217a6f4705
parent6302edb304f69068b108a69001d69bc6213b6a6a (diff)
Fix mongodb errors on application startup1.3.0-tca-gen2
Revert Dockerfile refactor due to permissions issues Issue-ID: DCAEGEN2-2747 Issue-ID: DCAEGEN2-2590 Signed-off-by: Kai Lu <lukai@chinamobile.com> Change-Id: I84075575cc75090876416cb13e0ac197a8e0f6e3 Signed-off-by: Remigiusz Janeczek <remigiusz.janeczek@nokia.com>
-rw-r--r--dcae-analytics/dcae-analytics-model/pom.xml15
-rw-r--r--dcae-analytics/dcae-analytics-tca-core/pom.xml24
-rw-r--r--dcae-analytics/dcae-analytics-tca-model/pom.xml10
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/Dockerfile28
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/pom.xml102
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java15
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaAlertTransformer.java4
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandler.java5
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java12
-rw-r--r--dcae-analytics/dcae-analytics-web/pom.xml26
-rw-r--r--dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapMrConfig.java28
-rw-r--r--dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapPollerConfig.java6
-rw-r--r--dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapRetryConfig.java3
-rw-r--r--dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/MessageStoreConfig.java5
-rw-r--r--dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdvice.java18
-rw-r--r--dcae-analytics/pom.xml110
16 files changed, 138 insertions, 273 deletions
diff --git a/dcae-analytics/dcae-analytics-model/pom.xml b/dcae-analytics/dcae-analytics-model/pom.xml
index 96f235d..ff8382d 100644
--- a/dcae-analytics/dcae-analytics-model/pom.xml
+++ b/dcae-analytics/dcae-analytics-model/pom.xml
@@ -98,21 +98,6 @@
<version>${sdk.version}</version>
</dependency>
<dependency>
- <groupId>io.projectreactor.netty</groupId>
- <artifactId>reactor-netty</artifactId>
- <version>0.9.12.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler-proxy</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
diff --git a/dcae-analytics/dcae-analytics-tca-core/pom.xml b/dcae-analytics/dcae-analytics-tca-core/pom.xml
index 81a97f1..f7393ac 100644
--- a/dcae-analytics/dcae-analytics-tca-core/pom.xml
+++ b/dcae-analytics/dcae-analytics-tca-core/pom.xml
@@ -72,27 +72,17 @@
<groupId>${project.groupId}</groupId>
<artifactId>dcae-analytics-test</artifactId>
</dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler-proxy</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
</dependencies>
<dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>5.0.11.RELEASE</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>5.0.11.RELEASE</version>
+ </dependency>
+ </dependencies>
</dependencyManagement>
</project>
diff --git a/dcae-analytics/dcae-analytics-tca-model/pom.xml b/dcae-analytics/dcae-analytics-tca-model/pom.xml
index 0510883..076125d 100644
--- a/dcae-analytics/dcae-analytics-tca-model/pom.xml
+++ b/dcae-analytics/dcae-analytics-tca-model/pom.xml
@@ -63,16 +63,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>dcae-analytics-test</artifactId>
</dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler-proxy</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
</dependencies>
diff --git a/dcae-analytics/dcae-analytics-tca-web/Dockerfile b/dcae-analytics/dcae-analytics-tca-web/Dockerfile
index 2791e03..a2c59c4 100644
--- a/dcae-analytics/dcae-analytics-tca-web/Dockerfile
+++ b/dcae-analytics/dcae-analytics-tca-web/Dockerfile
@@ -9,23 +9,23 @@ ARG DOCKER_ARTIFACT_DIR
ARG user=tca-gen2
ARG group=tca-gen2
-WORKDIR ${DOCKER_ARTIFACT_DIR}
-#Copy dependencies and executable jar
-COPY ${PROJECT_BUILD_DIR_NAME}/${FINAL_JAR} .
-
USER root
-#Symlink to overcome Docker limitation to put ARG inside ENTRYPOINT
-RUN mkdir -p /var/log/ONAP/dcaegen2/analytics/tca-gen2 && \
- addgroup $group && adduser --system --disabled-password --no-create-home --ingroup $group $user && \
- chmod g+rwx /opt; \
- chmod u+rw /var/log/ONAP/dcaegen2/analytics/tca-gen2 && \
- chown -R $user /opt && \
- chown -R $user /var/log/ONAP/dcaegen2/analytics/tca-gen2 && \
- ln -s ${FINAL_JAR} tca-gen2.jar && \
- chown $user ${FINAL_JAR} tca-gen2.jar
+RUN mkdir -p /var/log/ONAP/dcaegen2/analytics/tca-gen2
+#Add a new user and group to allow container to be run as non-root
+RUN addgroup $group && adduser --system --disabled-password --no-create-home --ingroup $group $user && \
+ chmod 775 /opt && \
+ chmod 775 /var/log/ONAP/dcaegen2/analytics/tca-gen2 && \
+ chown -R $user:$group /opt && \
+ chown -R $user:$group /var/log/ONAP/dcaegen2/analytics/tca-gen2
+
+#Copy dependencies and executable jar
+WORKDIR ${DOCKER_ARTIFACT_DIR}
+COPY ${PROJECT_BUILD_DIR_NAME}/${FINAL_JAR} .
+#Overcome Docker limitation to put ARG inside ENTRYPOINT
+RUN ln -s ${FINAL_JAR} tca-gen2.jar
EXPOSE 8100
-USER $user
+USER $user:$group
ENTRYPOINT ["java", "-Dspring.profiles.active=configBindingService,dmaap,mongo", "-jar", "tca-gen2.jar"]
diff --git a/dcae-analytics/dcae-analytics-tca-web/pom.xml b/dcae-analytics/dcae-analytics-tca-web/pom.xml
index 86d332f..7c81f4f 100644
--- a/dcae-analytics/dcae-analytics-tca-web/pom.xml
+++ b/dcae-analytics/dcae-analytics-tca-web/pom.xml
@@ -3,6 +3,7 @@
~ ================================================================================
~ Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
~ Copyright (c) 2021 Samsung Electronics. All rights reserved.
+ ~ Copyright (c) 2021 Nokia Intellectual Property. All rights reserved.
~ ================================================================================
~ Modifications Copyright (C) 2019 IBM
~ ================================================================================
@@ -43,7 +44,7 @@
<properties>
<main.basedir>${project.parent.basedir}</main.basedir>
<docker.image.name>onap/${project.groupId}.${project.artifactId}</docker.image.name>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
</properties>
<dependencies>
@@ -69,7 +70,6 @@
<artifactId>undertow-core</artifactId>
</exclusion>
</exclusions>
-
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
@@ -107,6 +107,10 @@
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
+ <groupId>org.springframework.plugin</groupId>
+ <artifactId>spring-plugin-core</artifactId>
+ </dependency>
+ <dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
@@ -117,33 +121,13 @@
<artifactId>dcae-analytics-test</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/io.undertow/undertow-core -->
- <dependency>
- <groupId>io.undertow</groupId>
- <artifactId>undertow-core</artifactId>
- </dependency>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler-proxy</artifactId>
- <version>4.1.54.Final</version>
+ <groupId>io.undertow</groupId>
+ <artifactId>undertow-core</artifactId>
</dependency>
</dependencies>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>5.1.12.RELEASE</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<build>
<resources>
<resource>
@@ -165,39 +149,39 @@
</plugin>
<!-- DOCKER PLUGIN -->
<plugin>
- <groupId>com.spotify</groupId>
- <artifactId>dockerfile-maven-plugin</artifactId>
- <version>1.4.10</version>
- <configuration>
- <contextDirectory>${project.basedir}</contextDirectory>
- <repository>${docker.repository}/${docker.image.name}</repository>
- <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
- <buildArgs>
- <PROJECT_BUILD_DIR_NAME>target</PROJECT_BUILD_DIR_NAME>
- <DEPENDENCIES_DIR>${dependency.dir.name}</DEPENDENCIES_DIR>
- <DOCKER_ARTIFACT_DIR>/opt</DOCKER_ARTIFACT_DIR>
- <FINAL_JAR>${project.build.finalName}.jar</FINAL_JAR>
- </buildArgs>
- </configuration>
- <executions>
- <execution>
- <id>build-image</id>
- <phase>install</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- <execution>
- <id>tag-version</id>
- <phase>install</phase>
- <goals>
- <goal>tag</goal>
- <goal>push</goal>
- </goals>
- <configuration>
- <tag>${project.version}</tag>
- </configuration>
- </execution>
+ <groupId>com.spotify</groupId>
+ <artifactId>dockerfile-maven-plugin</artifactId>
+ <version>1.4.10</version>
+ <configuration>
+ <contextDirectory>${project.basedir}</contextDirectory>
+ <repository>${docker.repository}/${docker.image.name}</repository>
+ <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
+ <buildArgs>
+ <PROJECT_BUILD_DIR_NAME>target</PROJECT_BUILD_DIR_NAME>
+ <DEPENDENCIES_DIR>${dependency.dir.name}</DEPENDENCIES_DIR>
+ <DOCKER_ARTIFACT_DIR>/opt</DOCKER_ARTIFACT_DIR>
+ <FINAL_JAR>${project.build.finalName}.jar</FINAL_JAR>
+ </buildArgs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>build-image</id>
+ <phase>install</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>tag-version</id>
+ <phase>install</phase>
+ <goals>
+ <goal>tag</goal>
+ <goal>push</goal>
+ </goals>
+ <configuration>
+ <tag>${project.version}</tag>
+ </configuration>
+ </execution>
<execution>
<id>tag-version-ts</id>
<phase>install</phase>
@@ -206,10 +190,10 @@
<goal>push</goal>
</goals>
<configuration>
- <tag>${project.version}-${maven.build.timestamp}Z</tag>
+ <tag>${project.version}-${maven.build.timestamp}Z</tag>
</configuration>
</execution>
- </executions>
+ </executions>
</plugin>
</plugins>
</build>
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java
index 3579d3e..ed8e7ea 100644
--- a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java
+++ b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java
@@ -1,6 +1,8 @@
/*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 China Mobile Property. All rights reserved.
+ * Copyright (c) 2021 Nokia 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.
@@ -23,8 +25,6 @@ import static org.onap.dcae.analytics.model.AnalyticsHttpConstants.REQUEST_ID_HE
import static org.onap.dcae.analytics.model.AnalyticsHttpConstants.REQUEST_TRANSACTION_ID_HEADER_KEY;
import java.util.List;
-import java.util.Map;
-
import org.onap.dcae.analytics.model.AnalyticsProfile;
import org.onap.dcae.analytics.model.DmaapMrConstants;
import org.onap.dcae.analytics.tca.web.TcaAppProperties;
@@ -44,6 +44,7 @@ import org.springframework.integration.channel.NullChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
+import org.springframework.integration.handler.GenericHandler;
import org.springframework.messaging.MessageHeaders;
/**
@@ -82,11 +83,15 @@ public class TcaMrConfig {
// get messages from dmaap subscriber channel
return IntegrationFlows.from(mrSubscriberOutputChannel)
// handle incoming message from dmaap
- .handle((List<String> cefMessages, Map<String, Object> headers) ->
- tcaProcessingService.getTcaExecutionResults(
+ .handle(new GenericHandler<List<String>>() {
+ @Override
+ public Object handle(List<String> cefMessages, MessageHeaders headers) {
+ return tcaProcessingService.getTcaExecutionResults(
headers.getOrDefault(REQUEST_ID_HEADER_KEY, headers.get(MessageHeaders.ID)).toString(),
headers.getOrDefault(REQUEST_TRANSACTION_ID_HEADER_KEY, "").toString(),
- tcaPolicyWrapper, cefMessages))
+ tcaPolicyWrapper, cefMessages);
+ }
+ })
// transform tca execution results to alerts - if not alerts are detected terminate further processing
.transform(tcaAlertTransformer, c -> c.requiresReply(false))
// post messages to dmaap publisher input channel
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaAlertTransformer.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaAlertTransformer.java
index 9bade85..ff086ed 100644
--- a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaAlertTransformer.java
+++ b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaAlertTransformer.java
@@ -1,6 +1,7 @@
/*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 China Mobile 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.
@@ -71,7 +72,7 @@ public class TcaAlertTransformer extends AbstractTransformer {
@Override
@SuppressWarnings("unchecked")
- protected Object doTransform(final Message<?> message) throws Exception {
+ protected Object doTransform(final Message<?> message) {
final Object messagePayload = message.getPayload();
@@ -158,3 +159,4 @@ public class TcaAlertTransformer extends AbstractTransformer {
Integer.toString(abatedExecutionContexts.size()), Integer.toString(tcaAlerts.size()));
}
}
+
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandler.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandler.java
index 7cd542c..024e4bf 100644
--- a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandler.java
+++ b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandler.java
@@ -1,6 +1,7 @@
/*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 China Mobile 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.
@@ -24,7 +25,6 @@ import static org.onap.dcae.analytics.model.AnalyticsHttpConstants.REQUEST_BEGIN
import static org.onap.dcae.analytics.model.AnalyticsHttpConstants.REQUEST_END_TS_HEADER_KEY;
import java.util.Date;
-import java.util.Map;
import org.onap.dcae.analytics.model.ecomplogger.AnalyticsErrorType;
import org.onap.dcae.analytics.tca.core.util.TcaUtils;
@@ -60,7 +60,7 @@ public class TcaPublisherResponseHandler implements GenericHandler<String> {
}
@Override
- public Object handle(final String payload, final Map<String, Object> headers) {
+ public Object handle(final String payload, MessageHeaders headers) {
final MessageHeaders messageHeaders = new MessageHeaders(headers);
final String requestId = AnalyticsHttpUtils.getRequestId(messageHeaders);
@@ -99,3 +99,4 @@ public class TcaPublisherResponseHandler implements GenericHandler<String> {
}
}
+
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java b/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java
index 66043aa..2637a39 100644
--- a/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java
+++ b/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java
@@ -1,6 +1,7 @@
/*
* ================================================================================
* Copyright (c) 2019 IBM Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 China Mobile 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.
@@ -26,17 +27,19 @@ import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.dcae.analytics.tca.web.TcaAppProperties;
import org.onap.dcae.analytics.tca.web.TcaAppProperties.Tca;
+import org.springframework.messaging.MessageHeaders;
public class TcaPublisherResponseHandlerTest {
- static Map<String, Object> headers;
+ static MessageHeaders messageHeaders;
@BeforeAll
static void initialize() {
- headers = new HashMap<>();
+ Map headers = new HashMap<>();
headers.put("X-ECOMP-RequestID", "TestRequestID");
headers.put("X-ECOMP-TransactionID", "TestTransactionID");
headers.put("X-ECOMP-FromAppID", "TestFromAppID");
+ messageHeaders = new MessageHeaders(headers);
}
@@ -49,7 +52,7 @@ public class TcaPublisherResponseHandlerTest {
Mockito.when(tcaAppProperties.getTca().getEnableEcompLogging()).thenReturn(true);
TcaPublisherResponseHandler responseHandler = new TcaPublisherResponseHandler(tcaAppProperties);
- responseHandler.handle("testpayload", headers);
+ responseHandler.handle("testpayload", messageHeaders);
}
@@ -62,8 +65,9 @@ public class TcaPublisherResponseHandlerTest {
Mockito.when(tcaAppProperties.getTca().getEnableEcompLogging()).thenReturn(false);
TcaPublisherResponseHandler responseHandler = new TcaPublisherResponseHandler(tcaAppProperties);
- responseHandler.handle("testpayload", headers);
+ responseHandler.handle("testpayload", messageHeaders);
}
}
+
diff --git a/dcae-analytics/dcae-analytics-web/pom.xml b/dcae-analytics/dcae-analytics-web/pom.xml
index 4d7efb7..856a8ed 100644
--- a/dcae-analytics/dcae-analytics-web/pom.xml
+++ b/dcae-analytics/dcae-analytics-web/pom.xml
@@ -3,6 +3,7 @@
~ ================================================================================
~ Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved.
~ Copyright (c) 2021 Samsung Electronics. All rights reserved.
+ ~ Copyright (c) 2021 Nokia 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.
@@ -104,7 +105,10 @@
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mongodb</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-mongodb</artifactId>
+ </dependency>
<!-- APACHE HTTP CLIENT -->
<dependency>
@@ -145,27 +149,7 @@
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
</dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler-proxy</artifactId>
- <version>4.1.54.Final</version>
- </dependency>
</dependencies>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>5.0.11.RELEASE</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
</project>
diff --git a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapMrConfig.java b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapMrConfig.java
index 1fe9e51..705a724 100644
--- a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapMrConfig.java
+++ b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapMrConfig.java
@@ -1,6 +1,8 @@
/*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 China Mobile Property. All rights reserved.
+ * Copyright (c) 2021 Nokia 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.
@@ -19,10 +21,6 @@
package org.onap.dcae.analytics.web.config;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.util.Map;
-
import org.onap.dcae.analytics.model.AnalyticsHttpConstants;
import org.onap.dcae.analytics.model.AnalyticsProfile;
import org.onap.dcae.analytics.model.DmaapMrConstants;
@@ -44,16 +42,20 @@ import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
-import org.springframework.integration.dsl.channel.MessageChannels;
+import org.springframework.integration.dsl.MessageChannels;
import org.springframework.integration.endpoint.MethodInvokingMessageSource;
+import org.springframework.integration.handler.GenericHandler;
import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice;
import org.springframework.integration.http.dsl.Http;
import org.springframework.integration.scheduling.PollerMetadata;
import org.springframework.integration.store.BasicMessageGroupStore;
import org.springframework.integration.store.MessageGroupQueue;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageHeaders;
import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
/**
* @author Rajiv Singla
*/
@@ -139,21 +141,23 @@ public class DmaapMrConfig {
final RestTemplate mrPublisherRestTemplate,
final DirectChannel mrPublisherInputChannel,
final RequestHandlerRetryAdvice requestHandlerRetryAdvice) {
-
return IntegrationFlows.from(mrPublisherInputChannel)
.handle(Http.outboundGateway(mrPublisherPreferences.getRequestURL(), mrPublisherRestTemplate)
.mappedRequestHeaders(DMAAP_MAPPED_REQUEST_HEADERS)
.httpMethod(HttpMethod.POST)
.extractPayload(true)
.expectedResponseType(String.class), c -> c.advice(requestHandlerRetryAdvice))
- // add end timestamp
- .handle((String p, Map<String, Object> headers) ->
- MessageBuilder.withPayload(p).copyHeaders(headers)
- .setHeader(AnalyticsHttpConstants.REQUEST_END_TS_HEADER_KEY,
- AnalyticsWebUtils.CREATION_TIMESTAMP_SUPPLIER.get()).build()
- )
+ .handle(new GenericHandler<String>() {
+ @Override
+ public Object handle(String payload, MessageHeaders headers) {
+ return MessageBuilder.withPayload(payload).copyHeaders(headers)
+ .setHeader(AnalyticsHttpConstants.REQUEST_END_TS_HEADER_KEY,
+ AnalyticsWebUtils.CREATION_TIMESTAMP_SUPPLIER.get()).build();
+ }
+ })
.channel(DmaapMrConstants.DMAAP_MR_PUBLISHER_OUTPUT_CHANNEL)
.get();
}
}
+
diff --git a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapPollerConfig.java b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapPollerConfig.java
index ab85d5f..9fec649 100644
--- a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapPollerConfig.java
+++ b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapPollerConfig.java
@@ -1,6 +1,7 @@
/*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 China Mobile 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.
@@ -19,8 +20,6 @@
package org.onap.dcae.analytics.web.config;
-import java.util.concurrent.TimeUnit;
-
import org.onap.dcae.analytics.model.AnalyticsProfile;
import org.onap.dcae.analytics.web.dmaap.MrSubscriberPollingAdvice;
import org.onap.dcae.analytics.web.dmaap.MrSubscriberPollingPreferences;
@@ -56,7 +55,7 @@ public class DmaapPollerConfig {
final MrSubscriberPollingPreferences pollingPreferences = mrSubscriberPreferences.getPollingPreferences();
final int minInterval = pollingPreferences.getMinPollingInterval();
final DynamicPeriodicTrigger dynamicPeriodicTrigger =
- new DynamicPeriodicTrigger(minInterval, TimeUnit.MILLISECONDS);
+ new DynamicPeriodicTrigger(minInterval);
dynamicPeriodicTrigger.setFixedRate(true);
return dynamicPeriodicTrigger;
}
@@ -77,3 +76,4 @@ public class DmaapPollerConfig {
}
}
+
diff --git a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapRetryConfig.java b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapRetryConfig.java
index 48f0144..319be8b 100644
--- a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapRetryConfig.java
+++ b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapRetryConfig.java
@@ -1,6 +1,7 @@
/*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 China Mobile 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.
@@ -31,7 +32,7 @@ import org.springframework.context.annotation.Profile;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
-import org.springframework.integration.dsl.channel.MessageChannels;
+import org.springframework.integration.dsl.MessageChannels;
import org.springframework.integration.handler.LoggingHandler;
import org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer;
import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice;
diff --git a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/MessageStoreConfig.java b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/MessageStoreConfig.java
index aa1c502..c645b6c 100644
--- a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/MessageStoreConfig.java
+++ b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/MessageStoreConfig.java
@@ -1,6 +1,7 @@
/*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 Nokia 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.
@@ -23,7 +24,7 @@ import org.onap.dcae.analytics.model.AnalyticsProfile;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
-import org.springframework.data.mongodb.MongoDbFactory;
+import org.springframework.data.mongodb.MongoDatabaseFactory;
import org.springframework.integration.mongodb.store.MongoDbChannelMessageStore;
import org.springframework.integration.store.BasicMessageGroupStore;
import org.springframework.integration.store.SimpleMessageStore;
@@ -43,7 +44,7 @@ public class MessageStoreConfig {
@Bean
@Profile(AnalyticsProfile.MONGO_PROFILE_NAME)
- public BasicMessageGroupStore mongoMessageGroupStore(final MongoDbFactory mongoDbFactory) {
+ public BasicMessageGroupStore mongoMessageGroupStore(final MongoDatabaseFactory mongoDbFactory) {
final MongoDbChannelMessageStore store = new MongoDbChannelMessageStore(mongoDbFactory);
store.setPriorityEnabled(true);
return store;
diff --git a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdvice.java b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdvice.java
index 2ebb38d..6572a25 100644
--- a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdvice.java
+++ b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdvice.java
@@ -1,6 +1,8 @@
/*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2021 China Mobile Property. All rights reserved.
+ * Copyright (c) 2021 Nokia 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.
@@ -19,6 +21,7 @@
package org.onap.dcae.analytics.web.dmaap;
+import java.time.Duration;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -84,8 +87,7 @@ public class MrSubscriberPollingAdvice extends AbstractRequestHandlerAdvice {
@Override
@SuppressWarnings("unchecked")
- protected Object doInvoke(final ExecutionCallback callback, final Object target, final Message<?> message)
- throws Exception {
+ protected Object doInvoke(final ExecutionCallback callback, final Object target, final Message<?> message) {
// execute call back
Object result = callback.execute();
@@ -98,14 +100,7 @@ public class MrSubscriberPollingAdvice extends AbstractRequestHandlerAdvice {
final MessageBuilder<String> resultMessageBuilder = (MessageBuilder<String>) result;
final String payload = resultMessageBuilder.getPayload();
final Map<String, Object> headers = resultMessageBuilder.getHeaders();
- final Object httpStatusCode = headers.get(AnalyticsHttpConstants.HTTP_STATUS_CODE_HEADER_KEY);
-
- // get http status code
- if (httpStatusCode == null) {
- return result;
- }
- final HttpStatus httpStatus = HttpStatus.resolve(Integer.parseInt(httpStatusCode.toString()));
-
+ final HttpStatus httpStatus = (HttpStatus) headers.get(AnalyticsHttpConstants.HTTP_STATUS_CODE_HEADER_KEY);
// if status code is present and successful apply polling adjustments
if (httpStatus != null && httpStatus.is2xxSuccessful()) {
@@ -119,7 +114,7 @@ public class MrSubscriberPollingAdvice extends AbstractRequestHandlerAdvice {
"Next Polling Interval will be: {}", debugLogSpec, requestId, transactionId,
String.valueOf(areMessagesPresent), nextPollingInterval.toString());
- trigger.setPeriod(nextPollingInterval.get());
+ trigger.setDuration(Duration.ofMillis(nextPollingInterval.get()));
// if no messages were found in dmaap poll - terminate further processing
if (!areMessagesPresent) {
@@ -148,3 +143,4 @@ public class MrSubscriberPollingAdvice extends AbstractRequestHandlerAdvice {
}
}
}
+
diff --git a/dcae-analytics/pom.xml b/dcae-analytics/pom.xml
index 4f8fc42..d3d924f 100644
--- a/dcae-analytics/pom.xml
+++ b/dcae-analytics/pom.xml
@@ -3,6 +3,7 @@
~ ================================================================================
~ Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
~ Copyright (c) 2021 Samsung Electronics. All rights reserved.
+ ~ Copyright (c) 2021 China Mobile 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.
@@ -56,9 +57,8 @@
<!-- DEPENDENCIES VERSION -->
<eelf.logger.version>1.0.1-SNAPSHOT</eelf.logger.version>
- <spring.boot.version>2.0.9.RELEASE</spring.boot.version>
+ <spring.boot.version>2.4.4</spring.boot.version>
<spring.cloud.version>Finchley.RC2</spring.cloud.version>
- <spring.version>5.0.11.RELEASE</spring.version>
<commons.text.version>1.4</commons.text.version>
<springfox-swagger2.version>3.0.0</springfox-swagger2.version>
<findbugs.jsr305.version>3.0.2</findbugs.jsr305.version>
@@ -109,9 +109,7 @@
<snapshots.path>content/repositories/snapshots/</snapshots.path>
<releases.path>content/repositories/releases/</releases.path>
<docker.repository>nexus3.onap.org:10003</docker.repository>
- <jackson.version>2.11.0</jackson.version>
- <undertow.version>2.2.2.Final</undertow.version>
- <spring-webflux.version>5.2.7.RELEASE</spring-webflux.version>
+ <spring-swagger-ui.version>2.10.5</spring-swagger-ui.version>
<!-- SONAR EXCLUSIONS -->
<!-- EXCLUDE TEST COVERAGE ON
@@ -184,11 +182,12 @@
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-swagger2.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>${springfox-swagger2.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.plugin</groupId>
+ <artifactId>spring-plugin-core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
@@ -196,9 +195,9 @@
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
- <groupId>org.springframework.plugin</groupId>
- <artifactId>spring-plugin-metadata</artifactId>
- <version>2.0.0.RELEASE</version>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>${spring-swagger-ui.version}</version>
</dependency>
<!-- FIND BUGS -->
@@ -270,40 +269,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>io.undertow</groupId>
- <artifactId>undertow-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webflux</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.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-smile</artifactId>
- </exclusion>
- </exclusions>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -315,46 +280,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webflux</artifactId>
- <version>${spring-webflux.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <version>2.2.0.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>2.23.4</version>
- </dependency>
- <dependency>
- <groupId>io.undertow</groupId>
- <artifactId>undertow-core</artifactId>
- <version>${undertow.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-smile</artifactId>
- <version>${jackson.version}</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -445,8 +370,7 @@
<version>${maven-surefire-plugin.version}</version>
<configuration>
<skipTests>${skip.unit.tests}</skipTests>
- <argLine>-Xmx2048m -Djava.awt.headless=true
- -XX:+UseConcMarkSweepGC
+ <argLine>-Xmx2048m -Djava.awt.headless=true -XX:+UseConcMarkSweepGC
-XX:OnOutOfMemoryError="kill -9 %p" -XX:+HeapDumpOnOutOfMemoryError ${surefireArgLine}
</argLine>
<redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
@@ -553,7 +477,7 @@
<id>validate</id>
<phase>validate</phase>
<configuration>
- <skip>true</skip>
+ <skip>true</skip>
<configLocation>${checkstyle.file.name}</configLocation>
<suppressionsLocation>${checkstyle.suppression.file.name}</suppressionsLocation>
<encoding>UTF-8</encoding>
@@ -686,12 +610,6 @@
</execution>
</executions>
</plugin>
-
- <!-- DOCKER PLUGIN -->
- <!-- <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId>
- <version>${docker-maven-version}</version> <configuration> <repository>${docker.repository}/onap/${project.groupId}.${project.artifactId}</repository>
- <tag>${project.version}</tag> </configuration> </plugin> -->
-
</plugins>
</pluginManagement>