diff options
author | 2020-06-22 14:01:13 +0100 | |
---|---|---|
committer | 2020-06-23 08:34:15 +0100 | |
commit | d5270c6f32111b0687911e85ab7d025f15360ba1 (patch) | |
tree | 03151bdf554f8260e095eaa3dbf1c2140bf7e4d4 /src/test | |
parent | 5479d1fa917c37510839849d9f74d96aab5fb4fb (diff) |
Migrate to Java 11
Issue-ID: DCAEGEN2-2282
Signed-off-by: JoeOLeary <joseph.o.leary@est.tech>
Change-Id: Iadd6cb2ede9b900ce5b83afcb68dab8ae27e54f9
Diffstat (limited to 'src/test')
7 files changed, 15 insertions, 19 deletions
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); } } |