diff options
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category')
2 files changed, 24 insertions, 26 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFuncTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFuncTest.java index 4c0a672f29..5db9c26c3e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFuncTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFuncTest.java @@ -30,11 +30,8 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.auditing.api.AuditEventFactory; import org.openecomp.sdc.be.auditing.impl.AuditingManager; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.impl.AuditingDao; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; import org.openecomp.sdc.be.resources.data.auditing.CategoryEvent; @@ -44,10 +41,20 @@ import org.openecomp.sdc.test.utils.TestConfigurationProvider; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.*; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.CATEGORY; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DESCRIPTION; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_ADD_CATEGORY_LOG_STR; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.GROUPING_NAME; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.MODIFIER_UID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.REQUEST_ID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.RESOURCE_TYPE; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.SERVICE_INSTANCE_ID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.STATUS_OK; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.SUB_CATEGORY; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.modifier; @RunWith(MockitoJUnitRunner.class) public class AuditCategoryEventFuncTest { @@ -55,18 +62,14 @@ public class AuditCategoryEventFuncTest { @Mock private static AuditCassandraDao cassandraDao; - @Mock - private static AuditingDao auditingDao; - @Mock - private static Configuration.ElasticSearchConfig esConfig; @Captor private ArgumentCaptor<CategoryEvent> eventCaptor; @Before public void setUp() { - init(esConfig); - auditingManager = new AuditingManager(auditingDao, cassandraDao, new TestConfigurationProvider()); + init(); + auditingManager = new AuditingManager(cassandraDao, new TestConfigurationProvider()); ThreadLocalsHolder.setUuid(REQUEST_ID); } @@ -82,8 +85,6 @@ public class AuditCategoryEventFuncTest { .build(), modifier, CATEGORY, SUB_CATEGORY, GROUPING_NAME, RESOURCE_TYPE); - when(auditingDao.addRecord(any(AuditingGenericEvent.class), eq(AuditingActionEnum.ADD_CATEGORY.getAuditingEsType()))) - .thenReturn(ActionStatus.OK); when(cassandraDao.saveRecord(any(AuditingGenericEvent.class))).thenReturn(CassandraOperationStatus.OK); assertThat(auditingManager.auditEvent(builder)).isEqualTo(EXPECTED_ADD_CATEGORY_LOG_STR); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditGetCategoryHierarchyEventTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditGetCategoryHierarchyEventTest.java index f887355f37..6672e1a0a9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditGetCategoryHierarchyEventTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditGetCategoryHierarchyEventTest.java @@ -30,11 +30,8 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.auditing.api.AuditEventFactory; import org.openecomp.sdc.be.auditing.impl.AuditingManager; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.impl.AuditingDao; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; import org.openecomp.sdc.be.resources.data.auditing.GetCategoryHierarchyEvent; @@ -43,10 +40,16 @@ import org.openecomp.sdc.test.utils.TestConfigurationProvider; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.*; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DESCRIPTION; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_GET_CATEGORY_HIERARCHY_LOG_STR; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.REQUEST_ID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.STATUS_OK; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_DETAILS; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_UID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.user; @RunWith(MockitoJUnitRunner.class) public class AuditGetCategoryHierarchyEventTest { @@ -54,17 +57,13 @@ public class AuditGetCategoryHierarchyEventTest { private static AuditCassandraDao cassandraDao; @Captor private ArgumentCaptor<GetCategoryHierarchyEvent> eventCaptor; - @Mock - private static AuditingDao auditingDao; - @Mock - private Configuration.ElasticSearchConfig esConfig; private AuditingManager auditingManager; @Before public void setUp() { - init(esConfig); - auditingManager = new AuditingManager(auditingDao, cassandraDao, new TestConfigurationProvider()); + init(); + auditingManager = new AuditingManager(cassandraDao, new TestConfigurationProvider()); } @Test @@ -76,8 +75,6 @@ public class AuditGetCategoryHierarchyEventTest { .requestId(REQUEST_ID) .build(), user, USER_DETAILS); - when(auditingDao.addRecord(any(AuditingGenericEvent.class), eq(AuditingActionEnum.GET_CATEGORY_HIERARCHY.getAuditingEsType()))) - .thenReturn(ActionStatus.OK); when(cassandraDao.saveRecord(any(AuditingGenericEvent.class))).thenReturn(CassandraOperationStatus.OK); assertThat(auditingManager.auditEvent(factory)).isEqualTo(EXPECTED_GET_CATEGORY_HIERARCHY_LOG_STR); |