diff options
Diffstat (limited to 'openecomp-be/backend')
7 files changed, 18 insertions, 97 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml index 5dd93c33f4..ca548b44e5 100644 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml @@ -46,24 +46,6 @@ <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> diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImpl.java index 82d5ae10d7..c1dd5d0a75 100644 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImpl.java +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImpl.java @@ -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() { diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogDaoStub.java b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogDaoStub.java index 4f311775bc..4f311775bc 100644 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogDaoStub.java +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogDaoStub.java diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImplTest.java b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImplTest.java index c00bcc3b54..4784d54862 100644 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImplTest.java @@ -20,42 +20,18 @@ 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); } } diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerImplTest.java index 0ce6098c61..44a4b20cc9 100644 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/test/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerImplTest.java @@ -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(){ diff --git a/openecomp-be/backend/openecomp-sdc-security-util/pom.xml b/openecomp-be/backend/openecomp-sdc-security-util/pom.xml index dc114db09f..d9370ac6af 100644 --- a/openecomp-be/backend/openecomp-sdc-security-util/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-security-util/pom.xml @@ -62,25 +62,6 @@ <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> diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml index 26030edc44..7b23506bac 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml @@ -161,24 +161,6 @@ <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> <version>${project.version}</version> |