remove powermock dependency from pom xmls 87/107887/2
authorRodrigo Lima <rodrigo.lima@yoppworks.com>
Tue, 19 May 2020 16:10:17 +0000 (12:10 -0400)
committerRodrigo Lima <rodrigo.lima@yoppworks.com>
Tue, 19 May 2020 21:17:52 +0000 (17:17 -0400)
- Remove powermock from pom xml files
- Remove powermock from ActivityLogManagerFactoryImplTest

Issue-ID: SDC-3071
Signed-off-by: Rodrigo Lima <rodrigo.lima@yoppworks.com>
Change-Id: I4c4b8b0751f4ce8895617a951429111fc08d8e2e

16 files changed:
asdctool/pom.xml
catalog-be/pom.xml
catalog-model/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/externaltesting-rest/externaltesting-rest-services/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml
openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml
openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImpl.java
openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogDaoStub.java [moved from openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogDaoStub.java with 100% similarity]
openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImplTest.java [moved from openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImplTest.java with 52% similarity]
openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerImplTest.java [moved from openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerImplTest.java with 89% similarity]
openecomp-be/backend/openecomp-sdc-security-util/pom.xml
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml
openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/pom.xml
openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml
pom.xml

index e6ff5c6..b685620 100644 (file)
       <groupId>io.netty</groupId>
       <artifactId>netty-handler</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
index a74d594..7f34e15 100644 (file)
           <artifactId>slf4j-log4j12</artifactId>
           <groupId>org.slf4j</groupId>
         </exclusion>
-        <exclusion>
-          <artifactId>powermock-api-mockito</artifactId>
-          <groupId>org.powermock</groupId>
-        </exclusion>
         <exclusion>
           <groupId>org.onap.aaf.authz</groupId>
           <artifactId>aaf-cadi-aaf</artifactId>
index 5fd10f7..0513136 100644 (file)
       <version>${commons-jci-core.version}</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-api-mockito-common</artifactId>
-      <version>1.7.4</version>
-      <scope>test</scope>
-    </dependency>
 
     <dependency>
       <groupId>org.codehaus.groovy</groupId>
index 036a072..184ed4c 100644 (file)
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4-common</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-api-mockito2</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.openecomp.sdc</groupId>
       <artifactId>openecomp-sdc-externaltesting-impl</artifactId>
index 1c4e61d..6cd5727 100644 (file)
       <artifactId>unique-type-rest-types</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4-common</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-api-mockito2</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
 
index 5dd93c3..ca548b4 100644 (file)
       <version>${project.version}</version>
       <scope>runtime</scope>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4-common</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-api-mockito2</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
 
index 82d5ae1..c1dd5d0 100644 (file)
@@ -20,8 +20,16 @@ import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
 import org.openecomp.sdc.activitylog.dao.ActivityLogDaoFactory;
 
 public class ActivityLogManagerFactoryImpl extends ActivityLogManagerFactory {
-  private static final ActivityLogManager INSTANCE =
-      new ActivityLogManagerImpl(ActivityLogDaoFactory.getInstance().createInterface());
+  private final ActivityLogManager INSTANCE;
+
+
+  public ActivityLogManagerFactoryImpl() {
+    this.INSTANCE = new ActivityLogManagerImpl(ActivityLogDaoFactory.getInstance().createInterface());
+  }
+
+  ActivityLogManagerFactoryImpl(ActivityLogManager activityLogManager) {
+    this.INSTANCE = activityLogManager;
+  }
 
   @Override
   public ActivityLogManager createInterface() {
 
 package org.openecomp.sdc.activitylog.impl;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
+import org.junit.jupiter.api.Test;
+import static org.mockito.Mockito.mock;
 import org.openecomp.sdc.activitylog.ActivityLogManager;
-import org.openecomp.sdc.activitylog.dao.ActivityLogDao;
-import org.openecomp.sdc.activitylog.dao.ActivityLogDaoFactory;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.MockitoAnnotations.initMocks;
-import static org.powermock.api.mockito.PowerMockito.when;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(ActivityLogDaoFactory.class)
 public class ActivityLogManagerFactoryImplTest {
 
-    @Mock
-    ActivityLogDaoFactory activityLogDaoFactory;
-    @Mock
-    ActivityLogDao activityLogDao;
-
-    @Before
-    public void setUp(){
-        initMocks(this);
-        PowerMockito.mockStatic(ActivityLogDaoFactory.class);
-        when(ActivityLogDaoFactory.getInstance()).thenReturn(activityLogDaoFactory);
-        when(activityLogDaoFactory.createInterface()).thenReturn(activityLogDao);
-
-    }
-
     @Test
     public void createInterfaceTest(){
-        ActivityLogManager activityLogManager = new ActivityLogManagerFactoryImpl().createInterface();
+        ActivityLogManager activityLogManager =
+            new ActivityLogManagerFactoryImpl(mock(ActivityLogManager.class)).createInterface();
         assertNotNull(activityLogManager);
     }
 }
@@ -20,9 +20,8 @@
 
 package org.openecomp.sdc.activitylog.impl;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
 import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
 import org.openecomp.sdc.versioning.dao.types.Version;
 
@@ -33,18 +32,11 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
 
 public class ActivityLogManagerImplTest {
     private ActivityLogManagerImpl activityLogManager;
 
-    @Mock
-    private ActivityLogDaoStub activityLogDao;
-
-    @Before
-    public void setUp(){
-        initMocks(this);
-    }
+    private ActivityLogDaoStub activityLogDao = Mockito.mock(ActivityLogDaoStub.class);
 
     @Test
     public void logActivityTest(){
index dc114db..d9370ac 100644 (file)
       <scope>test</scope>
     </dependency>
 
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>junit</groupId>
-          <artifactId>junit</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-api-mockito2</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
 
   </dependencies>
 
index 26030ed..7b23506 100644 (file)
       <artifactId>openecomp-sdc-activity-log-manager</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4-common</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-api-mockito2</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.openecomp.sdc</groupId>
       <artifactId>openecomp-sdc-activity-log-api</artifactId>
index c87b3e5..8daff53 100644 (file)
       <version>${servlet-api.version}</version>
       <scope>provided</scope>
     </dependency>
-    <!-- testing -->
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-api-mockito2</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.projectlombok</groupId>
       <artifactId>lombok</artifactId>
index 4a324b1..938787c 100644 (file)
       <version>${easymock.version}</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-api-easymock</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-core</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
 </project>
index 3a8413a..15b3a6a 100644 (file)
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>${powermock.version}</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
 </project>
diff --git a/pom.xml b/pom.xml
index c7e972a..798ab3a 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -106,7 +106,6 @@ Modifications copyright (c) 2018-2019 Nokia
     <commons-jci-core.version>1.1</commons-jci-core.version>
 
     <!--TESTING-->
-    <powermock.version>2.0.7</powermock.version>
     <mockito.version>3.3.3</mockito.version>
     <mockitoJupiter.version>3.3.3</mockitoJupiter.version>
     <jmockit.version>1.35</jmockit.version>