From: seanfos Date: Tue, 13 Apr 2021 10:19:14 +0000 (-0700) Subject: MR Java 11 Uplift X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fmessagerouter%2Fmsgrtr.git;a=commitdiff_plain;h=bb5750720e2fd6ca11194521b99be563ef02b820 MR Java 11 Uplift Signed-off-by: seanfos Change-Id: I0da010ebc43b18222c1153ebf4478eacd740f65d Issue-ID: DMAAP-1385 --- diff --git a/.gitignore b/.gitignore index 0f63015..ab7b50b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ /target/ /bin/ +logs +debug-logs +.idea +.project +msgrtr.iml \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7b738ba..e0a5212 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ org.onap.oparent oparent - 2.1.0 + 3.2.0 @@ -42,8 +42,8 @@ 3.0.4 1.2 2.13.3 - 1.7 - 1.7 + 11 + 11 UTF-8 https://nexus.onap.org java @@ -102,12 +102,12 @@ ch.qos.logback logback-core - 1.2.0 + 1.2.3 ch.qos.logback logback-classic - 1.2.0 + 1.2.3 org.grails @@ -194,7 +194,7 @@ junit junit - 4.11 + 4.12 test @@ -213,7 +213,7 @@ org.slf4j slf4j-api - 1.7.6 + 1.7.28 @@ -252,22 +252,22 @@ org.springframework spring-expression - 4.3.18.RELEASE + 5.2.10.RELEASE org.springframework spring-webmvc - 5.2.3.RELEASE + 5.2.10.RELEASE org.springframework spring-core - 4.3.18.RELEASE + 5.2.10.RELEASE javax.servlet javax.servlet-api - 3.0.1 + 4.0.1 provided @@ -282,7 +282,7 @@ org.json json - 20131018 + 20160810 @@ -299,14 +299,27 @@ com.google.guava guava - 23.6.1-jre + 30.1.1-jre com.att.eelf eelf-core - 0.0.1 - compile + 1.0.0 + + + org.mockito + mockito-core + + + org.powermock + powermock-module-junit4 + + + org.powermock + powermock-api-mockito + + @@ -350,6 +363,18 @@ + + javax.annotation + javax.annotation-api + 1.3.2 + + + javax.xml.bind + jaxb-api + 2.3.1 + + + @@ -411,45 +436,54 @@ com.fasterxml.jackson.core jackson-core - 2.8.11 + 2.12.2 test - com.fasterxml.jackson.core jackson-databind - 2.11.2 + 2.12.2 - org.powermock - powermock-api-mockito - 1.6.4 + powermock-module-junit4 + 2.0.7 test - org.powermock - powermock-module-junit4 - 1.6.4 + powermock-core + 2.0.7 test - org.powermock powermock-module-junit4-rule - 1.6.4 + 2.0.7 test - org.mockito - mockito-core - 1.10.19 + org.powermock + powermock-api-support + 2.0.7 test - + + org.powermock + powermock-api-mockito2 + 2.0.7 + + + org.apache.commons + commons-lang3 + 3.8.1 + + + commons-lang + commons-lang + 2.6 + - DMaaP @@ -464,12 +498,12 @@ maven-checkstyle-plugin - 2.17 + 3.1.2 org.onap.oparent checkstyle - 2.0.0 + 3.0.0 @@ -484,11 +518,11 @@ false true false - ${project.build.sourceDirectory} + ${project.build.sourceDirectory} true - false + false @@ -503,14 +537,14 @@ with minor changes --> onap-checkstyle/onap-java-style.xml - ${project.build.sourceDirectory} + ${project.build.sourceDirectory} true true true true - false + false @@ -559,12 +593,23 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12.4 + 3.0.0-M5 - + + --illegal-access=permit + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + --illegal-access=permit + diff --git a/src/test/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImplTest.java b/src/test/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImplTest.java index f9178e1..09361db 100644 --- a/src/test/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImplTest.java +++ b/src/test/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImplTest.java @@ -24,11 +24,11 @@ import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; @@ -62,7 +62,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.dmaap.dmf.mr.CambriaApiException; import org.onap.dmaap.dmf.mr.backends.Consumer; import org.onap.dmaap.dmf.mr.backends.ConsumerFactory; @@ -81,7 +81,7 @@ import org.onap.dmaap.dmf.mr.utils.ConfigurationReader; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.Silent.class) public class EventsServiceImplTest { private InputStream iStream = null; @@ -118,6 +118,7 @@ public class EventsServiceImplTest { private MockHttpServletRequest request; + @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); @@ -187,7 +188,7 @@ public class EventsServiceImplTest { when(configurationReader.getfConsumerFactory()).thenReturn(factory); when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey); doThrow(new UnavailableException("Could not acquire consumer lock")).when(factory) - .getConsumerFor(eq(topicName), eq(consumerGroup), eq(clientId), anyInt(), anyString()); + .getConsumerFor(eq(topicName), eq(consumerGroup), eq(clientId), anyInt(), anyString()); thrown.expect(CambriaApiException.class); thrown.expectMessage(containsString(String.valueOf(HttpStatus.SC_SERVICE_UNAVAILABLE))); @@ -252,8 +253,8 @@ public class EventsServiceImplTest { String consumerGroup = "CG5"; String clientId = "7"; givenConfiguredWithMocks(metricsTopicName); - when(factory.getConsumerFor(eq(metricsTopicName), eq(consumerGroup), eq(clientId), anyInt(), anyString())) - .thenReturn(consumer); + when(factory.getConsumerFor(eq(metricsTopicName), eq(consumerGroup), eq(clientId), anyInt(), any())) + .thenReturn(consumer); doNothing().when(eventsService).respondOkWithStream(eq(dMaapContext), any(CambriaOutboundEventStream.class)); //when @@ -267,7 +268,7 @@ public class EventsServiceImplTest { @Test public void getEvents_shouldNotAuthorizeClient_whenTopicNoteEnforcedWithAaf_andTopicHasNoOwnerSet() - throws Exception { + throws Exception { //given String topicName = "someSimpleTopicName"; String consumerGroup = "CG5"; @@ -276,8 +277,8 @@ public class EventsServiceImplTest { when(permittedRequest.getHeaders(anyString())).thenReturn(Collections.emptyEnumeration()); dMaapContext.setRequest(permittedRequest); givenConfiguredWithMocks(topicName); - when(factory.getConsumerFor(eq(topicName), eq(consumerGroup), eq(clientId), anyInt(), anyString())) - .thenReturn(consumer); + when(factory.getConsumerFor(eq(topicName), eq(consumerGroup), eq(clientId), anyInt(), any())) + .thenReturn(consumer); doNothing().when(eventsService).respondOkWithStream(eq(dMaapContext), any(CambriaOutboundEventStream.class)); when(createdTopic.getOwner()).thenReturn(Strings.EMPTY); @@ -292,7 +293,7 @@ public class EventsServiceImplTest { @Test public void getEvents_shouldFailDmaapAuthorization_whenTopicOwnerIsSet_andUserHasNoReadPermissionToTopic() - throws Exception { + throws Exception { //given String topicName = "someSimpleTopicName"; String consumerGroup = "CG5"; @@ -302,7 +303,7 @@ public class EventsServiceImplTest { dMaapContext.setRequest(permittedRequest); givenConfiguredWithMocks(topicName); when(factory.getConsumerFor(eq(topicName), eq(consumerGroup), eq(clientId), anyInt(), anyString())) - .thenReturn(consumer); + .thenReturn(consumer); doNothing().when(eventsService).respondOkWithStream(eq(dMaapContext), any(CambriaOutboundEventStream.class)); when(createdTopic.getOwner()).thenReturn("SimpleTopicOwner"); when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey); @@ -335,7 +336,7 @@ public class EventsServiceImplTest { givenConfiguredWithMocks(topicName); givenConfiguredWithProperties(messageLimit, timeout, meta, pretty, cacheEnabled); when(factory.getConsumerFor(eq(topicName), eq(consumerGroup), eq(clientId), anyInt(), anyString())) - .thenReturn(consumer); + .thenReturn(consumer); givenUserAuthorizedWithAAF(request, topicName, "sub"); //when @@ -355,7 +356,7 @@ public class EventsServiceImplTest { } private void givenConfiguredWithProperties(String messageLimit, String timeout, String meta, String pretty, - String cacheEnabled) { + String cacheEnabled) { when(eventsService.getPropertyFromAJSCmap("meta")).thenReturn(meta); when(eventsService.getPropertyFromAJSCmap("pretty")).thenReturn(pretty); when(eventsService.getPropertyFromAJSCmap(ConsumerFactory.kSetting_EnableCache)).thenReturn(cacheEnabled); @@ -373,7 +374,7 @@ public class EventsServiceImplTest { } private void verifyInvocationOrderForSuccessCase(String topicName, String consumerGroup, String clientId, - ArgumentCaptor osWriter) throws Exception { + ArgumentCaptor osWriter) throws Exception { InOrder inOrder = Mockito.inOrder(configurationReader, factory, metrics, limiter, consumer, eventsService); inOrder.verify(configurationReader).getfMetrics(); @@ -402,11 +403,11 @@ public class EventsServiceImplTest { } - + @Test public void pushEvents_shouldFailDmaapAuthorization_whenTopicOwnerIsSet_andUserHasNoWritePermissionToTopic() - throws Exception { + throws Exception { //given String topicName = "someSimpleTopicName"; @@ -431,7 +432,7 @@ public class EventsServiceImplTest { @Test public void pushEvents_shouldFailOnAafAuthorization_whenCadiIsEnabled_topicNameEnforced_andUserHasNoPermission() - throws Exception { + throws Exception { //given String topicPrefix = "org.onap.aaf.enforced"; String topicName = topicPrefix + ".topicName"; @@ -479,7 +480,7 @@ public class EventsServiceImplTest { String topicName = "topicWithoutTransaction"; givenConfiguredWithMocks(topicName); doThrow(new IOException()).when(publisher) - .sendBatchMessageNew(eq(topicName), Mockito.>>any()); + .sendBatchMessageNew(eq(topicName), Mockito.>>any()); thrown.expect(CambriaApiException.class); thrown.expectMessage(containsString(String.valueOf(HttpStatus.SC_NOT_FOUND))); @@ -527,7 +528,7 @@ public class EventsServiceImplTest { doNothing().when(eventsService).respondOk(eq(dMaapContext), any(JSONObject.class)); request.addUserRole("org.onap.dmaap.mr.topic|:topic." + topicName + "|pub"); doThrow(new IOException()).when(publisher) - .sendBatchMessageNew(eq(topicName), Mockito.>>any()); + .sendBatchMessageNew(eq(topicName), Mockito.>>any()); thrown.expect(CambriaApiException.class); thrown.expectMessage(containsString(String.valueOf(HttpStatus.SC_NOT_FOUND))); @@ -556,7 +557,7 @@ public class EventsServiceImplTest { //then ArgumentCaptor captor = ArgumentCaptor.forClass(JSONObject.class); verify(publisher) - .sendBatchMessageNew(eq(metricsTopicName), Mockito.>>any()); + .sendBatchMessageNew(eq(metricsTopicName), Mockito.>>any()); verify(eventsService).respondOk(eq(dMaapContext), captor.capture()); verify(permittedRequest, never()).isUserInRole(anyString()); verify(createdTopic, never()).checkUserWrite(any(NsaSimpleApiKey.class)); diff --git a/src/test/java/org/onap/dmaap/dmf/mr/service/impl/TopicServiceImplTest.java b/src/test/java/org/onap/dmaap/dmf/mr/service/impl/TopicServiceImplTest.java index f287e8c..da5be91 100644 --- a/src/test/java/org/onap/dmaap/dmf/mr/service/impl/TopicServiceImplTest.java +++ b/src/test/java/org/onap/dmaap/dmf/mr/service/impl/TopicServiceImplTest.java @@ -23,12 +23,12 @@ package org.onap.dmaap.dmf.mr.service.impl; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.contains; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.contains; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; @@ -36,11 +36,13 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; +import com.att.ajsc.filemonitor.AJSCPropertiesMap; import com.att.nsa.configs.ConfigDbException; import com.att.nsa.security.NsaAcl; import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException; import com.att.nsa.security.db.simple.NsaSimpleApiKey; import java.io.IOException; +import java.nio.file.attribute.UserPrincipal; import java.util.Arrays; import java.util.HashSet; import javax.servlet.ServletOutputStream; @@ -56,7 +58,10 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.MockitoRule; +import org.mockito.quality.Strictness; import org.onap.dmaap.dmf.mr.CambriaApiException; import org.onap.dmaap.dmf.mr.beans.DMaaPContext; import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker; @@ -68,10 +73,13 @@ import org.onap.dmaap.dmf.mr.metabroker.Broker1; import org.onap.dmaap.dmf.mr.metabroker.Topic; import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator; import org.onap.dmaap.dmf.mr.utils.ConfigurationReader; -import sun.security.acl.PrincipalImpl; +import java.security.Principal; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.Silent.class) public class TopicServiceImplTest { @@ -130,9 +138,9 @@ public class TopicServiceImplTest { doNothing().when(topicService).respondOk(any(DMaaPContext.class),anyString()); doNothing().when(topicService).respondOk(any(DMaaPContext.class),any(JSONObject.class)); when(topicService.getPropertyFromAJSCbean("enforced.topic.name.AAF")) - .thenReturn("org.onap.dmaap.mr"); + .thenReturn("org.onap.dmaap.mr"); when(topicService.getPropertyFromAJSCmap("msgRtr.topicfactory.aaf")) - .thenReturn("org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:"); + .thenReturn("org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:"); } private void givenTopicBean(String topicName) { @@ -145,17 +153,18 @@ public class TopicServiceImplTest { public void createTopic_shouldSkipAAFAuthorization_whenCadiIsEnabled_andTopicNameNotEnforced() throws Exception { //given String topicName = "UNAUTHENTICATED.PRH.REGISTRATION"; - givenTopicBean(topicName); - when(dmaapKafkaMetaBroker.createTopic(eq(topicName), anyString(), anyString(), anyInt(), anyInt(), anyBoolean())) - .thenReturn(createdTopic); + when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), anyBoolean())) + .thenReturn(createdTopic); + + givenTopicBean(topicName); //when topicService.createTopic(dmaapContext, topicBean); //then - verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), anyString(), anyString(), anyInt(), anyInt(), - anyBoolean()); + verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), + anyBoolean()); verify(topicService).respondOk(eq(dmaapContext), any(JSONObject.class)); verify(httpServReq, never()).isUserInRole(TOPIC_CREATE_PEM); } @@ -166,15 +175,15 @@ public class TopicServiceImplTest { String topicName = "org.onap.dmaap.mr.topic-2"; givenTopicBean(topicName); - when(dmaapKafkaMetaBroker.createTopic(eq(topicName), anyString(), anyString(), anyInt(), anyInt(), anyBoolean())) - .thenReturn(createdTopic); + when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), anyBoolean())) + .thenReturn(createdTopic); //when topicService.createTopic(dmaapContext, topicBean); //then - verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), anyString(), anyString(), anyInt(), anyInt(), - anyBoolean()); + verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), + anyBoolean()); verify(topicService).respondOk(eq(dmaapContext), any(JSONObject.class)); verify(httpServReq, never()).isUserInRole(TOPIC_CREATE_PEM); } @@ -186,15 +195,15 @@ public class TopicServiceImplTest { givenTopicBean(topicName); doReturn(null).when(topicService).getDmaapAuthenticatedUser(dmaapContext); - when(dmaapKafkaMetaBroker.createTopic(eq(topicName), anyString(), anyString(), anyInt(), anyInt(), anyBoolean())) - .thenReturn(createdTopic); + when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), anyBoolean())) + .thenReturn(createdTopic); //when topicService.createTopic(dmaapContext, topicBean); //then - verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), anyString(), anyString(), anyInt(), anyInt(), - anyBoolean()); + verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), + anyBoolean()); verify(topicService).respondOk(eq(dmaapContext), any(JSONObject.class)); } @@ -204,18 +213,24 @@ public class TopicServiceImplTest { String topicName = "org.onap.dmaap.mr.topic-4"; givenTopicBean(topicName); + Principal user = new UserPrincipal(){ + @Override + public String getName(){ + return "user"; + } + }; when(topicService.isCadiEnabled()).thenReturn(true); when(httpServReq.isUserInRole(TOPIC_CREATE_PEM)).thenReturn(true); - when(httpServReq.getUserPrincipal()).thenReturn(new PrincipalImpl("user")); - when(dmaapKafkaMetaBroker.createTopic(eq(topicName), anyString(), eq("user"), anyInt(), anyInt(), anyBoolean())) - .thenReturn(createdTopic); + when(httpServReq.getUserPrincipal()).thenReturn(user); + when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), eq("user"), anyInt(), anyInt(), anyBoolean())) + .thenReturn(createdTopic); //when topicService.createTopic(dmaapContext, topicBean); //then verify(httpServReq).isUserInRole(TOPIC_CREATE_PEM); - verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), anyString(), eq("user"), anyInt(), anyInt(), anyBoolean()); + verify(dmaapKafkaMetaBroker).createTopic(eq(topicName), any(), eq("user"), anyInt(), anyInt(), anyBoolean()); verify(topicService).respondOk(eq(dmaapContext), any(JSONObject.class)); verify(topicService, never()).getDmaapAuthenticatedUser(dmaapContext); } @@ -228,12 +243,18 @@ public class TopicServiceImplTest { String topicName = "org.onap.dmaap.mr.topic-5"; givenTopicBean(topicName); + Principal user = new Principal(){ + @Override + public String getName(){ + return "user"; + } + }; when(topicService.isCadiEnabled()).thenReturn(true); when(httpServReq.isUserInRole(TOPIC_CREATE_PEM)).thenReturn(false); - when(httpServReq.getUserPrincipal()).thenReturn(new PrincipalImpl("user")); + when(httpServReq.getUserPrincipal()).thenReturn(user); when(dmaapKafkaMetaBroker.createTopic(eq(topicName), anyString(), eq("user"), anyInt(), anyInt(), anyBoolean())) - .thenReturn(createdTopic); + .thenReturn(createdTopic); //when topicService.createTopic(dmaapContext, topicBean); @@ -253,8 +274,8 @@ public class TopicServiceImplTest { String topicName = "org.onap.dmaap.mr.topic-6"; givenTopicBean(topicName); - when(dmaapKafkaMetaBroker.createTopic(eq(topicName), anyString(), anyString(), anyInt(), anyInt(), anyBoolean())) - .thenThrow(new ConfigDbException("fail")); + when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), any(), anyInt(), anyInt(), anyBoolean())) + .thenThrow(new ConfigDbException("fail")); //when topicService.createTopic(dmaapContext, topicBean); @@ -269,8 +290,8 @@ public class TopicServiceImplTest { String topicName = "org.onap.dmaap.mr.topic-7"; givenTopicBean(topicName); - when(dmaapKafkaMetaBroker.createTopic(eq(topicName), anyString(), anyString(), anyInt(), anyInt(), anyBoolean())) - .thenThrow(new Broker1.TopicExistsException("enfTopicNamePlusExtra")); + when(dmaapKafkaMetaBroker.createTopic(eq(topicName), any(), anyString(), anyInt(), anyInt(), anyBoolean())) + .thenThrow(new Broker1.TopicExistsException("enfTopicNamePlusExtra")); //when topicService.createTopic(dmaapContext, topicBean); @@ -351,7 +372,7 @@ public class TopicServiceImplTest { @Test(expected = TopicExistsException.class) public void testGetTopics_null_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException { + TopicExistsException, JSONException, ConfigDbException { Assert.assertNotNull(topicService); //PowerMockito.mockStatic(DMaaPResponseBuilder.class); @@ -368,7 +389,7 @@ public class TopicServiceImplTest { @Test public void testGetTopics_NonNull_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException { + TopicExistsException, JSONException, ConfigDbException { Assert.assertNotNull(topicService); //PowerMockito.mockStatic(DMaaPResponseBuilder.class); @@ -395,7 +416,7 @@ public class TopicServiceImplTest { @Test(expected = TopicExistsException.class) public void testGetPublishersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException, - IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -414,7 +435,7 @@ public class TopicServiceImplTest { @Test public void testGetPublishersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException, - IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -432,7 +453,7 @@ public class TopicServiceImplTest { @Test(expected = TopicExistsException.class) public void testGetConsumersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException, - IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -451,7 +472,7 @@ public class TopicServiceImplTest { @Test public void testGetConsumersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException, - IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -471,7 +492,7 @@ public class TopicServiceImplTest { @Test public void testGetPublishersByTopicName() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -496,7 +517,7 @@ public class TopicServiceImplTest { @Test(expected = TopicExistsException.class) public void testGetPublishersByTopicNameError() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -601,7 +622,7 @@ public class TopicServiceImplTest { @Test public void testPermitConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -626,8 +647,8 @@ public class TopicServiceImplTest { @Test(expected = TopicExistsException.class) public void testPermitConsumerForTopic_nulltopic() - throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + throws DMaaPAccessDeniedException, CambriaApiException, IOException, + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -652,7 +673,7 @@ public class TopicServiceImplTest { @Test public void testdenyConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -677,8 +698,8 @@ public class TopicServiceImplTest { @Test(expected = TopicExistsException.class) public void testdenyConsumerForTopic_nulltopic() - throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + throws DMaaPAccessDeniedException, CambriaApiException, IOException, + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -704,7 +725,7 @@ public class TopicServiceImplTest { @Test public void testPermitPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -729,8 +750,8 @@ public class TopicServiceImplTest { @Test(expected = TopicExistsException.class) public void testPermitPublisherForTopic_nulltopic() - throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + throws DMaaPAccessDeniedException, CambriaApiException, IOException, + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -755,7 +776,7 @@ public class TopicServiceImplTest { @Test public void testDenyPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -782,8 +803,8 @@ public class TopicServiceImplTest { @Test(expected = TopicExistsException.class) public void testDenyPublisherForTopic_nulltopic() - throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + throws DMaaPAccessDeniedException, CambriaApiException, IOException, + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -809,7 +830,7 @@ public class TopicServiceImplTest { @Test public void testGetAllTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -834,7 +855,7 @@ public class TopicServiceImplTest { @Test public void testGetTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException, - TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { + TopicExistsException, JSONException, ConfigDbException, AccessDeniedException { Assert.assertNotNull(topicService); @@ -859,3 +880,4 @@ public class TopicServiceImplTest { } + diff --git a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/Kafka011ConsumerTest.java b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/Kafka011ConsumerTest.java index 88d703e..3b9fbb3 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/Kafka011ConsumerTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/Kafka011ConsumerTest.java @@ -35,11 +35,13 @@ import org.onap.dmaap.dmf.mr.backends.kafka.Kafka011Consumer; import org.onap.dmaap.dmf.mr.backends.kafka.KafkaLiveLockAvoider2; import org.onap.dmaap.dmf.mr.constants.CambriaConstants; 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 com.att.ajsc.filemonitor.AJSCPropertiesMap; +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) @PrepareForTest({ AJSCPropertiesMap.class }) public class Kafka011ConsumerTest { diff --git a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaConsumerCacheTest.java b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaConsumerCacheTest.java index ced6fc4..de70a92 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaConsumerCacheTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaConsumerCacheTest.java @@ -32,6 +32,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -44,6 +45,7 @@ import org.onap.dmaap.dmf.mr.backends.kafka.KafkaConsumerCache.KafkaConsumerCach import org.onap.dmaap.dmf.mr.constants.CambriaConstants; import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl; +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) @PrepareForTest({ AJSCPropertiesMap.class }) public class KafkaConsumerCacheTest { diff --git a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaLiveLockAvoider2Test.java b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaLiveLockAvoider2Test.java index 71d50e8..7f81641 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaLiveLockAvoider2Test.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaLiveLockAvoider2Test.java @@ -40,9 +40,10 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.dmaap.dmf.mr.backends.kafka.KafkaLiveLockAvoider2; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.modules.junit4.PowerMockRunner; - +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) public class KafkaLiveLockAvoider2Test { diff --git a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaPublisherTest.java b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaPublisherTest.java index 8292c2c..e72b9d3 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaPublisherTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/KafkaPublisherTest.java @@ -39,12 +39,14 @@ import org.onap.dmaap.dmf.mr.beans.LogDetails; import org.onap.dmaap.dmf.mr.constants.CambriaConstants; import org.onap.dmaap.dmf.mr.utils.Utils; 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 com.att.ajsc.filemonitor.AJSCPropertiesMap; import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting; +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) @PrepareForTest({ Utils.class }) public class KafkaPublisherTest { diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/DMaaPKafkaMetaBrokerTest.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/DMaaPKafkaMetaBrokerTest.java index 0f4702a..a992104 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/DMaaPKafkaMetaBrokerTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/DMaaPKafkaMetaBrokerTest.java @@ -34,6 +34,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; 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; @@ -49,6 +50,7 @@ import com.att.nsa.configs.ConfigDb; import com.att.nsa.configs.ConfigDbException; import com.att.nsa.configs.ConfigPath; +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) @PrepareForTest({ AdminClient.class }) public class DMaaPKafkaMetaBrokerTest { diff --git a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/AdminServiceImplemTest.java b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/AdminServiceImplemTest.java index 1895ac6..3ef23f5 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/AdminServiceImplemTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/AdminServiceImplemTest.java @@ -44,9 +44,11 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; 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; +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) @PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class }) public class AdminServiceImplemTest { diff --git a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/ApiKeysServiceImplTest.java b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/ApiKeysServiceImplTest.java index a0ad709..322cf2a 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/ApiKeysServiceImplTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/ApiKeysServiceImplTest.java @@ -52,9 +52,11 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; 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; +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) @PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class }) public class ApiKeysServiceImplTest { diff --git a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/MMServiceImplTest.java b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/MMServiceImplTest.java index 20a8cad..5d1394f 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/MMServiceImplTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/MMServiceImplTest.java @@ -63,11 +63,13 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; 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 org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) @PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class, PropertiesMapBean.class, AJSCPropertiesMap.class }) diff --git a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/UIServiceImplTest.java b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/UIServiceImplTest.java index 2fbbec1..fe65b1b 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/UIServiceImplTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/UIServiceImplTest.java @@ -52,9 +52,11 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; 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; +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) @RunWith(PowerMockRunner.class) @PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class }) public class UIServiceImplTest {