diff options
author | JoeOLeary <joseph.o.leary@est.tech> | 2020-06-22 14:01:13 +0100 |
---|---|---|
committer | JoeOLeary <joseph.o.leary@est.tech> | 2020-06-23 08:34:15 +0100 |
commit | d5270c6f32111b0687911e85ab7d025f15360ba1 (patch) | |
tree | 03151bdf554f8260e095eaa3dbf1c2140bf7e4d4 | |
parent | 5479d1fa917c37510839849d9f74d96aab5fb4fb (diff) |
Migrate to Java 11
Issue-ID: DCAEGEN2-2282
Signed-off-by: JoeOLeary <joseph.o.leary@est.tech>
Change-Id: Iadd6cb2ede9b900ce5b83afcb68dab8ae27e54f9
10 files changed, 46 insertions, 30 deletions
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- ============LICENSE_START======================================================= - Copyright (C) 2019 Nordix Foundation. + Copyright (C) 2019-2020 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ <groupId>org.onap.dcaegen2.services</groupId> <artifactId>pm-mapper</artifactId> - <version>1.3.1-SNAPSHOT</version> + <version>1.3.2-SNAPSHOT</version> <parent> <groupId>org.onap.oparent</groupId> @@ -48,11 +48,13 @@ <gson.version>2.8.5</gson.version> <freemarker.version>2.3.28</freemarker.version> <commons.io.version>2.6</commons.io.version> - <!-- Testing.Test Dependencies --> + <xml.version>2.3.1</xml.version> + <jaxb.version>2.3.0.1</jaxb.version> + <!-- Testing Test Dependencies --> <junit.version>5.3.2</junit.version> <mockito.version>2.23.4</mockito.version> <mockito-ju5-ext.version>2.23.4</mockito-ju5-ext.version> - <powermock.version>2.0.0</powermock.version> + <powermock.version>2.0.7</powermock.version> <mockserver.version>3.10.8</mockserver.version> <junit4.version>4.12</junit4.version> <jsonschema.version>1.3.0</jsonschema.version> @@ -76,8 +78,8 @@ <sonar.jacoco.reportPaths>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPaths> <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath> <sonar.projectVersion>${project.version}</sonar.projectVersion> - <compiler.target.version>1.8</compiler.target.version> - <compiler.source.version>1.8</compiler.source.version> + <compiler.target.version>1.11</compiler.target.version> + <compiler.source.version>1.11</compiler.source.version> <onap.logging.version>1.2.2</onap.logging.version> <classpath.separator>@@</classpath.separator> <pmmapper.main.class>org.onap.dcaegen2.services.pmmapper.App</pmmapper.main.class> @@ -103,6 +105,21 @@ <version>${undertow.version}</version> </dependency> <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>${xml.version}</version> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-core</artifactId> + <version>${jaxb.version}</version> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>${xml.version}</version> + </dependency> + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${sl4j.version}</version> diff --git a/src/main/resources/Dockerfile b/src/main/resources/Dockerfile index c4eeb2e..e0d0164 100644 --- a/src/main/resources/Dockerfile +++ b/src/main/resources/Dockerfile @@ -17,11 +17,14 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= # -FROM openjdk:8u171-jre-alpine +FROM openjdk:11.0.7-jre-slim WORKDIR /opt/app/pm-mapper -RUN apk --no-cache add curl +RUN apt-get update && \ + apt-get install --no-recommends -y curl nano && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* RUN mkdir -p /var/log/ONAP @@ -54,5 +57,5 @@ LABEL git.branch="${git.branch}" \ git.commit.user.name="${git.commit.user.name}" -ENTRYPOINT ["/bin/sh", "-c", "nohup sh etc/reconfigure.sh & /usr/bin/java -jar ${project.artifactId}-${project.version}.jar"] +ENTRYPOINT ["/bin/sh", "-c", "nohup sh etc/reconfigure.sh & /usr/local/openjdk-11/bin/java -jar ${project.artifactId}-${project.version}.jar"] ARG JAR diff --git a/src/test/java/org/onap/dcaegen2/pmmapper/messagerouter/VESPublisherTest.java b/src/test/java/org/onap/dcaegen2/pmmapper/messagerouter/VESPublisherTest.java index 1772452..e5c5af4 100644 --- a/src/test/java/org/onap/dcaegen2/pmmapper/messagerouter/VESPublisherTest.java +++ b/src/test/java/org/onap/dcaegen2/pmmapper/messagerouter/VESPublisherTest.java @@ -24,6 +24,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.onap.dcaegen2.services.pmmapper.exceptions.RequestFailure; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import reactor.test.StepVerifier; import java.util.Arrays; import java.util.List; @@ -43,6 +44,7 @@ import reactor.core.publisher.Flux; @RunWith(PowerMockRunner.class) @PrepareForTest(EnvironmentConfig.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) public class VESPublisherTest { private static String topicURL = "http://mr/topic"; diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandlerTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandlerTest.java index 5cd1634..0462616 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandlerTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandlerTest.java @@ -48,10 +48,12 @@ import org.onap.dcaegen2.services.pmmapper.model.measurement.common.MeasurementF import org.onap.dcaegen2.services.pmmapper.utils.MeasConverter; import io.undertow.server.HttpServerExchange; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import utils.ArgumentCreator; import utils.EventUtils; @ExtendWith(MockitoExtension.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.parsers.*", "org.xml.*", "javax.management.*"}) class MeasFilterHandlerTest { private static final Path FILTER_DIRECTORY = Paths.get("src/test/resources/filter_test/"); @@ -181,7 +183,7 @@ class MeasFilterHandlerTest { testEvent.setFilter(generateValidFilter()); return Arguments.of(expectedEvent, testEvent); }; - return EventUtils.generateEventArguments(FILTER_DIRECTORY, "/nr", creator); + return EventUtils.generateEventArguments(FILTER_DIRECTORY, "nr", creator); } diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/DataRouterUtilsTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/DataRouterUtilsTest.java index c308840..0451543 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/DataRouterUtilsTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/DataRouterUtilsTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019 - 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,8 +56,7 @@ import utils.EventUtils; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; - -@PowerMockIgnore({"org.apache.http.conn.ssl.*", "javax.net.ssl.*" , "javax.crypto.*"}) +@PowerMockIgnore({"org.apache.http.conn.ssl.*", "javax.net.ssl.*" , "javax.crypto.*", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @PrepareForTest(RequestSender.class) @RunWith(PowerMockRunner.class) public class DataRouterUtilsTest { diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverterTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverterTest.java index c3412eb..6d38d19 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverterTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverterTest.java @@ -23,29 +23,27 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock;
import io.undertow.server.HttpServerExchange;
-import java.io.StringWriter;
import java.util.HashMap;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mockito;
import org.onap.dcaegen2.services.pmmapper.exceptions.MappingException;
import org.onap.dcaegen2.services.pmmapper.model.Event;
import org.onap.dcaegen2.services.pmmapper.model.EventMetadata;
import org.onap.dcaegen2.services.pmmapper.model.measurement.lte.MeasCollecFile;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest({JAXBContext.class})
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.parsers.*", "org.xml.*", "javax.management.*"})
public class MeasConverterTest {
-
private MeasConverter objUnderTest;
@Before
@@ -56,15 +54,10 @@ public class MeasConverterTest { public void convertToString_throws_mappingException() throws Exception {
MeasCollecFile file = new MeasCollecFile();
PowerMockito.mockStatic(JAXBContext.class);
- Marshaller marshallerMock = PowerMockito.mock(Marshaller.class);
JAXBContext jaxbContext = PowerMockito.mock(JAXBContext.class);
- StringWriter w = Mockito.mock(StringWriter.class);
- PowerMockito.whenNew(StringWriter.class).withNoArguments().thenReturn(w);
PowerMockito.when(JAXBContext.newInstance(MeasCollecFile.class)).thenReturn(jaxbContext);
- PowerMockito.when(jaxbContext.createMarshaller()).thenReturn(marshallerMock);
PowerMockito.doThrow(new JAXBException("",""))
- .when(marshallerMock).marshal( Mockito.any(MeasCollecFile.class)
- ,Mockito.any(StringWriter.class));
+ .when(jaxbContext).createMarshaller();
assertThrows(MappingException.class, () -> {
objUnderTest.convert(file);
diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasSplitterTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasSplitterTest.java index 82921e6..120bea1 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasSplitterTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasSplitterTest.java @@ -38,7 +38,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
-import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.onap.dcaegen2.services.pmmapper.model.Event;
import org.onap.dcaegen2.services.pmmapper.model.EventMetadata;
@@ -96,6 +95,6 @@ class MeasSplitterTest { Event testEvent = EventUtils.makeMockEvent(EventUtils.fileContentsToString(testEventPath), metadata);
return Arguments.of(numberOfEvents, measInfoIds, testEvent);
};
- return EventUtils.generateEventArguments(Paths.get(baseDir), "/nr", splitterCreator);
+ return EventUtils.generateEventArguments(Paths.get(baseDir), "nr", splitterCreator);
}
}
diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSenderTests.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSenderTests.java index c9f2998..08faf4a 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSenderTests.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSenderTests.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ import org.mockserver.verify.VerificationTimes; import org.onap.dcaegen2.services.pmmapper.utils.RequestSender; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import ch.qos.logback.classic.spi.ILoggingEvent; @@ -49,7 +50,7 @@ import utils.LoggingUtils; @RunWith(PowerMockRunner.class) @PrepareForTest(RequestSender.class) - +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) public class RequestSenderTests { private static ClientAndServer mockServer; private MockServerClient client = mockClient(); diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/XMLValidatorTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/XMLValidatorTest.java index cc39563..655fc7a 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/XMLValidatorTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/XMLValidatorTest.java @@ -102,6 +102,6 @@ class XMLValidatorTest { EventUtils.fileContentsToString(testEventPath), metadata, new HashMap<>(), ""); return Arguments.of(valid, testEvent); }; - return EventUtils.generateEventArguments(dataDirectory, "/nr", creator); + return EventUtils.generateEventArguments(dataDirectory, "nr", creator); } } diff --git a/version.properties b/version.properties index 4562779..ef20baa 100644 --- a/version.properties +++ b/version.properties @@ -1,6 +1,6 @@ major=1 minor=3 -patch=1 +patch=2 base_version=${major}.${minor}.${patch} release_version=${base_version} -snapshot_version=${base_version}-SNAPSHOT
\ No newline at end of file +snapshot_version=${base_version}-SNAPSHOT |