summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common-test/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-BE-common-test/src/main')
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCatalogItemTest.java35
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCategoryFunctionsItemTest.java42
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppContactUsItemTest.java49
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/SearchResultItemTest.java41
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImplTest.java28
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImplTest.java30
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppCatalogControllerTest.java263
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppContactUsControllerTest.java274
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerExternalRequestTest.java263
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerTest.java914
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AuditLogControllerTest.java102
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BEPropertyReaderControllerTest.java72
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BasicAuthAccountControllerTest.java254
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/CommonWidgetControllerTest.java84
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ConsulClientControllerTest.java142
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardControllerTest.java427
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardSearchResultControllerTest.java366
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/EPFusionBaseControllerTest.java64
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAccessRolesControllerTest.java509
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAppsRestfulControllerTest.java174
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/FunctionalMenuControllerTest.java506
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/GetAccessControllerTest.java71
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ManifestControllerTest.java56
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java223
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceProxyControllerTest.java106
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/PortalAdminControllerTest.java155
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RoleManageControllerTest.java189
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RolesApprovalSystemControllerTest.java323
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SchedulerControllerTest.java75
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SessionCommunicationControllerTest.java59
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/TicketEventControllerTest.java99
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserControllerTest.java137
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserNotificationControllerTest.java263
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRolesControllerTest.java308
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WebAnalyticsExtAppControllerTest.java110
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogController.java111
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java72
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/MockEPUser.java84
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/PopulateSampleTestData.java66
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RemoveSampleTestData.java65
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RestURLsTestSuite.java333
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java36
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java57
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java32
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java31
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java27
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java61
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java29
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java27
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java36
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java32
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java54
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java28
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java85
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java29
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java43
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java34
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java114
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java36
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java33
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java31
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java59
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java27
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java23
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java28
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java29
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java57
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java31
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java35
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java36
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java29
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java36
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java29
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java33
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java84
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java33
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java34
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/ApplicationCommonContextTestSuite.java175
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/MockitoTestSuite.java70
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/AppContactUsServiceImplTest.java147
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/DashboardSearchServiceImplTest.java114
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceCentralizedImplTest.java89
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceImplTest.java98
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleServiceImplTest.java208
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ExternalAccessRolesServiceImplTest.java346
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuMockServiceImplTest.java205
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuServiceImplTest.java73
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/GetAccessServiceImplTest.java50
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/LicenseableClassImplTest.java61
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ManifestServiceImplTest.java55
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/PersUserAppServiceImplTest.java181
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java33
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java25
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java38
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java32
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java46
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java35
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java37
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java26
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java26
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java102
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java63
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java41
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java52
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java47
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java29
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java29
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java41
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java41
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java33
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java33
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java64
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java46
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java31
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java39
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java42
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java35
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java26
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java47
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java24
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java35
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java42
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java40
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java65
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java37
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java58
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java19
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java25
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/exceptions/NoHealthyServiceExceptionTest.java23
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/ApplicationCommonContextTestSuite.java175
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/MockitoTestSuite.java70
-rw-r--r--ecomp-portal-BE-common-test/src/main/resources/PopulateTestData.sql32
-rw-r--r--ecomp-portal-BE-common-test/src/main/resources/RemoveTestData.sql31
133 files changed, 0 insertions, 12689 deletions
diff --git a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCatalogItemTest.java b/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCatalogItemTest.java
deleted file mode 100644
index 6fb89146..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCatalogItemTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.openecomp.portalapp.portal.ecomp.test.model;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem;
-
-public class AppCatalogItemTest {
-
- public AppCatalogItem mockAppCatalogItem(){
- AppCatalogItem appCatalogItem = new AppCatalogItem();
-
- appCatalogItem.setAlternateUrl("test");
- appCatalogItem.setMlAppName("test");
-
- return appCatalogItem;
- }
-
- @Test
- public void appCatalogItemTest(){
- AppCatalogItem appCatalogItem = mockAppCatalogItem();
-
- AppCatalogItem appCatalogItem1 = new AppCatalogItem();
- appCatalogItem1.setAlternateUrl("test");
- appCatalogItem1.setMlAppName("test");
-
- assertEquals(appCatalogItem.getAlternateUrl(), appCatalogItem1.getAlternateUrl());
- assertEquals(appCatalogItem.getMlAppName(), appCatalogItem1.getMlAppName());
-
- assertEquals(appCatalogItem.toString(), "AppCatalogItem [id=null, name=null, access=null, select=null, pending=null]");
- assertEquals(appCatalogItem.hashCode(), appCatalogItem1.hashCode());
- assertTrue(appCatalogItem.equals(appCatalogItem1));
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCategoryFunctionsItemTest.java b/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCategoryFunctionsItemTest.java
deleted file mode 100644
index 74e74b37..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCategoryFunctionsItemTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.openecomp.portalapp.portal.ecomp.test.model;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem;
-
-public class AppCategoryFunctionsItemTest {
-
- public AppCategoryFunctionsItem mockAppCategoryFunctionsItem(){
- AppCategoryFunctionsItem appCategoryFunctionsItem = new AppCategoryFunctionsItem();
-
- appCategoryFunctionsItem.setRowId("test");
- appCategoryFunctionsItem.setAppId("test");
- appCategoryFunctionsItem.setApplication("test");
- appCategoryFunctionsItem.setFunctions("test");
-
- return appCategoryFunctionsItem;
- }
-
- @Test
- public void appCategoryFunctionsItemTest(){
- AppCategoryFunctionsItem appCategoryFunctionsItem = mockAppCategoryFunctionsItem();
-
- AppCategoryFunctionsItem appCategoryFunctionsItem1 = new AppCategoryFunctionsItem();
-
- appCategoryFunctionsItem1.setRowId("test");
- appCategoryFunctionsItem1.setAppId("test");
- appCategoryFunctionsItem1.setApplication("test");
- appCategoryFunctionsItem1.setFunctions("test");
-
- assertEquals(appCategoryFunctionsItem.getRowId(), appCategoryFunctionsItem1.getRowId());
- assertEquals(appCategoryFunctionsItem.getAppId(), appCategoryFunctionsItem1.getAppId());
- assertEquals(appCategoryFunctionsItem.getApplication(), appCategoryFunctionsItem1.getApplication());
- assertEquals(appCategoryFunctionsItem.getFunctions(), appCategoryFunctionsItem1.getFunctions());
- assertEquals(appCategoryFunctionsItem.toString(), "AppCategoryFunctionsItem [rowId=test, appId=test, application=test, category=null, functions=test]");
- assertEquals(appCategoryFunctionsItem.hashCode(), appCategoryFunctionsItem1.hashCode());
- assertTrue(appCategoryFunctionsItem.equals(appCategoryFunctionsItem1));
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppContactUsItemTest.java b/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppContactUsItemTest.java
deleted file mode 100644
index 41539282..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppContactUsItemTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.openecomp.portalapp.portal.ecomp.test.model;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem;
-
-public class AppContactUsItemTest {
-
- public AppContactUsItem mockAppContactUsItem(){
- AppContactUsItem appContactUsItem = new AppContactUsItem();
-
- appContactUsItem.setAppId((long)1);
- appContactUsItem.setAppName("test");
- appContactUsItem.setDescription("test");
- appContactUsItem.setContactName("test");
- appContactUsItem.setContactEmail("test");
- appContactUsItem.setUrl("test");
- appContactUsItem.setActiveYN("test");
-
- return appContactUsItem;
- }
-
- @Test
- public void appContactUsItemTest(){
- AppContactUsItem appContactUsItem = mockAppContactUsItem();
-
- AppContactUsItem appContactUsItem1 = new AppContactUsItem();
- appContactUsItem1.setAppId((long)1);
- appContactUsItem1.setAppName("test");
- appContactUsItem1.setDescription("test");
- appContactUsItem1.setContactName("test");
- appContactUsItem1.setContactEmail("test");
- appContactUsItem1.setUrl("test");
- appContactUsItem1.setActiveYN("test");
-
- assertEquals(appContactUsItem.getAppId(), appContactUsItem1.getAppId());
- assertEquals(appContactUsItem.getAppName(), appContactUsItem1.getAppName());
- assertEquals(appContactUsItem.getDescription(), appContactUsItem1.getDescription());
- assertEquals(appContactUsItem.getContactName(), appContactUsItem1.getContactName());
- assertEquals(appContactUsItem.getContactEmail(), appContactUsItem1.getContactEmail());
- assertEquals(appContactUsItem.getUrl(), appContactUsItem1.getUrl());
- assertEquals(appContactUsItem.getActiveYN(), appContactUsItem1.getActiveYN());
- assertEquals(appContactUsItem.toString(), "AppContactUsItem [appId=1, appName=test, description=test, contactName=test, contactEmail=test, url=test, activeYN=test]");
- assertEquals(appContactUsItem.hashCode(), appContactUsItem1.hashCode());
- assertTrue(appContactUsItem.equals(appContactUsItem1));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/SearchResultItemTest.java b/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/SearchResultItemTest.java
deleted file mode 100644
index 97e3be6c..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/SearchResultItemTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.openecomp.portalapp.portal.ecomp.test.model;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem;
-
-public class SearchResultItemTest {
-
- public SearchResultItem mockSearchResultItem(){
- SearchResultItem searchResultItem = new SearchResultItem();
-
- searchResultItem.setRowId("test");
- searchResultItem.setCategory("test");
- searchResultItem.setName("test");
- searchResultItem.setTarget("test");
- searchResultItem.setUuid("test");
-
- return searchResultItem;
- }
-
- @Test
- public void searchResultItemTest(){
- SearchResultItem searchResultItem = mockSearchResultItem();
-
- SearchResultItem searchResultItem1 = new SearchResultItem();
- searchResultItem1.setRowId("test");
- searchResultItem1.setCategory("test");
- searchResultItem1.setName("test");
- searchResultItem1.setTarget("test");
- searchResultItem1.setUuid("test");
-
- assertEquals(searchResultItem.getRowId(), searchResultItem.getRowId());
- assertEquals(searchResultItem.getCategory(), searchResultItem.getCategory());
- assertEquals(searchResultItem.getName(), searchResultItem.getName());
- assertEquals(searchResultItem.getTarget(), searchResultItem.getTarget());
- assertEquals(searchResultItem.getUuid(), searchResultItem.getUuid());
- assertEquals(searchResultItem.toString(), searchResultItem.toString());
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImplTest.java
deleted file mode 100644
index 23e4c28e..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImplTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.openecomp.portalapp.lm;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-
-import org.junit.Test;
-
-public class FusionLicenseManagerImplTest {
-
-
- @Test
- public void FusionLicenseManagerImplTest(){
- FusionLicenseManagerImpl fusionLicenseManagerImpl = new FusionLicenseManagerImpl();
-
- String nvlReturn = null;
-
- int installLicenseInt = fusionLicenseManagerImpl.installLicense();
- nvlReturn = fusionLicenseManagerImpl.nvl("test");
- Date expiredDateReturn = fusionLicenseManagerImpl.getExpiredDate();
-
- assertEquals(installLicenseInt, 0);
- assertEquals(nvlReturn, null);
- assertEquals(expiredDateReturn, null);
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImplTest.java
deleted file mode 100644
index 1d9f4a64..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImplTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.openecomp.portalapp.lm;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.FileNotFoundException;
-
-import org.junit.Test;
-
-public class LicenseableClassImplTest {
-
- @Test
- public void licenseableClassImplTest() throws FileNotFoundException{
- LicenseableClassImpl licenseableClassImpl = new LicenseableClassImpl();
-
- String appNameReturn = licenseableClassImpl.getApplicationName();
- java.io.InputStream inputStream = licenseableClassImpl.getPublicKeystoreAsInputStream();
- String aliasReturn = licenseableClassImpl.getAlias();
- String pswdReturn = licenseableClassImpl.getKeyPasswd();
- String pkPswd = licenseableClassImpl.getPublicKeystorePassword();
- String cpPswd = licenseableClassImpl.getCipherParamPassword();
-
- assertEquals(appNameReturn, "");
- assertEquals(inputStream, null);
- assertEquals(aliasReturn, "");
- assertEquals(pswdReturn, "");
- assertEquals(pkPswd, "");
- assertEquals(cpPswd, "");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppCatalogControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppCatalogControllerTest.java
deleted file mode 100644
index 23cb7a45..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppCatalogControllerTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.AppCatalogController;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl;
-import org.openecomp.portalapp.portal.service.EPAppCommonServiceImpl;
-import org.openecomp.portalapp.portal.service.EPAppService;
-import org.openecomp.portalapp.portal.service.PersUserAppService;
-import org.openecomp.portalapp.portal.service.PersUserAppServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.AppCatalogPersonalization;
-import org.openecomp.portalapp.portal.transport.FieldsValidator;
-import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-public class AppCatalogControllerTest extends MockitoTestSuite {
-
- @Mock
- AdminRolesService adminRolesService = new AdminRolesServiceImpl();
-
- @Mock
- EPAppService appService = new EPAppCommonServiceImpl();
-
- @InjectMocks
- AppCatalogController appCatalogController = new AppCatalogController();
-
- PersUserAppService persUserAppService = Mockito.spy(new PersUserAppServiceImpl());
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- @Mock
- EPUser epuser;
-
- NullPointerException nullPointerException = new NullPointerException();
-
- MockEPUser mockUser = new MockEPUser();
-
- public AppCatalogItem mockAppCatalogItem() {
- AppCatalogItem appCatalogItem = new AppCatalogItem();
- appCatalogItem.setId((long) 1);
- appCatalogItem.setName("Ecomp Portal");
- appCatalogItem.setImageUrl("Test_URL");
- appCatalogItem.setDescription("Testing");
- appCatalogItem.setNotes("Test");
- appCatalogItem.setUrl("test");
- appCatalogItem.setAlternateUrl("test");
- appCatalogItem.setRestricted(false);
- appCatalogItem.setOpen(false);
- appCatalogItem.setAccess(true);
- appCatalogItem.setSelect(true);
- appCatalogItem.setPending(false);
-
- return appCatalogItem;
- }
-
- @Test
- public void getAppCatalogTestIfUserNotAdmin() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<AppCatalogItem> actualAppCatalogList = null;
-
- List<AppCatalogItem> expectedAppCatalog = new ArrayList<>();
-
- AppCatalogItem appCatalogItem = mockAppCatalogItem();
- expectedAppCatalog.add(appCatalogItem);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(appService.getUserAppCatalog(user)).thenReturn(expectedAppCatalog);
- actualAppCatalogList = appCatalogController.getAppCatalog(mockedRequest, mockedResponse);
-
- assertTrue(actualAppCatalogList.contains(appCatalogItem));
-
- }
-
- @Test
- public void getAppCatalogTestIfUserIsAdmin() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<AppCatalogItem> actualAppCatalogList = null;
-
- List<AppCatalogItem> expectedAppCatalog = new ArrayList<>();
-
- AppCatalogItem appCatalogItem = mockAppCatalogItem();
-
- expectedAppCatalog.add(appCatalogItem);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAdminAppCatalog(user)).thenReturn(expectedAppCatalog);
- actualAppCatalogList = appCatalogController.getAppCatalog(mockedRequest, mockedResponse);
-
- assertTrue(actualAppCatalogList.contains(appCatalogItem));
-
- }
-
- @Test
- public void getAppCatalogTestIfUserisNull() throws IOException {
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(null);
- List<AppCatalogItem> actualAppCatalogList = new ArrayList<>();
- ;
- actualAppCatalogList = appCatalogController.getAppCatalog(mockedRequest, mockedResponse);
- assertNull(actualAppCatalogList);
-
- }
-
- @Test
- public void getAppCatalogTestIfUserThrowsExceptionTest() throws IOException {
- EPUser user = new EPUser();
- user.setFirstName("test");
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<AppCatalogItem> actualAppCatalogList = new ArrayList<>();
- ;
-
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
-
- Mockito.when(appCatalogController.getAppCatalog(mockedRequest, mockedResponse)).thenThrow(nullPointerException);
-
- actualAppCatalogList = appCatalogController.getAppCatalog(mockedRequest, mockedResponse);
- assertNull(actualAppCatalogList);
-
- }
-
- @Test
- public void putAppCatalogSelectionTestWhenAppIsNull() throws IOException {
-
- AppCatalogPersonalization persRequest = new AppCatalogPersonalization();
- persRequest.setAppId((long) 1);
- persRequest.setPending(false);
- persRequest.setSelect(false);
-
- EPUser user = mockUser.mockEPUser();
-
- FieldsValidator expectedFieldValidator = new FieldsValidator();
-
- FieldsValidator actualFieldValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
- ;
-
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(fields);
- expectedFieldValidator.setErrorCode(null);
-
- EPApp app = null;
-
- Mockito.when(appService.getApp(persRequest.getAppId())).thenReturn(app);
-
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
-
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- actualFieldValidator = appCatalogController.putAppCatalogSelection(mockedRequest, persRequest, mockedResponse);
- assertEquals(expectedFieldValidator, actualFieldValidator);
-
- }
-
- @Test
- public void putAppCatalogSelectionTest() throws IOException {
-
- AppCatalogPersonalization persRequest = new AppCatalogPersonalization();
- persRequest.setAppId((long) 1);
- persRequest.setPending(false);
- persRequest.setSelect(false);
-
- EPUser user = mockUser.mockEPUser();
-
- FieldsValidator expectedFieldValidator = new FieldsValidator();
-
- FieldsValidator actualFieldValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
- ;
-
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(fields);
- expectedFieldValidator.setErrorCode(null);
-
- EPApp app = new EPApp();
-
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppRestEndpoint("test");
- app.setAlternateUrl("test");
- app.setName("test");
- app.setMlAppName("test");
- app.setMlAppAdminId("test");
- app.setUsername("test");
- app.setAppPassword("test");
- app.setOpen(false);
- app.setEnabled(false);
- app.setUebKey("test");
- app.setUebSecret("test");
- app.setUebTopicName("test");
- app.setAppType(1);
-
- Mockito.when(appService.getApp(persRequest.getAppId())).thenReturn(app);
-
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
-
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.doNothing().when(persUserAppService).setPersUserAppValue(user, app, persRequest.getSelect(),
- persRequest.getPending());
-
- actualFieldValidator = appCatalogController.putAppCatalogSelection(mockedRequest, persRequest, mockedResponse);
-
- assertEquals(expectedFieldValidator, actualFieldValidator);
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppContactUsControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppContactUsControllerTest.java
deleted file mode 100644
index 12334d87..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppContactUsControllerTest.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.AppContactUsController;
-import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem;
-import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.AppContactUsService;
-import org.openecomp.portalapp.portal.service.AppContactUsServiceImpl;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-
-public class AppContactUsControllerTest extends MockitoTestSuite{
-
- @Mock
- AppContactUsService contactUsService = new AppContactUsServiceImpl();
-
- @InjectMocks
- AppContactUsController appContactUsController = new AppContactUsController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- public List<AppContactUsItem> mockResponse() {
- List<AppContactUsItem> appContactUsItemList = new ArrayList<AppContactUsItem>();
- AppContactUsItem appContactUsItem = new AppContactUsItem();
- appContactUsItem.setAppId((long) 1);
- appContactUsItem.setAppName("ECOMP Portal");
- appContactUsItem.setDescription("Test");
- appContactUsItem.setContactName("Test");
- appContactUsItem.setContactEmail("person@onap.org");
- appContactUsItem.setUrl("Test_URL");
- appContactUsItem.setActiveYN("Y");
- appContactUsItemList.add(appContactUsItem);
-
- return appContactUsItemList;
-
- }
-
- public PortalRestResponse<List<AppContactUsItem>> successPortalRestResponse() {
- PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = new PortalRestResponse<List<AppContactUsItem>>();
- List<AppContactUsItem> appContactUsItemList = mockResponse();
- expectedportalRestResponse.setMessage("success");
- expectedportalRestResponse.setResponse(appContactUsItemList);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- return expectedportalRestResponse;
-
- }
-
- public PortalRestResponse<List<AppContactUsItem>> exceptionPortalRestResponse() {
- PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = new PortalRestResponse<List<AppContactUsItem>>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- return expectedportalRestResponse;
-
- }
-
- @Test
- public void getAppContactUsList() throws Exception {
- PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = successPortalRestResponse();
- List<AppContactUsItem> appContactUsItemList = mockResponse();
- PortalRestResponse<List<AppContactUsItem>> actualPortalRestResponse = new PortalRestResponse<List<AppContactUsItem>>();
- Mockito.when(contactUsService.getAppContactUs()).thenReturn(appContactUsItemList);
- actualPortalRestResponse = appContactUsController.getAppContactUsList(mockedRequest);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void getAppContactUsListCatchesExeptionTest() throws Exception {
-
- PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = exceptionPortalRestResponse();
- PortalRestResponse<List<AppContactUsItem>> actualPortalRestResponse = new PortalRestResponse<List<AppContactUsItem>>();
- Mockito.when(contactUsService.getAppContactUs()).thenThrow(nullPointerException);
- actualPortalRestResponse = appContactUsController.getAppContactUsList(mockedRequest);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void getAppsAndContactsTest() throws Exception {
- PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = successPortalRestResponse();
- List<AppContactUsItem> appContactUsItemList = mockResponse();
- PortalRestResponse<List<AppContactUsItem>> actualPortalRestResponse = new PortalRestResponse<List<AppContactUsItem>>();
- Mockito.when(contactUsService.getAppsAndContacts()).thenReturn(appContactUsItemList);
- actualPortalRestResponse = appContactUsController.getAppsAndContacts(mockedRequest);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
-
- }
-
- @Test
- public void getAppsAndContactsCatchesExceptionTest() throws Exception {
- PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = exceptionPortalRestResponse();
- PortalRestResponse<List<AppContactUsItem>> actualPortalRestResponse = new PortalRestResponse<List<AppContactUsItem>>();
- Mockito.when(contactUsService.getAppsAndContacts()).thenThrow(nullPointerException);
- actualPortalRestResponse = appContactUsController.getAppsAndContacts(mockedRequest);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
-
- }
-
- @Test
- public void getAppCategoryFunctionsTest() throws Exception {
- PortalRestResponse<List<AppCategoryFunctionsItem>> actualportalRestResponse = null;
-
- List<AppCategoryFunctionsItem> contents = new ArrayList<AppCategoryFunctionsItem>();
-
- AppCategoryFunctionsItem appCategoryFunctionsItem = new AppCategoryFunctionsItem();
- AppCategoryFunctionsItem appCategoryFunctionsItem1 = new AppCategoryFunctionsItem();
-
- appCategoryFunctionsItem.setRowId("1");
- appCategoryFunctionsItem.setAppId("1");
- appCategoryFunctionsItem.setApplication("Ecomp-portal");
- appCategoryFunctionsItem.setCategory("test");
- appCategoryFunctionsItem.setFunctions("test");
-
- appCategoryFunctionsItem1.setRowId("2");
- appCategoryFunctionsItem1.setAppId("2");
- appCategoryFunctionsItem1.setApplication("Ecomp-portal-test");
- appCategoryFunctionsItem1.setCategory("test");
- appCategoryFunctionsItem1.setFunctions("test");
- contents.add(appCategoryFunctionsItem);
- contents.add(appCategoryFunctionsItem1);
-
- PortalRestResponse<List<AppCategoryFunctionsItem>> expectedportalRestResponse = new PortalRestResponse<List<AppCategoryFunctionsItem>>();
- expectedportalRestResponse.setMessage("success");
- expectedportalRestResponse.setResponse(contents);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
-
- Mockito.when(contactUsService.getAppCategoryFunctions()).thenReturn(contents);
- actualportalRestResponse = appContactUsController.getAppCategoryFunctions(mockedRequest);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
-
- }
-
- @Test
- public void getAppCategoryFunctionsCatchesExceptionTest() throws Exception {
- PortalRestResponse<List<AppCategoryFunctionsItem>> actualportalRestResponse = null;
- PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = exceptionPortalRestResponse();
- Mockito.when(contactUsService.getAppCategoryFunctions()).thenThrow(nullPointerException);
- actualportalRestResponse = appContactUsController.getAppCategoryFunctions(mockedRequest);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
-
- }
-
- @Test
- public void saveTest() throws Exception {
- PortalRestResponse<String> actualSaveAppContactUS = null;
-
- AppContactUsItem contactUs = new AppContactUsItem();
- contactUs.setAppId((long) 1);
- contactUs.setAppName("Ecomp Portal");
- contactUs.setDescription("Test");
- contactUs.setContactName("Test");
- contactUs.setContactEmail("person@onap.org");
- contactUs.setUrl("Test_URL");
- contactUs.setActiveYN("Y");
-
- Mockito.when(contactUsService.saveAppContactUs(contactUs)).thenReturn("SUCCESS");
- actualSaveAppContactUS = appContactUsController.save(contactUs);
- assertEquals(actualSaveAppContactUS.getMessage(), "SUCCESS");
- }
-
- @Test
- public void saveExceptionTest() throws Exception {
- PortalRestResponse<String> actualSaveAppContactUS = null;
-
- AppContactUsItem contactUs = new AppContactUsItem();
- contactUs.setAppId((long) 1);
- contactUs.setAppName("Ecomp Portal");
- contactUs.setDescription("Test");
- contactUs.setContactName("Test");
- contactUs.setContactEmail("person@onap.org");
- contactUs.setUrl("Test_URL");
- contactUs.setActiveYN("Y");
-
- Mockito.when(contactUsService.saveAppContactUs(contactUs)).thenThrow(new Exception());
- actualSaveAppContactUS = appContactUsController.save(contactUs);
- assertEquals(actualSaveAppContactUS.getMessage(), "failure");
- }
-
- @Test
- public void saveWhenAppContactUsItemNullTest() throws Exception {
- PortalRestResponse<String> actualSaveAppContactUS = null;
- AppContactUsItem contactUs = null;
- actualSaveAppContactUS = appContactUsController.save(contactUs);
- assertEquals(actualSaveAppContactUS.getMessage(), "failure");
-
- }
-
- @Test
- public void saveAllTest() throws Exception {
-
- List<AppContactUsItem> contactUs = mockResponse();
- PortalRestResponse<String> actualSaveAppContactUS = null;
- Mockito.when(contactUsService.saveAppContactUs(contactUs)).thenReturn("SUCCESS");
- actualSaveAppContactUS = appContactUsController.save(contactUs);
- assertEquals(actualSaveAppContactUS.getMessage(), "SUCCESS");
- }
-
- @Test
- public void saveAllExceptionTest() throws Exception {
-
- List<AppContactUsItem> contactUs = mockResponse();
- PortalRestResponse<String> actualSaveAppContactUS = null;
- Mockito.when(contactUsService.saveAppContactUs(contactUs)).thenThrow(new Exception());
- actualSaveAppContactUS = appContactUsController.save(contactUs);
- assertEquals(actualSaveAppContactUS.getMessage(), "failure");
- }
-
- @Test
- public void deleteTest() throws Exception {
-
- PortalRestResponse<String> actualSaveAppContactUS = null;
- Long id = (long) 1;
- String saveAppContactUs = "SUCCESS";
- Mockito.when(contactUsService.deleteContactUs(id)).thenReturn(saveAppContactUs);
- actualSaveAppContactUS = appContactUsController.delete(id);
- assertEquals(actualSaveAppContactUS.getMessage(), "SUCCESS");
- }
-
- @Test
- public void deleteExceptionTest() throws Exception {
-
- PortalRestResponse<String> actualSaveAppContactUS = null;
- Long id = (long) 1;
- Mockito.when(contactUsService.deleteContactUs(id)).thenThrow(new Exception());
- actualSaveAppContactUS = appContactUsController.delete(id);
- assertEquals(actualSaveAppContactUS.getMessage(), "failure");
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerExternalRequestTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerExternalRequestTest.java
deleted file mode 100644
index 1db55526..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerExternalRequestTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.AppsControllerExternalRequest;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.EPAppService;
-import org.openecomp.portalapp.portal.service.PortalAdminService;
-import org.openecomp.portalapp.portal.service.UserService;
-import org.openecomp.portalapp.portal.service.UserServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.FieldsValidator;
-import org.openecomp.portalapp.portal.transport.OnboardingApp;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-
-public class AppsControllerExternalRequestTest extends MockitoTestSuite {
-
- @Mock
- AdminRolesService adminRolesService;
-
- @Mock
- EPAppService appService;
-
- @Mock
- PortalAdminService portalAdminService;
-
- @Mock
- UserService userService = new UserServiceImpl();
-
- @InjectMocks
- AppsControllerExternalRequest appsControllerExternalRequest = new AppsControllerExternalRequest();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- MockEPUser mockUser = new MockEPUser();
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- @Test
- public void postPortalAdminIfUSerNullTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Missing required field: email, loginId, or loginPwd");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- EPUser user = mockUser.mockEPUser();
- user.setEmail("guestT@test.portal.onap.org");
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .postPortalAdmin(mockedRequest, mockedResponse, user);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void postPortalAdminTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("java.lang.NullPointerException");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- EPUser user = mockUser.mockEPUser();
- user.setEmail("guestT@test.portal.onap.org");
- user.setLoginPwd("pwd");
- user.setLoginId("Test");
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenThrow(nullPointerException);
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .postPortalAdmin(mockedRequest, mockedResponse, user);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void postPortalAdminCreateUserIfNotFoundTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- EPUser user = mockUser.mockEPUser();
- user.setEmail("guestT@test.portal.onap.org");
- user.setLoginPwd("pwd");
- user.setLoginId("Test");
- List<EPUser> expectedList = null;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenReturn(expectedList);
- Mockito.when(userService.saveNewUser(user, "Yes")).thenReturn(null);
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .postPortalAdmin(mockedRequest, mockedResponse, user);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void postPortalAdminCreateUserIfFoundTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- EPUser user = mockUser.mockEPUser();
- user.setEmail("guestT@test.portal.onap.org");
- user.setLoginPwd("pwd");
- user.setLoginId("Test");
- List<EPUser> expectedList = new ArrayList<EPUser>();
- expectedList.add(user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenReturn(expectedList);
- Mockito.when(userService.saveNewUser(user, "Yes")).thenReturn(null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .postPortalAdmin(mockedRequest, mockedResponse, user);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void postPortalAdminCreateUserIfNotSuperAdminTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- EPUser user = mockUser.mockEPUser();
- user.setEmail("guestT@test.portal.onap.org");
- user.setLoginPwd("pwd");
- user.setLoginId("Test");
- List<EPUser> expectedList = new ArrayList<EPUser>();
- expectedList.add(user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenReturn(expectedList);
- Mockito.when(userService.saveNewUser(user, "Yes")).thenReturn(null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
-
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- Mockito.when(portalAdminService.createPortalAdmin(user.getOrgUserId())).thenReturn(expectedFieldValidator);
-
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .postPortalAdmin(mockedRequest, mockedResponse, user);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void postPortalAdminCreateUserIfFieldValidatorErrorTest() throws Exception {
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 500);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("FieldsValidator [httpStatusCode=500, errorCode=null, fields=null]");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- EPUser user = mockUser.mockEPUser();
- user.setEmail("guestT@test.portal.onap.org");
- user.setLoginPwd("pwd");
- user.setLoginId("Test");
- List<EPUser> expectedList = new ArrayList<EPUser>();
- expectedList.add(user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenReturn(expectedList);
- Mockito.when(userService.saveNewUser(user, "Yes")).thenReturn(null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(portalAdminService.createPortalAdmin(user.getOrgUserId())).thenReturn(expectedFieldValidator);
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .postPortalAdmin(mockedRequest, mockedResponse, user);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void getOnboardAppExternalTest() {
- EPApp epApp = new EPApp();
- Long appId = (long) 1;
- Mockito.when(appService.getApp(appId)).thenReturn(epApp);
- OnboardingApp expectedApp = new OnboardingApp();
- Mockito.doNothing().when(appService).createOnboardingFromApp(epApp, expectedApp);
- OnboardingApp actualApp = appsControllerExternalRequest.getOnboardAppExternal(mockedRequest, mockedResponse,
- appId);
- assertEquals(expectedApp.getClass(), actualApp.getClass());
- }
-
- @Test
- public void postOnboardAppExternalExceptionTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Unexpected field: id");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
-
- OnboardingApp expectedOnboardingApp = new OnboardingApp();
- expectedOnboardingApp.id = (long) 1;
-
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .postOnboardAppExternal(mockedRequest, mockedResponse, expectedOnboardingApp);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void postOnboardAppExternalTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(
- "Missing required field: name, url, restUrl, restrictedApp, isOpen, isEnabled, myLoginsAppOwner");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
-
- OnboardingApp expectedOnboardingApp = new OnboardingApp();
- expectedOnboardingApp.id = null;
-
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .postOnboardAppExternal(mockedRequest, mockedResponse, expectedOnboardingApp);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
-
- }
-
- @Test
- public void putOnboardAppExternalifAppNullTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Unexpected value for field: id");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- Long appId = null;
- OnboardingApp expectedOnboardingApp = new OnboardingApp();
- expectedOnboardingApp.id = null;
-
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .putOnboardAppExternal(mockedRequest, mockedResponse, appId, expectedOnboardingApp);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void putOnboardAppExternalIfOnboardingAppDetailsNullTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(
- "Missing required field: name, url, restUrl, restrictedApp, isOpen, isEnabled, myLoginsAppOwner");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- Long appId = (long) 1;
- OnboardingApp expectedOnboardingApp = new OnboardingApp();
- expectedOnboardingApp.id = (long) 1;
- PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest
- .putOnboardAppExternal(mockedRequest, mockedResponse, appId, expectedOnboardingApp);
- assertEquals(actualPortalRestResponse, expectedportalRestResponse);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerTest.java
deleted file mode 100644
index 4b6849a6..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerTest.java
+++ /dev/null
@@ -1,914 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.AppsController;
-import org.openecomp.portalapp.portal.domain.AdminUserApplications;
-import org.openecomp.portalapp.portal.domain.AppIdAndNameTransportModel;
-import org.openecomp.portalapp.portal.domain.AppsResponse;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.domain.EcompApp;
-import org.openecomp.portalapp.portal.domain.UserRole;
-import org.openecomp.portalapp.portal.domain.UserRoles;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl;
-import org.openecomp.portalapp.portal.service.EPAppCommonServiceImpl;
-import org.openecomp.portalapp.portal.service.EPAppService;
-import org.openecomp.portalapp.portal.service.EPLeftMenuService;
-import org.openecomp.portalapp.portal.service.EPLeftMenuServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.EPAppsManualPreference;
-import org.openecomp.portalapp.portal.transport.EPAppsSortPreference;
-import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref;
-import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference;
-import org.openecomp.portalapp.portal.transport.FieldsValidator;
-import org.openecomp.portalapp.portal.transport.LocalRole;
-import org.openecomp.portalapp.portal.transport.OnboardingApp;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.web.support.AppUtils;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.MediaType;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({SystemProperties.class,AppUtils.class, EPUserUtils.class, MediaType.class})
-public class AppsControllerTest extends MockitoTestSuite{
-
- @InjectMocks
- AppsController appsController = new AppsController();
-
- @Mock
- AdminRolesService adminRolesService = new AdminRolesServiceImpl();
-
- @Mock
- EPAppService appService = new EPAppCommonServiceImpl();
-
- @Mock
- EPLeftMenuService leftMenuService = new EPLeftMenuServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- @Mock
- AppUtils appUtils = new AppUtils();
-
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void getUserAppsTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EcompApp> expectedEcompApps = new ArrayList<EcompApp>();
-
- EcompApp ecompApp = new EcompApp();
- ecompApp.setId((long) 1);
- ecompApp.setName("Test_app");
- ecompApp.setUrl("Test_URL");
- ecompApp.setUebKey("Test_key");
- ecompApp.setAlternateUrl("Test_alt_URL");
- expectedEcompApps.add(ecompApp);
- List<EcompApp> actualEcompApps = new ArrayList<EcompApp>();
- Mockito.when(appService.transformAppsToEcompApps(appService.getUserApps(user))).thenReturn(expectedEcompApps);
- actualEcompApps = appsController.getUserApps(mockedRequest, mockedResponse);
- assertEquals(expectedEcompApps, actualEcompApps);
- }
-
- @Test
- public void getUserAppsNoUserTest() {
- EPUser user = null;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(appService.transformAppsToEcompApps(appService.getUserApps(user))).thenReturn(null);
- assertNull(appsController.getUserApps(mockedRequest, mockedResponse));
-
- }
-
- @Test
- public void getUserAppsExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(appService.transformAppsToEcompApps(appService.getUserApps(user))).thenThrow(nullPointerException);
- assertNull(appsController.getUserApps(mockedRequest, mockedResponse));
-
- }
-
- @Test
- public void getPersUserAppsIfUserIsAdminTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EcompApp> expectedEcompApps = new ArrayList<EcompApp>();
-
- EcompApp ecompApp = new EcompApp();
- ecompApp.setId((long) 1);
- ecompApp.setName("Test_app");
- ecompApp.setUrl("Test_URL");
- ecompApp.setUebKey("Test_key");
- ecompApp.setAlternateUrl("Test_alt_URL");
- expectedEcompApps.add(ecompApp);
- List<EcompApp> actualEcompApps = new ArrayList<EcompApp>();
-
- List<EPApp> expectedApps = new ArrayList<EPApp>();
-
- EPApp app = new EPApp();
-
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppRestEndpoint("test");
- app.setAlternateUrl("test");
- app.setName("test");
- app.setMlAppName("test");
- app.setMlAppAdminId("test");
- app.setUsername("test");
- app.setAppPassword("test");
- app.setOpen(false);
- app.setEnabled(false);
- app.setUebKey("test");
- app.setUebSecret("test");
- app.setUebTopicName("test");
- app.setAppType(1);
-
- expectedApps.add(app);
-
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getPersAdminApps(user)).thenReturn(expectedApps);
-
- Mockito.when(appService.transformAppsToEcompApps(expectedApps)).thenReturn(expectedEcompApps);
- actualEcompApps = appsController.getPersUserApps(mockedRequest, mockedResponse);
- assertEquals(expectedEcompApps, actualEcompApps);
- }
-
- @Test
- public void getPersUserAppsIfUserNotAdminTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EcompApp> expectedEcompApps = new ArrayList<EcompApp>();
-
- EcompApp ecompApp = new EcompApp();
- ecompApp.setId((long) 1);
- ecompApp.setName("Test_app");
- ecompApp.setUrl("Test_URL");
- ecompApp.setUebKey("Test_key");
- ecompApp.setAlternateUrl("Test_alt_URL");
- expectedEcompApps.add(ecompApp);
- List<EcompApp> actualEcompApps = new ArrayList<EcompApp>();
-
- List<EPApp> expectedApps = new ArrayList<EPApp>();
-
- EPApp app = new EPApp();
-
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppRestEndpoint("test");
- app.setAlternateUrl("test");
- app.setName("test");
- app.setMlAppName("test");
- app.setMlAppAdminId("test");
- app.setUsername("test");
- app.setAppPassword("test");
- app.setOpen(false);
- app.setEnabled(false);
- app.setUebKey("test");
- app.setUebSecret("test");
- app.setUebTopicName("test");
- app.setAppType(1);
-
- expectedApps.add(app);
-
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(appService.getPersUserApps(user)).thenReturn(expectedApps);
- Mockito.when(appService.transformAppsToEcompApps(expectedApps)).thenReturn(expectedEcompApps);
- actualEcompApps = appsController.getPersUserApps(mockedRequest, mockedResponse);
- assertEquals(expectedEcompApps, actualEcompApps);
- }
-
- @Test
- public void getPersUserAppsIfUserNullTest() throws IOException {
- EPUser user = null;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- assertNull(appsController.getPersUserApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getPersUserAppsExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getPersAdminApps(user)).thenThrow(nullPointerException);
- assertNull(appsController.getPersUserApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAdminAppsIfNotAdminTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false);
- assertNull(appsController.getAdminApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAdminAppsTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<AppIdAndNameTransportModel> expectedAdminApps = new ArrayList<AppIdAndNameTransportModel>();
- AppIdAndNameTransportModel appIdAndNameTransportModel = new AppIdAndNameTransportModel();
- appIdAndNameTransportModel.setId((long) 1);
- appIdAndNameTransportModel.setName("Test_app");
- expectedAdminApps.add(appIdAndNameTransportModel);
- List<AppIdAndNameTransportModel> actualAdminApps = new ArrayList<AppIdAndNameTransportModel>();
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAdminApps(user)).thenReturn(expectedAdminApps);
- actualAdminApps = appsController.getAdminApps(mockedRequest, mockedResponse);
- assertEquals(actualAdminApps, expectedAdminApps);
-
- }
-
- @Test
- public void getAdminAppsExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAdminApps(user)).thenThrow(nullPointerException);
- assertNull(appsController.getAdminApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppsForSuperAdminAndAccountAdminifOnlyAccountAdminTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false);
- assertNull(appsController.getAppsForSuperAdminAndAccountAdmin(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppsForSuperAdminAndAccountAdminTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<AppIdAndNameTransportModel> expectedAdminApps = new ArrayList<AppIdAndNameTransportModel>();
- AppIdAndNameTransportModel appIdAndNameTransportModel = new AppIdAndNameTransportModel();
- appIdAndNameTransportModel.setId((long) 1);
- appIdAndNameTransportModel.setName("Test_app");
- expectedAdminApps.add(appIdAndNameTransportModel);
- List<AppIdAndNameTransportModel> actualAdminApps = new ArrayList<AppIdAndNameTransportModel>();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAppsForSuperAdminAndAccountAdmin(user)).thenReturn(expectedAdminApps);
- actualAdminApps = appsController.getAppsForSuperAdminAndAccountAdmin(mockedRequest, mockedResponse);
- assertEquals(actualAdminApps, expectedAdminApps);
-
- }
-
- @Test
- public void getAppsForSuperAdminExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false);
- Mockito.when(appService.getAppsForSuperAdminAndAccountAdmin(user)).thenThrow(nullPointerException);
- assertNull(appsController.getAppsForSuperAdminAndAccountAdmin(mockedRequest, mockedResponse));
- }
-
- @Test
- public void putUserAppsSortingManualTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EPAppsManualPreference> ePAppsManualPreference = new ArrayList<EPAppsManualPreference>();
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- FieldsValidator actualFieldValidator = new FieldsValidator();
- Mockito.when(appService.saveAppsSortManual(ePAppsManualPreference, user)).thenReturn(expectedFieldValidator);
- actualFieldValidator = appsController.putUserAppsSortingManual(mockedRequest, ePAppsManualPreference,
- mockedResponse);
- assertEquals(actualFieldValidator, expectedFieldValidator);
- }
-
- @Test
- public void putUserAppsSortingManualExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EPAppsManualPreference> ePAppsManualPreference = new ArrayList<EPAppsManualPreference>();
- Mockito.when(appService.saveAppsSortManual(ePAppsManualPreference, user)).thenThrow(nullPointerException);
- assertNull(appsController.putUserAppsSortingManual(mockedRequest, ePAppsManualPreference, mockedResponse));
- }
-
- @Test
- public void putUserWidgetsSortManualTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EPWidgetsSortPreference> ePWidgetsSortPreference = new ArrayList<EPWidgetsSortPreference>();
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- FieldsValidator actualFieldValidator = new FieldsValidator();
- Mockito.when(appService.saveWidgetsSortManual(ePWidgetsSortPreference, user))
- .thenReturn(expectedFieldValidator);
- actualFieldValidator = appsController.putUserWidgetsSortManual(mockedRequest, ePWidgetsSortPreference,
- mockedResponse);
- assertEquals(actualFieldValidator, expectedFieldValidator);
- }
-
- @Test
- public void putUserWidgetsSortManualExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EPAppsManualPreference> ePAppsManualPreference = new ArrayList<EPAppsManualPreference>();
- Mockito.when(appService.saveAppsSortManual(ePAppsManualPreference, user)).thenThrow(nullPointerException);
- assertNull(appsController.putUserAppsSortingManual(mockedRequest, ePAppsManualPreference, mockedResponse));
- }
-
- @Test
- public void putUserWidgetsSortPrefTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EPWidgetsSortPreference> ePWidgetsSortPreference = new ArrayList<EPWidgetsSortPreference>();
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- FieldsValidator actualFieldValidator = new FieldsValidator();
- Mockito.when(appService.deleteUserWidgetSortPref(ePWidgetsSortPreference, user))
- .thenReturn(expectedFieldValidator);
- actualFieldValidator = appsController.putUserWidgetsSortPref(mockedRequest, ePWidgetsSortPreference,
- mockedResponse);
- assertEquals(actualFieldValidator, expectedFieldValidator);
- }
-
- @Test
- public void putUserWidgetsSortPrefExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EPWidgetsSortPreference> ePWidgetsSortPreference = new ArrayList<EPWidgetsSortPreference>();
- Mockito.when(appService.deleteUserWidgetSortPref(ePWidgetsSortPreference, user))
- .thenThrow(nullPointerException);
- assertNull(appsController.putUserWidgetsSortPref(mockedRequest, ePWidgetsSortPreference, mockedResponse));
- }
-
- @Test
- public void deleteUserAppSortManualTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- EPDeleteAppsManualSortPref epDeleteAppsManualSortPref = new EPDeleteAppsManualSortPref();
-
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- FieldsValidator actualFieldValidator = new FieldsValidator();
- Mockito.when(appService.deleteUserAppSortManual(epDeleteAppsManualSortPref, user))
- .thenReturn(expectedFieldValidator);
- actualFieldValidator = appsController.deleteUserAppSortManual(mockedRequest, epDeleteAppsManualSortPref,
- mockedResponse);
- assertEquals(actualFieldValidator, expectedFieldValidator);
- }
-
- @Test
- public void deleteUserAppSortManualExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- EPDeleteAppsManualSortPref epDeleteAppsManualSortPref = new EPDeleteAppsManualSortPref();
- Mockito.when(appService.deleteUserAppSortManual(epDeleteAppsManualSortPref, user))
- .thenThrow(nullPointerException);
- assertNull(appsController.deleteUserAppSortManual(mockedRequest, epDeleteAppsManualSortPref, mockedResponse));
- }
-
- @Test
- public void putUserAppsSortingPreferenceTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- EPAppsSortPreference userAppsValue = new EPAppsSortPreference();
-
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- FieldsValidator actualFieldValidator = new FieldsValidator();
- Mockito.when(appService.saveAppsSortPreference(userAppsValue, user)).thenReturn(expectedFieldValidator);
- actualFieldValidator = appsController.putUserAppsSortingPreference(mockedRequest, userAppsValue,
- mockedResponse);
- assertEquals(actualFieldValidator, expectedFieldValidator);
- }
-
- @Test
- public void putUserAppsSortingPreferenceExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- EPAppsSortPreference userAppsValue = new EPAppsSortPreference();
- Mockito.when(appService.saveAppsSortPreference(userAppsValue, user)).thenThrow(nullPointerException);
- assertNull(appsController.putUserAppsSortingPreference(mockedRequest, userAppsValue, mockedResponse));
- }
-
- @Test
- public void getUserAppsSortTypePreferenceTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String expectedUserSortPreference = "TEST_DECE";
- String actualUserSortPreference = new String();
- Mockito.when(appService.getUserAppsSortTypePreference(user)).thenReturn(expectedUserSortPreference);
- actualUserSortPreference = appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse);
- assertEquals(actualUserSortPreference, expectedUserSortPreference);
- }
-
- @Test
- public void getUserAppsSortTypePreferenceExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(appService.getUserAppsSortTypePreference(user)).thenThrow(nullPointerException);
- assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getUserAppsSortTypePreferenceIfUserNullTest() throws IOException {
- EPUser user = null;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(appService.getUserAppsSortTypePreference(user)).thenThrow(nullPointerException);
- assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppsAdministratorsTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<AdminUserApplications> expecteAdminUserApplications = new ArrayList<AdminUserApplications>();
- List<AdminUserApplications> actualAdminUserApplications = new ArrayList<AdminUserApplications>();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAppsAdmins()).thenReturn(expecteAdminUserApplications);
- actualAdminUserApplications = appsController.getAppsAdministrators(mockedRequest, mockedResponse);
- assertEquals(expecteAdminUserApplications, actualAdminUserApplications);
- }
-
- @Test
- public void getAppsAdministratorsIfUserNotSuperAdminTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppsAdministratorsExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAppsAdmins()).thenThrow(nullPointerException);
- assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppsTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<AppsResponse> expectedApps = new ArrayList<AppsResponse>();
- AppsResponse apps = new AppsResponse((long) 1, "test", true, true);
- expectedApps.add(apps);
-
- List<AppsResponse> atualApps = new ArrayList<AppsResponse>();
-
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAllApps(false)).thenReturn(expectedApps);
- atualApps = appsController.getApps(mockedRequest, mockedResponse);
- assertEquals(expectedApps, atualApps);
- }
-
- @Test
- public void getAppsExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- assertNull(appsController.getApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppsIfUserNotSuperAdminTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAllApps(false)).thenThrow(nullPointerException);
- assertNull(appsController.getApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAllAppsTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<AppsResponse> expectedApps = new ArrayList<AppsResponse>();
- AppsResponse apps = new AppsResponse((long) 1, "test", true, true);
- expectedApps.add(apps);
- List<AppsResponse> atualApps = new ArrayList<AppsResponse>();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAllApps(true)).thenReturn(expectedApps);
- atualApps = appsController.getAllApps(mockedRequest, mockedResponse);
- assertEquals(expectedApps, atualApps);
- }
-
- @Test
- public void getAllAppsExceptionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- assertNull(appsController.getAllApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAllAppsIfUserNotSuperAdminTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getAllApps(true)).thenThrow(nullPointerException);
- assertNull(appsController.getAllApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppsFullListTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EcompApp> expectedEcompApps = new ArrayList<EcompApp>();
-
- EcompApp ecompApp = new EcompApp();
- ecompApp.setId((long) 1);
- ecompApp.setName("Test_app");
- ecompApp.setUrl("Test_URL");
- ecompApp.setUebKey("Test_key");
- ecompApp.setAlternateUrl("Test_alt_URL");
- expectedEcompApps.add(ecompApp);
- List<EcompApp> actualEcompApps = new ArrayList<EcompApp>();
- Mockito.when(appService.getEcompAppAppsFullList()).thenReturn(expectedEcompApps);
- actualEcompApps = appsController.getAppsFullList(mockedRequest, mockedResponse);
- assertEquals(expectedEcompApps, actualEcompApps);
- }
-
-// @Test
-// public void getAppsFullListNoUserTest() {
-// EPUser user = null;
-// Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-// Mockito.when(appService.getEcompAppAppsFullList()).thenReturn(null);
-// assertNull(appsController.getAppsFullList(mockedRequest, mockedResponse));
-//
-// }
-
- @Test
- public void getUserProfileTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- UserRole userRole = new UserRole();
- userRole.setUser_Id((long) 1);
- userRole.setOrgUserId("guest");
- userRole.setFirstName("Test_User_FirstName");
- userRole.setLastName("Test_User_LastName");
- userRole.setRoleId((long) 1);
- userRole.setRoleName("test");
-
- UserRoles unexpectedserAndRoles = new UserRoles(userRole);
- unexpectedserAndRoles.setFirstName("Test_User_FirstName");
- unexpectedserAndRoles.setLastName("Test_User_LastName");
- unexpectedserAndRoles.setGuestSession(false);
- unexpectedserAndRoles.setOrgUserId("guest");
- List<String> roles = new ArrayList<String>();
- roles.add("Test");
- unexpectedserAndRoles.setRoles(roles);
- Mockito.when(appService.getUserProfileNormalized(user)).thenReturn(unexpectedserAndRoles);
- UserRoles actualUserAndRoles = appsController.getUserProfile(mockedRequest, mockedResponse);
- assertEquals(unexpectedserAndRoles, actualUserAndRoles);
- }
-
- @Test
- public void getUserProfileIfUserNullTest() throws IOException {
- EPUser user = null;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(appService.getUserProfileNormalized(user)).thenReturn(null);
- assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getUserProfileExcpetionTest() throws IOException {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(appService.getUserProfileNormalized(user)).thenThrow(nullPointerException);
- assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppRolesTest() {
- List<LocalRole> expectedRoleList = new ArrayList<LocalRole>();
- LocalRole localRole = new LocalRole();
- localRole.setRoleId(1);
- localRole.setRolename("test");
- expectedRoleList.add(localRole);
- long appId = 1;
- Mockito.when(appService.getAppRoles(appId)).thenReturn(expectedRoleList);
- List<LocalRole> actualRoleList = appsController.getAppRoles(mockedRequest, appId);
- assertEquals(actualRoleList, expectedRoleList);
- }
-
- @Test
- public void getAppRolesExceptionTest() {
- long appId = 1;
- Mockito.when(appService.getAppRoles(appId)).thenThrow(nullPointerException);
- assertNull(appsController.getAppRoles(mockedRequest, appId));
- }
-
- @Test
- public void getOnboardingAppsTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<OnboardingApp> expectedOnboardingApps = new ArrayList<OnboardingApp>();
- OnboardingApp onboardingApp = new OnboardingApp();
- onboardingApp.setUebKey("test");
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getOnboardingApps()).thenReturn(expectedOnboardingApps);
- List<OnboardingApp> actualOnboardingApps = appsController.getOnboardingApps(mockedRequest, mockedResponse);
- assertEquals(expectedOnboardingApps, actualOnboardingApps);
- }
-
- @Test
- public void getOnboardingAppsifSuperAdiminTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- assertNull(appsController.getOnboardingApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getOnboardingAppsExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(!adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.getOnboardingApps()).thenThrow(nullPointerException);
- assertNull(appsController.getOnboardingApps(mockedRequest, mockedResponse));
- }
-
- @Test
- public void putOnboardingAppTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- OnboardingApp OnboardingApp = new OnboardingApp();
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.modifyOnboardingApp(OnboardingApp, user)).thenReturn(expectedFieldValidator);
- FieldsValidator actualFieldValidator = appsController.putOnboardingApp(mockedRequest, OnboardingApp,
- mockedResponse);
- assertEquals(expectedFieldValidator, actualFieldValidator);
- }
-
- @Test
- public void putOnboardingAppIfSuperAdminTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- FieldsValidator expectedFieldValidator = null;
- OnboardingApp OnboardingApp = new OnboardingApp();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(appService.modifyOnboardingApp(OnboardingApp, user)).thenReturn(expectedFieldValidator);
- assertNull(appsController.putOnboardingApp(mockedRequest, OnboardingApp, mockedResponse));
- }
-
- @Test
- public void putOnboardingAppExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- OnboardingApp OnboardingApp = new OnboardingApp();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.modifyOnboardingApp(OnboardingApp, user)).thenThrow(nullPointerException);
- assertNull(appsController.putOnboardingApp(mockedRequest, OnboardingApp, mockedResponse));
- }
-
- @Test
- public void postOnboardingAppTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- OnboardingApp OnboardingApp = new OnboardingApp();
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.addOnboardingApp(OnboardingApp, user)).thenReturn(expectedFieldValidator);
- FieldsValidator actualFieldValidator = appsController.postOnboardingApp(mockedRequest, OnboardingApp,
- mockedResponse);
- assertEquals(expectedFieldValidator, actualFieldValidator);
- }
-
- @Test
- public void postOnboardingAppIfSuperAdminTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- FieldsValidator expectedFieldValidator = null;
- OnboardingApp OnboardingApp = new OnboardingApp();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(appService.addOnboardingApp(OnboardingApp, user)).thenReturn(expectedFieldValidator);
- assertNull(appsController.postOnboardingApp(mockedRequest, OnboardingApp, mockedResponse));
- }
-
- @Test
- public void postOnboardingAppExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- OnboardingApp OnboardingApp = new OnboardingApp();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(appService.addOnboardingApp(OnboardingApp, user)).thenThrow(nullPointerException);
- assertNull(appsController.postOnboardingApp(mockedRequest, OnboardingApp, mockedResponse));
- }
-
- @Test
- public void deleteOnboardingAppTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- long appId = 1;
- Mockito.when(appService.deleteOnboardingApp(user,appId )).thenReturn(expectedFieldValidator);
- FieldsValidator actualFieldValidator = appsController.deleteOnboardingApp(mockedRequest,appId,
- mockedResponse);
- assertEquals(expectedFieldValidator, actualFieldValidator);
- }
-
- @Test
- public void deleteOnboardingAppIfSuperAdminTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- FieldsValidator expectedFieldValidator = null;
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- long appId = 1;
- Mockito.when(appService.deleteOnboardingApp(user,appId)).thenReturn(expectedFieldValidator);
- assertNull(appsController.deleteOnboardingApp(mockedRequest,appId,mockedResponse));
- }
-
- @Test
- public void deleteOnboardingAppExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- long appId = 1;
- Mockito.when(appService.deleteOnboardingApp(user,appId)).thenThrow(nullPointerException);
- assertNull(appsController.deleteOnboardingApp(mockedRequest,appId,mockedResponse));
- }
-
- @Test
- public void getLeftMenuItemsTest()
- {
- EPUser user = mockUser.mockEPUser();
- String menuList = "Test";
- PowerMockito.mockStatic(EPUserUtils.class);
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Set menuSet = new HashSet<>();
- menuSet.add(1);
- Mockito.when(AppUtils.getSession(mockedRequest)
- .getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME))).thenReturn(menuSet);
- Mockito.when(AppUtils.getSession(mockedRequest)
- .getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME))).thenReturn(menuSet);
- Mockito.when(leftMenuService.getLeftMenuItems(user, menuSet, menuSet)).thenReturn(menuList);
- String response = appsController.getLeftMenuItems(mockedRequest, mockedResponse);
- assertTrue(response.equals("Test"));
- }
-
- @Test
- public void getLeftMenuItemsExceptionTest()
- {
- EPUser user = mockUser.mockEPUser();
- String menuList = "Test";
- PowerMockito.mockStatic(EPUserUtils.class);
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Set menuSet = new HashSet<>();
- menuSet.add(1);
- Mockito.when(AppUtils.getSession(mockedRequest)
- .getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME))).thenReturn(menuSet);
- Mockito.when(AppUtils.getSession(mockedRequest)
- .getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME))).thenReturn(menuSet);
- Mockito.when(leftMenuService.getLeftMenuItems(user, menuSet, menuSet)).thenThrow(nullPointerException);
- assertNull(appsController.getLeftMenuItems(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getAppThumbnailExceptionTest()
- {
- EPApp app = null;
- assertNull(appsController.getAppThumbnail(mockedRequest, (long) 1, mockedResponse));
- }
-
- @Test
- public void getAppThumbnailTest()
- {
- EPApp app = new EPApp();
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppType(1);
- app.setImageUrl("www.ecomp.com");
- app.setThumbnail(new byte[] {1, 6, 3});
- Mockito.when(appService.getApp((long) 1)).thenReturn(app);
- HttpEntity<byte[]> response = appsController.getAppThumbnail(mockedRequest, (long) 1, mockedResponse);
- assertEquals(response.getHeaders().getContentLength(), 3);
- }
-
- @Test
- public void getAppThumbnailForMediaTypePngTest()
- {
-
- EPApp app = new EPApp();
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppType(1);
- app.setImageUrl("www.ecomp.png");
- app.setThumbnail(new byte[] {1, 6, 3});
- Mockito.when(appService.getApp((long) 1)).thenReturn(app);
- PowerMockito.mockStatic(MediaType.class);
- HttpEntity<byte[]> response = appsController.getAppThumbnail(mockedRequest, (long) 1, mockedResponse);
- assertEquals(response.getHeaders().getContentLength(), 3);
- }
-
- @Test
- public void getUserAppsOrderBySortPrefIfUSerNullTest(){
- List<EcompApp> listOfApps = new ArrayList<EcompApp>();
-
- EcompApp app = new EcompApp();
- listOfApps.add(app);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(null);
- assertNull(appsController.getUserAppsOrderBySortPref(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getUserAppsOrderBySortPrefTest(){
- List<EcompApp> listOfApps = new ArrayList<EcompApp>();
-
- EcompApp app = new EcompApp();
- listOfApps.add(app);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(mockedRequest.getParameter("mparams")).thenReturn("");
- Mockito.when(appService.transformAppsToEcompApps(appService.getAppsOrderByName(user))).thenReturn(listOfApps);
- List<EcompApp> listOfActualApps = appsController.getUserAppsOrderBySortPref(mockedRequest, mockedResponse);
- assertEquals(listOfActualApps.size(), 1);
- }
-
- @Test
- public void getUserAppsOrderBySortPrefIfusrSortPrefIsMTest(){
- List<EcompApp> listOfApps = new ArrayList<EcompApp>();
-
- EcompApp app = new EcompApp();
- listOfApps.add(app);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(mockedRequest.getParameter("mparams")).thenReturn("M");
- Mockito.when(appService.transformAppsToEcompApps(appService.getAppsOrderByName(user))).thenReturn(listOfApps);
- List<EcompApp> listOfActualApps = appsController.getUserAppsOrderBySortPref(mockedRequest, mockedResponse);
- assertEquals(listOfActualApps.size(), 1);
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AuditLogControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AuditLogControllerTest.java
deleted file mode 100644
index 33079b0c..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AuditLogControllerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.AuditLogController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.service.AuditService;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(EPUserUtils.class)
-public class AuditLogControllerTest {
-
-
- @Mock
- AuditService auditService;
-
- @InjectMocks
- AuditLogController auditLogController = new AuditLogController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
- MockEPUser mockUser = new MockEPUser();
- @Test
- public void auditLogTest()
- {
- PowerMockito.mockStatic(EPUserUtils.class);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1);
- auditLogController.auditLog(mockedRequest, "1", "app", "test");
- }
-
- @Test
- public void auditLogTabTest()
- {
- PowerMockito.mockStatic(EPUserUtils.class);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1);
- auditLogController.auditLog(mockedRequest, "1", "tab", "test");
- }
-
- @Test
- public void auditLogfunctionalTest()
- {
- PowerMockito.mockStatic(EPUserUtils.class);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1);
- auditLogController.auditLog(mockedRequest, "1", "functional", "test");
- }
-
- @Test
- public void auditLogleftMenuTest()
- {
- PowerMockito.mockStatic(EPUserUtils.class);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1);
- auditLogController.auditLog(mockedRequest, "1", "leftMenu", "test");
- }
-
- @Test(expected = NumberFormatException.class)
- public void auditLogExceptionTest()
- {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1);
- auditLogController.auditLog(mockedRequest, "1", "app", "test");
- }
-
- @Test
- public void auditLogerrorTest()
- {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenThrow(nullPointerException);
- auditLogController.auditLog(mockedRequest, "1", "app", "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BEPropertyReaderControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BEPropertyReaderControllerTest.java
deleted file mode 100644
index e4d34ceb..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BEPropertyReaderControllerTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertTrue;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.BEPropertyReaderController;
-import org.openecomp.portalapp.portal.domain.BEProperty;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(SystemProperties.class)
-public class BEPropertyReaderControllerTest extends MockitoTestSuite {
-
- @InjectMocks
- BEPropertyReaderController bEPropertyReaderController = new BEPropertyReaderController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
-
- NullPointerException nullPointerException = new NullPointerException();
-
- @Test
- public void readPropertyTest() {
- String key = "DOMAIN_CLASS_LOCATION";
- BEProperty beProperty = new BEProperty("DOMAIN_CLASS_LOCATION", "domain_class_location");
- PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>();
- ecpectedPortalRestResponse.setMessage("success");
- ecpectedPortalRestResponse.setResponse(beProperty);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
- PortalRestResponse<BEProperty> actualPortalRestResponse = null;
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(SystemProperties.getProperty("DOMAIN_CLASS_LOCATION")).thenReturn("domain_class_location");
- actualPortalRestResponse = bEPropertyReaderController.readProperty(mockedRequest, key);
- assertTrue(actualPortalRestResponse.equals(ecpectedPortalRestResponse));
-
- }
-
- @Test
- public void readPropertyExceptionTest() {
- String key =null;
- //BEProperty beProperty = new BEProperty("DOMAIN_CLASS_LOCATION", "domain_class_location");
- PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>();
- ecpectedPortalRestResponse.setMessage("java.lang.NullPointerException");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- PortalRestResponse<BEProperty> actualPortalRestResponse = null;
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(new BEProperty(key, SystemProperties.getProperty(key))).thenThrow(nullPointerException);
- actualPortalRestResponse = bEPropertyReaderController.readProperty(mockedRequest, key);
- assertTrue(actualPortalRestResponse.equals(ecpectedPortalRestResponse));
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BasicAuthAccountControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BasicAuthAccountControllerTest.java
deleted file mode 100644
index 8f9549ce..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BasicAuthAccountControllerTest.java
+++ /dev/null
@@ -1,254 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.BasicAuthAccountController;
-import org.openecomp.portalapp.portal.domain.BasicAuthCredentials;
-import org.openecomp.portalapp.portal.domain.EPEndpoint;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl;
-import org.openecomp.portalapp.portal.service.BasicAuthAccountService;
-import org.openecomp.portalapp.portal.service.BasicAuthAccountServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-
-public class BasicAuthAccountControllerTest extends MockitoTestSuite {
-
- @Mock
- BasicAuthAccountService basicAuthAccountService = new BasicAuthAccountServiceImpl();
-
- @Mock
- AdminRolesService adminRolesService = new AdminRolesServiceImpl();
-
- @InjectMocks
- BasicAuthAccountController basicAuthAccountController = new BasicAuthAccountController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- MockEPUser mockUser = new MockEPUser();
-
- public BasicAuthCredentials basicAuthCredentials() {
- BasicAuthCredentials basicAuthCredentials = new BasicAuthCredentials();
-
- basicAuthCredentials.setId((long) 1);
- basicAuthCredentials.setApplicationName("test");
- basicAuthCredentials.setUsername("Test");
- basicAuthCredentials.setPassword("Password");
- basicAuthCredentials.setIsActive("YES");
-
- List<EPEndpoint> endpoints = new ArrayList<EPEndpoint>();
-
- EPEndpoint ePEndpoint = new EPEndpoint();
- ePEndpoint.setId((long) 1);
- ePEndpoint.setName("Test");
- endpoints.add(ePEndpoint);
- basicAuthCredentials.setEndpoints(endpoints);
-
- return basicAuthCredentials;
-
- }
-
- @Test
- public void createBasicAuthAccountTest() throws Exception {
- BasicAuthCredentials basicAuthCredentials = basicAuthCredentials();
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("SUCCESS");
- expectedResponse.setResponse("");
- expectedResponse.setStatus(PortalRestStatusEnum.OK);
- long accountd = 1;
-
- Mockito.when(basicAuthAccountService.saveBasicAuthAccount(basicAuthCredentials)).thenReturn(accountd);
-
- PortalRestResponse<String> actualResponse = basicAuthAccountController.createBasicAuthAccount(mockedRequest,
- mockedResponse, basicAuthCredentials);
- assertEquals(actualResponse, expectedResponse);
- }
-
- @Test
- public void createBasicAuthAccountAdminTest() throws Exception {
- BasicAuthCredentials basicAuthCredentials = basicAuthCredentials();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("Authorization Required");
- expectedResponse.setResponse("Admin Only Operation! ");
- expectedResponse.setStatus(PortalRestStatusEnum.ERROR);
-
- PortalRestResponse<String> actualResponse = basicAuthAccountController.createBasicAuthAccount(mockedRequest,
- mockedResponse, basicAuthCredentials);
- assertEquals(actualResponse, expectedResponse);
- }
-
- @Test
- public void createBasicAuthAccountIfInputNullTest() throws Exception {
- BasicAuthCredentials basicAuthCredentials = null;
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("FAILURE");
- expectedResponse.setResponse("newBasicAuthAccount cannot be null or empty");
- expectedResponse.setStatus(PortalRestStatusEnum.ERROR);
- PortalRestResponse<String> actualResponse = basicAuthAccountController.createBasicAuthAccount(mockedRequest,
- mockedResponse, basicAuthCredentials);
- assertEquals(actualResponse, expectedResponse);
- }
-
- @Test
- public void getBasicAuthAccountTest() throws Exception {
- PortalRestResponse<List<BasicAuthCredentials>> expectedPortalResponse = new PortalRestResponse<List<BasicAuthCredentials>>();
- List<BasicAuthCredentials> basicAuthCredentialsList = new ArrayList<BasicAuthCredentials>();
- BasicAuthCredentials basicAuthCredentials = basicAuthCredentials();
- basicAuthCredentialsList.add(basicAuthCredentials);
-
- expectedPortalResponse.setMessage("Success");
- expectedPortalResponse.setResponse(null);
- expectedPortalResponse.setStatus(PortalRestStatusEnum.OK);
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(basicAuthAccountService.getAccountData()).thenReturn(null);
- PortalRestResponse<List<BasicAuthCredentials>> actualResponse = basicAuthAccountController
- .getBasicAuthAccount(mockedRequest, mockedResponse);
- assertEquals(expectedPortalResponse, actualResponse);
- }
-
- @Test
- public void getBasicAuthAccountIfSuperAdminTest() throws Exception {
- PortalRestResponse<List<BasicAuthCredentials>> expectedPortalResponse = new PortalRestResponse<List<BasicAuthCredentials>>();
- List<BasicAuthCredentials> basicAuthCredentialsList = new ArrayList<BasicAuthCredentials>();
- BasicAuthCredentials basicAuthCredentials = basicAuthCredentials();
- basicAuthCredentialsList.add(basicAuthCredentials);
-
- expectedPortalResponse.setMessage("UnAuthorized! Admin Only Operation");
- expectedPortalResponse.setResponse(new ArrayList<>());
- expectedPortalResponse.setStatus(PortalRestStatusEnum.ERROR);
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(basicAuthAccountService.getAccountData()).thenReturn(null);
- PortalRestResponse<List<BasicAuthCredentials>> actualResponse = basicAuthAccountController
- .getBasicAuthAccount(mockedRequest, mockedResponse);
- assertEquals(expectedPortalResponse, actualResponse);
- }
-
- @Test
- public void updateAccountTest() throws Exception {
- BasicAuthCredentials basicAuthCredentials = basicAuthCredentials();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("SUCCESS");
- expectedResponse.setResponse("");
- expectedResponse.setStatus(PortalRestStatusEnum.OK);
- long accountd = 1;
- PortalRestResponse<String> actualResponse = basicAuthAccountController.updateAccount(mockedRequest,
- mockedResponse, accountd, basicAuthCredentials);
- assertEquals(actualResponse, expectedResponse);
- }
-
- @Test
- public void updateAccountIfSuperAdminTest() throws Exception {
- BasicAuthCredentials basicAuthCredentials = basicAuthCredentials();
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("Authorization Required");
- expectedResponse.setResponse("Admin Only Operation! ");
- expectedResponse.setStatus(PortalRestStatusEnum.ERROR);
- long accountd = 1;
- PortalRestResponse<String> actualResponse = basicAuthAccountController.updateAccount(mockedRequest,
- mockedResponse, accountd, basicAuthCredentials);
- assertEquals(actualResponse, expectedResponse);
- }
-
- @Test
- public void updateAccountIfInputNullTest() throws Exception {
- BasicAuthCredentials basicAuthCredentials = null;
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("FAILURE");
- expectedResponse.setResponse("BasicAuthCredentials cannot be null or empty");
- expectedResponse.setStatus(PortalRestStatusEnum.ERROR);
- long accountd = 1;
- PortalRestResponse<String> actualResponse = basicAuthAccountController.updateAccount(mockedRequest,
- mockedResponse, accountd, basicAuthCredentials);
- assertEquals(actualResponse, expectedResponse);
- }
-
- @Test
- public void deleteAccountTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("SUCCESS");
- expectedResponse.setResponse("");
- expectedResponse.setStatus(PortalRestStatusEnum.OK);
- long accountd = 1;
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- PortalRestResponse<String> actualResponse = basicAuthAccountController.deleteAccount(mockedRequest,
- mockedResponse, accountd);
- assertEquals(actualResponse, expectedResponse);
- }
-
- @Test
- public void deleteAccountIfNotSuperAdminTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("Authorization Required");
- expectedResponse.setResponse("Admin Only Operation! ");
- expectedResponse.setStatus(PortalRestStatusEnum.ERROR);
- long accountd = 1;
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- PortalRestResponse<String> actualResponse = basicAuthAccountController.deleteAccount(mockedRequest,
- mockedResponse, accountd);
- System.out.println(actualResponse);
- assertEquals(actualResponse, expectedResponse);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/CommonWidgetControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/CommonWidgetControllerTest.java
deleted file mode 100644
index eae8ec07..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/CommonWidgetControllerTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertTrue;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.CommonWidgetController;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.DashboardSearchService;
-import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl;
-import org.openecomp.portalapp.portal.transport.CommonWidgetMeta;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-
-public class CommonWidgetControllerTest {
-
- @Mock
- DashboardSearchService dashboardSearchService = new DashboardSearchServiceImpl();
-
- @InjectMocks
- CommonWidgetController commonWidgetController = new CommonWidgetController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @SuppressWarnings("unchecked")
- @Test
- public void getWidgetDataTest() {
- String resourceType = "Test";
- PortalRestResponse<CommonWidgetMeta> acutualPoratlRestResponse = null;
- @SuppressWarnings("rawtypes")
- PortalRestResponse ecpectedPortalRestResponse = new PortalRestResponse();
- ecpectedPortalRestResponse.setMessage("Unexpected resource type Test");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- acutualPoratlRestResponse = commonWidgetController.getWidgetData(mockedRequest, resourceType);
- assertTrue(acutualPoratlRestResponse.equals(ecpectedPortalRestResponse));
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void getWidgetDataTestNew() {
- String resourceType = "EVENTS";
- PortalRestResponse<CommonWidgetMeta> acutualPoratlRestResponse = null;
- @SuppressWarnings("rawtypes")
- PortalRestResponse ecpectedPortalRestResponse = new PortalRestResponse();
- ecpectedPortalRestResponse.setMessage("success");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
- acutualPoratlRestResponse = commonWidgetController.getWidgetData(mockedRequest, resourceType);
- assertTrue(acutualPoratlRestResponse.equals(ecpectedPortalRestResponse));
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void getWidgetDataExceptionTest() {
- String resourceType = "null";
- PortalRestResponse<CommonWidgetMeta> acutualPoratlRestResponse = null;
- @SuppressWarnings("rawtypes")
- PortalRestResponse ecpectedPortalRestResponse = new PortalRestResponse();
- ecpectedPortalRestResponse.setMessage("Unexpected resource type null");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- acutualPoratlRestResponse = commonWidgetController.getWidgetData(mockedRequest, resourceType);
- assertTrue(acutualPoratlRestResponse.equals(ecpectedPortalRestResponse));
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ConsulClientControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ConsulClientControllerTest.java
deleted file mode 100644
index eda17409..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ConsulClientControllerTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.ConsulClientController;
-import org.openecomp.portalapp.portal.domain.BEProperty;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.ConsulHealthService;
-import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-
-import com.orbitz.consul.ConsulException;
-import com.orbitz.consul.model.health.ServiceHealth;
-
-import io.searchbox.client.config.exception.NoServerConfiguredException;
-
-public class ConsulClientControllerTest {
-
- @Mock
- ConsulHealthService consulHealthService = new ConsulHealthServiceImpl();
-
- @InjectMocks
- ConsulClientController consulClientController = new ConsulClientController();
-
- NoServerConfiguredException noServerConfiguredException = new NoServerConfiguredException(null);
-
- String service = "Test";
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
- ConsulException consulException = new ConsulException(nullPointerException);
-
- @Test
- public void getServiceLocationTest() {
- PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>();
- ecpectedPortalRestResponse.setMessage("Success!");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
- PortalRestResponse<String> actualPortalRestRespone = new PortalRestResponse<String>();
- actualPortalRestRespone = consulClientController.getServiceLocation(mockedRequest, mockedResponse, service);
- assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse));
- }
-
- @Test
- public void getServiceLocationExceptionTest() {
- PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>();
- ecpectedPortalRestResponse.setMessage("Warning!");
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.WARN);
- PortalRestResponse<String> actualPortalRestRespone = new PortalRestResponse<String>();
- Mockito.when(consulHealthService.getServiceLocation(service, null)).thenThrow(noServerConfiguredException);
- actualPortalRestRespone = consulClientController.getServiceLocation(mockedRequest, mockedResponse, service);
- assertTrue(actualPortalRestRespone.getMessage().equals(ecpectedPortalRestResponse.getMessage()));
- assertTrue(actualPortalRestRespone.getStatus().equals(ecpectedPortalRestResponse.getStatus()));
-
- }
-
- @Test
- public void getServiceLocationExceptionConsulExceptionTest() {
- PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>();
- ecpectedPortalRestResponse.setMessage("Error!");
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- PortalRestResponse<String> actualPortalRestRespone = new PortalRestResponse<String>();
- Mockito.when(consulHealthService.getServiceLocation(service, null)).thenThrow(consulException);
- actualPortalRestRespone = consulClientController.getServiceLocation(mockedRequest, mockedResponse, service);
- assertTrue(actualPortalRestRespone.getMessage().equals(ecpectedPortalRestResponse.getMessage()));
- assertTrue(actualPortalRestRespone.getStatus().equals(ecpectedPortalRestResponse.getStatus()));
- }
-
- public PortalRestResponse<List<ServiceHealth>> successResponse() {
- PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = new PortalRestResponse<List<ServiceHealth>>();
- List<ServiceHealth> healths = new ArrayList<ServiceHealth>();
- ecpectedPortalRestResponse.setMessage("Success!");
- ecpectedPortalRestResponse.setResponse(healths);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
- return ecpectedPortalRestResponse;
- }
-
- public PortalRestResponse<List<ServiceHealth>> errorResponse() {
- PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = new PortalRestResponse<List<ServiceHealth>>();
- List<ServiceHealth> healths = new ArrayList<ServiceHealth>();
- ecpectedPortalRestResponse.setMessage("Error!");
- ecpectedPortalRestResponse.setResponse(healths);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- return ecpectedPortalRestResponse;
- }
-
- @Test
- public void getAllHealthyNodesTest() {
- PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = successResponse();
- PortalRestResponse<List<ServiceHealth>> actualPortalRestRespone = new PortalRestResponse<List<ServiceHealth>>();
- actualPortalRestRespone = consulClientController.getAllHealthyNodes(mockedRequest, mockedResponse, service);
- assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse));
-
- }
-
- @Test
- public void getAllHealthyNodesExceptionTest() {
- PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = errorResponse();
- PortalRestResponse<List<ServiceHealth>> actualPortalRestRespone = new PortalRestResponse<List<ServiceHealth>>();
- Mockito.when(consulHealthService.getAllHealthyNodes(service)).thenThrow(consulException);
- actualPortalRestRespone = consulClientController.getAllHealthyNodes(mockedRequest, mockedResponse, service);
- assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse));
- }
-
- @Test
- public void getAllNodesTest() {
- PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = successResponse();
- PortalRestResponse<List<ServiceHealth>> actualPortalRestRespone = new PortalRestResponse<List<ServiceHealth>>();
- actualPortalRestRespone = consulClientController.getAllNodes(mockedRequest, mockedResponse, service);
- assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse));
- }
-
- @Test
- public void getAllNodesExceptionTest() {
- PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = errorResponse();
- PortalRestResponse<List<ServiceHealth>> actualPortalRestRespone = new PortalRestResponse<List<ServiceHealth>>();
- Mockito.when(consulHealthService.getAllNodes(service)).thenThrow(consulException);
- actualPortalRestRespone = consulClientController.getAllNodes(mockedRequest, mockedResponse, service);
- assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardControllerTest.java
deleted file mode 100644
index eed560de..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardControllerTest.java
+++ /dev/null
@@ -1,427 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.DashboardController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.DashboardSearchService;
-import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.CommonWidget;
-import org.openecomp.portalapp.portal.transport.CommonWidgetMeta;
-import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.domain.support.CollaborateList;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({EPUserUtils.class, CollaborateList.class, SystemProperties.class, EPCommonSystemProperties.class})
-public class DashboardControllerTest {
-
- @Mock
- DashboardSearchService searchService = new DashboardSearchServiceImpl();
-
- @InjectMocks
- DashboardController dashboardController = new DashboardController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
-
- NullPointerException nullPointerException = new NullPointerException();
-
- MockEPUser mockUser = new MockEPUser();
-
- public CommonWidgetMeta mockCommonWidgetMeta() {
- CommonWidgetMeta commonWidgetMeta= new CommonWidgetMeta();
- List<CommonWidget> widgetList = new ArrayList<>();
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId((long) 1);
- commonWidget.setCategory("test");
- commonWidget.setHref("testhref");
- commonWidget.setTitle("testTitle");
- commonWidget.setContent("testcontent");
- commonWidget.setEventDate("testDate");
- commonWidget.setSortOrder(1);
- widgetList.add(commonWidget);
- commonWidgetMeta.setItems(widgetList);
-
- return commonWidgetMeta;
- }
-
- public CommonWidget mockCommonWidget() {
-
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId((long) 1);
- commonWidget.setCategory("test");
- commonWidget.setHref("testhref");
- commonWidget.setTitle("testTitle");
- commonWidget.setContent("testcontent");
- commonWidget.setEventDate("testDate");
- commonWidget.setSortOrder(1);
-
- return commonWidget;
- }
-
-
- @Test
- public void getWidgetDataTest() throws IOException {
-
- String resourceType = null;
- PortalRestResponse<CommonWidgetMeta> expectedData = new PortalRestResponse<CommonWidgetMeta>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("Unexpected resource type null");
- expectedData.setResponse(null);
-
- PortalRestResponse<CommonWidgetMeta> actualResponse = dashboardController.getWidgetData(mockedRequest, resourceType);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void getWidgetDataWithValidResourceTest() throws IOException {
- String resourceType = "EVENTS";
- CommonWidgetMeta commonWidgetMeta= mockCommonWidgetMeta();
- commonWidgetMeta.setCategory(null);
-
- Mockito.when(searchService.getWidgetData(resourceType)).thenReturn(commonWidgetMeta);
- PortalRestResponse<CommonWidgetMeta> expectedData = new PortalRestResponse<CommonWidgetMeta>();
- expectedData.setStatus(PortalRestStatusEnum.OK);
- expectedData.setMessage("success");
- expectedData.setResponse(commonWidgetMeta);
-
- PortalRestResponse<CommonWidgetMeta> actualResponse = dashboardController.getWidgetData(mockedRequest, resourceType);
- System.out.println(actualResponse);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void saveWidgetDataBulkNullTest() throws IOException {
- CommonWidgetMeta commonWidgetMeta= mockCommonWidgetMeta();
- commonWidgetMeta.setCategory(null);
-
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("ERROR");
- expectedData.setResponse("Category cannot be null or empty");
-
- PortalRestResponse<String> actualResponse = dashboardController.saveWidgetDataBulk(commonWidgetMeta);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void saveWidgetUnexpectedDataBulkTest() throws IOException {
- CommonWidgetMeta commonWidgetMeta= mockCommonWidgetMeta();
- commonWidgetMeta.setCategory("Unexpected Data");
-
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("Unexpected resource type Unexpected Data");
- expectedData.setResponse(null);
-
- PortalRestResponse<String> actualResponse = dashboardController.saveWidgetDataBulk(commonWidgetMeta);
- assertEquals(expectedData,actualResponse);
-
- }
-
- @Test
- public void saveWidgetInvalidDataBulkTest() throws IOException {
- CommonWidgetMeta commonWidgetMeta= mockCommonWidgetMeta();
- commonWidgetMeta.setCategory("EVENTS");
-
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("Invalid category: test");
- expectedData.setResponse(null);
-
- PortalRestResponse<String> actualResponse = dashboardController.saveWidgetDataBulk(commonWidgetMeta);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void saveWidgetDataBulkTest() throws IOException {
-
- List<CommonWidget> widgetList = new ArrayList<>();
- CommonWidget commonWidget = new CommonWidget("EVENTS", "http://test.com", "testTitle", "testcontent", "2017-07-01", 1);
- widgetList.add(commonWidget);
- CommonWidgetMeta commonWidgetMeta= new CommonWidgetMeta("EVENTS", widgetList);
-
-
-
- /* commonWidgetMeta.setItems(widgetList);
-
- commonWidgetMeta.setCategory("EVENTS");*/
-
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.OK);
- expectedData.setMessage("success");
- expectedData.setResponse("success");
-
- Mockito.when(searchService.saveWidgetDataBulk(commonWidgetMeta)).thenReturn("success");
-
- PortalRestResponse<String> actualResponse = dashboardController.saveWidgetDataBulk(commonWidgetMeta);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void saveWidgetDataNullTest() throws IOException {
-
- CommonWidget commonWidget = mockCommonWidget();
- commonWidget.setId((long)1);
- commonWidget.setContent("test");
- commonWidget.setCategory(null);
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("ERROR");
- expectedData.setResponse("Category cannot be null or empty");
-
- PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget);
- assertEquals(expectedData,actualResponse);
-
- }
-
- @Test
- public void saveWidgetDataErrorTest() throws IOException {
-
- CommonWidget commonWidget = mockCommonWidget();
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("Invalid category: test");
- expectedData.setResponse(null);
-
- PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void saveWidgetDataTest() throws IOException {
-
- CommonWidgetMeta commonWidgetMeta= new CommonWidgetMeta();
- List<CommonWidget> widgetList = new ArrayList<>();
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId((long) 1);
- commonWidget.setCategory("EVENTS");
- commonWidget.setHref("http://test.com");
- commonWidget.setTitle("testTitle");
- commonWidget.setContent("testcontent");
- commonWidget.setEventDate("2017-07-01");
- commonWidget.setSortOrder(1);
- widgetList.add(commonWidget);
- commonWidgetMeta.setItems(widgetList);
-
- commonWidgetMeta.setCategory("EVENTS");
-
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.OK);
- expectedData.setMessage("success");
- expectedData.setResponse("success");
-
- Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn("success");
-
- PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget);
- assertEquals(expectedData,actualResponse);
-
- }
-
- @Test
- public void deleteWidgetDataTest() throws IOException {
-
- CommonWidget commonWidget = mockCommonWidget();
-
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.OK);
- expectedData.setMessage("success");
- expectedData.setResponse(null);
-
- Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn("success");
-
- PortalRestResponse<String> actualResponse = dashboardController.deleteWidgetData(commonWidget);
- assertEquals(expectedData,actualResponse);
-
- }
-
- @Test
- public void getActiveUsersTest(){
- List<String> activeUsers = new ArrayList<>();
- List<String> expectedUsersList = new ArrayList<>();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String userId = user.getOrgUserId();
- Mockito.when(searchService.getRelatedUsers(userId)).thenReturn(activeUsers);
- expectedUsersList= dashboardController.getActiveUsers(mockedRequest);
- assertEquals(expectedUsersList, activeUsers);
- }
-
-
- @Test
- public void getActiveUsersExceptionTest(){
- List<String> activeUsers = new ArrayList<>();
- List<String> expectedUsersList = new ArrayList<>();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String userId = user.getOrgUserId();
- Mockito.when(searchService.getRelatedUsers(userId)).thenThrow(nullPointerException);
- expectedUsersList = dashboardController.getActiveUsers(mockedRequest);
- assertEquals(expectedUsersList, activeUsers);
- }
-
- @Test
- public void getOnlineUserUpdateRateTest(){
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.OK);
- expectedData.setMessage("success");
- expectedData.setResponse("{onlineUserUpdateRate=1400000, onlineUserUpdateDuration=1400000}");
-
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_RATE)).thenReturn("1400");
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_DURATION)).thenReturn("1400");
-
- PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getOnlineUserUpdateRate(mockedRequest);
- assertEquals(expectedData.getStatus(),actualResponse.getStatus());
- }
-
- @Test
- public void getOnlineUserUpdateRateExceptionTest(){
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("java.lang.NullPointerException");
- expectedData.setResponse(null);
-
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_RATE)).thenThrow(nullPointerException);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_DURATION)).thenThrow(nullPointerException);
-
- PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getOnlineUserUpdateRate(mockedRequest);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void getWindowWidthThresholdForRightMenuTest(){
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.OK);
- expectedData.setMessage("success");
- expectedData.setResponse("{windowWidth=1400}");
-
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_RIGHT_MENU)).thenReturn("1400");
-
- PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getWindowWidthThresholdForRightMenu(mockedRequest);
- assertEquals(expectedData.getStatus(),actualResponse.getStatus());
- }
-
- @Test
- public void getWindowWidthThresholdForRightMenuExceptionTest(){
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("java.lang.NullPointerException");
- expectedData.setResponse(null);
-
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_RIGHT_MENU)).thenThrow(nullPointerException);
-
- PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getWindowWidthThresholdForRightMenu(mockedRequest);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void getWindowWidthThresholdForLeftMenuTest(){
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.OK);
- expectedData.setMessage("success");
- expectedData.setResponse("{windowWidth=1400}");
-
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_LEFT_MENU)).thenReturn("1400");
-
- PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getWindowWidthThresholdForLeftMenu(mockedRequest);
- assertEquals(expectedData.getStatus(),actualResponse.getStatus());
- }
-
- @Test
- public void getWindowWidthThresholdForLeftMenuExceptionTest(){
- PortalRestResponse<String> expectedData = new PortalRestResponse<String>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("java.lang.NullPointerException");
- expectedData.setResponse(null);
-
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_LEFT_MENU)).thenThrow(nullPointerException);
-
- PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getWindowWidthThresholdForLeftMenu(mockedRequest);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void getActiveUsersNullTest(){
- PortalRestResponse<List<String>> expectedData = new PortalRestResponse<List<String>>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("User object is null? - check logs");
- expectedData.setResponse(new ArrayList<>());
-
- PortalRestResponse<List<String>> actualResponse = dashboardController.activeUsers(mockedRequest);
- assertEquals(expectedData,actualResponse);
- }
-
- @Test
- public void activeUsersTest(){
- EPUser user = mockUser.mockEPUser();
- PortalRestResponse<List<String>> expectedData = new PortalRestResponse<List<String>>();
- expectedData.setStatus(PortalRestStatusEnum.OK);
- expectedData.setMessage("success");
- expectedData.setResponse(new ArrayList<>());
- PowerMockito.mockStatic(EPUserUtils.class);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- PortalRestResponse<List<String>> actualResponse = dashboardController.activeUsers(mockedRequest);
- assertEquals(expectedData,actualResponse);
- }
-
-// @Test
-// public void activeUsersExceptionTest(){
-// EPUser user = mockUser.mockEPUser();
-// user.setLoginId("test");
-// String loginId = "abc";
-// PortalRestResponse<List<String>> expectedData = new PortalRestResponse<List<String>>();
-// expectedData.setStatus(PortalRestStatusEnum.ERROR);
-// expectedData.setMessage("java.lang.NullPointerException");
-// expectedData.setResponse(null);
-//
-//// PowerMockito.mockStatic(EPUserUtils.class);
-// Mockito.when(searchService.getRelatedUsers(user.getLoginId(user.getLoginId()))).thenReturn(nullPointerException);
-// PortalRestResponse<List<String>> actualResponse = dashboardController.activeUsers(mockedRequest);
-// System.out.println(actualResponse);
-// //assertEquals(expectedData,actualResponse);
-// }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardSearchResultControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardSearchResultControllerTest.java
deleted file mode 100644
index 6da95415..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardSearchResultControllerTest.java
+++ /dev/null
@@ -1,366 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.DashboardSearchResultController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem;
-import org.openecomp.portalapp.portal.service.DashboardSearchService;
-import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.CommonWidget;
-import org.openecomp.portalapp.portal.transport.CommonWidgetMeta;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-
-public class DashboardSearchResultControllerTest {
-
- @Mock
- DashboardSearchService searchService = new DashboardSearchServiceImpl();
-
- @InjectMocks
- DashboardSearchResultController dashboardSearchResultController = new DashboardSearchResultController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void getWidgetDataTest() {
- String resourceType = "test";
- PortalRestResponse<CommonWidgetMeta> ecpectedPortalRestResponse = new PortalRestResponse<CommonWidgetMeta>();
- ecpectedPortalRestResponse.setMessage("success");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
- Mockito.when(searchService.getWidgetData(resourceType)).thenReturn(null);
- PortalRestResponse<CommonWidgetMeta> acutualPoratlRestResponse = dashboardSearchResultController
- .getWidgetData(mockedRequest, resourceType);
- assertEquals(acutualPoratlRestResponse, ecpectedPortalRestResponse);
-
- }
-
- @Test
- public void saveWidgetDataBulkTest() {
- PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>();
- ecpectedPortalRestResponse.setMessage("success");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
-
- CommonWidgetMeta commonWidgetMeta = new CommonWidgetMeta();
- commonWidgetMeta.setCategory("test");
-
- List<CommonWidget> commonWidgetList = new ArrayList<CommonWidget>();
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId((long) 1);
- commonWidget.setCategory("test");
- commonWidget.setHref("test_href");
- commonWidget.setTitle("test_title");
- commonWidget.setContent("test_content");
- commonWidget.setEventDate(null);
- commonWidget.setSortOrder(1);
-
- commonWidgetList.add(commonWidget);
-
- commonWidgetMeta.setItems(commonWidgetList);
-
- Mockito.when(searchService.saveWidgetDataBulk(commonWidgetMeta)).thenReturn(null);
-
- PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController
- .saveWidgetDataBulk(commonWidgetMeta);
- assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse);
- }
-
- @Test
- public void saveWidgetDataBulkIfCategoryNullTest() {
- PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>();
- ecpectedPortalRestResponse.setMessage("java.text.ParseException: Unparseable date: \"1\"");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
-
- CommonWidgetMeta commonWidgetMeta = new CommonWidgetMeta();
- commonWidgetMeta.setCategory("test");
-
- List<CommonWidget> commonWidgetList = new ArrayList<CommonWidget>();
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId(null);
- commonWidget.setCategory(null);
- commonWidget.setHref(null);
- commonWidget.setTitle(null);
- commonWidget.setContent("test_content");
- commonWidget.setEventDate("1");
- commonWidget.setSortOrder(1);
- commonWidgetList.add(commonWidget);
- commonWidgetMeta.setItems(commonWidgetList);
-
- Mockito.when(searchService.saveWidgetDataBulk(commonWidgetMeta)).thenReturn(null);
-
- PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController
- .saveWidgetDataBulk(commonWidgetMeta);
- assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse);
- }
-
- @Test
- public void saveWidgetDataTest() {
- PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>();
- ecpectedPortalRestResponse.setMessage("success");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId((long) 1);
- commonWidget.setCategory("test");
- commonWidget.setHref("test_href");
- commonWidget.setTitle("test_title");
- commonWidget.setContent("test_content");
- commonWidget.setEventDate(null);
- commonWidget.setSortOrder(1);
-
- Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn(null);
-
- PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController
- .saveWidgetData(commonWidget);
- assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse);
-
- }
-
- @Test
- public void saveWidgetDataExceptionTest() {
- PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>();
- ecpectedPortalRestResponse.setMessage("ERROR");
- ecpectedPortalRestResponse.setResponse("Cateogry cannot be null or empty");
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId((long) 1);
- commonWidget.setCategory("");
- commonWidget.setHref("test_href");
- commonWidget.setTitle("test_title");
- commonWidget.setContent("test_content");
- commonWidget.setEventDate(null);
- commonWidget.setSortOrder(1);
-
- Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn(null);
-
- PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController
- .saveWidgetData(commonWidget);
- assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse);
-
- }
-
- @Test
- public void saveWidgetDataDateErrorTest() {
- PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>();
- ecpectedPortalRestResponse.setMessage("java.text.ParseException: Unparseable date: \"1\"");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId((long) 1);
- commonWidget.setCategory("test");
- commonWidget.setHref("test_href");
- commonWidget.setTitle("test_title");
- commonWidget.setContent("test_content");
- commonWidget.setEventDate("1");
- commonWidget.setSortOrder(1);
-
- Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn(null);
-
- PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController
- .saveWidgetData(commonWidget);
- assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse);
-
- }
-
- public void deleteWidgetDataTest() {
- PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>();
- ecpectedPortalRestResponse.setMessage("success");
- ecpectedPortalRestResponse.setResponse(null);
- ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
- CommonWidget commonWidget = new CommonWidget();
- commonWidget.setId((long) 1);
- commonWidget.setCategory("test");
- commonWidget.setHref("test_href");
- commonWidget.setTitle("test_title");
- commonWidget.setContent("test_content");
- commonWidget.setEventDate(null);
- commonWidget.setSortOrder(1);
- Mockito.when(searchService.deleteWidgetData(commonWidget)).thenReturn(null);
-
- PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController
- .deleteWidgetData(commonWidget);
- System.out.println(actualPortalRestResponse);
- assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse);
- }
-
- @Test
- public void searchPortalIfUserIsNull() {
- EPUser user = null;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String searchString = "test";
-
- PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>();
- expectedResult.setMessage("searchPortal: User object is null? - check logs");
- expectedResult.setResponse(new HashMap<String, List<SearchResultItem>>());
- expectedResult.setStatus(PortalRestStatusEnum.ERROR);
- PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController
- .searchPortal(mockedRequest, searchString);
- assertEquals(expectedResult, actualResult);
- }
-
- @Test
- public void searchPortalIfSearchStringNullTest() {
- EPUser user = mockUser.mockEPUser();
- ;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String searchString = null;
-
- PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>();
- expectedResult.setMessage("searchPortal: String string is null");
- expectedResult.setResponse(new HashMap<String, List<SearchResultItem>>());
- expectedResult.setStatus(PortalRestStatusEnum.ERROR);
-
- PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController
- .searchPortal(mockedRequest, searchString);
- assertEquals(expectedResult, actualResult);
- }
-
- @Test
- public void searchPortalIfSearchTest() {
- EPUser user = mockUser.mockEPUser();
- ;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String searchString = "test";
- List<SearchResultItem> searchResultItemList = new ArrayList<SearchResultItem>();
- SearchResultItem searchResultItem = new SearchResultItem();
-
- searchResultItem.setId((long) 1);
- searchResultItem.setCategory("test");
- searchResultItem.setName("test_name");
- searchResultItem.setTarget("test_target");
- searchResultItem.setUuid("test_UUId");
- searchResultItemList.add(searchResultItem);
- Map<String, List<SearchResultItem>> expectedResultMap = new HashMap<String, List<SearchResultItem>>();
- expectedResultMap.put(searchString, searchResultItemList);
-
- PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>();
- expectedResult.setMessage("success");
- expectedResult.setResponse(expectedResultMap);
- expectedResult.setStatus(PortalRestStatusEnum.OK);
-
- Mockito.when(searchService.searchResults(user.getLoginId(), searchString)).thenReturn(expectedResultMap);
- PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController
- .searchPortal(mockedRequest, searchString);
- assertEquals(expectedResult, actualResult);
-
- }
-
- @Test
- public void searchPortalIfSearchExcptionTest() {
- EPUser user = mockUser.mockEPUser();
- ;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String searchString = "test";
-
- PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>();
- expectedResult.setMessage("null - check logs.");
- expectedResult.setResponse(new HashMap<String, List<SearchResultItem>>());
- expectedResult.setStatus(PortalRestStatusEnum.ERROR);
-
- Mockito.when(searchService.searchResults(user.getLoginId(), searchString)).thenThrow(nullPointerException);
- PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController
- .searchPortal(mockedRequest, searchString);
- assertEquals(expectedResult, actualResult);
- }
-
- @Test
- public void getActiveUsersTest() {
- List<String> expectedActiveUsers = new ArrayList<String>();
- EPUser user = mockUser.mockEPUser();
- ;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String userId = user.getOrgUserId();
- Mockito.when(searchService.getRelatedUsers(userId)).thenReturn(expectedActiveUsers);
- List<String> actualOnlineUsers = dashboardSearchResultController.getActiveUsers(mockedRequest);
- assertEquals(expectedActiveUsers, actualOnlineUsers);
-
- }
-
- @Test
- public void getActiveUsersExceptionTest() {
- List<String> expectedActiveUsers = new ArrayList<String>();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String userId = user.getOrgUserId();
- Mockito.when(searchService.getRelatedUsers(userId)).thenThrow(nullPointerException);
- List<String> actualOnlineUsers = dashboardSearchResultController.getActiveUsers(mockedRequest);
- assertEquals(expectedActiveUsers, actualOnlineUsers);
-
- }
-
- @Test
- public void activeUsersTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- PortalRestResponse<List<String>> expectedResult = new PortalRestResponse<List<String>>();
- expectedResult.setMessage("success");
- expectedResult.setResponse(new ArrayList<>());
- expectedResult.setStatus(PortalRestStatusEnum.OK);
- PortalRestResponse<List<String>> actualResult = dashboardSearchResultController.activeUsers(mockedRequest);
-
- assertEquals(actualResult, expectedResult);
-
- }
-
- @Test
- public void activeUsersIfUserNullTest() {
- EPUser user = null;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- PortalRestResponse<List<String>> expectedResult = new PortalRestResponse<List<String>>();
- expectedResult.setMessage("User object is null? - check logs");
- expectedResult.setResponse(new ArrayList<>());
- expectedResult.setStatus(PortalRestStatusEnum.ERROR);
- PortalRestResponse<List<String>> actualResult = dashboardSearchResultController.activeUsers(mockedRequest);
- assertEquals(actualResult, expectedResult);
-
- }
-
- @Test
- public void activeUsersExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- PortalRestResponse<List<String>> expectedResult = new PortalRestResponse<List<String>>();
- expectedResult.setMessage("null - check logs.");
- expectedResult.setResponse(new ArrayList<>());
- expectedResult.setStatus(PortalRestStatusEnum.ERROR);
- Mockito.when(searchService.getRelatedUsers(user.getLoginId())).thenThrow(nullPointerException);
- PortalRestResponse<List<String>> actualResult = dashboardSearchResultController.activeUsers(mockedRequest);
- assertEquals(actualResult, expectedResult);
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/EPFusionBaseControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/EPFusionBaseControllerTest.java
deleted file mode 100644
index 683738b9..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/EPFusionBaseControllerTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.controller.EPFusionBaseController;
-import org.openecomp.portalapp.portal.controller.DashboardController;
-import org.openecomp.portalapp.portal.service.DashboardSearchService;
-import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({EPUserUtils.class, SystemProperties.class})
-public class EPFusionBaseControllerTest {
-
- @Mock
- DashboardSearchService searchService = new DashboardSearchServiceImpl();
-
- @InjectMocks
- EPFusionBaseController epFusionBaseController; /*= mock(EPFusionBaseController.class);*/
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
-
- NullPointerException nullPointerException = new NullPointerException();
-
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void messagesTest(){
- Map<String, Object> expectedData = new HashMap<String, Object>();
- Map<String, Object> actualData = null;
-
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)).then(null);
- actualData = epFusionBaseController.messages(mockedRequest);
- System.out.println();
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAccessRolesControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAccessRolesControllerTest.java
deleted file mode 100644
index d2e1b13c..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAccessRolesControllerTest.java
+++ /dev/null
@@ -1,509 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.ExternalAccessRolesController;
-import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.ExternalAccessRolesService;
-import org.openecomp.portalapp.portal.service.ExternalAccessRolesServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.CentralRole;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.domain.AuditLog;
-import org.openecomp.portalsdk.core.domain.Role;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.client.HttpClientErrorException;
-public class ExternalAccessRolesControllerTest {
-
- @Mock
- ExternalAccessRolesService externalAccessRolesService = new ExternalAccessRolesServiceImpl();
-
- @InjectMocks
- ExternalAccessRolesController externalAccessRolesController = new ExternalAccessRolesController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
- @Mock
- AuditLog auditLog = new AuditLog();
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
- HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Failed");
-
- MockEPUser mockUser = new MockEPUser();
- String loginId = "guestT";
- String uebKey = "testUebKey";
-
- @Test
- public void getUserTest() throws Exception {
- List<EPUser> userList = new ArrayList<>();
- Mockito.when(externalAccessRolesService.getUser(loginId)).thenReturn(userList);
- assertNull(externalAccessRolesController.getUser(mockedRequest, mockedResponse, loginId));
- }
-
- @Test
- public void getUserExceptionTest() throws Exception {
- Mockito.when(externalAccessRolesService.getUser(loginId))
- .thenThrow(nullPointerException);
- assertNull(externalAccessRolesController.getUser(mockedRequest, mockedResponse, loginId));
- }
-
- public EPApp mockApp()
- {
- EPApp app = new EPApp();
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppRestEndpoint("test");
- app.setAlternateUrl("test");
- app.setName("test");
- app.setMlAppName("test");
- app.setMlAppAdminId("test");
- app.setUsername("test");
- app.setAppPassword("test");
- app.setOpen(false);
- app.setEnabled(false);
- app.setUebKey("test");
- app.setUebSecret("test");
- app.setUebTopicName("test");
- app.setAppType(1);
- return app;
- }
-
- @Test
- public void getRolesForAppTest() throws Exception {
- List<EPApp> applicationList = new ArrayList<EPApp>();
- List<CentralRole> answer = new ArrayList<>();
- EPApp app = mockApp();
- applicationList.add(app);
- Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
- Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app);
- Mockito.when(externalAccessRolesService.getRolesForApp(mockedRequest.getHeader(uebKey))).thenReturn(answer);
- assertEquals(externalAccessRolesController.getRolesForApp(mockedRequest, mockedResponse), answer);
- }
-
- @Test
- public void getRolesForAppExceptionTest() throws Exception {
- List<EPApp> applicationList = new ArrayList<EPApp>();
- List<CentralRole> answer = new ArrayList<>();
- EPApp app = mockApp();
- applicationList.add(app);
- Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
- Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app);
- Mockito.when(externalAccessRolesService.getRolesForApp(mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- assertNull(externalAccessRolesController.getRolesForApp(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getRoleFunctionsListTest() throws Exception {
- List<CentralRoleFunction> answer = new ArrayList<>();
- Mockito.when(externalAccessRolesService.getRoleFuncList(mockedRequest.getHeader(uebKey))).thenReturn(answer);
- assertEquals(externalAccessRolesController.getRoleFunctionsList(mockedRequest, mockedResponse), answer);
- }
-
- @Test
- public void getRoleFunctionsListExceptionTest() throws Exception {
- Mockito.when(externalAccessRolesService.getRoleFuncList(mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- assertNull(externalAccessRolesController.getRoleFunctionsList(mockedRequest, mockedResponse));
- }
-
- @Test
- public void getRoleInfoTest() throws Exception {
- CentralRole answer = new CentralRole();
- long roleId = 1;
- Mockito.when(externalAccessRolesService.getRoleInfo(roleId, mockedRequest.getHeader(uebKey)))
- .thenReturn(answer);
- assertEquals(externalAccessRolesController.getRoleInfo(mockedRequest, mockedResponse, roleId), answer);
- }
-
- @Test
- public void getRoleInfoExceptionTest() throws Exception {
- long roleId = 1;
- Mockito.when(externalAccessRolesService.getRoleInfo(roleId, mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- assertNull(externalAccessRolesController.getRoleInfo(mockedRequest, mockedResponse, roleId));
- }
-
- @Test
- public void getRoleFunctionTest() throws Exception {
- CentralRoleFunction centralRoleFunction = new CentralRoleFunction();
- String code = "test_menu";
- Mockito.when(externalAccessRolesService.getRoleFunction(code, mockedRequest.getHeader(uebKey)))
- .thenReturn(centralRoleFunction);
- assertEquals(externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, code),
- centralRoleFunction);
- }
-
- @Test
- public void getRoleFunctionExceptionTest() throws Exception {
- String code = "test_menu";
- Mockito.when(externalAccessRolesService.getRoleFunction(code, mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- assertNull(externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, code));
- }
-
- @Test
- public void saveRoleFunctionIfIsIsNotDeletedTest() throws Exception {
- List<EPApp> applicationList = new ArrayList<EPApp>();
- EPApp app = mockApp();
- applicationList.add(app);
- Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- String data = null;
- CentralRoleFunction centralRoleFunction = new CentralRoleFunction();
- Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenReturn(false);
- portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void saveRoleFunctionExceptionTest() throws Exception {
- List<EPApp> applicationList = new ArrayList<EPApp>();
- EPApp app = mockApp();
- applicationList.add(app);
- Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- String data = null;
- CentralRoleFunction centralRoleFunction = new CentralRoleFunction();
- Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenThrow(nullPointerException);
- portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data);
- System.out.println(portalRestResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void saveRoleFunctionTest() throws Exception {
- List<EPApp> applicationList = new ArrayList<EPApp>();
- List<CentralRole> answer = new ArrayList<>();
- EPApp app = mockApp();
- applicationList.add(app);
- Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- String data = null;
- CentralRoleFunction centralRoleFunction = new CentralRoleFunction();
- Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenReturn(true);
- portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data);
- System.out.println(portalRestResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
-// @Test
-// public void deleteRoleFunctionTest() throws Exception {
-// PortalRestResponse<String> portalRestResponse = null;
-// PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
-// expectedportalRestResponse.setMessage("Successfully Deleted");
-// expectedportalRestResponse.setResponse("Success");
-// PortalRestStatusEnum portalRestStatusEnum = null;
-// EPUser user = mockUser.mockEPUser();
-// EPApp app = mockApp();
-// expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
-// String code ="testNew";
-// Mockito.when(externalAccessRolesService.getUser(mockedRequest.getHeader("LOGIN_ID"))).thenReturn((List<EPUser>) user);
-// Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader("UEBKEY")).get(0)).thenReturn(app);
-// Mockito.when(externalAccessRolesService.deleteCentralRoleFunction(code, app)).thenReturn(true);
-// portalRestResponse = externalAccessRolesController.deleteRoleFunction(mockedRequest, mockedResponse, code);
-// assertEquals(portalRestResponse, expectedportalRestResponse);
-// }
-
- @Test
- public void getActiveRolesTest() throws Exception {
- List<CentralRole> cenRole = new ArrayList<>();
- Mockito.when(externalAccessRolesService.getActiveRoles(mockedRequest.getHeader(uebKey))).thenReturn(cenRole);
- List<CentralRole> expectedCenRole = externalAccessRolesController.getActiveRoles(mockedRequest, mockedResponse);
- assertEquals(expectedCenRole, cenRole);
- }
-
- @Test
- public void getActiveRolesExceptionTest() throws Exception {
- Mockito.when(externalAccessRolesService.getActiveRoles(mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- assertNull(externalAccessRolesController.getActiveRoles(mockedRequest, mockedResponse));
- }
-
- @Test
- public void deleteDependcyRoleRecordExceptionTest() throws Exception {
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Failed to deleteDependencyRoleRecord");
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- long roleId = 123;
- portalRestResponse = externalAccessRolesController.deleteDependencyRoleRecord(mockedRequest, mockedResponse, roleId);
- assertEquals(expectedportalRestResponse, portalRestResponse);
- }
-
- @Test
- public void bulkUploadFunctionsTest() throws Exception {
- Integer result = 0;
- Mockito.when(externalAccessRolesService.bulkUploadFunctions(mockedRequest.getHeader(uebKey)))
- .thenReturn(result);
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Successfully added: 0");
- expectedportalRestResponse.setResponse("Success");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
- portalRestResponse = externalAccessRolesController.bulkUploadFunctions(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadFunctionsExceptionTest() throws Exception {
- Mockito.when(externalAccessRolesService.bulkUploadFunctions(mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Failed to bulkUploadFunctions");
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- portalRestResponse = externalAccessRolesController.bulkUploadFunctions(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadRolesTest() throws Exception {
- Integer result = 0;
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Successfully added: 0");
- expectedportalRestResponse.setResponse("Success");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
- Mockito.when(externalAccessRolesService.bulkUploadRoles(mockedRequest.getHeader(uebKey))).thenReturn(result);
- portalRestResponse = externalAccessRolesController.bulkUploadRoles(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadRolesTestException() throws Exception {
- Mockito.when(externalAccessRolesService.bulkUploadRoles(mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Failed to bulkUploadRoles");
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- portalRestResponse = externalAccessRolesController.bulkUploadRoles(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadRoleFunctionsTest() throws Exception {
- Integer result = 0;
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Successfully added: 0");
- expectedportalRestResponse.setResponse("Success");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
- Mockito.when(externalAccessRolesService.bulkUploadRolesFunctions(mockedRequest.getHeader(uebKey)))
- .thenReturn(result);
- portalRestResponse = externalAccessRolesController.bulkUploadRoleFunctions(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadRoleFunctionsException() throws Exception {
- Mockito.when(externalAccessRolesService.bulkUploadRolesFunctions(mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Failed to bulkUploadRoleFunctions");
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- portalRestResponse = externalAccessRolesController.bulkUploadRoleFunctions(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadUserRolesTest() throws Exception {
- Integer result = 0;
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Successfully added: 0");
- expectedportalRestResponse.setResponse("Success");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
- Mockito.when(externalAccessRolesService.bulkUploadUserRoles(mockedRequest.getHeader(uebKey)))
- .thenReturn(result);
- portalRestResponse = externalAccessRolesController.bulkUploadUserRoles(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadUserRolesExceptionTest() throws Exception {
- Mockito.when(externalAccessRolesService.bulkUploadUserRoles(mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Failed to bulkUploadUserRoles");
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- portalRestResponse = externalAccessRolesController.bulkUploadUserRoles(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadPartnerFunctionsTest() throws Exception {
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Successfully added");
- expectedportalRestResponse.setResponse("Success");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
- portalRestResponse = externalAccessRolesController.bulkUploadPartnerFunctions(mockedRequest, mockedResponse, null);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
-
- @Test
- public void bulkUploadPartnerRolesTest() throws Exception {
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Successfully added");
- expectedportalRestResponse.setResponse("Success");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
- List<Role> upload = new ArrayList<>();
- portalRestResponse = externalAccessRolesController.bulkUploadPartnerRoles(mockedRequest, mockedResponse,
- upload);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void bulkUploadPartnerRolesExceptionTest() throws Exception
- {
- ExternalAccessRolesService externalAccessRolesService = null;
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Successfully added");
- expectedportalRestResponse.setResponse("Success");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
- List<Role> upload = new ArrayList<>();
- portalRestResponse = externalAccessRolesController.bulkUploadPartnerRoles(mockedRequest, mockedResponse,
- upload);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void getMenuFunctionsTest() throws Exception {
- List<String> functionsList = new ArrayList<>();
- Mockito.when(externalAccessRolesService.getMenuFunctionsList(mockedRequest.getHeader(uebKey)))
- .thenReturn(functionsList);
- List<String> expectedFunctionsList = externalAccessRolesController.getMenuFunctions(mockedRequest,
- mockedResponse);
- assertEquals(functionsList, expectedFunctionsList);
- }
-
- @Test
- public void getMenuFunctionsExceptionTest() throws Exception {
- Mockito.when(externalAccessRolesService.getMenuFunctionsList(mockedRequest.getHeader(uebKey)))
- .thenThrow(httpClientErrorException);
- assertNull(externalAccessRolesController.getMenuFunctions(mockedRequest, mockedResponse));
- }
-
-// @Test
-// public void getUsersOfApplicationTest() throws Exception {
-// List<String> users = new ArrayList<>();
-// Mockito.when(externalAccessRolesService.getAllUsers(mockedRequest.getHeader(uebKey))).thenReturn(users);
-// List<String> expectedusers = externalAccessRolesController.getUsersOfApplication(mockedRequest, mockedResponse);
-// assertEquals(users, expectedusers);
-// }
-
-// @Test
-// public void getUsersOfApplicationExceptionTest() throws Exception {
-// Mockito.when(externalAccessRolesService.getAllUsers(mockedRequest.getHeader(uebKey)))
-// .thenThrow(httpClientErrorException);
-// assertNull(externalAccessRolesController.getUsersOfApplication(mockedRequest, mockedResponse));
-// }
-
- @Test
- public void saveRoleExceptionTest() throws Exception {
- Role role = new Role();
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Failed to saveRole");
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- List<Role> upload = new ArrayList<>();
- portalRestResponse = externalAccessRolesController.saveRole(mockedRequest, mockedResponse,role);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void deleteRoleExceptionTest() throws Exception {
- String role = "TestNew";
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Failed to deleteRole for 'TestNew'");
- expectedportalRestResponse.setResponse("Failed");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
- portalRestResponse = externalAccessRolesController.deleteRole(mockedRequest, mockedResponse,role);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-
-
- @Test
- public void bulkUploadPartnerRoleFunctionsTest() throws Exception {
- PortalRestResponse<String> portalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Successfully added");
- expectedportalRestResponse.setResponse("Success");
- PortalRestStatusEnum portalRestStatusEnum = null;
- expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
- List<Role> upload = new ArrayList<>();
- portalRestResponse = externalAccessRolesController.bulkUploadPartnerRoleFunctions(mockedRequest, mockedResponse,upload);
- assertEquals(portalRestResponse, expectedportalRestResponse);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAppsRestfulControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAppsRestfulControllerTest.java
deleted file mode 100644
index 43860d45..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAppsRestfulControllerTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.ExternalAppsRestfulController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl;
-import org.openecomp.portalapp.portal.service.EPLoginService;
-import org.openecomp.portalapp.portal.service.EPLoginServiceImpl;
-import org.openecomp.portalapp.portal.service.EPRoleService;
-import org.openecomp.portalapp.portal.service.EPRoleServiceImpl;
-import org.openecomp.portalapp.portal.service.FunctionalMenuService;
-import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl;
-import org.openecomp.portalapp.portal.service.UserNotificationService;
-import org.openecomp.portalapp.portal.service.UserNotificationServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuItem;
-import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
-import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.service.DataAccessServiceImpl;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.slf4j.MDC;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ MDC.class, EPCommonSystemProperties.class })
-public class ExternalAppsRestfulControllerTest {
-
- @InjectMocks
- ExternalAppsRestfulController externalAppsRestfulController = new ExternalAppsRestfulController();
- @Mock
- FunctionalMenuService functionalMenuService = new FunctionalMenuServiceImpl();
-
- @Mock
- EPLoginService epLoginService = new EPLoginServiceImpl();
-
- @Mock
- AdminRolesService adminRolesService = new AdminRolesServiceImpl();
-
- @Mock
- UserNotificationService userNotificationService = new UserNotificationServiceImpl();
-
- @Mock
- EPRoleService epRoleService = new EPRoleServiceImpl();
-
- @Mock
- EcompPortalUtils EcompPortalUtils = new EcompPortalUtils();
-
- @Mock
- DataAccessService DataAccessService = new DataAccessServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- MockEPUser mockUser = new MockEPUser();
-
- @Test(expected = Exception.class)
- public void getFunctionalMenuItemsForUserIfUSerNullTest() throws
- Exception
- {
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- PowerMockito.mockStatic(MDC.class);
- EPUser epUser = null;
- String loginId = "guestT";
- Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test");
- Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser);
- externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest,
- mockedResponse);
- }
-
- @Test
- public void getFunctionalMenuItemsForUserIfSuperAdminTest() throws Exception {
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- PowerMockito.mockStatic(MDC.class);
- EPUser epUser = mockUser.mockEPUser();
- epUser.setId((long) 1);
- epUser.setLoginId("guestT");
- String loginId = "guestT";
- Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test");
- Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser);
- List<FunctionalMenuItem> expectedList = new ArrayList<FunctionalMenuItem>();
- FunctionalMenuItem functionalMenuItem = new FunctionalMenuItem();
- expectedList.add(functionalMenuItem);
- Mockito.when(mockedRequest.getHeader("LoginId")).thenReturn("guestT");
- Mockito.when(adminRolesService.isSuperAdmin(epUser)).thenReturn(true);
- Mockito.when(functionalMenuService.getFunctionalMenuItems()).thenReturn(expectedList);
- List<FunctionalMenuItem> actualList = externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest,
- mockedResponse);
- assertNull(actualList.get(0).menuId);
- }
-
- @Test
- public void getFunctionalMenuItemsForUserTest() throws Exception {
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- PowerMockito.mockStatic(MDC.class);
- EPUser epUser = mockUser.mockEPUser();
- epUser.setId((long) 1);
- epUser.setLoginId("guestT");
- String loginId = "guestT";
- Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test");
- Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser);
- List<FunctionalMenuItem> expectedList = new ArrayList<FunctionalMenuItem>();
- FunctionalMenuItem functionalMenuItem = new FunctionalMenuItem();
- expectedList.add(functionalMenuItem);
- Mockito.when(mockedRequest.getHeader("LoginId")).thenReturn("guestT");
- Mockito.when(adminRolesService.isSuperAdmin(epUser)).thenReturn(false);
- Mockito.when(functionalMenuService.getFunctionalMenuItemsForUser(epUser.getOrgUserId()))
- .thenReturn(expectedList);
- List<FunctionalMenuItem> actualList = externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest,
- mockedResponse);
- assertNull(actualList.get(0).menuId);
- }
-
- @Test(expected = Exception.class)
- public void getFavoritesForUserIfUserNullTest() throws Exception {
- List<FavoritesFunctionalMenuItemJson> favorites = new ArrayList<FavoritesFunctionalMenuItemJson>();
- FavoritesFunctionalMenuItemJson favoritesFunctionalMenuItemJson = new FavoritesFunctionalMenuItemJson();
- favorites.add(favoritesFunctionalMenuItemJson);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- PowerMockito.mockStatic(MDC.class);
- Mockito.when(mockedRequest.getHeader(EPCommonSystemProperties.MDC_LOGIN_ID)).thenReturn("Login_URL");
- Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test");
- EPUser epUser = null;
- externalAppsRestfulController.getFavoritesForUser(mockedRequest, mockedResponse);
- }
-
- @Test
- public void getFavoritesForUserTest() throws Exception {
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- PowerMockito.mockStatic(MDC.class);
- EPUser epUser = mockUser.mockEPUser();
- epUser.setId((long) 1);
- epUser.setLoginId("guestT");
- String loginId = "guestT";
- Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test");
- List<FavoritesFunctionalMenuItemJson> favorites = new ArrayList<FavoritesFunctionalMenuItemJson>();
- FavoritesFunctionalMenuItemJson favoritesFunctionalMenuItemJson = new FavoritesFunctionalMenuItemJson();
- favorites.add(favoritesFunctionalMenuItemJson);
- Mockito.when(mockedRequest.getHeader(EPCommonSystemProperties.MDC_LOGIN_ID)).thenReturn("Login_URL");
- Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test");
- Mockito.when(epLoginService.findUserWithoutPwd("Login_URL")).thenReturn(epUser);
- Mockito.when(functionalMenuService.getFavoriteItems(epUser.getId())).thenReturn(favorites);
- List<FavoritesFunctionalMenuItemJson> actaulFavorites = externalAppsRestfulController
- .getFavoritesForUser(mockedRequest, mockedResponse);
- assertEquals(actaulFavorites.size(), 1);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/FunctionalMenuControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/FunctionalMenuControllerTest.java
deleted file mode 100644
index 03e2107a..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/FunctionalMenuControllerTest.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.openecomp.portalapp.portal.controller.FunctionalMenuController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl;
-import org.openecomp.portalapp.portal.service.FunctionalMenuService;
-import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl;
-import org.openecomp.portalapp.portal.service.SearchService;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole;
-import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRolesList;
-import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItem;
-import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson;
-import org.openecomp.portalapp.portal.transport.FieldsValidator;
-import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuItem;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuItemWithRoles;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(SystemProperties.class)
-public class FunctionalMenuControllerTest extends MockitoTestSuite {
-
- String userid = "ab1234";
-
- @Mock
- FunctionalMenuService functionalMenuService = new FunctionalMenuServiceImpl();
-
- @InjectMocks
- FunctionalMenuController functionalMenuController = new FunctionalMenuController();
-
- @Mock
- private DataAccessService dataAccessService;
-
- @Mock
- SearchService searchService;
-
- @Mock
- AdminRolesService adminRolesService = new AdminRolesServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
-
- @InjectMocks
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- @Mock
- EPUser epuser;
-
- MockEPUser mockUser = new MockEPUser();
-
- List<BusinessCardApplicationRolesList> appRoles = new ArrayList<BusinessCardApplicationRolesList>();
- List<BusinessCardApplicationRolesList> appRolesActual = new ArrayList<BusinessCardApplicationRolesList>();
-
- List<BusinessCardApplicationRole> userAppRoleList = new ArrayList<BusinessCardApplicationRole>();
-
- public List<BusinessCardApplicationRole> mockBusinessCardApplicationRole() {
- List<BusinessCardApplicationRole> userAppRoleList = new ArrayList<BusinessCardApplicationRole>();
-
- BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole();
- businessCardApplicationRole.setRoleName("ADMIN");
- businessCardApplicationRole.setAppName("ASDC");
-
- BusinessCardApplicationRole businessCardApplicationRole1 = new BusinessCardApplicationRole();
- businessCardApplicationRole1.setAppName("ASDC");
- businessCardApplicationRole1.setRoleName("Tester");
-
- userAppRoleList.add(businessCardApplicationRole);
- userAppRoleList.add(businessCardApplicationRole1);
- return userAppRoleList;
- }
-
- public List<BusinessCardApplicationRolesList> mockBusinessCardApplicationRolesList() {
- List<BusinessCardApplicationRolesList> appRolesActual = new ArrayList<BusinessCardApplicationRolesList>();
-
- BusinessCardApplicationRolesList businessCardApplicationRolesList = new BusinessCardApplicationRolesList();
- businessCardApplicationRolesList.setAppName("ASDC");
-
- List<String> roleNames = new ArrayList<String>();
- roleNames.add("ADMIN");
- roleNames.add("Tester");
- businessCardApplicationRolesList.setRoleNames(roleNames);
-
- appRolesActual.add(businessCardApplicationRolesList);
- return appRolesActual;
- }
-
- @Test
- public void getAppListTestIfAppAlredyExistsBusinessCardApplicationRolesList() throws IOException {
-
- userAppRoleList = mockBusinessCardApplicationRole();
- appRolesActual = mockBusinessCardApplicationRolesList();
-
- Mockito.when(functionalMenuService.getUserAppRolesList(userid)).thenReturn(userAppRoleList);
-
- appRoles = functionalMenuController.getAppList(mockedRequest, userid);
-
- assertEquals(appRolesActual.size(), appRoles.size());
- assertEquals(appRolesActual.get(0).getAppName(), appRoles.get(0).getAppName());
- assertEquals(appRolesActual.get(0).getRoleNames(), appRoles.get(0).getRoleNames());
-
- }
-
- @Test
- public void getAppListTestIfAppDoesnotExistsInBusinessCardApplicationRolesList() throws IOException {
-
- userAppRoleList = mockBusinessCardApplicationRole();
- BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole();
- businessCardApplicationRole.setAppName("CCD");
- businessCardApplicationRole.setRoleName("ADMIN");
- userAppRoleList.add(businessCardApplicationRole);
- appRolesActual = mockBusinessCardApplicationRolesList();
- BusinessCardApplicationRolesList businessCardApplicationRolesList = new BusinessCardApplicationRolesList();
- businessCardApplicationRolesList.setAppName("CCD");
- List<String> roleNames1 = new ArrayList<String>();
- roleNames1.add("ADMIN");
- businessCardApplicationRolesList.setRoleNames(roleNames1);
- appRolesActual.add(businessCardApplicationRolesList);
- Mockito.when(functionalMenuService.getUserAppRolesList(userid)).thenReturn(userAppRoleList);
- appRoles = functionalMenuController.getAppList(mockedRequest, userid);
- assertEquals(appRolesActual.size(), appRoles.size());
- assertEquals(appRolesActual.get(0).getAppName(), appRoles.get(0).getAppName());
- assertEquals(appRolesActual.get(0).getRoleNames(), appRoles.get(0).getRoleNames());
- assertEquals(appRolesActual.get(1).getAppName(), appRoles.get(1).getAppName());
- assertEquals(appRolesActual.get(1).getRoleNames(), appRoles.get(1).getRoleNames());
-
- }
-
- @Test
- public void regenerateAncestorTableTest() {
- EPUser user = mockUser.mockEPUser();
-
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- FieldsValidator acutualFieldValidator = null;
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(fields);
- expectedFieldValidator.setErrorCode(null);
- Mockito.when(!adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(functionalMenuService.regenerateAncestorTable()).thenReturn(expectedFieldValidator);
- acutualFieldValidator = functionalMenuController.regenerateAncestorTable(mockedRequest, mockedResponse);
- assertTrue(acutualFieldValidator.equals(expectedFieldValidator));
- }
-
- @Test
- public void getFunctionalMenuStaticInfoExceptionTest(){
- String fnMenuStaticactualResponse = null;
- String fnMenuStaticexpectedResponse = null;
- String orgUserIdStr = null;
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(searchService.searchUserByUserId(orgUserIdStr)).thenReturn(user);
- fnMenuStaticactualResponse = functionalMenuController.getFunctionalMenuStaticInfo(mockedRequest, mockedResponse);
-
- assertEquals(fnMenuStaticactualResponse, fnMenuStaticexpectedResponse);
-
- }
-
- @Test
- public void getFunctionalMenuStaticInfoTest(){
- String fnMenuStaticactualResponse = null;
- String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13-0400\",\"userId\":\"guestT\",\"email\":\"test\"}";
- String orgUserIdStr = null;
-
- EPUser user = mockUser.mockEPUser();
- user.setEmail("test");
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(searchService.searchUserByUserId(orgUserIdStr)).thenReturn(user);
- fnMenuStaticactualResponse = functionalMenuController.getFunctionalMenuStaticInfo(mockedRequest, mockedResponse);
- assertEquals(fnMenuStaticactualResponse.length(), fnMenuStaticexpectedResponse.length());
- }
-
- @Test
- public void getMenuItemsForAuthUserNullTest(){
- List<FunctionalMenuItem> actualmenuItems = null;
- List<FunctionalMenuItem> expectedmenuItems = null;
-
- actualmenuItems = functionalMenuController.getMenuItemsForAuthUser(mockedRequest, mockedResponse);
- assertEquals(actualmenuItems, expectedmenuItems);
- }
-
- @Test
- public void getMenuItemsForAuthUserIsSuperAdminTest(){
- List<FunctionalMenuItem> actualmenuItems = null;
- List<FunctionalMenuItem> expectedmenuItems = new ArrayList<FunctionalMenuItem>();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- actualmenuItems = functionalMenuController.getMenuItemsForAuthUser(mockedRequest, mockedResponse);
- assertEquals(actualmenuItems, expectedmenuItems);
- }
-
- @Test
- public void getMenuItemsForAuthUserTest(){
- List<FunctionalMenuItem> actualmenuItems = null;
- List<FunctionalMenuItem> expectedmenuItems = new ArrayList<FunctionalMenuItem>();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- actualmenuItems = functionalMenuController.getMenuItemsForAuthUser(mockedRequest, mockedResponse);
- assertEquals(actualmenuItems, expectedmenuItems);
- }
-
- @Test
- public void getFunctionalMenuItemDetailsBadPermissionTest(){
- Integer menuId = 1234;
- FunctionalMenuItem actualmenuItem = null;
- FunctionalMenuItem expectedmenuItem = null;
- EPUser user = mockUser.mockEPUser();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
-
- actualmenuItem = functionalMenuController.getFunctionalMenuItemDetails(mockedRequest, menuId, mockedResponse);
- assertEquals(actualmenuItem, expectedmenuItem);
- }
-
- @Test
- public void getFunctionalMenuItemDetailsTest(){
- Integer menuId = 1234;
- FunctionalMenuItem actualmenuItem = null;
- FunctionalMenuItem expectedmenuItem = null;
- EPUser user = mockUser.mockEPUser();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(functionalMenuService.getFunctionalMenuItemDetails(menuId)).thenReturn(actualmenuItem);
-
- actualmenuItem = functionalMenuController.getFunctionalMenuItemDetails(mockedRequest, menuId, mockedResponse);
- assertEquals(actualmenuItem, expectedmenuItem);
- }
-
- @Test
- public void getMenuItemsForEditingTest(){
- List<FunctionalMenuItem> actualMenuItems = null;
- List<FunctionalMenuItem> expectedMenuItems = null;
- EPUser user = mockUser.mockEPUser();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(functionalMenuService.getFunctionalMenuItems(true)).thenReturn(actualMenuItems);
-
- actualMenuItems = functionalMenuController.getMenuItemsForEditing(mockedRequest, mockedResponse);
- assertEquals(actualMenuItems, expectedMenuItems);
- }
-
- @Test
- public void getMenuItemsForEditingBadPermissionsTest(){
- List<FunctionalMenuItem> actualMenuItems = null;
- List<FunctionalMenuItem> expectedMenuItems = null;
- EPUser user = mockUser.mockEPUser();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(functionalMenuService.getFunctionalMenuItems(true)).thenReturn(actualMenuItems);
-
- actualMenuItems = functionalMenuController.getMenuItemsForEditing(mockedRequest, mockedResponse);
- assertEquals(actualMenuItems, expectedMenuItems);
- }
-
- @Test
- public void getMenuItemsForNotificationsTest(){
- List<FunctionalMenuItem> actualMenuItems = null;
- List<FunctionalMenuItem> expectedMenuItems = new ArrayList<FunctionalMenuItem>();
- Mockito.when(functionalMenuService.getFunctionalMenuItemsForNotificationTree(false)).thenReturn(actualMenuItems);
-
- actualMenuItems = functionalMenuController.getMenuItemsForNotifications(mockedRequest, mockedResponse);
- assertEquals(actualMenuItems, expectedMenuItems);
- }
-
- @Test
- public void getMenuItemsForAppTest(){
- Integer appId = 1234;
- List<FunctionalMenuItem> actualMenuItems = null;
- List<FunctionalMenuItem> expectedMenuItems = null;
- Mockito.when(functionalMenuService.getFunctionalMenuItemsForApp(appId)).thenReturn(actualMenuItems);
-
- actualMenuItems = functionalMenuController.getMenuItemsForApp(mockedRequest, appId);
- assertEquals(actualMenuItems, expectedMenuItems);
- }
-
- @Test
- public void getMenuItemsForUserTest(){
- String orgUserId ="test";
- List<FunctionalMenuItem> actualMenuItems = null;
- List<FunctionalMenuItem> expectedMenuItems = null;
- Mockito.when(functionalMenuService.getFunctionalMenuItemsForUser(orgUserId)).thenReturn(actualMenuItems);
-
- actualMenuItems = functionalMenuController.getMenuItemsForUser(mockedRequest, orgUserId);
- assertEquals(actualMenuItems, expectedMenuItems);
- }
-
- @Test
- public void createFunctionalMenuItemTest(){
- FieldsValidator actualFieldsValidator = new FieldsValidator();
- FieldsValidator expectedFieldsValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
- expectedFieldsValidator.setHttpStatusCode((long) 200);
- expectedFieldsValidator.setFields(fields);
- expectedFieldsValidator.setErrorCode(null);
- FunctionalMenuItemWithRoles menuItemJson = new FunctionalMenuItemWithRoles();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(functionalMenuService.createFunctionalMenuItem(menuItemJson)).thenReturn(expectedFieldsValidator);
- actualFieldsValidator = functionalMenuController.createFunctionalMenuItem(mockedRequest, menuItemJson, mockedResponse);
- assertEquals(actualFieldsValidator, expectedFieldsValidator);
- }
-
- @Test
- public void createFunctionalMenuItemBadPermisssionsTest(){
- FieldsValidator actualFieldsValidator = null;
- FieldsValidator expectedFieldsValidator = null;
- FunctionalMenuItemWithRoles menuItemJson = new FunctionalMenuItemWithRoles();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(functionalMenuService.createFunctionalMenuItem(menuItemJson)).thenReturn(expectedFieldsValidator);
- actualFieldsValidator = functionalMenuController.createFunctionalMenuItem(mockedRequest, menuItemJson, mockedResponse);
- assertEquals(actualFieldsValidator, expectedFieldsValidator);
- }
-
- @Test
- public void getFavoritesForUserTest(){
- List<FavoritesFunctionalMenuItemJson> actualFavoritesFunctionalMenuItemsJson = null;
- List<FavoritesFunctionalMenuItemJson> expectedFunctionalMenuItemsJson = new ArrayList<FavoritesFunctionalMenuItemJson>();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(functionalMenuService.getFavoriteItems(user.getId())).thenReturn(expectedFunctionalMenuItemsJson);
- actualFavoritesFunctionalMenuItemsJson = functionalMenuController.getFavoritesForUser(mockedRequest, mockedResponse);
- assertEquals(actualFavoritesFunctionalMenuItemsJson, expectedFunctionalMenuItemsJson);
- }
-
- @Test
- public void deleteFavoriteItemTest(){
- Long userId = (long)1;
- Long menuId = (long)1;
- FieldsValidator actualFieldsValidator = new FieldsValidator();
- FieldsValidator expectedFieldsValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
- expectedFieldsValidator.setHttpStatusCode((long) 200);
- expectedFieldsValidator.setFields(fields);
- expectedFieldsValidator.setErrorCode(null);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(functionalMenuService.removeFavoriteItem(user.getId(), menuId)).thenReturn(actualFieldsValidator);
- actualFieldsValidator = functionalMenuController.deleteFavoriteItem(mockedRequest, menuId, mockedResponse);
- assertEquals(actualFieldsValidator, expectedFieldsValidator);
- }
-
- @Test
- public void addFavoriteItemTest(){
- FavoritesFunctionalMenuItem menuItemJson = new FavoritesFunctionalMenuItem();
- FieldsValidator actualFieldsValidator = new FieldsValidator();
- FieldsValidator expectedFieldsValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
- expectedFieldsValidator.setHttpStatusCode((long) 200);
- expectedFieldsValidator.setFields(fields);
- expectedFieldsValidator.setErrorCode(null);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(functionalMenuService.setFavoriteItem(menuItemJson)).thenReturn(actualFieldsValidator);
- actualFieldsValidator = functionalMenuController.addFavoriteItem(mockedRequest, menuItemJson, mockedResponse);
- assertEquals(actualFieldsValidator, expectedFieldsValidator);
- }
-
- @Test
- public void getMenuItemsTest(){
- List<FunctionalMenuItem> actualFunctionalMenuItems = new ArrayList<FunctionalMenuItem>();
- List<FunctionalMenuItem> expectedFunctionalMenuItems = new ArrayList<FunctionalMenuItem>();
- List<FunctionalMenuItem> menuItems = new ArrayList<FunctionalMenuItem>();
- Mockito.when(functionalMenuService.getFunctionalMenuItems()).thenReturn(menuItems);
- actualFunctionalMenuItems = functionalMenuController.getMenuItems(mockedRequest, mockedResponse);
- assertEquals(actualFunctionalMenuItems, expectedFunctionalMenuItems);
- }
-
- @Test
- public void deleteFunctionalMenuItemTest(){
- Long menuId = (long)1;
- FieldsValidator actualFieldsValidator = new FieldsValidator();
- FieldsValidator expectedFieldsValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
- expectedFieldsValidator.setHttpStatusCode((long) 200);
- expectedFieldsValidator.setFields(fields);
- expectedFieldsValidator.setErrorCode(null);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(functionalMenuService.deleteFunctionalMenuItem(menuId)).thenReturn(actualFieldsValidator);
- actualFieldsValidator = functionalMenuController.deleteFunctionalMenuItem(mockedRequest, menuId, mockedResponse);
- assertEquals(actualFieldsValidator, expectedFieldsValidator);
- }
-
- @Test
- public void deleteFunctionalMenuItemBadPermissionsTest(){
- Long menuId = (long)1;
- FieldsValidator actualFieldsValidator = null;
- FieldsValidator expectedFieldsValidator = null;
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(functionalMenuService.deleteFunctionalMenuItem(menuId)).thenReturn(actualFieldsValidator);
- actualFieldsValidator = functionalMenuController.deleteFunctionalMenuItem(mockedRequest, menuId, mockedResponse);
- assertEquals(actualFieldsValidator, expectedFieldsValidator);
- }
-
- @Test
- public void editFunctionalMenuItemTest(){
- FunctionalMenuItemWithRoles menuItemJson = new FunctionalMenuItemWithRoles();
- FieldsValidator actualFieldsValidator = new FieldsValidator();
- FieldsValidator expectedFieldsValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
- expectedFieldsValidator.setHttpStatusCode((long) 200);
- expectedFieldsValidator.setFields(fields);
- expectedFieldsValidator.setErrorCode(null);
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(functionalMenuService.editFunctionalMenuItem(menuItemJson)).thenReturn(actualFieldsValidator);
- actualFieldsValidator = functionalMenuController.editFunctionalMenuItem(mockedRequest, menuItemJson, mockedResponse);
- assertEquals(actualFieldsValidator, expectedFieldsValidator);
- }
-
- @Test
- public void editFunctionalMenuItemBadPermissionsTest(){
- FunctionalMenuItemWithRoles menuItemJson = new FunctionalMenuItemWithRoles();
- FieldsValidator actualFieldsValidator = null;
- FieldsValidator expectedFieldsValidator = null;
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(functionalMenuService.editFunctionalMenuItem(menuItemJson)).thenReturn(actualFieldsValidator);
- actualFieldsValidator = functionalMenuController.editFunctionalMenuItem(mockedRequest, menuItemJson, mockedResponse);
- assertEquals(actualFieldsValidator, expectedFieldsValidator);
- }
-
- @Test
- public void getECOMPTitleTest(){
- PortalRestResponse<String> actualportalRestResponse = null;
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- expectedportalRestResponse.setMessage("success");
- expectedportalRestResponse.setResponse("Portal");
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)).thenReturn("Portal");
- actualportalRestResponse = functionalMenuController.getECOMPTitle(mockedRequest, mockedResponse);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/GetAccessControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/GetAccessControllerTest.java
deleted file mode 100644
index b9ab249e..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/GetAccessControllerTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.GetAccessController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.domain.GetAccessResult;
-import org.openecomp.portalapp.portal.service.GetAccessService;
-import org.openecomp.portalapp.portal.service.GetAccessServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-
-public class GetAccessControllerTest {
-
- @Mock
- GetAccessService getAccessService = new GetAccessServiceImpl();
-
- @InjectMocks
- GetAccessController getAccessController = new GetAccessController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
- MockEPUser mockUser = new MockEPUser();
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
-
- @Test
- public void getAppList() throws IOException
- {
- List<GetAccessResult> expectedAppsList = new ArrayList<GetAccessResult>();
- EPUser user = mockUser.mockEPUser();
- GetAccessResult getAccessResult = new GetAccessResult();
- getAccessResult.setRowId("1");
- getAccessResult.setRoleId((long) 1);
- getAccessResult.setEcompFunction("test");
- getAccessResult.setAppName("Test_App");
- getAccessResult.setAppMotsId(1);
- getAccessResult.setRoleName("Test_role");
- getAccessResult.setRoleActive("N");
- getAccessResult.setReqType("test");
-
- expectedAppsList.add(getAccessResult);
-
- List<GetAccessResult> actualAppsList = null;
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(getAccessService.getAppAccessList(user)).thenReturn(expectedAppsList);
- actualAppsList = getAccessController.getAppList(mockedRequest);
- assertTrue(actualAppsList.contains(getAccessResult));
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ManifestControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ManifestControllerTest.java
deleted file mode 100644
index ceaceaac..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ManifestControllerTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.jar.Attributes;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.ManifestController;
-import org.openecomp.portalapp.portal.service.ManifestService;
-import org.openecomp.portalapp.portal.service.ManifestServiceImpl;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-
-public class ManifestControllerTest extends MockitoTestSuite{
-
-
- @Mock
- ManifestService manifestService = new ManifestServiceImpl();
-
- @InjectMocks
- ManifestController manifestController = new ManifestController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
- NullPointerException nullPointerException = new NullPointerException();
-
- @Test
- public void getManifestTest() throws IOException
- {
- Map<String, Object> expectedResponse = new HashMap<String, Object>();
- Attributes attributes = new Attributes();
- expectedResponse.put("test", attributes);
- Mockito.when(manifestService.getWebappManifest()).thenReturn(attributes);
- Map<String, Object> actualResponse = manifestController.getManifest(mockedRequest);
- assertTrue((actualResponse.keySet().toArray().length) == 1);
-
- }
-
- @Test
- public void getManifestExceptionTest() throws IOException
- {
- Mockito.when(manifestService.getWebappManifest()).thenThrow(nullPointerException);
- Map<String, Object> actualResponse = manifestController.getManifest(mockedRequest);
- assertTrue((actualResponse.keySet().toArray().length) == 1);
- assertTrue(actualResponse.get("error").equals("failed to get manifest: java.lang.NullPointerException"));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java
deleted file mode 100644
index 765de291..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.MicroserviceController;
-import org.openecomp.portalapp.portal.domain.MicroserviceData;
-import org.openecomp.portalapp.portal.domain.WidgetCatalog;
-import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.ConsulHealthService;
-import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl;
-import org.openecomp.portalapp.portal.service.MicroserviceService;
-import org.openecomp.portalapp.portal.service.MicroserviceServiceImpl;
-import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestTemplate;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(WidgetServiceHeaders.class)
-public class MicroserviceControllerTest extends MockitoTestSuite{
-
- @InjectMocks
- MicroserviceController microserviceController = new MicroserviceController();
-
- @Mock
- ConsulHealthService consulHealthService = new ConsulHealthServiceImpl();
-
- @Mock
- MicroserviceService microserviceService = new MicroserviceServiceImpl();
-
- @Mock
- RestTemplate template = new RestTemplate();
-
- @Mock
- MicroserviceData microserviceData = new MicroserviceData();
-
- @SuppressWarnings("rawtypes")
- @Mock
- ResponseEntity<List<WidgetCatalog>> ans = new ResponseEntity<List<WidgetCatalog>>(HttpStatus.OK);
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Mock
- EcompPortalUtils EcompPortalUtils = new EcompPortalUtils();
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Test
- public void createMicroserviceIfServiceDataNullTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("FAILURE");
- expectedportalRestResponse.setResponse("MicroserviceData cannot be null or empty");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- MicroserviceData microserviceData = null;
- PortalRestResponse<String> actualportalRestResponse = microserviceController.createMicroservice(mockedRequest,
- mockedResponse, microserviceData);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void createMicroserviceTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("SUCCESS");
- expectedportalRestResponse.setResponse("");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- PortalRestResponse<String> actualportalRestResponse = microserviceController.createMicroservice(mockedRequest,
- mockedResponse, microserviceData);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void createMicroserviceExceptionTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("FAILURE");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- Mockito.when(microserviceService.saveMicroservice(microserviceData)).thenReturn((long) 1);
- Mockito.when(microserviceData.getParameterList()).thenThrow(nullPointerException);
- PortalRestResponse<String> actualportalRestResponse = microserviceController.createMicroservice(mockedRequest,
- mockedResponse, microserviceData);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void getMicroserviceTest() throws Exception {
- Mockito.when(microserviceService.getMicroserviceData()).thenReturn(null);
- List<MicroserviceData> list = microserviceController.getMicroservice(mockedRequest, mockedResponse);
- assertEquals(list, null);
- }
-
- @Test
- public void updateMicroserviceIfServiceISNullTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("FAILURE");
- expectedportalRestResponse.setResponse("MicroserviceData cannot be null or empty");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- MicroserviceData microserviceData = null;
- PortalRestResponse<String> actualportalRestResponse = microserviceController.updateMicroservice(mockedRequest,
- mockedResponse, 1, microserviceData);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void updateMicroserviceTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("SUCCESS");
- expectedportalRestResponse.setResponse("");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- PortalRestResponse<String> actualportalRestResponse = microserviceController.updateMicroservice(mockedRequest,
- mockedResponse, 1, microserviceData);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void updateMicroserviceExceptionTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("FAILURE");
- expectedportalRestResponse.setResponse(null);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- Mockito.when(microserviceController.updateMicroservice(mockedRequest, mockedResponse, 1, microserviceData))
- .thenThrow(nullPointerException);
- PortalRestResponse<String> actualportalRestResponse = microserviceController.updateMicroservice(mockedRequest,
- mockedResponse, 1, microserviceData);
- assertEquals(actualportalRestResponse, expectedportalRestResponse);
- }
-
- @Test
- public void deleteMicroserviceExceptionTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("FAILURE");
- expectedportalRestResponse.setResponse(
- "I/O error on GET request for \"" + EcompPortalUtils.widgetMsProtocol() + "://null/widget/microservices/widgetCatalog/service/1\":null; nested exception is java.net.UnknownHostException: null");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- PowerMockito.mockStatic(WidgetServiceHeaders.class);
- PortalRestResponse<String> actuaPportalRestResponse = microserviceController.deleteMicroservice(mockedRequest,
- mockedResponse, 1);
- assertEquals(actuaPportalRestResponse.getStatus(), expectedportalRestResponse.getStatus());
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void deleteMicroserviceTest() throws Exception {
- String HTTPS = "https://";
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("SOME WIDGETS ASSOICATE WITH THIS SERVICE");
- expectedportalRestResponse.setResponse("'null' ,'null' ");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.WARN);
- List<WidgetCatalog> List = new ArrayList<WidgetCatalog>();
- WidgetCatalog widgetCatalog = new WidgetCatalog();
- widgetCatalog.setId(1);
- WidgetCatalog widgetCatalog1 = new WidgetCatalog();
- widgetCatalog.setId(2);
- List.add(widgetCatalog);
- List.add(widgetCatalog1);
- PowerMockito.mockStatic(WidgetServiceHeaders.class);
- String whatService = "widgets-service";
- Mockito.when(consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))).thenReturn("Test");
- Mockito.when(ans.getBody()).thenReturn(List);
- ParameterizedTypeReference<List<WidgetCatalog>> typeRef = new ParameterizedTypeReference<List<WidgetCatalog>>() {
- };
- Mockito.when(template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))
- + "/widget/microservices/widgetCatalog/service/" + 1,
- HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), typeRef)).thenReturn(ans);
-
- PortalRestResponse<String> actuaPportalRestResponse = microserviceController.deleteMicroservice(mockedRequest,
- mockedResponse, 1);
- assertEquals(actuaPportalRestResponse, expectedportalRestResponse);
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void deleteMicroserviceWhenNoWidgetsAssociatedTest() throws Exception {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("SUCCESS");
- expectedportalRestResponse.setResponse("");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- List<WidgetCatalog> List = new ArrayList<WidgetCatalog>();
- PowerMockito.mockStatic(WidgetServiceHeaders.class);
- String whatService = "widgets-service";
- Mockito.when(consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))).thenReturn("Test");
- Mockito.when(ans.getBody()).thenReturn(List);
- ParameterizedTypeReference<List<WidgetCatalog>> typeRef = new ParameterizedTypeReference<List<WidgetCatalog>>() {
- };
- Mockito.when(template.exchange(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))
- + "/widget/microservices/widgetCatalog/service/" + 1,
- HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), typeRef)).thenReturn(ans);
- PortalRestResponse<String> actuaPportalRestResponse = microserviceController.deleteMicroservice(mockedRequest,
- mockedResponse, 1);
- assertEquals(actuaPportalRestResponse, expectedportalRestResponse);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceProxyControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceProxyControllerTest.java
deleted file mode 100644
index 115819d2..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceProxyControllerTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertTrue;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.openecomp.portalapp.portal.controller.MicroserviceProxyController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.service.MicroserviceProxyService;
-import org.openecomp.portalapp.portal.service.MicroserviceProxyServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.client.HttpClientErrorException;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-
-public class MicroserviceProxyControllerTest extends MockitoTestSuite {
-
- @Mock
- MicroserviceProxyService microserviceProxyService = new MicroserviceProxyServiceImpl();
-
- @InjectMocks
- MicroserviceProxyController microserviceProxyController = new MicroserviceProxyController();
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
- @Mock
- ObjectMapper objectMapper = new ObjectMapper();
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void getMicroserviceProxyTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(microserviceProxyService.proxyToDestination(1, user, mockedRequest)).thenReturn("Success");
- String acutualString = microserviceProxyController.getMicroserviceProxy(mockedRequest, getMockedResponse(), 1);
- assertTrue(acutualString.equals("{\"error\":\"Success\"}"));
- }
-
- @Test(expected = NullPointerException.class)
- public void getMicroserviceProxyNullPoniterExceptionTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(microserviceProxyService.proxyToDestination(1, user, mockedRequest))
- .thenThrow(nullPointerException);
- microserviceProxyController.getMicroserviceProxy(mockedRequest, getMockedResponse(), 1);
- }
-
- @Test
- public void getMicroserviceProxyExceptionTest() throws Exception {
- HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.OK, "Success");
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(microserviceProxyService.proxyToDestination(1, user, mockedRequest))
- .thenThrow(httpClientErrorException);
- String acutualString = microserviceProxyController.getMicroserviceProxy(mockedRequest, getMockedResponse(), 1);
- assertTrue(acutualString.equals("{\"error\":\"\"}"));
- }
-
- @Test
- public void getMicroserviceProxyByWidgetIdTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(microserviceProxyService.proxyToDestinationByWidgetId(1, user, mockedRequest))
- .thenReturn("Success");
- String acutualString = microserviceProxyController.getMicroserviceProxyByWidgetId(mockedRequest,
- getMockedResponse(), 1);
- assertTrue(acutualString.equals("{\"error\":\"Success\"}"));
- }
-
- @Test(expected = NullPointerException.class)
- public void getMicroserviceProxyByWidgetIdNullPointerExceptionTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(microserviceProxyService.proxyToDestinationByWidgetId(1, user, mockedRequest))
- .thenThrow(nullPointerException);
- microserviceProxyController.getMicroserviceProxyByWidgetId(mockedRequest, getMockedResponse(), 1);
- }
-
- @Test
- public void getMicroserviceProxyByWidgetIdExceptionTest() throws Exception {
- HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.OK, "Success");
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(microserviceProxyService.proxyToDestinationByWidgetId(1, user, mockedRequest))
- .thenThrow(httpClientErrorException);
- String acutualString = microserviceProxyController.getMicroserviceProxyByWidgetId(mockedRequest,
- getMockedResponse(), 1);
- assertTrue(acutualString.equals("{\"error\":\"\"}"));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/PortalAdminControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/PortalAdminControllerTest.java
deleted file mode 100644
index 4f3d1791..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/PortalAdminControllerTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.PortalAdminController;
-import org.openecomp.portalapp.portal.domain.EPRole;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.exceptions.NoHealthyServiceException;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl;
-import org.openecomp.portalapp.portal.service.PortalAdminService;
-import org.openecomp.portalapp.portal.service.PortalAdminServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.FieldsValidator;
-import org.openecomp.portalapp.portal.transport.PortalAdmin;
-import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.service.AuditService;
-import org.openecomp.portalsdk.core.service.AuditServiceImpl;
-
-public class PortalAdminControllerTest extends MockitoTestSuite{
-
- @InjectMocks
- PortalAdminController portalAdminController = new PortalAdminController();
-
- @Mock
- AdminRolesService adminRolesService = new AdminRolesServiceImpl();
-
- @Mock
- PortalAdminService portalAdminService = new PortalAdminServiceImpl();
-
- @Mock
- AuditService auditService = new AuditServiceImpl();
-
-
- @Mock
- EcompPortalUtils ecompPortalUtils = new EcompPortalUtils();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- MockEPUser mockUser = new MockEPUser();
-
-
- @Test
- public void getPortalAdminsTest()
- {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<PortalAdmin> expectedPortalAdminsList = new ArrayList<PortalAdmin>();
- PortalAdmin portalAdmin= new PortalAdmin();
-
- portalAdmin.setUserId((long) 1);
- portalAdmin.setLoginId("guestT");
- portalAdmin.setFirstName("Test_FirstName");
- portalAdmin.setLastName("Test_LastName");
-
- expectedPortalAdminsList.add(portalAdmin);
-
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
-
- Mockito.when(portalAdminService.getPortalAdmins()).thenReturn(expectedPortalAdminsList);
- List<PortalAdmin> actualPortalAdminsList = portalAdminController.getPortalAdmins(mockedRequest, mockedResponse);
- assertEquals(actualPortalAdminsList,expectedPortalAdminsList);
-
- }
-// @Test
-// public void getPortalAdminsIfUserIsNullTest()
-// {
-// EPUser user = null;
-// Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-//
-// assertNull(portalAdminController.getPortalAdmins(mockedRequest, mockedResponse));
-//
-// }
-
- @Test
- public void getPortalAdminsIfUserIsSuperAdminTest()
- {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- assertNull(portalAdminController.getPortalAdmins(mockedRequest, mockedResponse));
-
- }
-
-
-
- @Test
- public void createPortalAdminTest()
- {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(null);
- expectedFieldValidator.setErrorCode(null);
- FieldsValidator actualFieldValidator = new FieldsValidator();
- String sbcid = "Test";
-
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(portalAdminService.createPortalAdmin(sbcid)).thenReturn(expectedFieldValidator);
- actualFieldValidator = portalAdminController.createPortalAdmin(mockedRequest, sbcid, mockedResponse);
- assertEquals(actualFieldValidator,expectedFieldValidator);
-
- }
-
-// @Test
-// public void createPortalAdminIfUserIsNullTest()
-// {
-// //EPUser user = null;
-// Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(null);
-// String sbcid = "null";
-// assertNull(portalAdminController.createPortalAdmin(mockedRequest, sbcid, mockedResponse));
-//
-// }
-
- @Test
- public void createPortalAdminIfUserIsSuperAdminTest()
- {
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- String sbcid = "Test";
- assertNull(portalAdminController.createPortalAdmin(mockedRequest, sbcid, mockedResponse));
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RoleManageControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RoleManageControllerTest.java
deleted file mode 100644
index faa9b1f7..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RoleManageControllerTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.controller.core.RoleController;
-import org.openecomp.portalapp.controller.core.RoleFunctionListController;
-import org.openecomp.portalapp.controller.core.RoleListController;
-import org.openecomp.portalapp.portal.controller.RoleManageController;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.ExternalAccessRolesService;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.springframework.web.servlet.ModelAndView;
-
-public class RoleManageControllerTest {
-
-
-
- @Mock
- RoleController roleController;
-
- @Mock
- RoleListController roleListController;
-
- @Mock
- RoleFunctionListController roleFunctionListController;
-
-
- @Mock
- ExternalAccessRolesService externalAccessRolesService;
-
- @Mock
- ExternalAccessRolesService externalAccessRolesService1 = null;
-
- @InjectMocks
- RoleManageController roleManageController = new RoleManageController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void toggleRoleTest()
- {
- PortalRestResponse<String> portalRestResponse = new PortalRestResponse<String>();
- portalRestResponse.setMessage("success");
- portalRestResponse.setResponse(null);
- PortalRestStatusEnum portalRestStatusEnum = null;
- portalRestResponse.setStatus(portalRestStatusEnum.OK);
-
- PortalRestResponse<String> expectedpPortalRestResponse=roleManageController.toggleRole(mockedRequest, mockedResponse);
- assertEquals(portalRestResponse,expectedpPortalRestResponse);
-
- }
-
-// @Test
-// public void toggleRoleExceptionTest()
-// {
-// PortalRestResponse<String> portalRestResponse = new PortalRestResponse<String>();
-// portalRestResponse.setMessage("success");
-// portalRestResponse.setResponse(null);
-// PortalRestStatusEnum portalRestStatusEnum = null;
-// portalRestResponse.setStatus(portalRestStatusEnum.OK);
-// Mockito.doNothing().when(roleListController).toggleRole(mockedRequest, mockedResponse))).th
-// getRoleListController().toggleRole(request, response)
-//
-// PortalRestResponse<String> expectedpPortalRestResponse=roleManageController.toggleRole(mockedRequest, mockedResponse);
-// assertEquals(portalRestResponse,expectedpPortalRestResponse);
-//
-// }
- @Test
- public void removeRoleTest() throws Exception
- {
- ModelAndView modelandView = new ModelAndView("login.htm");
- Mockito.when(roleListController.removeRole(mockedRequest, mockedResponse)).thenReturn(modelandView);
- ModelAndView expectedModelandView = roleManageController.removeRole(mockedRequest, mockedResponse);
- assertEquals(expectedModelandView, modelandView);
- }
-
- @Test
- public void saveRoleTest() throws Exception
- {
- ModelAndView modelandView = new ModelAndView("login.htm");
- Mockito.when(roleController.saveRole(mockedRequest, mockedResponse)).thenReturn(modelandView);
- ModelAndView expectedModelandView = roleManageController.saveRole(mockedRequest, mockedResponse);
- assertEquals(expectedModelandView, modelandView);
- }
-
- @Test
- public void removeRoleRoleFunctionTest() throws Exception
- {
- ModelAndView modelandView = new ModelAndView("login.htm");
- Mockito.when(roleController.removeRoleFunction(mockedRequest, mockedResponse)).thenReturn(modelandView);
- ModelAndView expectedModelandView = roleManageController.removeRoleRoleFunction(mockedRequest, mockedResponse);
- assertEquals(expectedModelandView, modelandView);
- }
-
- @Test
- public void addRoleRoRoleFunctionTest() throws Exception
- {
- ModelAndView modelandView = new ModelAndView("login.htm");
- Mockito.when(roleController.addRoleFunction(mockedRequest, mockedResponse)).thenReturn(modelandView);
- ModelAndView expectedModelandView = roleManageController.addRoleRoRoleFunction(mockedRequest, mockedResponse);
- assertEquals(expectedModelandView, modelandView);
- }
-
- @Test
- public void removeChildRoleTest() throws Exception
- {
- ModelAndView modelandView = new ModelAndView("login.htm");
- Mockito.when(roleController.removeChildRole(mockedRequest, mockedResponse)).thenReturn(modelandView);
- ModelAndView expectedModelandView = roleManageController.removeChildRole(mockedRequest, mockedResponse);
- assertEquals(expectedModelandView, modelandView);
- }
-
-
- @Test
- public void getRoleTest() throws Exception
- {
- Mockito.doNothing().when(roleController).getRole(mockedRequest, mockedResponse);
- roleManageController.getRole(mockedRequest, mockedResponse);
- }
-
- @Test
- public void getRolesTest() throws Exception
- {
- Mockito.doNothing().when(roleListController).getRoles(mockedRequest, mockedResponse);
- roleManageController.getRoles(mockedRequest, mockedResponse);
- }
-
- @Test
- public void getRoleFunctionListTest() throws Exception
- {
- Mockito.doNothing().when(roleFunctionListController).getRoleFunctionList(mockedRequest, mockedResponse);
- roleManageController.getRoleFunctionList(mockedRequest, mockedResponse);
- }
-
- @Test
- public void saveRoleFunctionTest() throws Exception
- {
- Mockito.doNothing().when(roleFunctionListController).saveRoleFunction(mockedRequest, mockedResponse, "test");
- roleManageController.saveRoleFunction(mockedRequest, mockedResponse, "test");
- }
-
- @Test
- public void removeRoleFunctionTest() throws Exception
- {
- Mockito.doNothing().when(roleFunctionListController).removeRoleFunction(mockedRequest, mockedResponse, "test");
- roleManageController.removeRoleFunction(mockedRequest, mockedResponse, "test");
- }
-
- @Test
- public void syncRolesTest() throws Exception
- {
- EPApp app = new EPApp();
- Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app);
- roleManageController.syncRoles(app);
- }
-
-
- @Test
- public void addeChildRoleTest() throws Exception
- {
- ModelAndView modelandView = new ModelAndView("login.htm");
- Mockito.when(roleController.addChildRole(mockedRequest, mockedResponse)).thenReturn(modelandView);
- ModelAndView expectedModelandView = roleManageController.addChildRole(mockedRequest, mockedResponse);
- assertEquals(expectedModelandView, modelandView);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RolesApprovalSystemControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RolesApprovalSystemControllerTest.java
deleted file mode 100644
index 79ae0276..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RolesApprovalSystemControllerTest.java
+++ /dev/null
@@ -1,323 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval;
-import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemUser;
-import org.openecomp.portalapp.portal.controller.RolesApprovalSystemController;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.UserRolesService;
-import org.openecomp.portalapp.portal.transport.ExternalRequestFieldsValidator;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-
-public class RolesApprovalSystemControllerTest extends MockitoTestSuite {
-
- @Mock
- UserRolesService userRolesService;
-
- @InjectMocks
- RolesApprovalSystemController rolesApprovalSystemController = new RolesApprovalSystemController();
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void postUserProfileIfRolesNullTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Request has no roles");
- expectedportalRestResponse.setResponse("save user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = null;
- extSysUser.setRoles(externalSystemRoleApprovalList);
-
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .postUserProfile(mockedRequest, extSysUser, mockedResponse);
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void postUserProfileTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Saved Successfully");
- expectedportalRestResponse.setResponse("Success");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(true,
- "Saved Successfully");
-
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "POST"))
- .thenReturn(externalRequestFieldsValidator);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .postUserProfile(mockedRequest, extSysUser, mockedResponse);
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void postUserProfileFailureTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Received Bad String");
- expectedportalRestResponse.setResponse("save user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(false,
- "Received Bad String");
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "POST"))
- .thenReturn(externalRequestFieldsValidator);
-
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .postUserProfile(mockedRequest, extSysUser, mockedResponse);
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void postUserProfileExceptionTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse("save user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "POST")).thenThrow(nullPointerException);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .postUserProfile(mockedRequest, extSysUser, mockedResponse);
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void putUserProfileIfLoginIdNullTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Request has no login ID");
- expectedportalRestResponse.setResponse("save user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId(null);
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- extSysUser.setRoles(externalSystemRoleApprovalList);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .putUserProfile(mockedRequest, extSysUser, mockedResponse);
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void putUserProfileTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Updated Successfully");
- expectedportalRestResponse.setResponse("Success");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(true,
- "Updated Successfully");
-
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "PUT"))
- .thenReturn(externalRequestFieldsValidator);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .putUserProfile(mockedRequest, extSysUser, mockedResponse);
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void putUserProfileFailureTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Received Bad String");
- expectedportalRestResponse.setResponse("save user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(false,
- "Received Bad String");
-
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "PUT"))
- .thenReturn(externalRequestFieldsValidator);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .putUserProfile(mockedRequest, extSysUser, mockedResponse);
-
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void putUserProfileExceptionTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse("save user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "PUT")).thenThrow(nullPointerException);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .putUserProfile(mockedRequest, extSysUser, mockedResponse);
-
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void deleteUserProfileIfApplicationNameNullTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Request has no application name");
- expectedportalRestResponse.setResponse("delete user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName(null);
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- extSysUser.setRoles(externalSystemRoleApprovalList);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .deleteUserProfile(mockedRequest, extSysUser, mockedResponse);
-
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void deleteUserProfileIfMyloginrequestIdNullTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Request has no request ID");
- expectedportalRestResponse.setResponse("delete user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId(null);
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- extSysUser.setRoles(externalSystemRoleApprovalList);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .deleteUserProfile(mockedRequest, extSysUser, mockedResponse);
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void deleteUserProfileTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("Deleted Successfully");
- expectedportalRestResponse.setResponse("Success");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(true,
- "Success");
-
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "DELETE"))
- .thenReturn(externalRequestFieldsValidator);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .deleteUserProfile(mockedRequest, extSysUser, mockedResponse);
-
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void deleteUserProfileFailureTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage("failed");
- expectedportalRestResponse.setResponse("delete user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(false,
- "failed");
-
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "DELETE"))
- .thenReturn(externalRequestFieldsValidator);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .deleteUserProfile(mockedRequest, extSysUser, mockedResponse);
-
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-
- @Test
- public void deleteUserProfileExceptionTest() {
- PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse("delete user profile failed");
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- ExternalSystemUser extSysUser = new ExternalSystemUser();
- extSysUser.setApplicationName("Test_App");
- extSysUser.setLoginId("1");
- extSysUser.setMyloginrequestId("Test");
- List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>();
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApprovalList.add(externalSystemRoleApproval);
- extSysUser.setRoles(externalSystemRoleApprovalList);
- Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "DELETE")).thenThrow(nullPointerException);
- PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController
- .deleteUserProfile(mockedRequest, extSysUser, mockedResponse);
-
- assertEquals(expectedportalRestResponse, actualportalRestResponse);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SchedulerControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SchedulerControllerTest.java
deleted file mode 100644
index c5280814..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SchedulerControllerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import java.sql.DriverManager;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.json.simple.JSONObject;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.SchedulerController;
-import org.openecomp.portalapp.portal.scheduler.SchedulerProperties;
-import org.openecomp.portalapp.portal.scheduler.SchedulerRestInterface;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({UserUtils.class,SystemProperties.class})
-
-public class SchedulerControllerTest {
-
- @Mock
- SchedulerRestInterface schedulerRestInterface;
-
-
-
- @InjectMocks
- SchedulerController schedulerController = new SchedulerController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockEPUser mockUser = new MockEPUser();
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Test
- public void getTimeSlotsTest() throws Exception{
- schedulerController.getTimeSlots(mockedRequest, "12");
-
- }
-
- @Test
- public void postCreateNewVNFChangeTest() throws Exception{
- //String testJsonData="{\"domain\":\"ChangeManagement\",\"scheduleName\":\"VnfUpgrade/DWF\",\"userId\":\"su7376\",\"domainData\":[{\"WorkflowName\":\"HEAT Stack Software Update for vNFs\",\"CallbackUrl\":\"http://127.0.0.1:8989/scheduler/v1/loopbacktest/vid\",\"CallbackData\":\"testing\"}],\"schedulingInfo\":{\"normalDurationInSeconds\":60,\"additionalDurationInSeconds\":60,\"concurrencyLimit\":60,\"policyId\":\"SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_zone_localTime.1.xml\",\"vnfDetails\":[{\"groupId\":\"group1\",\"node\":[\"satmo415vbc\",\"satmo455vbc\"]}]}}";
- JSONObject jsonObject =Mockito.mock(JSONObject.class);
-
- schedulerController.postCreateNewVNFChange(mockedRequest, jsonObject);
- }
-
- @Test
- public void postSubmitVnfChangeTimeslotsTest() throws Exception{
- JSONObject jsonObject =Mockito.mock(JSONObject.class);
- Mockito.when(jsonObject.get("scheduleId")).thenReturn("12");
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.when(SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SUBMIT_NEW_VNF_CHANGE)).thenReturn("/v1/ChangeManagement/schedules/{scheduleId}/approvals");
- schedulerController.postSubmitVnfChangeTimeslots(mockedRequest, jsonObject);
- }
-
-} \ No newline at end of file
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SessionCommunicationControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SessionCommunicationControllerTest.java
deleted file mode 100644
index cc7bf040..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SessionCommunicationControllerTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.drools.core.command.assertion.AssertEquals;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.controller.sessionmgt.SessionCommunicationController;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.service.sessionmgt.ManageService;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-
-public class SessionCommunicationControllerTest {
-
-
- @Mock
- ManageService manageService;
-
- @InjectMocks
- SessionCommunicationController SessionCommunicationController = new SessionCommunicationController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- NullPointerException nullPointerException = new NullPointerException();
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
- MockEPUser mockUser = new MockEPUser();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
-
-
- @Test
- public void getSessionSlotCheckIntervalTest() throws Exception
- {
- Mockito.when(manageService.fetchSessionSlotCheckInterval()).thenReturn(1);
- int result = SessionCommunicationController.getSessionSlotCheckInterval(mockedRequest, mockedResponse);
- assertEquals(result, 1);
-
- }
-
- @Test
- public void extendSessionTimeOutsTest() throws Exception
- {
- Mockito.doNothing().when(manageService).extendSessionTimeOuts("test");
- Boolean result = SessionCommunicationController.extendSessionTimeOuts(mockedRequest, mockedResponse, "test");
- assertEquals(result, true);
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/TicketEventControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/TicketEventControllerTest.java
deleted file mode 100644
index fe656269..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/TicketEventControllerTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.TicketEventController;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.UserNotificationService;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(UserUtils.class)
-public class TicketEventControllerTest {
-
- @Mock
- UserNotificationService userNotificationService;
-
- @InjectMocks
- TicketEventController ticketEventController = new TicketEventController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockEPUser mockUser = new MockEPUser();
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
-// @Test
-// public void saveTest() throws Exception {
-// String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}";
-// PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest,
-// mockedResponse, ticketEventJson);
-// assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.OK) == 0);
-// }
-
- @Test
- public void saveTestForException() throws Exception {
- String ticketEventJson = "\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}";
- PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest,
- mockedResponse, ticketEventJson);
- assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0);
- }
-
-// @Test
-// public void saveTestForApplicationValid() throws Exception {
-// String ticketEventJson = "{\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}";
-// PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest,
-// mockedResponse, ticketEventJson);
-// assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0);
-// assertEquals(actualPortalRestResponse.getMessage(), "application is mandatory");
-//
-// }
-
- @Test
- public void saveTestForBodyValid() throws Exception {
- String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\",\"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}";
- PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest,
- mockedResponse, ticketEventJson);
- assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0);
- assertEquals(actualPortalRestResponse.getMessage(), "body is mandatory");
- }
-
- @Test
- public void saveTestForEventSourceValid() throws Exception {
- String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}";
- PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest,
- mockedResponse, ticketEventJson);
- assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0);
- assertEquals(actualPortalRestResponse.getMessage(), "Message Source is mandatory");
- }
-
- @Test
- public void saveTestForUserListValid() throws Exception {
- String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {}}";
- PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest,
- mockedResponse, ticketEventJson);
- assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0);
- assertEquals(actualPortalRestResponse.getMessage(), "At least one user Id is mandatory");
- }
-} \ No newline at end of file
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserControllerTest.java
deleted file mode 100644
index 19f309b4..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserControllerTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.UserController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.UserService;
-import org.openecomp.portalapp.portal.service.UserServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.ProfileDetail;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.onboarding.util.CipherUtil;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(CipherUtil.class)
-public class UserControllerTest extends MockitoTestSuite {
-
- @InjectMocks
- UserController userController = new UserController();
-
- @Mock
- UserService userService = new UserServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void getLoggedinUserExceptionTest() {
- EPUser epUser = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser);
- PortalRestResponse<ProfileDetail> expectedResponse = new PortalRestResponse<ProfileDetail>();
- expectedResponse.setMessage(null);
- expectedResponse.setResponse(null);
- expectedResponse.setStatus(PortalRestStatusEnum.ERROR);
- PortalRestResponse<ProfileDetail> response = userController.getLoggedinUser(mockedRequest);
- assertEquals(response, expectedResponse);
- }
-
- @Test
- public void getLoggedinUserTest() throws Exception {
- EPUser epUser = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser);
- PortalRestResponse<ProfileDetail> expectedResponse = new PortalRestResponse<ProfileDetail>();
- expectedResponse.setMessage("success");
- ProfileDetail profileDetail = new ProfileDetail();
- expectedResponse.setResponse(profileDetail);
- expectedResponse.setStatus(PortalRestStatusEnum.OK);
- PowerMockito.mockStatic(CipherUtil.class);
- Mockito.when(CipherUtil.decrypt(epUser.getLoginPwd())).thenReturn("Password");
- PortalRestResponse<ProfileDetail> response = userController.getLoggedinUser(mockedRequest);
- assertEquals(response.getMessage(), expectedResponse.getMessage());
- assertEquals(response.getStatus(), expectedResponse.getStatus());
- }
-
- @Test
- public void modifyLoggedinUserIfProfileNullTest() {
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("java.lang.NullPointerException");
- expectedResponse.setResponse(null);
- expectedResponse.setStatus(PortalRestStatusEnum.ERROR);
- ProfileDetail profileDetail = null;
- PortalRestResponse<String> actualResponse = userController.modifyLoggedinUser(mockedRequest, profileDetail);
- assertEquals(actualResponse, expectedResponse);
- assertEquals(actualResponse.getStatus(), expectedResponse.getStatus());
- }
-
- @Test
- public void modifyLoggedinUserExceptionTest() {
- EPUser epUser = mockUser.mockEPUser();
-
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage(
- "java.lang.ClassCastException: com.sun.crypto.provider.AESCipher$General cannot be cast to javax.crypto.CipherSpi");
- expectedResponse.setResponse(null);
- expectedResponse.setStatus(PortalRestStatusEnum.ERROR);
- ProfileDetail profileDetail = new ProfileDetail();
- profileDetail.setFirstName("Test_FirstName");
- profileDetail.setLastName("Test_LastName");
- profileDetail.setEmail("Test_Email");
- profileDetail.setLoginId("Test_LoginId");
- profileDetail.setLoginPassword("Test_LoginPassword");
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser);
- PortalRestResponse<String> actualResponse = userController.modifyLoggedinUser(mockedRequest, profileDetail);
- assertEquals(actualResponse, expectedResponse);
-
- }
-
- /*@Test
- public void modifyLoggedinUserTest() throws Exception {
- EPUser epUser = mockUser.mockEPUser();
- PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>();
- expectedResponse.setMessage("success");
- expectedResponse.setResponse(null);
- PortalRestStatusEnum enu = null;
- expectedResponse.setStatus(enu.OK);
- ProfileDetail profileDetail = new ProfileDetail();
- profileDetail.setFirstName("Test_FirstName");
- profileDetail.setLastName("Test_LastName");
- profileDetail.setEmail("Test_Email");
- profileDetail.setLoginId("Test_LoginId");
- profileDetail.setLoginPassword("Test_LoginPassword");
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser);
- PowerMockito.mockStatic(CipherUtil.class);
- Mockito.when(CipherUtil.decrypt(epUser.getLoginPwd())).thenReturn("Password");
- PortalRestResponse<String> actualResponse = userController.modifyLoggedinUser(mockedRequest, profileDetail);
- System.out.println(actualResponse);
- }*/
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserNotificationControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserNotificationControllerTest.java
deleted file mode 100644
index 2bc6977d..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserNotificationControllerTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Matchers;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.UserNotificationController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.FunctionalMenuService;
-import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl;
-import org.openecomp.portalapp.portal.service.UserNotificationService;
-import org.openecomp.portalapp.portal.service.UserNotificationServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.EpNotificationItem;
-import org.openecomp.portalapp.portal.transport.EpNotificationItemVO;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuRole;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(UserUtils.class)
-public class UserNotificationControllerTest {
-
- @Mock
- FunctionalMenuService functionalMenuService = new FunctionalMenuServiceImpl();
-
- @Mock
- UserNotificationService userNotificationService = new UserNotificationServiceImpl();
-
- @InjectMocks
- UserNotificationController userNotificationController = new UserNotificationController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockEPUser mockUser = new MockEPUser();
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- @Test
- public void getMenuIdRoleIdTest() {
- List<FunctionalMenuRole> expectedMenuRoleList = new ArrayList<FunctionalMenuRole>();
- FunctionalMenuRole functionalMenuRole = new FunctionalMenuRole();
- functionalMenuRole.setId(new Integer(99999999));
- functionalMenuRole.setMenuId((long) 137);
- functionalMenuRole.setAppId(new Integer(456));
- functionalMenuRole.setRoleId(new Integer(6214));
- expectedMenuRoleList.add(functionalMenuRole);
- List<FunctionalMenuRole> actualFunctionalMenuRoleList = null;
- Mockito.when(functionalMenuService.getFunctionalMenuRole()).thenReturn(expectedMenuRoleList);
- actualFunctionalMenuRoleList = userNotificationController.getMenuIdRoleId(mockedRequest, mockedResponse);
- assertTrue(actualFunctionalMenuRoleList.equals(expectedMenuRoleList));
-
- }
-
- @Test
- public void getNotificationsTest() {
- EPUser user = mockUser.mockEPUser();
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EpNotificationItem> expectedEpNotificationList = new ArrayList<EpNotificationItem>();
- EpNotificationItem epNotificationItem = new EpNotificationItem();
- epNotificationItem.setNotificationId((long) 200);
- expectedEpNotificationList.add(epNotificationItem);
- PortalRestResponse<List<EpNotificationItem>> expectedportalRestResponse = new PortalRestResponse<List<EpNotificationItem>>();
- expectedportalRestResponse.setMessage("success");
- expectedportalRestResponse.setResponse(expectedEpNotificationList);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
- PortalRestResponse<List<EpNotificationItem>> actualPortalRestResponse = null;
- Mockito.when(userNotificationService.getNotifications(user.getId())).thenReturn(expectedEpNotificationList);
- actualPortalRestResponse = userNotificationController.getNotifications(mockedRequest, mockedResponse);
- assertTrue(expectedportalRestResponse.equals(actualPortalRestResponse));
-
- }
-
- @Test
- public void getNotificationsCatchesExceptionTest() {
- EPUser user = mockUser.mockEPUser();
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EpNotificationItem> expectedEpNotificationList = null;
- PortalRestResponse<List<EpNotificationItem>> expectedportalRestResponse = new PortalRestResponse<List<EpNotificationItem>>();
- expectedportalRestResponse.setMessage(null);
- expectedportalRestResponse.setResponse(expectedEpNotificationList);
- expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- PortalRestResponse<List<EpNotificationItem>> actualPortalRestResponse = null;
- Mockito.when(userNotificationService.getNotifications(user.getId())).thenThrow(new NullPointerException());
- actualPortalRestResponse = userNotificationController.getNotifications(mockedRequest, mockedResponse);
- assertTrue(expectedportalRestResponse.equals(actualPortalRestResponse));
- }
-
- @Test
- public void getAdminNotificationsTest() {
- EPUser user = mockUser.mockEPUser();
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- List<EpNotificationItemVO> actualEpNotificationsList = new ArrayList<EpNotificationItemVO>();
- List<EpNotificationItemVO> expectedEpNotificationsList = new ArrayList<EpNotificationItemVO>();
- EpNotificationItemVO epNotificationItemVO = new EpNotificationItemVO();
- epNotificationItemVO.setId((long) 1);
- expectedEpNotificationsList.add(epNotificationItemVO);
- Mockito.when(userNotificationService.getAdminNotificationVOS(Matchers.anyLong())).thenReturn(expectedEpNotificationsList);
- actualEpNotificationsList = userNotificationController.getAdminNotifications(mockedRequest, mockedResponse);
- assertTrue(actualEpNotificationsList.equals(expectedEpNotificationsList));
- }
-
- @Test
- public void saveTestWhenNotificationIsNull() throws Exception {
- EPUser user = mockUser.mockEPUser();
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>();
- PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>();
- expectedPortalRestResponse.setMessage("FAILURE");
- expectedPortalRestResponse.setResponse("Notification Header cannot be null or empty");
- expectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
-
- EpNotificationItem notificationItem = null;
- actualPortalRestResponse = userNotificationController.save(mockedRequest, mockedResponse, notificationItem);
- assertTrue(actualPortalRestResponse.equals(expectedPortalRestResponse));
- }
-
- @Test
- public void saveTestWhenEndTimeIsGreater() throws Exception {
- EPUser user = mockUser.mockEPUser();
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>();
- PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>();
- expectedPortalRestResponse.setMessage("FAILURE");
- expectedPortalRestResponse.setResponse("End Time should be greater than start time");
- expectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- EpNotificationItem notificationItem = new EpNotificationItem();
- notificationItem.setNotificationId((long) 1);
- notificationItem.setMsgHeader("Test");
- Date currentDate = new Date();
- Calendar c = Calendar.getInstance();
- c.setTime(currentDate);
- c.add(Calendar.DATE, 1);
- Date currentDatePlusOne = c.getTime();
- notificationItem.setStartTime(currentDatePlusOne);
- notificationItem.setEndTime(currentDate);
-
- actualPortalRestResponse = userNotificationController.save(mockedRequest, mockedResponse, notificationItem);
- assertTrue(actualPortalRestResponse.equals(expectedPortalRestResponse));
-
- }
-
- @Test
- public void saveTestWhenNoRoleIDExists() throws Exception {
- EPUser user = mockUser.mockEPUser();
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>();
- PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>();
- expectedPortalRestResponse.setMessage("FAILURE");
- expectedPortalRestResponse.setResponse("No Roles Ids Exist for the selected Roles");
- expectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
- EpNotificationItem notificationItem = new EpNotificationItem();
- notificationItem.setNotificationId((long) 1);
- notificationItem.setMsgHeader("Test");
- notificationItem.setIsForAllRoles("N");
- Date currentDate = new Date();
- Calendar c = Calendar.getInstance();
- c.setTime(currentDate);
- c.add(Calendar.DATE, 1);
- Date currentDatePlusOne = c.getTime();
- notificationItem.setStartTime(currentDate);
- notificationItem.setEndTime(currentDatePlusOne);
- List<Long> roleList = new ArrayList<Long>();
- notificationItem.setRoleIds(roleList);
- actualPortalRestResponse = userNotificationController.save(mockedRequest, mockedResponse, notificationItem);
- assertTrue(actualPortalRestResponse.equals(expectedPortalRestResponse));
- }
-
- @Test
- public void saveTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- HttpSession session = mockedRequest.getSession();
- session.setAttribute("user", user);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>();
- PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>();
- expectedPortalRestResponse.setMessage("SUCCESS");
- expectedPortalRestResponse.setResponse("");
- expectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK);
- EpNotificationItem notificationItem = new EpNotificationItem();
- notificationItem.setNotificationId((long) 1);
- notificationItem.setMsgHeader("Test");
- notificationItem.setIsForAllRoles("Y");
- Date currentDate = new Date();
- Calendar c = Calendar.getInstance();
- c.setTime(currentDate);
- c.add(Calendar.DATE, 1);
- Date currentDatePlusOne = c.getTime();
- notificationItem.setStartTime(currentDate);
- notificationItem.setEndTime(currentDatePlusOne);
- List<Long> roleList = new ArrayList<Long>();
- Long role1 = (long) 1;
- roleList.add(role1);
- notificationItem.setRoleIds(roleList);
- HttpServletRequest request = mockitoTestSuite.getMockedRequest();
- PowerMockito.mockStatic(UserUtils.class);
- Mockito.when(UserUtils.getUserIdAsLong(request)).thenReturn((long) 1);
- Mockito.when(userNotificationService.saveNotification(notificationItem)).thenReturn("Test");
- actualPortalRestResponse = userNotificationController.save(mockedRequest, mockedResponse, notificationItem);
- assertTrue(actualPortalRestResponse.equals(expectedPortalRestResponse));
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRolesControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRolesControllerTest.java
deleted file mode 100644
index 4014f441..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRolesControllerTest.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.UserRolesController;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.domain.EcompAuditLog;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.SearchService;
-import org.openecomp.portalapp.portal.service.UserRolesService;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.AppWithRolesForUser;
-import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole;
-import org.openecomp.portalapp.portal.transport.FieldsValidator;
-import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName;
-import org.openecomp.portalapp.portal.transport.RoleInAppForUser;
-import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
-import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.service.AuditService;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({EcompPortalUtils.class, EPCommonSystemProperties.class, EcompAuditLog.class, SystemProperties.class})
-public class UserRolesControllerTest extends MockitoTestSuite {
-
- String userid = "ab1234";
-
- @Mock
- UserRolesService userRolesService;
-
- @Mock
- SearchService searchService;
-
- @Mock
- AuditService auditService;
-
- @Mock
- AdminRolesService adminRolesService;
-
- @Mock
- FieldsValidator fieldsValidator;
-
- @InjectMocks
- UserRolesController userRolesController = new UserRolesController();
-
- @Mock
- private DataAccessService dataAccessService;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
-
- @Mock
- EPUserUtils ePUserUtils = new EPUserUtils();
-
- @Mock
- EPUser epuser;
-
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void putAppWithUserRoleRequestTest() {
-
- FieldsValidator actualFieldsValidator = null;
-
- AppWithRolesForUser appWithRolesForUser = new AppWithRolesForUser();
- List<RoleInAppForUser> listofRoles = new ArrayList<RoleInAppForUser>();
-
- appWithRolesForUser.setOrgUserId("guest");
- appWithRolesForUser.setAppId((long) 550);
- appWithRolesForUser.setAppName("D2 Services Analytics Dashboard");
- appWithRolesForUser.setAppRoles(listofRoles);
-
- RoleInAppForUser roleInAppForUser = new RoleInAppForUser();
- roleInAppForUser.setIsApplied(false);
- roleInAppForUser.setRoleId((long) 1);
- roleInAppForUser.setRoleName("System Administrator");
-
- RoleInAppForUser roleInAppForUser1 = new RoleInAppForUser();
- roleInAppForUser1.setIsApplied(true);
- roleInAppForUser1.setRoleId((long) 16);
- roleInAppForUser1.setRoleName("Standard User");
-
- listofRoles.add(roleInAppForUser);
- listofRoles.add(roleInAppForUser1);
- EPUser user = mockUser.mockEPUser();
- FieldsValidator expectedFieldValidator = new FieldsValidator();
- List<FieldName> fields = new ArrayList<>();
-
- expectedFieldValidator.setHttpStatusCode((long) 200);
- expectedFieldValidator.setFields(fields);
- expectedFieldValidator.setErrorCode(null);
- HttpSession session = mockedRequest.getSession();
- session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
-
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(userRolesService.putUserAppRolesRequest(appWithRolesForUser, user))
- .thenReturn(expectedFieldValidator);
-
- actualFieldsValidator = userRolesController.putAppWithUserRoleRequest(mockedRequest, appWithRolesForUser,
- mockedResponse);
- assertEquals(expectedFieldValidator.getHttpStatusCode(), actualFieldsValidator.getHttpStatusCode());
- assertEquals(expectedFieldValidator.getErrorCode(), actualFieldsValidator.getErrorCode());
- assertEquals(expectedFieldValidator.getFields(), actualFieldsValidator.getFields());
-
- }
-
- @Test
- public void getPhoneBookSearchResultBadPermissionsTest() {
- String searchString = "test";
- String actualResult = null;
- String expectedResult = null;
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false);
- Mockito.when(searchService.searchUsersInPhoneBook(searchString)).thenReturn(actualResult);
-
- actualResult = userRolesController.getPhoneBookSearchResult(mockedRequest, searchString, mockedResponse);
- assertEquals(expectedResult, actualResult);
-
- }
-
- @Test
- public void getPhoneBookSearchResultValidationTest() {
- String searchString = " t";
- String actualResult = null;
- String expectedResult = null;
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false);
- Mockito.when(searchService.searchUsersInPhoneBook(searchString)).thenReturn(actualResult);
-
- actualResult = userRolesController.getPhoneBookSearchResult(mockedRequest, searchString, mockedResponse);
- assertEquals(expectedResult, actualResult);
-
- }
-
- @Test
- public void getPhoneBookSearchResultTest() {
- String searchString = "test";
- String actualResult = null;
- String expectedResult = null;
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false);
- Mockito.when(searchService.searchUsersInPhoneBook(searchString)).thenReturn(actualResult);
-
- actualResult = userRolesController.getPhoneBookSearchResult(mockedRequest, searchString, mockedResponse);
- assertEquals(expectedResult, actualResult);
-
- }
-
- @Test
- public void getAppsWithAdminRoleStateForUserTest(){
-
- String orgUserId = "hb123f";
- AppsListWithAdminRole actualResult = new AppsListWithAdminRole();
- AppsListWithAdminRole expectedResult = new AppsListWithAdminRole();
- EPUser user = mockUser.mockEPUser();
- // PowerMockito.mockStatic(EcompPortalUtils.class);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(adminRolesService.getAppsWithAdminRoleStateForUser(orgUserId)).thenReturn(actualResult);
-
- actualResult = userRolesController.getAppsWithAdminRoleStateForUser(mockedRequest, orgUserId, mockedResponse);
- assertEquals(expectedResult, actualResult);
- }
-
- /*@Test
- public void getAppsWithAdminRoleStateForUserBadRequestTest(){
-
- String orgUserId = "hb123f";
- AppsListWithAdminRole actualResult = null;
- AppsListWithAdminRole expectedResult = null;
- EPUser user = mockUser.mockEPUser();
- PowerMockito.mockStatic(EcompPortalUtils.class);
- PowerMockito.when(EcompPortalUtils.legitimateUserId(orgUserId)).thenReturn(false);
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(adminRolesService.getAppsWithAdminRoleStateForUser(orgUserId)).thenReturn(actualResult);
-
- actualResult = userRolesController.getAppsWithAdminRoleStateForUser(mockedRequest, orgUserId, mockedResponse);
- assertEquals(expectedResult, actualResult);
- }*/
-
- @Test
- public void putAppsWithAdminRoleStateForUserBadStatusCodeTest(){
- FieldsValidator actualFieldsValidator = null;
- AppsListWithAdminRole newAppsListWithAdminRoles = new AppsListWithAdminRole();
- FieldsValidator expectedFieldsValidator = new FieldsValidator();
- List<FieldName> fieldNames = new ArrayList<FieldName>();
- expectedFieldsValidator.setErrorCode(null);
- expectedFieldsValidator.setFields(fieldNames);
- expectedFieldsValidator.setHttpStatusCode((long)200);
-
- EPUser user = mockUser.mockEPUser();
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
-
- actualFieldsValidator = userRolesController.putAppsWithAdminRoleStateForUser(mockedRequest, newAppsListWithAdminRoles, mockedResponse);
- assertEquals(expectedFieldsValidator, actualFieldsValidator);
- }
-
-
- /*@Test
- public void putAppsWithAdminRoleStateForUserTest() {
-
- FieldsValidator actualFieldsValidator = null;
- AppsListWithAdminRole newAppsListWithAdminRoles = new AppsListWithAdminRole();
- EPUser user = mockUser.mockEPUser();
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- PowerMockito.mockStatic(EcompAuditLog.class);
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN)).thenReturn("1400");
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP)).thenReturn("1400");
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)).thenReturn("1400");
- Mockito.when(SystemProperties.getProperty(SystemProperties.MDC_TIMER)).thenReturn("1400");
-
- actualFieldsValidator = userRolesController.putAppsWithAdminRoleStateForUser(mockedRequest, newAppsListWithAdminRoles, mockedResponse);
-
- System.out.println(actualFieldsValidator);
- Mockito.when(searchService.searchUsersInPhoneBook(searchString)).thenReturn(actualResult);
-
- actualResult = userRolesController.getPhoneBookSearchResult(mockedRequest, searchString, mockedResponse);
- assertEquals(expectedResult, actualResult);
-
- }*/
-
- /*@Test
- public void putAppsWithAdminRoleStateForUserTest(){
- FieldsValidator actualFieldsValidator = null;
- AppsListWithAdminRole newAppsListWithAdminRoles = new AppsListWithAdminRole();
- FieldsValidator expectedFieldsValidator = new FieldsValidator();
- List<FieldName> fieldNames = new ArrayList<FieldName>();
- expectedFieldsValidator.setErrorCode(null);
- expectedFieldsValidator.setFields(fieldNames);
- expectedFieldsValidator.setHttpStatusCode((long)200);
-
- EPUser user = mockUser.mockEPUser();
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- PowerMockito.mockStatic(EcompAuditLog.class);
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- Mockito.when(adminRolesService.setAppsWithAdminRoleStateForUser(newAppsListWithAdminRoles));
- Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user);
-
- // Mockito.call(auditService.logActivity(auditLog, null));
-// Mockito.when(SystemProperties.getProperty(EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN)).thenReturn("1400");
-// Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP)).thenReturn("1400");
-// Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)).thenReturn("1400");
-// Mockito.when(SystemProperties.getProperty(SystemProperties.MDC_TIMER)).thenReturn("1400");
-
- actualFieldsValidator = userRolesController.putAppsWithAdminRoleStateForUser(mockedRequest, newAppsListWithAdminRoles, mockedResponse);
- assertEquals(expectedFieldsValidator, actualFieldsValidator);
- }*/
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WebAnalyticsExtAppControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WebAnalyticsExtAppControllerTest.java
deleted file mode 100644
index 4973894a..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WebAnalyticsExtAppControllerTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.*;
-
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.io.IOUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.WebAnalyticsExtAppController;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl;
-import org.openecomp.portalapp.portal.service.AppsCacheService;
-import org.openecomp.portalapp.portal.service.AppsCacheServiceImple;
-import org.openecomp.portalapp.portal.transport.Analytics;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIResponse;
-import org.openecomp.portalsdk.core.service.AuditService;
-import org.openecomp.portalsdk.core.service.AuditServiceImpl;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({SystemProperties.class,IOUtils.class,Object.class})
-public class WebAnalyticsExtAppControllerTest {
-
-
-
- @InjectMocks
- WebAnalyticsExtAppController webAnalyticsExtAppController = new WebAnalyticsExtAppController();
-
- @Mock
- AdminRolesService adminRolesService = new AdminRolesServiceImpl();
-
- @Mock
- AppsCacheService appCacheService = new AppsCacheServiceImple();
-
- @Mock
- AuditService auditService = new AuditServiceImpl();
-
-// @Mock
-// InputStream analyticsFileStream;
-
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
- /*@Test
- public void getAnalyticsScriptTest() throws Exception
- {
- String expectedResponse = "http://www.ecomp.com";
-
- InputStream analyticsFileStream = null;
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(IOUtils.class);
- Mockito.when(IOUtils.toString(analyticsFileStream, StandardCharsets.UTF_8.name())).thenReturn("PORTAL_ENV_URL");
- Mockito.when(SystemProperties.getProperty("frontend_url")).thenReturn("http://www.ecomp.com/test");
- String actualResponse = webAnalyticsExtAppController.getAnalyticsScript(mockedRequest);
-// assertNull(webAnalyticsExtAppController.getAnalyticsScript(mockedRequest));
-
- // System.out.println(actualResponse);
- assertTrue(actualResponse.equals(expectedResponse));
- }*/
-
- /*@Test
- public void getAnalyticsScriptExceptionTest() throws Exception
- {
- String expectedResponse = "";
- InputStream analyticsFileStream = null;
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(IOUtils.class);
- Mockito.when(IOUtils.toString(analyticsFileStream, StandardCharsets.UTF_8.name())).thenThrow(nullPointerException);
- Mockito.when(SystemProperties.getProperty("frontend_url")).thenReturn("http://www.ecomp.com/test");
- String actualResponse = webAnalyticsExtAppController.getAnalyticsScript(mockedRequest);
- assertEquals(actualResponse,expectedResponse);
- }*/
-
- @Test
- public void storeAnalyticsScriptIfAnalyticsNullTest() throws Exception
- {
- PortalAPIResponse expectedPortalAPIResponse = new PortalAPIResponse(true, "error");
- Analytics analytics= null;
- Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(null);
- PortalAPIResponse actualPortalAPIResponse = webAnalyticsExtAppController.storeAnalyticsScript(mockedRequest, analytics);
- assertTrue(expectedPortalAPIResponse.getMessage().equals(actualPortalAPIResponse.getMessage()));
- assertTrue(expectedPortalAPIResponse.getStatus().equals(actualPortalAPIResponse.getStatus()));
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogController.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogController.java
deleted file mode 100644
index f3255917..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogController.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.DashboardController;
-import org.openecomp.portalapp.portal.domain.WidgetCatalog;
-import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
-import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
-import org.openecomp.portalapp.portal.service.ConsulHealthService;
-import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl;
-import org.openecomp.portalapp.portal.service.DashboardSearchService;
-import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl;
-import org.openecomp.portalapp.portal.service.MicroserviceService;
-import org.openecomp.portalapp.portal.service.MicroserviceServiceImpl;
-import org.openecomp.portalapp.portal.service.WidgetParameterService;
-import org.openecomp.portalapp.portal.service.WidgetParameterServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.CommonWidgetMeta;
-import org.openecomp.portalapp.portal.utils.CustomLoggingFilter;
-import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.client.RestClientException;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({EPUserUtils.class})
-public class WidgetsCatalogController {
-
- @Mock
- ConsulHealthService consulHealthService = new ConsulHealthServiceImpl();
-
- @Mock
- MicroserviceService microserviceService = new MicroserviceServiceImpl();
-
- @Mock
- WidgetParameterService widgetParameterService = new WidgetParameterServiceImpl();
-
- @InjectMocks
- WidgetsCatalogController widgetsCatalogController = new WidgetsCatalogController();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
-
- NullPointerException nullPointerException = new NullPointerException();
-
- MockEPUser mockUser = new MockEPUser();
-
- /*public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("loginName") String loginName) throws RestClientException, Exception {
- List<WidgetCatalog> widgets = new ArrayList<>();
- try {
- CustomLoggingFilter d;
- ResponseEntity<ArrayList> ans = template.exchange(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
- + "/widget/microservices/widgetCatalog/" + loginName,
- HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class);
- widgets = ans.getBody();
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "getUserWidgetCatalog failed", e);
- // returning null because null help check on the UI if there was a
- // communication problem with Microservice.
- return null;
- }
- return widgets;
- }
-
- @Test
- public void getWidgetDataTest(){
-
- String resourceType = null;
- List<WidgetCatalog> expectedData = new ArrayList<WidgetCatalog>();
- expectedData.setStatus(PortalRestStatusEnum.ERROR);
- expectedData.setMessage("Unexpected resource type null");
- expectedData.setResponse(null);
-
- PortalRestResponse<CommonWidgetMeta> actualResponse = dashboardController.getWidgetData(mockedRequest, resourceType);
- assertEquals(expectedData,actualResponse);
-
-
- }*/
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java
deleted file mode 100644
index 60a9b7a1..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.openecomp.portalapp.portal.test.controller;
-
-import static org.junit.Assert.assertTrue;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.controller.WidgetsCatalogMarkupController;
-import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders;
-import org.openecomp.portalapp.portal.service.ConsulHealthService;
-import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl;
-import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.onboarding.util.CipherUtil;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.springframework.web.client.RestClientException;
-import org.springframework.web.client.RestTemplate;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(WidgetServiceHeaders.class)
-public class WidgetsCatalogMarkupControllerTest extends MockitoTestSuite {
-
- @InjectMocks
- WidgetsCatalogMarkupController widgetsCatalogMarkupController = new WidgetsCatalogMarkupController();
-
- @Mock
- ConsulHealthService consulHealthService = new ConsulHealthServiceImpl();
-
- @Mock
- RestTemplate template = new RestTemplate();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
- @Mock
- CipherUtil cipherUtil= new CipherUtil();
-
- @Mock
- EcompPortalUtils EcompPortalUtils =new EcompPortalUtils();
-
- @Mock
- WidgetServiceHeaders WidgetServiceHeaders ;
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
-
- @SuppressWarnings("static-access")
- @Test
- public void getWidgetMarkupTest() throws RestClientException, Exception
- {
- String whatService = "widgets-service";
- PowerMockito.mockStatic(WidgetServiceHeaders.class);
- Mockito.when(template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, null) + "/widget/microservices/markup/" + 1, String.class,
- WidgetServiceHeaders.getInstance())).thenReturn("Success");
- String response = widgetsCatalogMarkupController.getWidgetMarkup(mockedRequest, mockedResponse, 1);
- assertTrue(response.equals("Success"));
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/MockEPUser.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/MockEPUser.java
deleted file mode 100644
index 344350e0..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/MockEPUser.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.core;
-
-import java.util.Date;
-
-import org.openecomp.portalapp.portal.domain.EPUser;
-
-public class MockEPUser {
-
- public EPUser mockEPUser() {
-
- EPUser ePUser = new EPUser();
- ePUser.setOrgId(null);
- ePUser.setManagerId(null);
- ePUser.setFirstName("test");
- ePUser.setLastName("test");
- ePUser.setMiddleInitial(null);
- ePUser.setPhone(null);
- ePUser.setFax(null);
- ePUser.setCellular(null);
- ePUser.setEmail(null);
- ePUser.setAddressId(null);
- ePUser.setAlertMethodCd(null);
- ePUser.setHrid(null);
- ePUser.setOrgUserId("guestT");
- ePUser.setOrgCode(null);
- ePUser.setAddress1(null);
- ePUser.setAddress2(null);
- ePUser.setCity(null);
- ePUser.setState(null);
- ePUser.setZipCode(null);
- ePUser.setCountry(null);
- ePUser.setOrgManagerUserId(null);
- ePUser.setLocationClli(null);
- ePUser.setBusinessCountryCode(null);
- ePUser.setBusinessCountryName(null);
- ePUser.setBusinessUnit(null);
- ePUser.setBusinessUnitName(null);
- ePUser.setDepartment(null);
- ePUser.setDepartmentName(null);
- ePUser.setCompanyCode(null);
- ePUser.setCompany(null);
- ePUser.setZipCodeSuffix(null);
- ePUser.setJobTitle(null);
- ePUser.setCommandChain(null);
- ePUser.setSiloStatus(null);
- ePUser.setCostCenter(null);
- ePUser.setFinancialLocCode(null);
-
- ePUser.setLoginId(null);
- ePUser.setLoginPwd(null);
- Date date = new Date();
- ePUser.setLastLoginDate(date);
- ePUser.setActive(true);
- ePUser.setInternal(false);
- ePUser.setSelectedProfileId(null);
- ePUser.setTimeZoneId(null);
- ePUser.setOnline(true);
- ePUser.setChatId(null);
- ePUser.setUserApps(null);
- ePUser.setPseudoRoles(null);
-
- ePUser.setId((long) -1);
- return ePUser;
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/PopulateSampleTestData.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/PopulateSampleTestData.java
deleted file mode 100644
index 8f99f442..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/PopulateSampleTestData.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.core;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import javax.sql.DataSource;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.jdbc.datasource.DataSourceUtils;
-import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
-
-public class PopulateSampleTestData extends ApplicationCommonContextTestSuite {
-
- @Autowired
- DataSource dataSource;
-
- @Before
- public void populateTestData() throws SQLException {
-
- String sql = "PopulateTestData.sql";
- createConnection(sql);
- }
-
- public void createConnection(String sql) {
- Connection connection = null;
- ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
- populator.addScript(new ClassPathResource(sql));
- try {
- connection = DataSourceUtils.getConnection(dataSource);
- populator.populate(connection);
- } finally {
- if (connection != null) {
- DataSourceUtils.releaseConnection(connection, dataSource);
- }
- }
- }
-
- @Test
- public void populateTest() {
- assert (true);
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RemoveSampleTestData.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RemoveSampleTestData.java
deleted file mode 100644
index c9954a69..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RemoveSampleTestData.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.core;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import javax.sql.DataSource;
-
-import org.junit.After;
-import org.junit.Test;
-import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.jdbc.datasource.DataSourceUtils;
-import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
-
-public class RemoveSampleTestData extends ApplicationCommonContextTestSuite {
- @Autowired
- DataSource dataSource;
-
- public static int count = 0;
-
- @After
- public void removeTestData() throws SQLException {
- String sql = "RemoveTestData.sql";
- createConnection(sql);
- }
-
- public void createConnection(String sql) {
- Connection connection = null;
- ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
- populator.addScript(new ClassPathResource(sql));
- try {
- connection = DataSourceUtils.getConnection(dataSource);
- populator.populate(connection);
- } finally {
- if (connection != null) {
- DataSourceUtils.releaseConnection(connection, dataSource);
- }
- }
- }
-
- @Test
- public void removeTest() {
- assert (true);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RestURLsTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RestURLsTestSuite.java
deleted file mode 100644
index 10108cde..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RestURLsTestSuite.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.core;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin;
-import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole;
-import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.http.MediaType;
-import org.springframework.test.web.servlet.ResultActions;
-import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
-import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- *
- * Use RestURLsTestSuite to test Rest API URL's
- */
-public class RestURLsTestSuite extends ApplicationCommonContextTestSuite {
-
- public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(),
- MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
-
- String url = null;
-
- MockEPUser mockUser = new MockEPUser();
-
- public byte[] convertObjectToJsonBytes(Object object) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- return mapper.writeValueAsBytes(object);
- }
-
- public void requestBuilder(String url) throws Exception {
- EPUser user = mockUser.mockEPUser();
-
- MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(url);
- requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- ResultActions ra = getMockMvc().perform(requestBuilder);
- assertData(ra);
- }
-
- public void assertData(ResultActions ra) {
- Assert.assertEquals("application/json", ra.andReturn().getResponse().getContentType());
- Assert.assertEquals(200, ra.andReturn().getResponse().getStatus());
-
- }
-
- @Test
- public void getMenuItemsTest() throws Exception {
- url = "/portalApi/functionalMenu";
- requestBuilder(url);
- }
-
- @Test
- public void getMenuItemsForNotificationsTest() throws Exception {
- url = "/portalApi/functionalMenuForNotificationTree";
- requestBuilder(url);
- }
-
- @Test
- public void getUserAppsTestnew() throws Exception {
- url = "/portalApi/userApps";
- requestBuilder(url);
- }
-
- @Test
- public void getPersUserAppsTest() throws Exception {
- url = "/portalApi/persUserApps";
- requestBuilder(url);
- }
-
- @Test
- public void getAppCatalogTest() throws Exception {
- url = "/portalApi/appCatalog";
- requestBuilder(url);
- }
-
- @Test
- public void getAppListNewTest() throws Exception {
- ResultActions ra = getMockMvc()
- .perform(MockMvcRequestBuilders.get("/portalApi/userApplicationRoles").param("userId", "guest"));
- assertData(ra);
- }
-
- @Test
- public void getAvailableAppListTest() throws Exception {
- url = "/portalApi/availableApps";
- requestBuilder(url);
- }
-
- @Test
- public void getAllAppsTest() throws Exception {
- url = "/portalApi/allAvailableApps";
- requestBuilder(url);
- }
-
- @Test
- public void getUserProfileTest() throws Exception {
- url = "/portalApi/userProfile";
- requestBuilder(url);
- }
-
- @Test
- public void getRolesByAppTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/adminAppsRoles/550");
- requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- ResultActions ra = getMockMvc().perform(requestBuilder);
- assertData(ra);
- }
-
- @Test
- public void getAppsWithAdminRoleStateForUserTest() throws Exception {
- url = "/portalApi/adminAppsRoles?user=guest";
- requestBuilder(url);
-
- }
-
- @Test
- public void getUsersFromAppEndpointTest() throws Exception {
- url = "/portalApi/app/550/users";
- requestBuilder(url);
- }
-
- @Test
- public void getOnboardingAppsTest() throws Exception {
- url = "/portalApi/onboardingApps";
- requestBuilder(url);
- }
-
- @Test
- public void getMenuItemsForAuthUserTest() throws Exception {
- url = "/portalApi/functionalMenuForAuthUser";
- requestBuilder(url);
- }
-
- @Test
- public void getMenuItemsForEditingTest() throws Exception {
- url = "/portalApi/functionalMenuForEditing";
- requestBuilder(url);
- }
-
- @Test
- public void getAppRolesTest() throws Exception {
- url = "/portalApi/appRoles/455";
- requestBuilder(url);
- }
-
- @Test
- public void regenerateAncestorTableTest() throws Exception {
-
- EPUser user = mockUser.mockEPUser();
-
- MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders
- .get("/portalApi/regenerateFunctionalMenuAncestors");
- requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- ResultActions ra = getMockMvc().perform(requestBuilder);
- assertEquals("application/json;charset=UTF-8", ra.andReturn().getResponse().getContentType());
- Assert.assertEquals(200, ra.andReturn().getResponse().getStatus());
-
- }
-
- @Test
- public void getAppListTest() throws Exception {
- url = "/portalApi/getAppList";
- requestBuilder(url);
- }
-
- @Test
- public void getFavoritesForUserTest() throws Exception {
- url = "/portalApi/getFavoriteItems";
- requestBuilder(url);
- }
-
- @Test
- public void getManifestTest() throws Exception {
- url = "/portalApi/manifest";
- requestBuilder(url);
- }
-
- @Test
- public void getActiveUsersTest() throws Exception {
- url = "/portalApi/dashboard/activeUsers";
- requestBuilder(url);
- }
-
- @Test
- public void searchPortalTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/dashboard/search")
- .param("searchString", "guest");
- requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- ResultActions ra = getMockMvc().perform(requestBuilder);
- assertData(ra);
- }
-
- @Test
- public void getWidgetDataTest() throws Exception {
- EPUser user = mockUser.mockEPUser();
- MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/dashboard/widgetData")
- .param("resourceType", "guest");
- requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- ResultActions ra = getMockMvc().perform(requestBuilder);
- assertData(ra);
- }
-
- @Test
- public void getAppsAndContactsTest() throws Exception {
- url = "/portalApi/contactus/allapps";
- requestBuilder(url);
- }
-
- @Test
- public void getPortalDetailsTest() throws Exception {
- url = "/portalApi/contactus/feedback";
- requestBuilder(url);
- }
-
- @Test
- public void getAppCategoryFunctionsTest() throws Exception {
- url = "/portalApi/contactus/functions";
- requestBuilder(url);
- }
-
- @Test
- public void getOnlineUserUpdateRateTest() throws Exception {
- url = "/portalApi/dashboard/onlineUserUpdateRate";
- requestBuilder(url);
- }
-
- @Test
- public void getMenuIdRoleIdTest() throws Exception {
- url = "/portalApi/getFunctionalMenuRole";
- requestBuilder(url);
- }
-
- @Test
- public void getNotificationsTest() throws Exception {
- url = "/portalApi/getNotifications";
- requestBuilder(url);
- }
-
- @Test
- public void getAdminNotificationsTest() throws Exception {
- url = "/portalApi/getAdminNotifications";
- requestBuilder(url);
- }
-
- @Test
- public void getNotificationAppRolesTest() throws Exception {
- url = "/portalApi/getNotificationAppRoles";
- requestBuilder(url);
- }
-
- @Test
- public void getNotificationUpdateRateTest() throws Exception {
- url = "/portalApi/notificationUpdateRate";
- requestBuilder(url);
- }
-
- @Test
- public void notificationReadTest() throws Exception {
- url = "/portalApi/notificationRead?notificationId=262";
- requestBuilder(url);
- }
-
- @Test
- public void testGetRolesTest() throws Exception {
- url = "/portalApi/notificationRole/248/roles";
- requestBuilder(url);
- }
-
- @Test
- public void putAppsWithAdminRoleStateForUserTest() throws Exception {
-
- AppsListWithAdminRole appsListWithAdminRole = new AppsListWithAdminRole();
- appsListWithAdminRole.setOrgUserId("guest");
- ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>();
- AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin();
- appNameIdIsAdmin.setId((long) 455);
- appNameIdIsAdmin.setAppName("CCD");
- appNameIdIsAdmin.setIsAdmin(true);
- appNameIdIsAdmin.setRestrictedApp(false);
- appsRoles.add(appNameIdIsAdmin);
- appsListWithAdminRole.setAppsRoles(appsRoles);
- EPUser user = mockUser.mockEPUser();
- MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.put("/portalApi/adminAppsRoles")
- .contentType(APPLICATION_JSON_UTF8).content(convertObjectToJsonBytes(appsListWithAdminRole));
-
- requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
- ResultActions ra = getMockMvc().perform(requestBuilder);
- assertData(ra);
- }
-
- @Test
- public void ticketEventControllerForExternalSystem() throws Exception {
- String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}";
- MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/auxapi/ticketevent")
- .contentType(APPLICATION_JSON_UTF8).content(ticketEventJson);
- ResultActions ra = getMockMvc().perform(requestBuilder);
- assertTrue(ra.andReturn().getResponse().getContentType().contains("application/json"));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java
deleted file mode 100644
index ed13c2df..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.AdminUserApp;
-
-public class AdminUserAppTest {
-
- public AdminUserApp mockAdminUserApp(){
-
- AdminUserApp adminUserApp = new AdminUserApp();
-
- adminUserApp.setUserId((long)1);
- adminUserApp.setFirstName("test");
- adminUserApp.setLastName("test");
- adminUserApp.setOrgUserId("test");
- adminUserApp.setAppId((long)1);
- adminUserApp.setAppName("test");
-
- return adminUserApp;
- }
-
- @Test
- public void adminUserAppTest(){
- AdminUserApp adminUserApp = mockAdminUserApp();
-
- assertEquals(adminUserApp.getUser_Id(), new Long(1));
- assertEquals(adminUserApp.getFirstName(), "test");
- assertEquals(adminUserApp.getLastName(), "test");
- assertEquals(adminUserApp.getOrgUserId(), "test");
- assertEquals(adminUserApp.getAppName(), "test");
- assertEquals(adminUserApp.getAppId(), new Long(1));
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java
deleted file mode 100644
index 6faf44a8..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.persistence.Column;
-import javax.persistence.Id;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.AdminUserApp;
-import org.openecomp.portalapp.portal.domain.AdminUserApplications;
-
-public class AdminUserApplicationsTest {
-
- public AdminUserApplications mockAdminUserApplications(){
-
- AdminUserApp adminUserApp = new AdminUserApp();
-
- adminUserApp.setUserId((long)1);
- adminUserApp.setFirstName("test");
- adminUserApp.setLastName("test");
- adminUserApp.setOrgUserId("test");
- adminUserApp.setAppId((long)1);
- adminUserApp.setAppName("test");
-
- AdminUserApplications adminUserApplications = new AdminUserApplications(adminUserApp);
-
- adminUserApplications.setUser_Id((long)1);
- adminUserApplications.setFirstName("test");
- adminUserApplications.setLastName("test");
- adminUserApplications.setOrgUserId("test");
- return adminUserApplications;
- }
-
- @Test
- public void adminUserAppTest(){
- AdminUserApplications adminUserApplications = mockAdminUserApplications();
- AdminUserApp adminUserApp = new AdminUserApp();
-
- adminUserApp.setUserId((long)1);
- adminUserApp.setFirstName("test");
- adminUserApp.setLastName("test");
- adminUserApp.setOrgUserId("test");
- adminUserApp.setAppId((long)1);
- adminUserApp.setAppName("test");
- AdminUserApplications adminUserApplications1 = new AdminUserApplications(adminUserApp);
-
- assertEquals(adminUserApplications.getUser_Id(), new Long(1));
- assertEquals(adminUserApplications.getFirstName(), "test");
- assertEquals(adminUserApplications.getLastName(), "test");
- assertEquals(adminUserApplications.getOrgUserId(), "test");
-
-
- assertEquals(adminUserApplications1.getApps().get(0).getAppId(),adminUserApp.getAppId());
- assertEquals(adminUserApplications1.getApps().get(0).getAppName(),adminUserApp.getAppName());
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java
deleted file mode 100644
index f4368616..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.AppContactUs;
-
-public class AppContactUsTest {
-
- public AppContactUs mockAppContactUs(){
- AppContactUs appContactUs = new AppContactUs();
- appContactUs.setDescription("test");
- appContactUs.setContactEmail("test");
- appContactUs.setContactName("test");
- appContactUs.setUrl("test");
- appContactUs.setActiveYN("test");
-
- return appContactUs;
- }
-
- @Test
- public void mockAppContactUsTest(){
- AppContactUs appContactUs = mockAppContactUs();
-
- assertEquals(appContactUs.getDescription(), "test");
- assertEquals(appContactUs.getContactEmail(), "test");
- assertEquals(appContactUs.getContactName(), "test");
- assertEquals(appContactUs.getUrl(), "test");
- assertEquals(appContactUs.getActiveYN(), "test");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java
deleted file mode 100644
index 83bdc591..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
-
-public class CentralRoleFunctionTest {
-
- public CentralRoleFunction mockCentralRoleFunction(){
-
- CentralRoleFunction centralRoleFunction = new CentralRoleFunction();
-
- centralRoleFunction.setCode("test");
- centralRoleFunction.setName("test");
- centralRoleFunction.setAppId((long)1);
- centralRoleFunction.setEditUrl("test");
-
- return centralRoleFunction;
- }
-
- @Test
- public void centralRoleFunctionTest(){
- CentralRoleFunction centralRoleFunction = mockCentralRoleFunction();
-
- assertEquals(centralRoleFunction.getAppId(), new Long(1));
- assertEquals(centralRoleFunction.getCode(), "test");
- assertEquals(centralRoleFunction.getName(), "test");
- assertEquals(centralRoleFunction.getEditUrl(), "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java
deleted file mode 100644
index a3f24631..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPAppRoleFunction;
-
-public class EPAppRoleFunctionTest {
-
- public EPAppRoleFunction mockEPAppRoleFunction(){
- EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction();
- epAppRoleFunction.setRoleId((long)1);
- epAppRoleFunction.setAppId((long)1);
- epAppRoleFunction.setCode("test");
-
- return epAppRoleFunction;
- }
-
- @Test
- public void epAppRoleFunctionTest(){
- EPAppRoleFunction epAppRoleFunction = mockEPAppRoleFunction();
-
- assertEquals(epAppRoleFunction.getRoleId(), new Long(1));
- assertEquals(epAppRoleFunction.getAppId(), new Long(1));
- assertEquals(epAppRoleFunction.getCode(), "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java
deleted file mode 100644
index 9a60e7d7..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPApp;
-
-public class EPAppTest {
-
- public EPApp mockEPApp(){
- EPApp epApp = new EPApp();
-
- epApp.setName("test");
- epApp.setImageUrl("test");
- epApp.setDescription("test");
- epApp.setNotes("test");
- epApp.setUrl("test");
- epApp.setAlternateUrl("test");
- epApp.setAppRestEndpoint("test");
- epApp.setMlAppName("test");
- epApp.setMlAppAdminId("test");
- epApp.setMotsId((long)1);
- epApp.setUsername("test");
- epApp.setAppPassword("test");
- epApp.setOpen(false);
- epApp.setEnabled(false);
- epApp.setUebTopicName("test");
- epApp.setUebSecret("test");
- epApp.setAppType(1);
- epApp.setCentralAuth(false);
- epApp.setNameSpace("test");
-
- return epApp;
- }
-
- @Test
- public void epAppTest(){
- EPApp epApp = mockEPApp();
-
- assertEquals(epApp.getName(), "test");
- assertEquals(epApp.getImageUrl(), "test");
- assertEquals(epApp.getDescription(), "test");
- assertEquals(epApp.getNotes(), "test");
- assertEquals(epApp.getUrl(), "test");
- assertEquals(epApp.getAlternateUrl(), "test");
- assertEquals(epApp.getAppRestEndpoint(), "test");
- assertEquals(epApp.getMlAppName(), "test");
- assertEquals(epApp.getMlAppAdminId(), "test");
- assertEquals(epApp.getMotsId(), new Long(1));
- assertEquals(epApp.getUsername(), "test");
- assertEquals(epApp.getAppPassword(), "test");
- assertEquals(epApp.getOpen(), false);
- assertEquals(epApp.getEnabled(), false);
- assertEquals(epApp.getUebTopicName(), "test");
- assertEquals(epApp.getUebSecret(), "test");
- assertEquals(epApp.getAppType(), Integer.valueOf(1));
- assertEquals(epApp.getCentralAuth(), false);
- assertEquals(epApp.getNameSpace(), "test");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java
deleted file mode 100644
index 07206244..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPEndpointAccount;
-
-public class EPEndpointAccountTest {
-
- public EPEndpointAccount mockEPEndpointAccount(){
- EPEndpointAccount epEndpointAccount = new EPEndpointAccount();
-
- epEndpointAccount.setEp_id((long)1);
- epEndpointAccount.setAccount_id((long)1);
- epEndpointAccount.setId((long)1);
-
- return epEndpointAccount;
- }
-
- @Test
- public void epEndpointAccount(){
- EPEndpointAccount epEndpointAccount = mockEPEndpointAccount();
- assertEquals(epEndpointAccount.getEp_id(), new Long(1));
- assertEquals(epEndpointAccount.getAccount_id(), new Long(1));
- assertEquals(epEndpointAccount.getId(), new Long(1));
-
- assertEquals(epEndpointAccount.toString(), "EPEndpointAccount [id=1, ep_id=1, account_id=1]");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java
deleted file mode 100644
index 8fbee988..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPEndpoint;
-
-public class EPEndpointTest {
-
- public EPEndpoint mockEPEndpoint(){
- EPEndpoint epEndpoint = new EPEndpoint();
-
- epEndpoint.setId((long)1);
- epEndpoint.setName("test");
-
- return epEndpoint;
- }
-
- @Test
- public void epEndpointTest(){
- EPEndpoint epEndpoint = mockEPEndpoint();
-
- assertEquals(epEndpoint.getId(), new Long(1));
- assertEquals(epEndpoint.getName(), "test");
- assertEquals("EPEndpoint [id=1, name=test]", epEndpoint.toString());
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java
deleted file mode 100644
index 05453bfa..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPRole;
-
-public class EPRoleTest {
-
- public EPRole mockEPRole(){
- EPRole epRole = new EPRole();
-
- epRole.setName("test");
- epRole.setActive(false);
- epRole.setPriority(1);
- epRole.setAppId((long)1);
- epRole.setAppRoleId((long)1);
-
- return epRole;
- }
-
- @Test
- public void epRoleTest(){
- EPRole epRole = mockEPRole();
-
- assertEquals(epRole.getName(), "test");
- assertEquals(epRole.getActive(), false);
- assertEquals(epRole.getPriority().toString(),"1");
- assertEquals(epRole.getAppId(), new Long(1));
- assertEquals(epRole.getAppRoleId(), new Long(1));
-
- assertEquals(epRole.toString(), "[Id = null, name = test]");
-
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java
deleted file mode 100644
index a21eec76..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPUserAppCatalogRoles;
-
-public class EPUserAppCatalogRolesTest {
-
- public EPUserAppCatalogRoles mockEPUserAppCatalogRoles(){
- EPUserAppCatalogRoles epUserAppCatalogRoles = new EPUserAppCatalogRoles();
-
- epUserAppCatalogRoles.setRequestedRoleId((long)1);
- epUserAppCatalogRoles.setRolename("test");
- epUserAppCatalogRoles.setRequestStatus("status");
- epUserAppCatalogRoles.setAppId((long)1);
-
- return epUserAppCatalogRoles;
- }
-
- @Test
- public void epUserAppCatalogRolesTest(){
- EPUserAppCatalogRoles epUserAppCatalogRoles = mockEPUserAppCatalogRoles();
-
- assertEquals(epUserAppCatalogRoles.getRequestedRoleId(), new Long(1));
- assertEquals(epUserAppCatalogRoles.getRolename(), "test");
- assertEquals(epUserAppCatalogRoles.getRequestStatus(), "status");
- assertEquals(epUserAppCatalogRoles.getAppId(), new Long(1));
-
- assertEquals("EPUserAppCatalogRoles [requestedRoleId=1, rolename=test, requestStatus=status, appId=1]", epUserAppCatalogRoles.toString());
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java
deleted file mode 100644
index c9147bbe..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest;
-import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail;
-
-public class EPUserAppRolesRequestDetailTest {
-
- public EPUserAppRolesRequestDetail mockEPUserAppRolesRequestDetail(){
-
- EPUserAppRolesRequest epUserAppRolesRequest = new EPUserAppRolesRequest();
- epUserAppRolesRequest.setUserId((long)1);
- epUserAppRolesRequest.setAppId((long)1);
- epUserAppRolesRequest.setCreated(new Date());
- epUserAppRolesRequest.setUpdatedDate(new Date());
- epUserAppRolesRequest.setRequestStatus("test");
-
- EPUserAppRolesRequestDetail epUserAppRolesRequestDetail = new EPUserAppRolesRequestDetail();
- epUserAppRolesRequestDetail.setReqRoleId((long)1);
- epUserAppRolesRequestDetail.setReqType("test");
- epUserAppRolesRequestDetail.setEpRequestIdData(epUserAppRolesRequest);
-
- return epUserAppRolesRequestDetail;
- }
-
- @Test
- public void epUserAppRolesRequestDetailTest(){
-
- EPUserAppRolesRequest epUserAppRolesRequest = new EPUserAppRolesRequest();
- epUserAppRolesRequest.setUserId((long)1);
- epUserAppRolesRequest.setAppId((long)1);
- epUserAppRolesRequest.setCreated(new Date());
- epUserAppRolesRequest.setUpdatedDate(new Date());
- epUserAppRolesRequest.setRequestStatus("test");
-
- EPUserAppRolesRequestDetail epUserAppRolesRequestDetail = mockEPUserAppRolesRequestDetail();
-
- EPUserAppRolesRequestDetail epUserAppRolesRequestDetail1 = new EPUserAppRolesRequestDetail();
- epUserAppRolesRequestDetail1.setReqRoleId((long)1);
- epUserAppRolesRequestDetail1.setReqType("test");
- epUserAppRolesRequestDetail1.setEpRequestIdData(epUserAppRolesRequest);
-
- assertEquals(epUserAppRolesRequestDetail.getReqRoleId(), new Long(1));
- assertEquals(epUserAppRolesRequestDetail.getReqType(), "test");
- assertEquals(epUserAppRolesRequestDetail.getEpRequestIdData(), epUserAppRolesRequest);
- assertEquals(epUserAppRolesRequestDetail.hashCode(), epUserAppRolesRequestDetail1.hashCode());
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java
deleted file mode 100644
index 540c63e9..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPUserAppRoles;
-
-public class EPUserAppRolesTest {
-
- public EPUserAppRoles mockEPUserAppRoles(){
- EPUserAppRoles epUserAppRoles = new EPUserAppRoles();
-
- epUserAppRoles.setRoleId((long)1);
- epUserAppRoles.setAppId((long)1);
-
- return epUserAppRoles;
- }
-
- @Test
- public void epUserAppRolesTest(){
- EPUserAppRoles epUserAppRoles = mockEPUserAppRoles();
-
- assertEquals(epUserAppRoles.getRoleId(), new Long(1));
- assertEquals(epUserAppRoles.getAppId(), new Long(1));
- assertEquals("EpUserAppRoles [roleId=1, appId=1]", epUserAppRoles.toString());
- }
-}
-
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java
deleted file mode 100644
index 0c450ebb..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.domain.EPRole;
-import org.openecomp.portalapp.portal.domain.EPUserApp;
-
-public class EPUserAppTest {
-
- public EPUserApp mockEPUserApp(){
-
- EPApp epApp = new EPApp();
- epApp.setName("test");
- epApp.setImageUrl("test");
- epApp.setDescription("test");
- epApp.setNotes("test");
- epApp.setUrl("test");
- epApp.setAlternateUrl("test");
- epApp.setAppRestEndpoint("test");
- epApp.setMlAppName("test");
- epApp.setMlAppAdminId("test");
- epApp.setMotsId((long)1);
- epApp.setUsername("test");
- epApp.setAppPassword("test");
-
-
- //Role
- EPRole epRole = new EPRole();
- epRole.setName("test");
- epRole.setActive(false);
- epRole.setPriority(1);
- epRole.setAppId((long)1);
- epRole.setAppRoleId((long)1);
-
- EPUserApp user = new EPUserApp();
- user.setUserId((long)1);
- user.setApp(epApp);
- user.setRole(epRole);
- user.setPriority((short)32767);
-
-
- return user;
- }
-
- @Test
- public void userTest(){
- EPUserApp user = mockEPUserApp();
-
- EPApp epApp = new EPApp();
- epApp.setName("test");
- epApp.setImageUrl("test");
- epApp.setDescription("test");
- epApp.setNotes("test");
- epApp.setUrl("test");
- epApp.setAlternateUrl("test");
- epApp.setAppRestEndpoint("test");
- epApp.setMlAppName("test");
- epApp.setMlAppAdminId("test");
- epApp.setMotsId((long)1);
- epApp.setUsername("test");
- epApp.setAppPassword("test");
- user.setApp(epApp);
-
- //Role
- EPRole epRole = new EPRole();
- epRole.setName("test");
- epRole.setActive(false);
- epRole.setPriority(1);
- epRole.setAppId((long)1);
- epRole.setAppRoleId((long)1);
-
-
- assertEquals(user.getUserId(),Long.valueOf(1));
- assertEquals(user.getApp(), epApp);
- assertEquals(user.getPriority().getClass(), Short.class);
-
- assertEquals(user.toString(), "[u: 1; a: null, r: null; appRoleId: 1]");
-
- assertEquals(user.hashCode(), user.hashCode());
-
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java
deleted file mode 100644
index afad6f63..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPUserAppsManualSortPreference;
-
-public class EPUserAppsManualSortPreferenceTest {
-
- public EPUserAppsManualSortPreference mockEPUserAppsManualSortPreference(){
-
- EPUserAppsManualSortPreference epUserAppsManualSortPreference = new EPUserAppsManualSortPreference();
- epUserAppsManualSortPreference.setUserId(1);
- epUserAppsManualSortPreference.setAppId((long)1);
- epUserAppsManualSortPreference.setAppManualSortOrder(1);
-
- return epUserAppsManualSortPreference;
- }
-
- @Test
- public void epUserAppsManualSortPreferenceTest(){
-
- EPUserAppsManualSortPreference epUserAppsManualSortPreference = mockEPUserAppsManualSortPreference();
-
- assertEquals(epUserAppsManualSortPreference.getUserId(), 1);
- assertEquals(epUserAppsManualSortPreference.getAppId(), new Long(1));
- assertEquals(epUserAppsManualSortPreference.getAppManualSortOrder(), 1);
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java
deleted file mode 100644
index 545c16d5..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPUserAppsSortPreference;
-
-public class EPUserAppsSortPreferenceTest {
-
- public EPUserAppsSortPreference mockEPUserAppsSortPreferenceTest(){
-
- EPUserAppsSortPreference epUserAppsSortPreference = new EPUserAppsSortPreference();
- epUserAppsSortPreference.setUserId(1);
- epUserAppsSortPreference.setSortPref("test");
- epUserAppsSortPreference.setId((long)1);
- epUserAppsSortPreference.setCreated(new Date());
- epUserAppsSortPreference.setModified(new Date());
- epUserAppsSortPreference.setModifiedId((long)1);
- epUserAppsSortPreference.setRowNum((long)1);
- epUserAppsSortPreference.setAuditTrail(null);
-
- return epUserAppsSortPreference;
- }
-
- @Test
- public void epUserAppsSortPreferenceTest() {
- EPUserAppsSortPreference epUserAppsSortPreference = mockEPUserAppsSortPreferenceTest();
-
- assertEquals(epUserAppsSortPreference.getUserId(), 1);
- assertEquals(epUserAppsSortPreference.getSortPref(), "test");
- assertEquals(epUserAppsSortPreference.getId(), new Long(1));
- assertEquals(epUserAppsSortPreference.getCreated(), new Date());
- assertEquals(epUserAppsSortPreference.getModified(), new Date());
- assertEquals(epUserAppsSortPreference.getModifiedId(), new Long(1));
- assertEquals(epUserAppsSortPreference.getRowNum(), new Long(1));
- assertEquals(epUserAppsSortPreference.getAuditTrail(), null);
-
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java
deleted file mode 100644
index 64313e52..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPUserNotification;
-
-public class EPUserNotificationTest {
-
- public EPUserNotification mockEPUserNotification(){
-
- EPUserNotification epUserNotification = new EPUserNotification();
-
- epUserNotification.setUserId((long)1);
- epUserNotification.setNotificationId((long)1);
- epUserNotification.setViewed("test");
- epUserNotification.setUpdateTime(new Date());
-
- return epUserNotification;
- }
-
- @Test
- public void epUserNotificationTest(){
- EPUserNotification epUserNotification = mockEPUserNotification();
-
- assertEquals(epUserNotification.getUserId(), new Long(1));
- assertEquals(epUserNotification.getNotificationId(), new Long(1));
- assertEquals(epUserNotification.getViewed(), "test");
- // assertEquals(epUserNotification.getUpdateTime(), new Date());
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java
deleted file mode 100644
index 54e6193d..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPUser;
-
-public class EPUserTest {
-
- public EPUser mockEPUser(){
-
- EPUser epUser = new EPUser();
-
- epUser.setId((long)1);
- epUser.setManagerId((long) 1234);
- epUser.setFirstName("test");
- epUser.setLastName("test");
- epUser.setMiddleInitial("test");
- epUser.setPhone("test");
- epUser.setFax("test");
- epUser.setCellular("test");
- epUser.setEmail("test");
- epUser.setAddressId((long) 123);
- epUser.setAlertMethodCd("test");
- epUser.setHrid("test");
- epUser.setOrgUserId("test");
- epUser.setOrgCode("test");
- epUser.setAddress1("test");
- epUser.setAddress2("test");
- epUser.setCity("test");
- epUser.setState("test");
- epUser.setZipCode("test");
- epUser.setCountry("test");
- epUser.setOrgManagerUserId("test");
- epUser.setLocationClli("test");
- epUser.setBusinessCountryCode("test");
- epUser.setBusinessCountryName("test");
- epUser.setBusinessUnit("test");
- epUser.setBusinessUnitName("test");
- epUser.setDepartment("test");
- epUser.setDepartmentName("test");
- epUser.setCompanyCode("test");
- epUser.setCompany("test");
- epUser.setZipCodeSuffix("test");
- epUser.setJobTitle("test");
- epUser.setCommandChain("test");
- epUser.setSiloStatus("test");
- epUser.setCostCenter("test");
- epUser.setFinancialLocCode("test");
- epUser.setLoginId("test");
- epUser.setLoginPwd("test");
- epUser.setLastLoginDate(new Date());
- epUser.setActive(false);
- epUser.setInternal(false);
- epUser.setSelectedProfileId((long) 12345);
- epUser.setTimeZoneId((long) 12345);
- epUser.setOnline(false);
- epUser.setChatId("test");
- return epUser;
-
- }
-
- @Test
- public void userTest(){
- EPUser user = mockEPUser();
-
- assertEquals(user.getId(), new Long(1));
- assertEquals(user.getManagerId(), new Long(1234));
- assertEquals(user.getFirstName(), "test");
- assertEquals(user.getLastName(), "test");
- assertEquals(user.getMiddleInitial(), "test");
- assertEquals(user.getPhone(), "test");
- assertEquals(user.getFax(), "test");
- assertEquals(user.getCellular(), "test");
- assertEquals(user.getEmail(), "test");
- assertEquals(user.getAddressId(), new Long(123) );
- assertEquals(user.getAlertMethodCd(), "test");
- assertEquals(user.getHrid(), "test");
- assertEquals(user.getOrgUserId(), "test");
- assertEquals(user.getOrgCode(), "test");
- assertEquals(user.getAddress1(), "test");
- assertEquals(user.getAddress2(), "test");
- assertEquals(user.getState(), "test");
- assertEquals(user.getZipCode(), "test");
- assertEquals(user.getCountry(), "test");
- assertEquals(user.getOrgManagerUserId(), "test");
- assertEquals(user.getLocationClli(), "test");
- assertEquals(user.getBusinessCountryCode(), "test");
- assertEquals(user.getBusinessCountryName(), "test");
- assertEquals(user.getBusinessUnit(), "test");
- assertEquals(user.getBusinessUnitName(), "test");
- assertEquals(user.getDepartment(), "test");
- assertEquals(user.getDepartmentName(), "test");
- assertEquals(user.getCompanyCode(), "test");
- assertEquals(user.getCompany(), "test");
- assertEquals(user.getZipCodeSuffix(), "test");
- assertEquals(user.getJobTitle(), "test");
- assertEquals(user.getCommandChain(), "test");
- assertEquals(user.getSiloStatus(), "test");
- assertEquals(user.getFinancialLocCode(), "test");
- assertEquals(user.getLoginId(), "test");
- assertEquals(user.getLoginPwd(), "test");
- assertEquals(user.getActive(), false);
- assertEquals(user.getInternal(), false);
- assertEquals(user.getSelectedProfileId(), new Long (12345));
- assertEquals(user.getTimeZoneId(), new Long (12345));
- assertEquals(user.getChatId(), "test");
-
- //assertEquals(user.toString(), "EPUser [orgId=null, managerId=1234, firstName=test, middleInitial=test, lastName=test, phone=test, fax=test, cellular=test, email=test, addressId=123, alertMethodCd=test, hrid=test, orgUserId=test, orgCode=test, address1=test, address2=test, city=test, state=test, zipCode=test, country=test, orgManagerUserId=test, locationClli=test, businessCountryCode=test, businessCountryName=test, businessUnit=test, businessUnitName=test, department=test, departmentName=test, companyCode=test, company=test, zipCodeSuffix=test, jobTitle=test, commandChain=test, siloStatus=test, costCenter=test, financialLocCode=test, loginId=test, loginPwd=test, lastLoginDate=Tue Sep 05 11:04:49 EDT 2017, active=false, internal=false, selectedProfileId=12345, timeZoneId=12345, online=false, chatId=test, isGuest=false, userApps=[], pseudoRoles=[]]");
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java
deleted file mode 100644
index 69aa3db0..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPWidgetsManualSortPreference;
-
-public class EPWidgetsManualSortPreferenceTest {
-
- public EPWidgetsManualSortPreference mockEPWidgetsManualSortPreference(){
- EPWidgetsManualSortPreference epWidgetsManualSortPreference = new EPWidgetsManualSortPreference();
-
- epWidgetsManualSortPreference.setUserId(1);
- epWidgetsManualSortPreference.setWidgetId((long)1);
- epWidgetsManualSortPreference.setWidgetRow(1);
- epWidgetsManualSortPreference.setWidgetCol(1);
- epWidgetsManualSortPreference.setWidgetWidth(1);
- epWidgetsManualSortPreference.setWidgetHeight(1);
-
- return epWidgetsManualSortPreference;
- }
-
- @Test
- public void epWidgetsManualSortPreferenceTest(){
- EPWidgetsManualSortPreference epWidgetsManualSortPreference = mockEPWidgetsManualSortPreference();
-
- assertEquals(epWidgetsManualSortPreference.getWidgetId(), new Long(1));
- assertEquals(epWidgetsManualSortPreference.getUserId(), 1);
- assertEquals(epWidgetsManualSortPreference.getWidgetRow(), 1);
- assertEquals(epWidgetsManualSortPreference.getWidgetCol(), 1);
- assertEquals(epWidgetsManualSortPreference.getWidgetHeight(), 1);
- assertEquals(epWidgetsManualSortPreference.getWidgetWidth(), 1);
-
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java
deleted file mode 100644
index ca2bdfb3..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EcompAppRoleId;
-
-public class EcompAppRoleIdTest {
-
- public EcompAppRoleId mockEcompAppRoleId(){
-
- EcompAppRoleId ecompAppRoleId = new EcompAppRoleId();
-
- ecompAppRoleId.setAppId((long)1);
- ecompAppRoleId.setAppName("test");
- ecompAppRoleId.setRoleId(1);
- ecompAppRoleId.setRoleName("test");
-
- return ecompAppRoleId;
- }
-
- @Test
- public void ecompAppRoleIdTest(){
-
- EcompAppRoleId ecompAppRoleId = mockEcompAppRoleId();
-
- assertEquals(ecompAppRoleId.getAppId(), new Long(1));
- assertEquals(ecompAppRoleId.getAppName(), "test");
- assertEquals(ecompAppRoleId.getRoleId().toString(), "1");
- assertEquals(ecompAppRoleId.getRoleName(), "test");
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java
deleted file mode 100644
index 4ba244b7..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EcompAppRole;
-
-public class EcompAppRoleTest {
-
- public EcompAppRole mockEcompAppRole(){
- EcompAppRole ecompAppRole = new EcompAppRole();
-
- ecompAppRole.setAppId((long)1);
- ecompAppRole.setAppName("test");
- ecompAppRole.setRoleId(1);
- ecompAppRole.setRoleName("test");
-
- return ecompAppRole;
- }
-
- @Test
- public void ecompAppRoleTest(){
- EcompAppRole ecompAppRole = mockEcompAppRole();
-
- assertEquals(ecompAppRole.getAppId(), new Long(1));
- assertEquals(ecompAppRole.getAppName(), "test");
- assertEquals(ecompAppRole.getRoleId().toString(), "1");
- assertEquals(ecompAppRole.getRoleName(), "test");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java
deleted file mode 100644
index e007102c..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.EPAppRoleFunction;
-import org.openecomp.portalapp.portal.domain.ExternalRoleDetails;
-
-public class ExternalRoleDetailsTest {
-
- public ExternalRoleDetails mockExternalRoleDetails(){
-
- List<EPAppRoleFunction> epAppRoleFunctionList = new ArrayList<EPAppRoleFunction>();
-
- EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction();
- epAppRoleFunction.setRoleId((long)1);
- epAppRoleFunction.setAppId((long)1);
- epAppRoleFunction.setCode("test");
-
- epAppRoleFunctionList.add(epAppRoleFunction);
-
- ExternalRoleDetails externalRoleDetails = new ExternalRoleDetails();
-
- externalRoleDetails.setName("test");
- externalRoleDetails.setActive(false);
- externalRoleDetails.setPriority(1);
- externalRoleDetails.setAppId((long)1);
- externalRoleDetails.setAppRoleId((long)1);
- externalRoleDetails.setPerms(epAppRoleFunctionList);
-
- return externalRoleDetails;
- }
-
- @Test
- public void externalRoleDetailsTest(){
-
- List<EPAppRoleFunction> epAppRoleFunctionList = new ArrayList<EPAppRoleFunction>();
-
- EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction();
- epAppRoleFunction.setRoleId((long)1);
- epAppRoleFunction.setAppId((long)1);
- epAppRoleFunction.setCode("test");
-
- epAppRoleFunctionList.add(epAppRoleFunction);
-
- ExternalRoleDetails externalRoleDetails = mockExternalRoleDetails();
-
- assertEquals(externalRoleDetails.getAppId(), new Long(1));
- assertEquals(externalRoleDetails.getAppRoleId(), new Long(1));
- assertEquals(externalRoleDetails.getPriority().toString(), "1");
- assertEquals(externalRoleDetails.getName(), "test");
- assertEquals(externalRoleDetails.getPriority().toString(), "1");
- assertEquals(externalRoleDetails.getPerms().size(), epAppRoleFunctionList.size());
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java
deleted file mode 100644
index ea884578..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.ExternalSystemAccess;
-
-public class ExternalSystemAccessTest {
-
- public ExternalSystemAccess mockExternalSystemAccess(){
- ExternalSystemAccess externalSystemAccess = new ExternalSystemAccess("test", false);
-
- externalSystemAccess.setKey("test");
- externalSystemAccess.setAccessValue(false);
-
- return externalSystemAccess;
- }
-
- @Test
- public void externalSystemAccessTest(){
- ExternalSystemAccess externalSystemAccess = mockExternalSystemAccess();
-
- assertEquals(externalSystemAccess.getKey(), "test");
- assertEquals(externalSystemAccess.getAccessValue(), false);
- }
-}
-
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java
deleted file mode 100644
index 2c47ed5a..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval;
-
-public class ExternalSystemRoleApprovalTest {
-
- public ExternalSystemRoleApproval mockExternalSystemRoleApproval(){
- ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval();
- externalSystemRoleApproval.setRoleName("test");
-
- return externalSystemRoleApproval;
- }
-
- @Test
- public void externalSystemRoleApprovalTest(){
- ExternalSystemRoleApproval externalSystemRoleApproval = mockExternalSystemRoleApproval();
-
- assertEquals(externalSystemRoleApproval.getRoleName(), "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java
deleted file mode 100644
index abec873b..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID;
-
-public class FunctionalMenuItemWithAppIDTest {
-
- public FunctionalMenuItemWithAppID mockFunctionalMenuItemWithAppID(){
- FunctionalMenuItemWithAppID functionalMenuItemWithAppID = new FunctionalMenuItemWithAppID();
-
- functionalMenuItemWithAppID.setRestrictedApp(false);
- functionalMenuItemWithAppID.setUrl("test");
-
-
- return functionalMenuItemWithAppID;
- }
-
- @Test
- public void functionalMenuItemWithAppIDTest(){
- FunctionalMenuItemWithAppID functionalMenuItemWithAppID = mockFunctionalMenuItemWithAppID();
-
- assertEquals(functionalMenuItemWithAppID.toString(), "FunctionalMenuItem [menuId=null, column=null, text=null, parentMenuId=null, url=test, active_yn=null, appid=null, roles=null, restrictedApp=false]");
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java
deleted file mode 100644
index 90a65eb8..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.GetAccessResultId;
-
-public class GetAccessResultIdTest {
-
- public GetAccessResultId mockGetAccessResultId(){
-
- GetAccessResultId getAccessResultIdObj = new GetAccessResultId();
- getAccessResultIdObj.setEcompFunction("test");
- getAccessResultIdObj.setAppName("test");
- getAccessResultIdObj.setRoleName("test");
-
- return getAccessResultIdObj;
- }
-
- @Test
- public void getAccessResultIdObjTest(){
- GetAccessResultId getAccessResultIdObj = mockGetAccessResultId();
-
- assertEquals(getAccessResultIdObj.getEcompFunction(), "test");
- assertEquals(getAccessResultIdObj.getAppName(), "test");
- assertEquals(getAccessResultIdObj.getRoleName(), "test");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java
deleted file mode 100644
index d7e4ca29..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import java.util.ArrayList;
-import java.util.List;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.MicroserviceData;
-import org.openecomp.portalapp.portal.domain.MicroserviceParameter;
-
-public class MicroserviceDataTest {
-
- public MicroserviceData mockMicroserviceData(){
-
- MicroserviceData microserviceData= new MicroserviceData();
-
- List<MicroserviceParameter> parameterList = new ArrayList<MicroserviceParameter>();
-
- MicroserviceParameter microserviceParameter = new MicroserviceParameter();
- microserviceParameter.setId((long)1);
- microserviceParameter.setServiceId((long)1);
- microserviceParameter.setPara_key("test");
- microserviceParameter.setPara_value("test");
- parameterList.add(microserviceParameter);
-
- microserviceData.setId((long)1);
- microserviceData.setName("test");
- microserviceData.setActive("test");
- microserviceData.setDesc("test");
- microserviceData.setAppId((long)1);
- microserviceData.setUrl("test");
- microserviceData.setSecurityType("test");
- microserviceData.setUsername("test");
- microserviceData.setPassword("test");
-
-
- return microserviceData;
- }
-
- @Test
- public void microserviceDataTest(){
- MicroserviceData microserviceData= mockMicroserviceData();
-
- assertEquals(microserviceData.getId(), new Long(1));
- assertEquals(microserviceData.getName(), "test");
- assertEquals(microserviceData.getActive(), "test");
- assertEquals(microserviceData.getDesc(), "test");
- // assertEquals(microserviceData.getAppId(), new long(1));
- assertEquals(microserviceData.getUrl(), "test");
- assertEquals(microserviceData.getSecurityType(), "test");
- assertEquals(microserviceData.getUsername(), "test");
- assertEquals(microserviceData.getPassword(), "test");
-
- assertEquals(microserviceData.toString(), "MicroserviceData [id=1, name=test, desc=test, appId=1, "
- + "url=test, securityType=test, username=test, password=test, parameterList=null]");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java
deleted file mode 100644
index e15f2267..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.MicroserviceParameter;
-
-public class MicroserviceParameterTest {
-
- public MicroserviceParameter mockMicroserviceParameter(){
- MicroserviceParameter microserviceParameter = new MicroserviceParameter();
-
- microserviceParameter.setId((long)1);
- microserviceParameter.setServiceId((long)1);
- microserviceParameter.setPara_key("test");
- microserviceParameter.setPara_value("test");
-
- return microserviceParameter;
- }
-
- @Test
- public void microserviceParameterTest(){
- MicroserviceParameter microserviceParameter = mockMicroserviceParameter();
- assertEquals(microserviceParameter.getId(), new Long(1));
- assertEquals(microserviceParameter.getServiceId(),(long)1);
- assertEquals(microserviceParameter.getPara_key(), "test");
- assertEquals(microserviceParameter.getPara_value(), "test");
-
- assertEquals(microserviceParameter.toString(), "MicroserviceParameter [id=1, serviceId=1, para_key=test, para_value=test]");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java
deleted file mode 100644
index 7f4bdc1b..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.PersUserAppSelection;
-
-public class PersUserAppSelectionTest {
-
- public PersUserAppSelection mockPersUserAppSelection(){
-
- PersUserAppSelection persUserAppSelection = new PersUserAppSelection();
- persUserAppSelection.setUserId((long)1);
- persUserAppSelection.setAppId((long)1);
- persUserAppSelection.setStatusCode("test");
-
- return persUserAppSelection;
- }
-
- @Test
- public void persUserAppSelectionTest(){
-
- PersUserAppSelection persUserAppSelection1 = new PersUserAppSelection((long)1, (long)1, (long)1,"test");
-
- PersUserAppSelection persUserAppSelection = mockPersUserAppSelection();
-
- assertEquals(persUserAppSelection.getUserId(), new Long(1));
- assertEquals(persUserAppSelection.getAppId(), new Long(1));
- assertEquals(persUserAppSelection.getStatusCode(), "test");
- assertEquals(persUserAppSelection1.hashCode(), new PersUserAppSelection((long)1, (long)1, (long)1,"test").hashCode());
- assertEquals(persUserAppSelection1, new PersUserAppSelection((long)1, (long)1, (long)1,"test"));
- assertTrue(persUserAppSelection1.equals(new PersUserAppSelection((long)1, (long)1, (long)1,"test")));
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java
deleted file mode 100644
index 55e1bd64..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.PersUserWidgetSelection;
-
-public class PersUserWidgetSelectionTest {
-
- public PersUserWidgetSelection mockPersUserWidgetSelection(){
-
- PersUserWidgetSelection persUserWidgetSelection = new PersUserWidgetSelection();
-
- persUserWidgetSelection.setUserId((long)1);
- persUserWidgetSelection.setWidgetId((long)1);
- persUserWidgetSelection.setStatusCode("test");
-
- return persUserWidgetSelection;
- }
-
- @Test
- public void persUserWidgetSelectionTest(){
- PersUserWidgetSelection persUserWidgetSelection = mockPersUserWidgetSelection();
-
- PersUserWidgetSelection persUserWidgetSelection1 = new PersUserWidgetSelection((long)1, (long)1, (long)1, "test");
-
- assertEquals(persUserWidgetSelection.getUserId(), new Long(1));
- assertEquals(persUserWidgetSelection.getWidgetId(), new Long(1));
- assertEquals(persUserWidgetSelection.getStatusCode(), "test");
- assertEquals(persUserWidgetSelection1, new PersUserWidgetSelection((long)1, (long)1, (long)1, "test"));
- assertTrue(persUserWidgetSelection1.equals(new PersUserWidgetSelection((long)1, (long)1, (long)1,"test")));
- assertEquals(persUserWidgetSelection.hashCode(), persUserWidgetSelection1.hashCode());
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java
deleted file mode 100644
index 6763cc0b..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.model.Result;
-
-public class ResultTest {
-
- public Result mockResult(){
-
- Result result= new Result("test");
-
- result.setResult("test");
- return result;
- }
-
- @Test
- public void resultTest(){
-
- Result result = mockResult();
- result.setResult("test");
-
- assertEquals(result.getResult(), "test");
-
- }
-
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java
deleted file mode 100644
index 239080d2..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.SharedContext;
-
-public class SharedContextTest {
-
- public SharedContext mockSharedContext(){
-
- SharedContext sharedContext = new SharedContext();
- sharedContext.setId((long)1);
- sharedContext.setCreate_time(new Date());
- sharedContext.setContext_id("test");
- sharedContext.setCkey("test");
- sharedContext.setCvalue("test");
-
- return sharedContext;
- }
-
- @Test
- public void sharedContextTest(){
- SharedContext sharedContext = mockSharedContext();
-
- assertEquals(sharedContext.getId(), new Long(1));
- // assertEquals(sharedContext.getCreate_time(), new Date());
- assertEquals(sharedContext.getContext_id(), "test");
- assertEquals(sharedContext.getCkey(), "test");
- assertEquals(sharedContext.getCvalue(), "test");
-
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java
deleted file mode 100644
index 169d8798..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.UserIdRoleId;
-
-public class UserIdRoleIdTest {
-
- public UserIdRoleId mockUserIdRoleId(){
- UserIdRoleId userIdRoleId = new UserIdRoleId();
- userIdRoleId.setUser_Id("test");
- userIdRoleId.setRoleId("test");
- userIdRoleId.setOrgUserId("test");
- userIdRoleId.setAppId("test");
-
- return userIdRoleId;
- }
-
- @Test
- public void userIdRoleIdTest(){
- UserIdRoleId userIdRoleId = mockUserIdRoleId();
-
- assertEquals(userIdRoleId.getUser_Id(), "test");
- assertEquals(userIdRoleId.getRoleId(), "test");
- assertEquals(userIdRoleId.getOrgUserId(), "test");
- assertEquals(userIdRoleId.getAppId(), "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java
deleted file mode 100644
index fe525d7b..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter;
-
-public class WidgetCatalogParameterTest {
-
- public WidgetCatalogParameter mockWidgetCatalogParameter(){
- WidgetCatalogParameter widgetCatalogParameter = new WidgetCatalogParameter();
-
- widgetCatalogParameter.setId((long)1);
- widgetCatalogParameter.setWidgetId((long)1);
- widgetCatalogParameter.setUserId((long)1);
- widgetCatalogParameter.setParamId((long)1);
- widgetCatalogParameter.setUser_value("test");
-
- return widgetCatalogParameter;
- }
-
- @Test
- public void widgetCatalogParameterTest(){
- WidgetCatalogParameter widgetCatalogParameter = mockWidgetCatalogParameter();
-
- assertEquals(widgetCatalogParameter.getId(), new Long(1));
- assertEquals(widgetCatalogParameter.getWidgetId(), new Long(1));
- assertEquals(widgetCatalogParameter.getUserId(), new Long(1));
- assertEquals(widgetCatalogParameter.getParamId(), new Long(1));
- assertEquals(widgetCatalogParameter.getUser_value(), "test");
- assertEquals(widgetCatalogParameter.toString(), "WidgetCatalogParameter [id=1, widgetId=1, userId=1, paramId=1, user_value=test]");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java
deleted file mode 100644
index 3b7aa764..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.App;
-import org.openecomp.portalapp.portal.domain.RoleApp;
-import org.openecomp.portalapp.portal.domain.WidgetCatalog;
-
-public class WidgetCatalogTest {
-
- public WidgetCatalog mockWidgetCatalog() {
-
- WidgetCatalog widgetCatalog = new WidgetCatalog();
-
- Set<RoleApp> roleAppSet = new HashSet<RoleApp>();
- // App
- App app = new App();
- app.setAppId((long) 1);
- app.setAppName("test");
-
- // RoleApp
- RoleApp roleApp = new RoleApp();
- roleApp.setRoleId((long) 1);
- roleApp.setRoleName("test");
- roleApp.setApp(app);
- roleApp.setWidgets(null);
-
- roleAppSet.add(roleApp);
-
- widgetCatalog.setId((long) 1);
- widgetCatalog.setName("test");
- widgetCatalog.setDesc("test");
- widgetCatalog.setFileLocation("test");
- widgetCatalog.setAllowAllUser("test");
- widgetCatalog.setServiceId((long) 1);
- widgetCatalog.setSortOrder("test");
- widgetCatalog.setStatusCode("test");
-
- widgetCatalog.setWidgetRoles(roleAppSet);
-
- return widgetCatalog;
-
- }
-
- @Test
- public void widgetCatalogTest() {
-
- // App
- App app = new App();
- app.setAppId((long) 1);
- app.setAppName("test");
-
- Set<RoleApp> roleAppSet = new HashSet<RoleApp>();
- // RoleApp
- RoleApp roleApp = new RoleApp();
- roleApp.setRoleId((long) 1);
- roleApp.setRoleName("test");
- roleApp.setApp(app);
- roleApp.setWidgets(null);
-
- roleAppSet.add(roleApp);
-
- WidgetCatalog widgetCatalog = mockWidgetCatalog();
-
-
- assertEquals(widgetCatalog.getId(), (long)1);
- assertEquals(widgetCatalog.getName(), "test");
- assertEquals(widgetCatalog.getDesc(), "test");
- assertEquals(widgetCatalog.getFileLocation(), "test");
- assertEquals(widgetCatalog.getAllowAllUser(), "test");
- assertEquals(widgetCatalog.getServiceId(), new Long (1));
- assertEquals(widgetCatalog.getSortOrder(), "test");
- assertEquals(widgetCatalog.getStatusCode(), "test");
- assertEquals(widgetCatalog.getWidgetRoles().size(),1);
-
- assertEquals("WidgetCatalog [id=1, name=test, desc=test, fileLocation=test, allowAllUser=test]", widgetCatalog.toString());
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java
deleted file mode 100644
index 75b3d606..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.WidgetParameterResult;
-
-public class WidgetParameterResultTest {
-
- public WidgetParameterResult mockWidgetParameterResult(){
-
- WidgetParameterResult widgetParameterResult = new WidgetParameterResult();
- widgetParameterResult.setParam_id((long)1);
- widgetParameterResult.setParam_key("test");
- widgetParameterResult.setUser_value("test");
- widgetParameterResult.setDefault_value("test");
-
- return widgetParameterResult;
- }
-
- @Test
- public void widgetParameterResultTest(){
-
- WidgetParameterResult widgetParameterResult = mockWidgetParameterResult();
-
- assertEquals(widgetParameterResult.getParam_key(), "test");
- assertEquals(widgetParameterResult.getParam_id(), new Long(1));
- assertEquals(widgetParameterResult.getUser_value(), "test");
- assertEquals(widgetParameterResult.getDefault_value(), "test");
-
- assertEquals("WidgetParameterResult [param_id=1, param_key=test, user_value=test, default_value=test]", widgetParameterResult.toString());
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java
deleted file mode 100644
index a7597982..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.openecomp.portalapp.portal.test.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.Widget;
-
-public class WidgetTest {
-
- public Widget mockWidget(){
-
- Widget widget = new Widget();
- widget.setName("test");
- widget.setWidth(100);
- widget.setHeight(100);
- widget.setUrl("test");
- widget.setAppId((long)1);
-
- return widget;
- }
-
- @Test
- public void widgetTest(){
- Widget widget = mockWidget();
-
- assertEquals(widget.getName(), "test");
- assertTrue(widget.getWidth() == 100);
- assertTrue(widget.getHeight() == 100);
- assertEquals(widget.getUrl(), "test");
- assertEquals(widget.getAppId(), new Long(1));
-
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/ApplicationCommonContextTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/ApplicationCommonContextTestSuite.java
deleted file mode 100644
index d7930c14..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/ApplicationCommonContextTestSuite.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.framework;
-
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.openecomp.portalsdk.core.conf.AppConfig;
-//import org.openecomp.portalapp.conf.ExternalAppConfig;
-//import org.openecomp.portalapp.conf.HibernateMappingLocations;
-import org.openecomp.portalsdk.core.conf.HibernateConfiguration;
-import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable;
-import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
-import org.openecomp.portalsdk.core.util.CacheManager;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.FilterType;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.transaction.TransactionConfiguration;
-import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
-import org.springframework.test.context.web.WebAppConfiguration;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-
-/**
- *
- * In order to write a unit test, 1. inherit this class 2. place the "war"
- * folder on your test class's classpath 3. run the test with the following VM
- * argument; This is important because when starting the application from
- * Container, the System Properties file (SystemProperties.java) can have the
- * direct path but, when running from the Mock Junit container, the path should
- * be prefixed with "classpath" to enable the mock container to search for the
- * file in the classpath -Dcontainer.classpath="classpath:"
- */
-
-@SuppressWarnings("deprecation")
-@RunWith(SpringJUnit4ClassRunner.class)
-@WebAppConfiguration
-@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class })
-@ActiveProfiles(value = "test")
-public class ApplicationCommonContextTestSuite {
-
- @Autowired
- public WebApplicationContext wac;
-
- private MockMvc mockMvc;
-
- @Before
- public void setup() {
- if (mockMvc == null) {
- this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
-
- }
- }
-
- public Object getBean(String name) {
- return this.wac.getBean(name);
- }
-
- public MockMvc getMockMvc() {
- return mockMvc;
- }
-
- public void setMockMvc(MockMvc mockMvc) {
- this.mockMvc = mockMvc;
- }
-
- public WebApplicationContext getWebApplicationContext() {
- return wac;
- }
-
-}
-
-@Configuration
-@ComponentScan(basePackages = "org.openecomp", excludeFilters = {
- // the following source configurations should not be scanned; instead of
- // using Exclusion filter, we can use the @Profile annotation to exclude
- // them
- @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.LogoutController*"),
- @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.SDKLoginController*"),
- @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalapp.conf.ExternalAppConfig*"),
- @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.*.*InitUebHandler*") })
-@Profile("test")
-class MockAppConfig extends AppConfig {
-
- @Bean
- HibernateMappingLocatable locatable() {
- return new MockHibernateMappingLocations();
- }
-
- @Bean
- HibernateConfiguration hibConfiguration() {
- return new HibernateConfiguration();
- }
-
- @Bean
- public SystemProperties systemProperties() {
- return new MockSystemProperties();
- }
-
- @Bean
- public AbstractCacheManager cacheManager() {
- return new CacheManager() {
-
- public void configure() throws IOException {
-
- }
- };
- }
-
- public String[] tileDefinitions() {
- return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml",
- "classpath:/WEB-INF/defs/definitions.xml" };
- }
-
- public void addInterceptors(InterceptorRegistry registry) {
- // registry.addInterceptor(new
- // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
- // registry.addInterceptor(resourceInterceptor());
- }
-
- public static class MockSystemProperties extends SystemProperties {
-
- public MockSystemProperties() {
- }
-
- }
-
-}
-
-@Profile("test")
-class MockHibernateMappingLocations implements HibernateMappingLocatable {
-
- public Resource[] getMappingLocations() {
- return new Resource[] { new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"),
- new ClassPathResource("WEB-INF/fusion/orm/EP.hbm.xml"),
- new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml") };
-
- }
-
- public String[] getPackagesToScan() {
- return new String[] { "org.openecomp", "src" };
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/MockitoTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/MockitoTestSuite.java
deleted file mode 100644
index 44019aa6..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/MockitoTestSuite.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.framework;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-
-@RunWith(MockitoJUnitRunner.class)
-public class MockitoTestSuite {
-
-
- public MockHttpServletRequestWrapper mockedRequest = new MockHttpServletRequestWrapper(
- Mockito.mock(HttpServletRequest.class));
- public HttpServletResponse mockedResponse = Mockito.mock(HttpServletResponse.class);
-
- public MockHttpServletRequestWrapper getMockedRequest() {
- return mockedRequest;
- }
-
- public HttpServletResponse getMockedResponse() {
- return mockedResponse;
- }
-
- public class MockHttpServletRequestWrapper extends HttpServletRequestWrapper {
-
- HttpSession session = Mockito.mock(HttpSession.class);
-
- public MockHttpServletRequestWrapper(HttpServletRequest request) {
- super(request);
-
- }
-
- @Override
- public HttpSession getSession() {
-
- return session;
- }
-
- @Override
- public HttpSession getSession(boolean create) {
-
- return session;
- }
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/AppContactUsServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/AppContactUsServiceImplTest.java
deleted file mode 100644
index bb74cc6a..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/AppContactUsServiceImplTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.domain.AppContactUs;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem;
-import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem;
-import org.openecomp.portalapp.portal.service.AppContactUsService;
-import org.openecomp.portalapp.portal.service.AppContactUsServiceImpl;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.service.DataAccessServiceImpl;
-
-public class AppContactUsServiceImplTest {
-
-
- @Mock
- DataAccessService dataAccessService = new DataAccessServiceImpl();
-
- @Mock
- AppContactUsService AppContactUsService = new AppContactUsServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @InjectMocks
- AppContactUsServiceImpl appContactUsServiceImpl = new AppContactUsServiceImpl();
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
-
-
- public EPApp getApp() {
- EPApp app = new EPApp();
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppRestEndpoint("test");
- app.setAlternateUrl("test");
- app.setName("test");
- app.setMlAppName("test");
- app.setMlAppAdminId("test");
- app.setUsername("test");
- app.setAppPassword("test");
- app.setOpen(true);
- app.setEnabled(false);
- app.setUebKey("test");
- app.setUebSecret("test");
- app.setUebTopicName("test");
- app.setAppType(1);
- return app;
- }
- @Test
- public void getAppContactUsTest() throws Exception
- {
-
- List<AppContactUsItem> contactUsItemList = new ArrayList<>();
- AppContactUsItem appContactUsItem= new AppContactUsItem();
- appContactUsItem.setAppName("testNew");
- contactUsItemList.add(appContactUsItem);
- AppContactUsItem appContactUsItem1= new AppContactUsItem();
- appContactUsItem1.setAppName("test");
- contactUsItemList.add(appContactUsItem1);
- Mockito.when(dataAccessService.executeNamedQuery("getAppContactUsItems", null, null)).thenReturn(contactUsItemList);
- List<AppContactUsItem> expectedcontactUsItemList = appContactUsServiceImpl.getAppContactUs();
- assertEquals(expectedcontactUsItemList, contactUsItemList);
- }
-
- @Test
- public void getAppsAndContactsTest() throws Exception
- {
- List<AppContactUsItem> contactUsItemList = new ArrayList<>();
- AppContactUsItem appContactUsItem= new AppContactUsItem();
- appContactUsItem.setAppName("testNew");
- contactUsItemList.add(appContactUsItem);
- AppContactUsItem appContactUsItem1= new AppContactUsItem();
- appContactUsItem1.setAppName("test");
- contactUsItemList.add(appContactUsItem1);
- Mockito.when(dataAccessService.executeNamedQuery("getAppsAndContacts", null, null)).thenReturn(contactUsItemList);
- List<AppContactUsItem> expectedcontactUsItemList = appContactUsServiceImpl.getAppsAndContacts();
- assertEquals(expectedcontactUsItemList, contactUsItemList);
- }
-
- @Test
- public void getAppCategoryFunctionsTest() throws Exception
- {
- List<AppCategoryFunctionsItem> list = new ArrayList<>();
- Mockito.when(dataAccessService.executeNamedQuery("getAppCategoryFunctions", null, null)).thenReturn(list);
- List<AppCategoryFunctionsItem> expectedlist = appContactUsServiceImpl.getAppCategoryFunctions();
- assertEquals(list, expectedlist);
- }
-
- @Test(expected = java.lang.Exception.class)
- public void saveAppContactUsTest() throws Exception
- {
- HashMap<String, Object> map = new HashMap<String, Object>();
- List<AppContactUsItem> contactUsModelList = new ArrayList<>();
- AppContactUsItem appContactUsItem= new AppContactUsItem();
- appContactUsItem.setAppId((long) 1);
- contactUsModelList.add(appContactUsItem);
- AppContactUs appContact = new AppContactUs();
- Mockito.when(dataAccessService.getDomainObject(AppContactUs.class, 1, map)).thenReturn(appContact);
- EPApp app = getApp();
- Mockito.when(dataAccessService.getDomainObject(EPApp.class, 1, new HashMap<String, Object>())).thenReturn(app);
- AppContactUs contactUs = new AppContactUs();
- contactUs.setApp(app);
- contactUs.setDescription(appContactUsItem.getDescription());
- contactUs.setContactName(appContactUsItem.getContactName());
- contactUs.setContactEmail(appContactUsItem.getContactEmail());
- contactUs.setActiveYN(appContactUsItem.getActiveYN());
- contactUs.setUrl(appContactUsItem.getUrl());
- Mockito.doNothing().when(dataAccessService).saveDomainObject(contactUs,map);
- appContactUsServiceImpl.saveAppContactUs(contactUsModelList);
- }
-
- @Test(expected = java.lang.NullPointerException.class)
- public void deleteContactUsTest() throws Exception
- {
- HashMap<String, Object> map = new HashMap<String, Object>();
- AppContactUs contactUs = new AppContactUs();
- Mockito.when((AppContactUs) dataAccessService.getDomainObject(AppContactUs.class, 1, map)).thenReturn(contactUs);
- appContactUsServiceImpl.deleteContactUs((long) 1);
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/DashboardSearchServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/DashboardSearchServiceImplTest.java
deleted file mode 100644
index ab380ba5..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/DashboardSearchServiceImplTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem;
-import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.CommonWidget;
-import org.openecomp.portalapp.portal.transport.CommonWidgetMeta;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-
-public class DashboardSearchServiceImplTest {
-
- @Mock
- DataAccessService dataAccessService;
-
- @InjectMocks
- DashboardSearchServiceImpl dashboardSearchServiceImpl = new DashboardSearchServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- NullPointerException nullPointerException = new NullPointerException();
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
- MockEPUser mockUser = new MockEPUser();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
-
- @Test
- public void searchResultsTest()
- {
- Map<String, String> params = new HashMap<>();
- params.put("userId", "guestT");
- params.put("searchQuery", "test");
-
- List<SearchResultItem> list = new ArrayList<>();
- SearchResultItem searchResultItem= new SearchResultItem();
- searchResultItem.setCategory("test");
- list.add(searchResultItem);
- Mockito.when(dataAccessService.executeNamedQuery("searchPortal", params, null)).thenReturn(list);
- Map<String, List<SearchResultItem>> result = dashboardSearchServiceImpl.searchResults("guestT", "test");
- assertTrue(result.keySet().contains("test"));
- }
-
- @Test
- public void getRelatedUsersTest()
- {
- List<String> activeUsers = new ArrayList<>();
- Map<String, String> params = new HashMap<>();
- params.put("userId", "guestT");
- Mockito.when(dataAccessService.executeNamedQuery("relatedUsers", params, null)).thenReturn(activeUsers);
- List<String> expectedActiveUsers = dashboardSearchServiceImpl.getRelatedUsers("guestT");
- assertEquals(expectedActiveUsers,activeUsers);
- }
- @Test
- public void getWidgetDataTest()
- {
- CommonWidgetMeta CommonWidgetMeta = null;
- Map<String, String> params = new HashMap<>();
- params.put("cat", "test");
- @SuppressWarnings("unchecked")
- List<CommonWidget> widgetItems = new ArrayList<>();
- CommonWidget commonWidget = new CommonWidget();
- widgetItems.add(commonWidget);
- Mockito.when(dataAccessService.executeNamedQuery("getCommonWidgetItem", params, null)).thenReturn(widgetItems);
- CommonWidgetMeta expectedCommonWidgetMeta =dashboardSearchServiceImpl.getWidgetData("test");
- assertEquals(expectedCommonWidgetMeta.getCategory(), "test");
- }
-
- @Test
- public void saveWidgetDataBulkTest()
- {
- CommonWidgetMeta CommonWidgetMeta = new CommonWidgetMeta();
- List<CommonWidget> widgetList = new ArrayList<>();
- CommonWidget commonWidget = new CommonWidget();
- widgetList.add(commonWidget);
- CommonWidgetMeta.setItems(widgetList);
- Mockito.doNothing().when(dataAccessService).saveDomainObject(commonWidget, null);
- assertEquals(dashboardSearchServiceImpl.saveWidgetDataBulk(CommonWidgetMeta), "success");
- }
-
- @Test
- public void saveWidgetDataTest()
- {
- CommonWidget commonWidget = new CommonWidget();
- Mockito.doNothing().when(dataAccessService).saveDomainObject(commonWidget, null);
- assertEquals(dashboardSearchServiceImpl.saveWidgetData(commonWidget), "success");
- }
-
- @Test
- public void deleteWidgetDataTest()
- {
- CommonWidget commonWidget = new CommonWidget();
- Mockito.doNothing().when(dataAccessService).deleteDomainObject(commonWidget, null);
- assertEquals(dashboardSearchServiceImpl.deleteWidgetData(commonWidget), "success");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceCentralizedImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceCentralizedImplTest.java
deleted file mode 100644
index 7db06a52..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceCentralizedImplTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.hibernate.SessionFactory;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(SystemProperties.class)
-public class EPRoleFunctionServiceCentralizedImplTest {
-
-
- @Mock
- DataAccessService dataAccessService;
-
- @Mock
- SessionFactory sessionFactory;
-
- @InjectMocks
- EPRoleFunctionServiceCentralizedImpl ePRoleFunctionServiceCentralizedImpl = new EPRoleFunctionServiceCentralizedImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- NullPointerException nullPointerException = new NullPointerException();
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
- MockEPUser mockUser = new MockEPUser();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
-
- @Test
- public void getRoleFunctions()
- {
- List<CentralRoleFunction> getRoleFuncList = new ArrayList<>();
- CentralRoleFunction centralRoleFunction = new CentralRoleFunction();
- getRoleFuncList.add(centralRoleFunction);
- List<RoleFunction> getRoleFuncListOfPortal = new ArrayList<>();
- RoleFunction roleFunction = new RoleFunction();
- getRoleFuncListOfPortal.add(roleFunction);
- final Map<String, Long> params = new HashMap<>();
- params.put("appId", (long) 1);
- Mockito.when(dataAccessService.executeNamedQuery("getAllRoleFunctions", params, null)).thenReturn(getRoleFuncList);
- List<RoleFunction> expectedGetRoleFuncListOfPortal = ePRoleFunctionServiceCentralizedImpl.getRoleFunctions();
- assertEquals(expectedGetRoleFuncListOfPortal.size(),getRoleFuncListOfPortal.size());
- }
-
- @Test
- public void getRoleFunctionsNewTest()
- {
- HttpSession session = mockedRequest.getSession();
- EPUser user = mockUser.mockEPUser();
- user.setId((long) 1);
- String userId = user.getId().toString();
- final Map<String, String> params = new HashMap<>();
- params.put("userId", userId);
- @SuppressWarnings("unused")
- List getRoleFuncListOfPortal = new ArrayList<>();
- Mockito.when(dataAccessService.executeNamedQuery("getRoleFunctionsOfUser", params, null)).thenReturn(getRoleFuncListOfPortal);
- Set<String> getRoleFuncListOfPortalSet = ePRoleFunctionServiceCentralizedImpl.getRoleFunctions(mockedRequest, user);
- assertTrue(getRoleFuncListOfPortalSet.size() == 0);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceImplTest.java
deleted file mode 100644
index c8cd8d28..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceImplTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.domain.EPRole;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalapp.util.EPUserUtils;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ SystemProperties.class, EPUserUtils.class })
-public class EPRoleFunctionServiceImplTest {
-
- @Mock
- DataAccessService dataAccessService;
-
- @InjectMocks
- EPRoleFunctionServiceImpl ePRoleFunctionServiceImpl = new EPRoleFunctionServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- NullPointerException nullPointerException = new NullPointerException();
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
- MockEPUser mockUser = new MockEPUser();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
-
- @Test
- public void getRoleFunctionsTest() {
- List<RoleFunction> functions = new ArrayList<>();
- Mockito.when(dataAccessService.getList(RoleFunction.class, null)).thenReturn(functions);
- List<RoleFunction> expectedFunctions = ePRoleFunctionServiceImpl.getRoleFunctions();
- assertEquals(expectedFunctions, functions);
- }
-
- @Test
- public void getRoleFunctionsRequestTest() {
- EPUser user = mockUser.mockEPUser();
- HashSet roleFunctions = new HashSet<>();
- PowerMockito.mockStatic(SystemProperties.class);
- HttpSession session = mockedRequest.getSession();
- Mockito.when(session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)))
- .thenReturn(roleFunctions);
- HashSet expectedRoleFunctions = (HashSet) ePRoleFunctionServiceImpl.getRoleFunctions(mockedRequest, user);
- assertEquals(expectedRoleFunctions, roleFunctions);
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void getRoleFunctionsRequestIfNullTest() {
- EPUser user = mockUser.mockEPUser();
- HashSet roleFunctions = null;
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPUserUtils.class);
- HttpSession session = mockedRequest.getSession();
- Mockito.when(session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)))
- .thenReturn(roleFunctions);
- HashMap roles = new HashMap<>();
- EPRole role = new EPRole();
- SortedSet<RoleFunction> roleFunctionSet = new TreeSet<RoleFunction>();
- RoleFunction rolefun = new RoleFunction();
- roleFunctionSet.add(rolefun);
- role.setRoleFunctions(roleFunctionSet);
- roles.put((long) 1, role);
- Mockito.when(EPUserUtils.getRoles(mockedRequest)).thenReturn(roles);
- HashSet expectedRoleFunctions = (HashSet) ePRoleFunctionServiceImpl.getRoleFunctions(mockedRequest, user);
- assertTrue(expectedRoleFunctions.size() == 1);
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleServiceImplTest.java
deleted file mode 100644
index 10060350..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleServiceImplTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.domain.EPRole;
-import org.openecomp.portalapp.portal.service.EPRoleServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-
-public class EPRoleServiceImplTest {
-
- @Mock
- DataAccessService dataAccessService;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @InjectMocks
- EPRoleServiceImpl ePRoleServiceImpl = new EPRoleServiceImpl();
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void getRoleFunctionsTest() {
- List<RoleFunction> roleFunctionList = new ArrayList<>();
- Mockito.when(dataAccessService.getList(RoleFunction.class, null)).thenReturn(roleFunctionList);
- List<RoleFunction> expectedRoleFunctionList = ePRoleServiceImpl.getRoleFunctions();
- assertEquals(roleFunctionList, expectedRoleFunctionList);
- }
-
- @Test
- public void getAvailableChildRolesIfRoleIdIsNullTest() {
- List<EPRole> roleList = new ArrayList<>();
- EPRole role = new EPRole();
- EPRole role1 = new EPRole();
- role.addChildRole(role1);
- roleList.add(role);
- Mockito.when(dataAccessService.getList(EPRole.class, null)).thenReturn(roleList);
- List<EPRole> expectedRoleList = ePRoleServiceImpl.getAvailableChildRoles(null);
- assertEquals(roleList, expectedRoleList);
- }
-
- // @Test
- // public void getAvailableChildRolesIfRoleIdNotNullTest()
- // {
- // List<EPRole> roleList = new ArrayList<>();
- // EPRole role = new EPRole();
- // EPRole role1= new EPRole();
- // role.addChildRole(role1);
- // roleList.add(role);
- // Mockito.when(dataAccessService.getDomainObject(EPRole.class, 1,
- // null)).thenReturn(role);
- // Mockito.when(dataAccessService.getList(EPRole.class,
- // null)).thenReturn(roleList);
- //
- // List<EPRole> expectedRoleList =
- // ePRoleServiceImpl.getAvailableChildRoles((long) 1);
- // System.out.println(expectedRoleList);
- // assertEquals(roleList,expectedRoleList);
- // }
- //
- @Test
- public void getRoleFunctionTest() {
- RoleFunction roleFunction = new RoleFunction();
- Mockito.when(dataAccessService.getDomainObject(RoleFunction.class, "test", null)).thenReturn(roleFunction);
- RoleFunction expectedRoleFunction = ePRoleServiceImpl.getRoleFunction("test");
- assertEquals(expectedRoleFunction, roleFunction);
- }
-
- @Test
- public void saveRoleFunctionTest() {
- EPRole role = new EPRole();
- Mockito.doNothing().when(dataAccessService).saveDomainObject(role, null);
- ePRoleServiceImpl.saveRole(role);
- }
-
- @Test
- public void deleteRoleFunctionTest() {
- RoleFunction roleFunction = new RoleFunction();
- Mockito.doNothing().when(dataAccessService).deleteDomainObject(roleFunction, null);
- ePRoleServiceImpl.deleteRoleFunction(roleFunction);
- }
-
- @Test
- public void getRoleTest() {
- EPRole role = null;
- Mockito.when(dataAccessService.getDomainObject(EPRole.class, 1, null)).thenReturn(role);
- EPRole expectedRole = ePRoleServiceImpl.getRole((long) 1);
- assertEquals(expectedRole, role);
- }
-
- @Test
- public void getRoleIfappIdNullTest() {
- assertNull(ePRoleServiceImpl.getRole(null, null));
-
- }
-
- @Test
- public void getRoleIfappIdNotNullTest() {
- List<EPRole> roles = new ArrayList<>();
- EPRole role = new EPRole();
- roles.add(role);
- String sql = "SELECT * FROM fn_role where APP_ID = 1 AND APP_ROLE_ID = 1";
- Mockito.when(dataAccessService.executeSQLQuery(sql, EPRole.class, null)).thenReturn(roles);
- EPRole expectedRole = ePRoleServiceImpl.getRole((long) 1, (long) 1);
- assertEquals(expectedRole, role);
-
- }
-
- @Test
- public void getRoleIfListSizeIsMoreThan1Test() {
- List<EPRole> roles = new ArrayList<>();
- EPRole role = new EPRole();
- EPRole role1 = new EPRole();
- roles.add(role);
- roles.add(role1);
- String sql = "SELECT * FROM fn_role where APP_ID = 1 AND APP_ROLE_ID = 1";
- Mockito.when(dataAccessService.executeSQLQuery(sql, EPRole.class, null)).thenReturn(roles);
- EPRole expectedRole = ePRoleServiceImpl.getRole((long) 1, (long) 1);
- assertEquals(expectedRole, role);
-
- }
-
- @Test
- public void getRoleIfListSizeIsEmptyTest() {
- List<EPRole> roles = new ArrayList<>();
- String sql = "SELECT * FROM fn_role where APP_ID = 1 AND APP_ROLE_ID = 1";
- Mockito.when(dataAccessService.executeSQLQuery(sql, EPRole.class, null)).thenReturn(roles);
- assertNull(ePRoleServiceImpl.getRole((long) 1, (long) 1));
-
- }
-
- @Test
- public void saveRoleTest() {
- EPRole role = new EPRole();
- Mockito.doNothing().when(dataAccessService).saveDomainObject(role, null);
- ePRoleServiceImpl.saveRole(role);
- }
-
- @Test
- public void deleteRoleTest() {
- EPRole role = new EPRole();
- Mockito.doNothing().when(dataAccessService).deleteDomainObject(role, null);
- ePRoleServiceImpl.deleteRole(role);
- }
-
- @Test
- public void getAvailableRolesTest() {
- List<EPRole> roleList = new ArrayList<>();
- Mockito.when(dataAccessService.getList(EPRole.class, null)).thenReturn(roleList);
- List<EPRole> expectedRoleList = ePRoleServiceImpl.getAvailableRoles();
- assertEquals(expectedRoleList, roleList);
- }
-
- @Test
- public void getAppRolesTest() {
- final Map<String, String> portalParams = null;
- List<EPRole> roleList = new ArrayList<>();
- Mockito.when(dataAccessService.executeNamedQuery("getPortalAppRoles", portalParams, null)).thenReturn(roleList);
- assertNull(ePRoleServiceImpl.getAppRole("test", (long) 1));
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void getAppRolesIfNotPortalTest() {
- final Map<String, String> params = null;
- List<EPRole> roleList = new ArrayList<>();
- EPRole role = new EPRole();
- EPRole role1 = new EPRole();
- roleList.add(role);
- roleList.add(role1);
- Mockito.when((List<EPRole>) dataAccessService.executeNamedQuery("getAppRoles", params, null))
- .thenReturn(roleList);
- List<EPRole> expectedRoleList = (List<EPRole>) ePRoleServiceImpl.getAppRole("test", (long) 10);
- System.out.println(expectedRoleList);
-
- }
-
- @Test
- public void saveRoleFunction() {
- RoleFunction domainRoleFunction = new RoleFunction();
- Mockito.doNothing().when(dataAccessService).saveDomainObject(domainRoleFunction, null);
- ePRoleServiceImpl.saveRoleFunction(domainRoleFunction);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ExternalAccessRolesServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ExternalAccessRolesServiceImplTest.java
deleted file mode 100644
index d8cd6425..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ExternalAccessRolesServiceImplTest.java
+++ /dev/null
@@ -1,346 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Matchers;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.domain.EPAppRoleFunction;
-import org.openecomp.portalapp.portal.domain.EPRole;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.service.ExternalAccessRolesServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.portal.transport.ExternalAccessPerms;
-import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
-import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.service.DataAccessServiceImpl;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.HttpClientErrorException;
-import org.springframework.web.client.RestTemplate;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ EcompPortalUtils.class, SystemProperties.class, EPCommonSystemProperties.class })
-public class ExternalAccessRolesServiceImplTest {
- @Mock
- DataAccessService dataAccessService1 = new DataAccessServiceImpl();
-
- @Mock
- RestTemplate template = new RestTemplate();
-
- @InjectMocks
- ExternalAccessRolesServiceImpl externalAccessRolesServiceImpl = new ExternalAccessRolesServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
- MockEPUser mockUser = new MockEPUser();
-
- public EPApp mockApp() {
- EPApp app = new EPApp();
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 10);
- app.setAppRestEndpoint("test");
- app.setAlternateUrl("test");
- app.setName("test");
- app.setMlAppName("test");
- app.setMlAppAdminId("test");
- app.setUsername("test");
- app.setAppPassword("test");
- app.setOpen(false);
- app.setEnabled(false);
- app.setUebKey("test");
- app.setUebSecret("test");
- app.setUebTopicName("test");
- app.setAppType(1);
- return app;
- }
-
- @Test
- public void getAppRolesIfAppIsPortalTest() throws Exception {
- List<EPRole> applicationRoles = new ArrayList<>();
- Mockito.when(dataAccessService1.getList(EPRole.class, "test", null, null)).thenReturn(applicationRoles);
- List<EPRole> expectedApplicationRoles = externalAccessRolesServiceImpl.getAppRoles((long) 1);
- assertEquals(expectedApplicationRoles, applicationRoles);
- }
-
- @Test
- public void getAppRolesTest() throws Exception {
- List<EPRole> applicationRoles = new ArrayList<>();
- Mockito.when(dataAccessService1.getList(EPRole.class, "test", null, null)).thenReturn(applicationRoles);
- List<EPRole> expectedApplicationRoles = externalAccessRolesServiceImpl.getAppRoles((long) 10);
- assertEquals(expectedApplicationRoles, applicationRoles);
- }
-
- // @SuppressWarnings("null")
- // @Test(expected = java.lang.Exception.class)
- // public void getAppRolesExceptionTest() throws Exception{
- // List<EPRole> applicationRoles = new ArrayList<>();
- // DataAccessService dataAccessService = null ;
- // Mockito.when(dataAccessService.getList(EPRole.class, "where app_id = 10",
- // null, null)).thenThrow(nullPointerException);
- // List<EPRole> expectedApplicationRoles =
- // externalAccessRolesServiceImpl.getAppRoles((long) 10);
- // assertEquals(expectedApplicationRoles,applicationRoles);
- // }
-
- @Test(expected = java.lang.Exception.class)
- public void getAppExceptionTest() throws Exception {
- List<EPApp> app = new ArrayList<>();
- String uebKey = "test-ueb-key";
- Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null))
- .thenReturn(app);
- List<EPApp> expectedapp = externalAccessRolesServiceImpl.getApp(uebKey);
- assertEquals(app, expectedapp);
- }
-
- @Test(expected = java.lang.Exception.class)
- public void getAppTest() throws Exception {
- List<EPApp> appList = new ArrayList<>();
- EPApp app = mockApp();
- appList.add(app);
- String uebKey = "test-ueb-key";
- Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null))
- .thenReturn(appList);
- List<EPApp> expectedapp = externalAccessRolesServiceImpl.getApp(uebKey);
- }
-
- @Test
- public void getAppErrorTest() throws Exception {
- List<EPApp> appList = new ArrayList<>();
- EPApp app = mockApp();
- app.setId((long) 1);
- appList.add(app);
- String uebKey = "test-ueb-key";
- Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null))
- .thenReturn(appList);
- List<EPApp> expectedapp = externalAccessRolesServiceImpl.getApp(uebKey);
- assertEquals(appList, expectedapp);
- }
-
- @Test
- public void addRoleTest() throws Exception {
- HttpHeaders headers = new HttpHeaders();
- PowerMockito.mockStatic(EcompPortalUtils.class);
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- String uebKey = "test-ueb-key";
- Role role = new Role();
- role.setId((long) 25);
- EPApp app = mockApp();
- app.setEnabled(true);
- app.setId((long) 10);
- app.setNameSpace("test_namesapce");
- Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
- List<EPApp> appList = new ArrayList<>();
- appList.add(app);
- List<EPRole> roleList = new ArrayList<>();
- EPRole ePRole = new EPRole();
- role.setName("Test Role");
- roleList.add(ePRole);
- Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null))
- .thenReturn(appList);
- Mockito.when(dataAccessService1.getList(EPRole.class, " where app_role_id = " + role.getId(), null, null))
- .thenReturn(roleList);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL))
- .thenReturn("Testurl");
- ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.CREATED);
- Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
- Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse);
-
- assertTrue(externalAccessRolesServiceImpl.addRole(role, uebKey));
- }
-
- @Test
- public void addRoleMethodNotAllowedTest() throws Exception {
- HttpHeaders headers = new HttpHeaders();
- PowerMockito.mockStatic(EcompPortalUtils.class);
- PowerMockito.mockStatic(SystemProperties.class);
- PowerMockito.mockStatic(EPCommonSystemProperties.class);
- String uebKey = "test-ueb-key";
- Role role = new Role();
- role.setId((long) 25);
- EPApp app = mockApp();
- app.setEnabled(true);
- app.setId((long) 10);
- app.setNameSpace("test_namesapce");
- Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
- List<EPApp> appList = new ArrayList<>();
- appList.add(app);
- List<EPRole> roleList = new ArrayList<>();
- EPRole ePRole = new EPRole();
- role.setName("Test Role");
- roleList.add(ePRole);
- Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null))
- .thenReturn(appList);
- Mockito.when(dataAccessService1.getList(EPRole.class, " where app_role_id = " + role.getId(), null, null))
- .thenReturn(roleList);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL))
- .thenReturn("Testurl");
- ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.METHOD_NOT_ALLOWED);
- Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
- Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse);
-
- assertFalse(externalAccessRolesServiceImpl.addRole(role, uebKey));
- }
-
- public EPApp getApp() {
- EPApp app = new EPApp();
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppRestEndpoint("test");
- app.setAlternateUrl("test");
- app.setName("test");
- app.setMlAppName("test");
- app.setMlAppAdminId("test");
- app.setUsername("test");
- app.setAppPassword("test");
- app.setOpen(true);
- app.setEnabled(false);
- app.setUebKey("test");
- app.setUebSecret("test");
- app.setUebTopicName("test");
- app.setAppType(1);
- return app;
- }
-
- @Test
- public void deleteCentralRoleFunctionTest() throws Exception {
- final Map<String, String> params = new HashMap<>();
- EPApp app = mockApp();
- params.put("functionCd", "menu_fun_code");
- params.put("appId", String.valueOf(10));
- List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>();
- CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction();
- domainCentralRoleFunction.setCode("menu_fun_code");
- centralRoleFunctionList.add(domainCentralRoleFunction);
- Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, null))
- .thenReturn(centralRoleFunctionList);
- ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.OK);
- Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.DELETE),
- Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse);
- HttpHeaders headers = new HttpHeaders();
- PowerMockito.mockStatic(EcompPortalUtils.class);
- Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
-
- Mockito.doNothing().when(dataAccessService1).deleteDomainObjects(EPAppRoleFunction.class,
- "app_id = " + app.getId() + " and function_cd = '" + "menu_fun_code" + "'", null);
-
- assertTrue(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app));
- }
-
- @Test
- public void deleteCentralRoleFunctionFailTest() throws Exception {
- final Map<String, String> params = new HashMap<>();
- EPApp app = mockApp();
- params.put("functionCd", "menu_fun_code");
- params.put("appId", String.valueOf(10));
- List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>();
- CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction();
- domainCentralRoleFunction.setCode("menu_fun_code");
- centralRoleFunctionList.add(domainCentralRoleFunction);
- HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.NOT_FOUND);
- Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, null))
- .thenReturn(centralRoleFunctionList);
- ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.NOT_FOUND);
- Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.DELETE),
- Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenThrow(httpClientErrorException);
- HttpHeaders headers = new HttpHeaders();
- PowerMockito.mockStatic(EcompPortalUtils.class);
- Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
-
- Mockito.doNothing().when(dataAccessService1).deleteDomainObjects(EPAppRoleFunction.class,
- "app_id = " + app.getId() + " and function_cd = '" + "menu_fun_code" + "'", null);
-
- assertTrue(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app));
- }
-
- @Test
- public void deleteCentralRoleFunctionExceptionTest() {
- final Map<String, String> params = new HashMap<>();
- EPApp app = mockApp();
- params.put("functionCd", "menu_fun_code");
- params.put("appId", String.valueOf(10));
- List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>();
- CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction();
- domainCentralRoleFunction.setCode("menu_fun_code");
- centralRoleFunctionList.add(domainCentralRoleFunction);
- Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, null))
- .thenThrow(nullPointerException);
- assertFalse(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app));
- }
-
- @Test
- public void getUserTest() {
- List<EPUser> userList = new ArrayList<>();
- EPUser user = mockUser.mockEPUser();
- userList.add(user);
- Mockito.when(dataAccessService1.getList(EPUser.class, " where org_user_id = '" + "guestT" + "'", null, null))
- .thenReturn(userList);
- List<EPUser> expectedUserList = externalAccessRolesServiceImpl.getUser("guestT");
- assertEquals(expectedUserList, userList);
- }
-
- public void saveCentralRoleFunctionTest() throws Exception {
- CentralRoleFunction centralRoleFunction = new CentralRoleFunction();
- centralRoleFunction.setCode("menu_test");
- EPApp app = mockApp();
- app.setId((long) 1);
- final Map<String, String> params = new HashMap<>();
- params.put("functionCd", "menu_test");
- params.put("appId", String.valueOf(1));
- ExternalAccessPerms extPerms = new ExternalAccessPerms();
- PowerMockito.mockStatic(EcompPortalUtils.class);
- HttpHeaders headers = new HttpHeaders();
- Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
- List<CentralRoleFunction> appRoleFunc = new ArrayList<>();
- appRoleFunc.add(centralRoleFunction);
- Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params,
- null)).thenReturn(appRoleFunc);
- ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.OK);
- Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET),
- Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuMockServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuMockServiceImplTest.java
deleted file mode 100644
index 51802c13..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuMockServiceImplTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID;
-import org.openecomp.portalapp.portal.service.FunctionalMenuService;
-import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl;
-import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuItem;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuRole;
-import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
-import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({SystemProperties.class, EPCommonSystemProperties.class})
-public class FunctionalMenuMockServiceImplTest extends ApplicationCommonContextTestSuite {
-
- @Mock
- FunctionalMenuService functionalMenuService;
-
- @Mock
- DataAccessService dataAccessService;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @InjectMocks
- FunctionalMenuServiceImpl functionalMenuServiceImpl= new FunctionalMenuServiceImpl();
-
- @Test
- public void assignHelpURLsTest(){
- List<FunctionalMenuItem> menuItems = new ArrayList<FunctionalMenuItem>();
- FunctionalMenuItem functionalMenuItem1 = new FunctionalMenuItem();
- functionalMenuItem1.text = "Contact Us";
- FunctionalMenuItem functionalMenuItem2 = new FunctionalMenuItem();
- functionalMenuItem2.text = "Get Access";
- FunctionalMenuItem functionalMenuItem3 = new FunctionalMenuItem();
- functionalMenuItem3.text = "User Guide";
- menuItems.add(functionalMenuItem1);
- menuItems.add(functionalMenuItem2);
- menuItems.add(functionalMenuItem3);
-
- PowerMockito.mockStatic(SystemProperties.class);
- Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.USER_GUIDE_URL)).thenReturn("http://todo_enter_user_guide_link");
-// Mockito.doNothing().when(functionalMenuServiceImpl).assignHelpURLs(menuItems);
- functionalMenuServiceImpl.assignHelpURLs(menuItems);
- }
-
- @Test
- public void getFunctionalMenuItemsTest(){
- String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id FROM fn_menu_functional m, "
- + "fn_menu_functional_roles r WHERE m.menu_id = r.menu_id AND UPPER(m.active_yn) = 'Y' AND r.role_id != '900' "
- + "UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn,-1 app_id FROM fn_menu_functional m "
- + "WHERE m.url='' AND UPPER(m.active_yn) = 'Y'";
- List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>();
- List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>();
-
- Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult);
-
- actualResult = functionalMenuServiceImpl.getFunctionalMenuItems(true);
- assertEquals(actualResult, expectedResult);
- }
-
- @Test
- public void getFunctionalMenuItemsNegativeTest(){
- String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id FROM fn_menu_functional m, "
- + "fn_menu_functional_roles r WHERE m.menu_id = r.menu_id AND UPPER(m.active_yn) = 'Y' AND r.role_id != '900' "
- + "UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn,-1 app_id FROM fn_menu_functional m "
- + "WHERE m.url='' AND UPPER(m.active_yn) = 'Y'";
- List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>();
- List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>();
-
- Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult);
-
- actualResult = functionalMenuServiceImpl.getFunctionalMenuItems(false);
- assertEquals(actualResult, expectedResult);
- }
-
- @Test
- public void getFunctionalMenuItemsForNotificationTreeTest(){
- String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id FROM fn_menu_functional m, fn_menu_functional_roles r "
- + "WHERE m.menu_id = r.menu_id AND UPPER(m.active_yn) = 'Y' AND r.role_id != '900' UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id,"
- + " m.url, m.active_yn,-1 app_id FROM fn_menu_functional m WHERE m.url='' AND UPPER(m.active_yn) = 'Y'";
- List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>();
- List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>();
-
- Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult);
-
- actualResult = functionalMenuServiceImpl.getFunctionalMenuItemsForNotificationTree(true);
- assertEquals(actualResult, expectedResult);
-
- }
-
- @Test
- public void getFunctionalMenuItemsForNotificationNegativeTreeTest(){
- String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id FROM fn_menu_functional m, fn_menu_functional_roles r "
- + "WHERE m.menu_id = r.menu_id AND UPPER(m.active_yn) = 'Y' AND r.role_id != '900' UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id,"
- + " m.url, m.active_yn,-1 app_id FROM fn_menu_functional m WHERE m.url='' AND UPPER(m.active_yn) = 'Y'";
- List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>();
- List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>();
-
- Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult);
-
- actualResult = functionalMenuServiceImpl.getFunctionalMenuItemsForNotificationTree(false);
- assertEquals(actualResult, expectedResult);
- }
-
- @Test
- public void getFunctionalMenuItemsForAppTest(){
- String sql = "SELECT DISTINCT m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m.active_yn "
- + "FROM fn_menu_functional m, fn_menu_functional m1, fn_menu_functional_ancestors a, fn_menu_functional_roles mr "
- + "WHERE mr.app_id='1' AND mr.menu_id = m.menu_id AND UPPER(m.active_yn) = 'Y' AND UPPER(m1.active_yn) ='Y' AND a.menu_id = m.menu_id "
- + "AND a.ancestor_menu_id = m1.menu_id";
- Integer appId = 1;
- List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>();
- List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>();
-
- Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult);
-
- actualResult = functionalMenuServiceImpl.getFunctionalMenuItemsForApp(appId);
- assertEquals(actualResult, expectedResult);
- }
-
- @Test
- public void getFunctionalMenuItemsForUserTest(){
- String orgUserId = "test";
- String sql = "SELECT DISTINCT m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m.active_yn "
- + "FROM fn_menu_functional m, fn_menu_functional m1, fn_menu_functional_ancestors a, fn_menu_functional_roles mr, fn_user u , fn_user_role ur "
- + "WHERE u.org_user_id='test' AND u.user_id = ur.user_id AND ur.app_id = mr.app_id AND (ur.role_id = mr.role_id OR ur.role_id = '999') "
- + "AND m.menu_id = mr.menu_id AND UPPER(m.active_yn) = 'Y' AND UPPER(m1.active_yn) ='Y' AND a.menu_id = m.menu_id "
- + "AND a.ancestor_menu_id = m1.menu_id UNION select m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m1.active_yn "
- + "FROM fn_menu_functional m, fn_menu_functional_roles mr, fn_menu_functional m1, fn_menu_functional_ancestors a where a.menu_id = m.menu_id AND a.ancestor_menu_id = m1.menu_id AND m.menu_id != m1.menu_id AND m.menu_id = mr.menu_id AND mr.role_id = '900' AND UPPER(m.active_yn) = 'Y' AND UPPER(m1.active_yn) ='Y' UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn FROM fn_menu_functional m WHERE m.text in ('Favorites','Get Access','Contact Us','Support','User Guide','Help')";
- List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>();
- List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>();
-
- Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult);
-
- actualResult = functionalMenuServiceImpl.getFunctionalMenuItemsForUser(orgUserId);
- assertEquals(actualResult, expectedResult);
- }
-
- @Test
- public void getFunctionalMenuItemDetailsTest(){
- Integer menuid = 1;
- String sql = "SELECT * FROM fn_menu_functional_roles WHERE menu_id = '1'";
- FunctionalMenuItem actualResult = null;
- FunctionalMenuItem expectedResult = null;
- List<FunctionalMenuRole> roleItems = new ArrayList<FunctionalMenuRole>();
- Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(roleItems);
-
- actualResult = functionalMenuServiceImpl.getFunctionalMenuItemDetails(menuid);
- assertEquals(actualResult, expectedResult);
- }
-
- @Test
- public void getFavoriteItemsTest(){
- Long userId = (long)1;
- String sql = "SELECT DISTINCT f.user_id,f.menu_id,m.text,m.url "
- + "FROM fn_menu_favorites f, fn_menu_functional m, fn_menu_functional_roles mr "
- + "WHERE f.user_id='1' AND f.menu_id = m.menu_id AND f.menu_id = mr.menu_id AND mr.role_id != '900' ";
- List<FavoritesFunctionalMenuItemJson> actualResult = new ArrayList<FavoritesFunctionalMenuItemJson>();
- List<FavoritesFunctionalMenuItemJson> expectedResult = new ArrayList<FavoritesFunctionalMenuItemJson>();
-
- Mockito.when(dataAccessService.executeSQLQuery(sql, FavoritesFunctionalMenuItemJson.class, null)).thenReturn(expectedResult);
-
- actualResult = functionalMenuServiceImpl.getFavoriteItems(userId);
- assertEquals(actualResult, expectedResult);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuServiceImplTest.java
deleted file mode 100644
index 2ca02ba6..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuServiceImplTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.service.FunctionalMenuService;
-import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuRole;
-import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class FunctionalMenuServiceImplTest extends ApplicationCommonContextTestSuite {
-
- @Autowired
- FunctionalMenuService functionalMenuService;
-
- @Test
- public void getAppListTestService() throws Exception {
-
- String userId = "guestT";
- List<BusinessCardApplicationRole> userAppRolesActualResult = null;
-
- List<BusinessCardApplicationRole> userAppRolesExpectedResult = new ArrayList<BusinessCardApplicationRole>();
- BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole();
- businessCardApplicationRole.setAppName("ECOMP Portal");
- businessCardApplicationRole.setRoleName("System Administrator");
- userAppRolesExpectedResult.add(businessCardApplicationRole);
- Map<String, String> params = new HashMap<String, String>();
- params.put("userId", userId);
- userAppRolesActualResult = functionalMenuService.getUserAppRolesList(userId);
- assertTrue(userAppRolesActualResult.contains(businessCardApplicationRole));
-
- }
-
- @Test
- public void getFunctionalMenuRoleTest() throws Exception {
-
- FunctionalMenuRole expectedFunctionalMenuRole = new FunctionalMenuRole();
- expectedFunctionalMenuRole.setId(new Integer(-1));
-
- expectedFunctionalMenuRole.setMenuId((long) 137);
- expectedFunctionalMenuRole.setAppId(new Integer(456));
- expectedFunctionalMenuRole.setRoleId(new Integer(6214));
- List<FunctionalMenuRole> actualFunctionalMenuRoleList = null;
- actualFunctionalMenuRoleList = functionalMenuService.getFunctionalMenuRole();
- assertTrue(actualFunctionalMenuRoleList.contains(expectedFunctionalMenuRole));
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/GetAccessServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/GetAccessServiceImplTest.java
deleted file mode 100644
index e689fab7..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/GetAccessServiceImplTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.domain.GetAccessResult;
-import org.openecomp.portalapp.portal.service.GetAccessServiceImpl;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.service.DataAccessServiceImpl;
-
-public class GetAccessServiceImplTest {
-
-
- @Mock
- DataAccessService dataAccessService = new DataAccessServiceImpl();
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @InjectMocks
- GetAccessServiceImpl getAccessServiceImpl = new GetAccessServiceImpl();
-
- MockEPUser mockUser = new MockEPUser();
-
- @Test
- public void getAppAccessListTest()
- {
- EPUser user = mockUser.mockEPUser();
- Map<String, Long> params = new HashMap<>();
- params.put("userId", user.getId());
- List<GetAccessResult> appAccessList = new ArrayList<>();
- Mockito.when(dataAccessService.executeNamedQuery("getAppAccessFunctionRole", params, null)).thenReturn(appAccessList);
-
- List<GetAccessResult> expectedAppAccessList = getAccessServiceImpl.getAppAccessList(user);
- assertEquals(expectedAppAccessList, appAccessList);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/LicenseableClassImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/LicenseableClassImplTest.java
deleted file mode 100644
index 5c4cb5b4..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/LicenseableClassImplTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.lm.LicenseableClassImpl;
-
-public class LicenseableClassImplTest {
-
- @InjectMocks
- LicenseableClassImpl licenseableClassImpl= new LicenseableClassImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void getApplicationNameTest()
- {
- assertEquals(licenseableClassImpl.getApplicationName(), "");
- }
- @Test
- public void getPublicKeystoreAsInputStreamTest() throws IOException
- {
- assertNull(licenseableClassImpl.getPublicKeystoreAsInputStream());
- }
- @Test
- public void getAliasTest()
- {
- assertEquals(licenseableClassImpl.getAlias(), "");
- }
- @Test
- public void getKeyPasswdTest()
- {
- assertEquals(licenseableClassImpl.getKeyPasswd(), "");
- }
- @Test
- public void getPublicKeystorePasswordTest()
- {
- assertEquals(licenseableClassImpl.getPublicKeystorePassword(), "");
- }
- @Test
- public void getCipherParamPasswordTest()
- {
- assertEquals(licenseableClassImpl.getPublicKeystorePassword(), "");
- }
- @Test
- public void getClassToLicenseTest()
- {
- assertEquals(licenseableClassImpl.getClassToLicense(), LicenseableClassImpl.class);
- }
-
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ManifestServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ManifestServiceImplTest.java
deleted file mode 100644
index f2b6036e..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ManifestServiceImplTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.jar.Attributes;
-
-import javax.servlet.ServletContext;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.service.ManifestServiceImpl;
-
-public class ManifestServiceImplTest {
-
- @Mock
- ServletContext context;
-
- @Mock
- ServletContext context1 = null;
-
- @InjectMocks
- ManifestServiceImpl manifestServiceImpl = new ManifestServiceImpl();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- NullPointerException nullPointerException = new NullPointerException();
-
- @Test
- public void getWebappManifestTest() throws IOException {
- final String MANIFEST_RESOURCE_PATH = "/META-INF/MANIFEST.MF";
- InputStream inputStream = new ByteArrayInputStream("test data".getBytes());
- Mockito.when(context.getResourceAsStream(MANIFEST_RESOURCE_PATH)).thenReturn(inputStream);
- Attributes attributes = manifestServiceImpl.getWebappManifest();
- assertTrue(attributes.size() == 0);
- }
-
- @Test(expected = java.lang.NullPointerException.class)
- public void getWebappManifestExceptionTest() throws IOException {
- final String MANIFEST_RESOURCE_PATH = "/META-INF/MANIFEST.MF";
- InputStream inputStream = new ByteArrayInputStream("test data".getBytes());
- Mockito.when(context1.getResourceAsStream(MANIFEST_RESOURCE_PATH)).thenThrow(nullPointerException);
- Attributes attributes = manifestServiceImpl.getWebappManifest();
- assertTrue(attributes.size() == 0);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/PersUserAppServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/PersUserAppServiceImplTest.java
deleted file mode 100644
index bdd6cbd1..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/PersUserAppServiceImplTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.openecomp.portalapp.portal.test.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.portalapp.portal.domain.EPApp;
-import org.openecomp.portalapp.portal.domain.EPUser;
-import org.openecomp.portalapp.portal.domain.EPUserApp;
-import org.openecomp.portalapp.portal.domain.PersUserAppSelection;
-import org.openecomp.portalapp.portal.service.AdminRolesService;
-import org.openecomp.portalapp.portal.service.PersUserAppServiceImpl;
-import org.openecomp.portalapp.portal.service.UserRolesService;
-import org.openecomp.portalapp.portal.test.core.MockEPUser;
-import org.openecomp.portalapp.test.framework.MockitoTestSuite;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-
-public class PersUserAppServiceImplTest {
-
- @Mock
- DataAccessService dataAccessService;
- @Mock
- AdminRolesService adminRolesService;
- @Mock
- UserRolesService userRolesService;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @InjectMocks
- PersUserAppServiceImpl persUserAppServiceImpl = new PersUserAppServiceImpl();
-
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
-
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
- MockEPUser mockUser = new MockEPUser();
-
- public EPApp getApp() {
- EPApp app = new EPApp();
- app.setName("Test");
- app.setImageUrl("test");
- app.setDescription("test");
- app.setNotes("test");
- app.setUrl("test");
- app.setId((long) 1);
- app.setAppRestEndpoint("test");
- app.setAlternateUrl("test");
- app.setName("test");
- app.setMlAppName("test");
- app.setMlAppAdminId("test");
- app.setUsername("test");
- app.setAppPassword("test");
- app.setOpen(true);
- app.setEnabled(false);
- app.setUebKey("test");
- app.setUebSecret("test");
- app.setUebTopicName("test");
- app.setAppType(1);
- return app;
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void setPersUserAppValueIfUserNull() {
- persUserAppServiceImpl.setPersUserAppValue(null, null, false, false);
- }
-
- @Test
- public void setPersUserAppValueTest() {
- EPApp app = getApp();
- EPUser user = mockUser.mockEPUser();
- List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>();
- PersUserAppSelection persUserAppSelection = new PersUserAppSelection();
- persUserAppSelection.setId((long) 1);
- persUserAppSelectionList.add(persUserAppSelection);
- Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null))
- .thenReturn(persUserAppSelectionList);
- Mockito.doNothing().when(dataAccessService).deleteDomainObject(persUserAppSelection, null);
- persUserAppServiceImpl.setPersUserAppValue(user, app, false, true);
- }
-
- @Test
- public void setPersUserAppValueIfSelectTest() {
- EPApp app = getApp();
- EPUser user = mockUser.mockEPUser();
- List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>();
- PersUserAppSelection persUserAppSelection = new PersUserAppSelection();
- persUserAppSelection.setId((long) 1);
- persUserAppSelectionList.add(persUserAppSelection);
- Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null))
- .thenReturn(persUserAppSelectionList);
- Mockito.doNothing().when(dataAccessService).saveDomainObject(persUserAppSelection, null);
- persUserAppServiceImpl.setPersUserAppValue(user, app, true, true);
- }
-
- @Test
- public void setPersUserAppValueIfOpenTest() {
- EPApp app = getApp();
- app.setOpen(false);
- EPUser user = mockUser.mockEPUser();
- List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>();
- PersUserAppSelection persUserAppSelection = new PersUserAppSelection();
- persUserAppSelection.setId((long) 1);
- persUserAppSelectionList.add(persUserAppSelection);
- Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null))
- .thenReturn(persUserAppSelectionList);
- Mockito.doNothing().when(dataAccessService).saveDomainObject(persUserAppSelection, null);
- persUserAppServiceImpl.setPersUserAppValue(user, app, true, true);
- }
-
- @Test
- public void setPersUserAppValueIfAppNotOpenTest() {
- EPApp app = getApp();
- app.setOpen(false);
- EPUser user = mockUser.mockEPUser();
- List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>();
- PersUserAppSelection persUserAppSelection = new PersUserAppSelection();
- persUserAppSelection.setId((long) 1);
- persUserAppSelectionList.add(persUserAppSelection);
- Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null))
- .thenReturn(persUserAppSelectionList);
- Mockito.doNothing().when(dataAccessService).saveDomainObject(persUserAppSelection, null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- List<EPUserApp> roles = new ArrayList<>();
- EPUserApp epUserApp = new EPUserApp();
- roles.add(epUserApp);
- Mockito.when(userRolesService.getCachedAppRolesForUser(app.getId(), user.getId())).thenReturn(roles);
- persUserAppServiceImpl.setPersUserAppValue(user, app, true, false);
- }
-
- @Test
- public void setPersUserAppValueIfNotPortalAdminTest() {
- EPApp app = getApp();
- app.setOpen(false);
- EPUser user = mockUser.mockEPUser();
- List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>();
- PersUserAppSelection persUserAppSelection = new PersUserAppSelection();
- persUserAppSelection.setId((long) 1);
- persUserAppSelectionList.add(persUserAppSelection);
- Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null))
- .thenReturn(persUserAppSelectionList);
- Mockito.doNothing().when(dataAccessService).deleteDomainObject(persUserAppSelection, null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false);
- List<EPUserApp> roles = new ArrayList<>();
- EPUserApp epUserApp = new EPUserApp();
- roles.add(epUserApp);
- Mockito.when(userRolesService.getCachedAppRolesForUser(app.getId(), user.getId())).thenReturn(roles);
- persUserAppServiceImpl.setPersUserAppValue(user, app, true, false);
- }
-
- @Test
- public void setPersUserAppValueNewTest() {
- EPApp app = getApp();
- app.setOpen(false);
- EPUser user = mockUser.mockEPUser();
- List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>();
- PersUserAppSelection persUserAppSelection = new PersUserAppSelection();
- persUserAppSelection.setId((long) 1);
- persUserAppSelectionList.add(persUserAppSelection);
- Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null))
- .thenReturn(persUserAppSelectionList);
- Mockito.doNothing().when(dataAccessService).saveDomainObject(persUserAppSelection, null);
- Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true);
- List<EPUserApp> roles = new ArrayList<>();
- EPUserApp epUserApp = new EPUserApp();
- roles.add(epUserApp);
- Mockito.when(userRolesService.getCachedAppRolesForUser(app.getId(), user.getId())).thenReturn(roles);
- persUserAppServiceImpl.setPersUserAppValue(user, app, false, false);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java
deleted file mode 100644
index 7fd3c03f..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.Analytics;
-
-public class AnalyticsTest {
-
- public Analytics mockAnalytics(){
- Analytics analytics = new Analytics();
-
- analytics.setAction("test");
- analytics.setPage("test");
- analytics.setFunction("test");
- analytics.setUserid("test");
- analytics.setType("test");
-
- return analytics;
- }
-
- @Test
- public void analyticsTest(){
- Analytics analytics = mockAnalytics();
-
- assertEquals(analytics.getAction(), "test");
- assertEquals(analytics.getPage(), "test");
- assertEquals(analytics.getFunction(), "test");
- assertEquals(analytics.getUserid(), "test");
- assertEquals(analytics.getType(), "test");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java
deleted file mode 100644
index c583c9cd..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class AppCatalogPersonalizationTest {
-
- public AppCatalogPersonalization mockAppCatalogPersonalization(){
- AppCatalogPersonalization appCatalogPersonalization = new AppCatalogPersonalization();
-
- return appCatalogPersonalization;
- }
-
- @Test
- public void appCatalogPersonalizationTest(){
- AppCatalogPersonalization appCatalogPersonalization = mockAppCatalogPersonalization();
-
- AppCatalogPersonalization appCatalogPersonalization1 = new AppCatalogPersonalization();
-
- assertEquals(appCatalogPersonalization.hashCode(), appCatalogPersonalization1.hashCode());
- assertTrue(appCatalogPersonalization.equals(appCatalogPersonalization1));
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java
deleted file mode 100644
index a1dffd28..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin;
-
-public class AppNameIdIsAdminTest {
-
- public AppNameIdIsAdmin mockAppNameIdIsAdmin(){
- AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin();
- appNameIdIsAdmin.setId((long)1);
- appNameIdIsAdmin.setAppName("test");
- appNameIdIsAdmin.setRestrictedApp(false);
- appNameIdIsAdmin.setIsAdmin(false);
- return appNameIdIsAdmin;
- }
-
- @Test
- public void appNameIdIsAdminTest(){
- AppNameIdIsAdmin appNameIdIsAdmin = mockAppNameIdIsAdmin();
-
- AppNameIdIsAdmin appNameIdIsAdmin1 = new AppNameIdIsAdmin();
- appNameIdIsAdmin1.setId((long)1);
- appNameIdIsAdmin1.setAppName("test");
- appNameIdIsAdmin1.setRestrictedApp(false);
- appNameIdIsAdmin1.setIsAdmin(false);
-
- assertEquals(appNameIdIsAdmin.getId(), new Long(1));
- assertEquals(appNameIdIsAdmin.getAppName(), "test");
- assertEquals(appNameIdIsAdmin.getRestrictedApp(), false);
- assertEquals(appNameIdIsAdmin.getIsAdmin(), false);
-
- assertEquals(appNameIdIsAdmin.toString(), "AppNameIdIsAdmin [id=1, appName=test, isAdmin=false, restrictedApp=false]");
- assertEquals(appNameIdIsAdmin.hashCode(), appNameIdIsAdmin1.hashCode());
- assertTrue(appNameIdIsAdmin.equals(appNameIdIsAdmin1));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java
deleted file mode 100644
index 2a7c343c..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import org.openecomp.portalapp.portal.transport.AppWithRolesForUser;
-
-public class AppWithRolesForUserTest {
-
- public AppWithRolesForUser mockAppWithRolesForUser(){
- AppWithRolesForUser appWithRolesForUser = new AppWithRolesForUser();
-
- // List<RoleInAppForUser> appRoles = new ArrayList<RoleInAppForUser>();
-
- appWithRolesForUser.setOrgUserId("test");
- appWithRolesForUser.setAppId((long)1);
- appWithRolesForUser.setAppName("test");
- appWithRolesForUser.setAppRoles(null);
-
- return appWithRolesForUser;
- }
-
- @Test
- public void roleInAppForUserTest(){
- AppWithRolesForUser appWithRolesForUser = mockAppWithRolesForUser();
-
- assertEquals(appWithRolesForUser.getOrgUserId(), "test");
- assertEquals(appWithRolesForUser.getAppId(), new Long(1));
- assertEquals(appWithRolesForUser.getAppName(), "test");
- assertEquals(appWithRolesForUser.getAppRoles(), null);
- assertEquals(appWithRolesForUser.toString(), "AppWithRolesForUser [orgUserId=test, appId=1, appName=test, appRoles=null]");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java
deleted file mode 100644
index 2c601d3c..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin;
-import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole;
-
-public class AppsListWithAdminRoleTest {
-
- public AppsListWithAdminRole mockAppsListWithAdminRole(){
- AppsListWithAdminRole appsListWithAdminRole = new AppsListWithAdminRole();
-
- ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>();
- AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin();
- appsRoles.add(appNameIdIsAdmin);
-
- appsListWithAdminRole.setOrgUserId("test");
- appsListWithAdminRole.setAppsRoles(appsRoles);
-
- return appsListWithAdminRole;
- }
-
- @Test
- public void appsListWithAdminRoleTest(){
- AppsListWithAdminRole appsListWithAdminRole = mockAppsListWithAdminRole();
-
- AppsListWithAdminRole appsListWithAdminRole1 = new AppsListWithAdminRole();
-
- ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>();
- AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin();
- appsRoles.add(appNameIdIsAdmin);
-
- appsListWithAdminRole1.setOrgUserId("test");
- appsListWithAdminRole1.setAppsRoles(appsRoles);
-
- assertEquals(appsListWithAdminRole.getOrgUserId(), "test");
- assertEquals(appsListWithAdminRole.getAppsRoles(), appsRoles);
-
- assertTrue(appsListWithAdminRole.equals(appsListWithAdminRole1));
- assertEquals(appsListWithAdminRole.hashCode(), appsListWithAdminRole1.hashCode());
- assertEquals(appsListWithAdminRole.toString(), "AppsListWithAdminRole [orgUserId=test, appsRoles=[AppNameIdIsAdmin [id=null, appName=null, isAdmin=null, restrictedApp=null]]]");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java
deleted file mode 100644
index 854afccc..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.BulkUploadRoleFunction;
-
-public class BulkUploadRoleFunctionTest {
-
- public BulkUploadRoleFunction mockBulkUploadRoleFunction(){
-
- BulkUploadRoleFunction bulkUploadRoleFunction = new BulkUploadRoleFunction();
-
- bulkUploadRoleFunction.setFunctionName("test");
- bulkUploadRoleFunction.setFunctionCd("test");
-
- return bulkUploadRoleFunction;
- }
-
- @Test
- public void bulkUploadRoleFunctionTest(){
- BulkUploadRoleFunction bulkUploadRoleFunction = mockBulkUploadRoleFunction();
-
- BulkUploadRoleFunction bulkUploadRoleFunction1 = new BulkUploadRoleFunction();
-
- bulkUploadRoleFunction1.setFunctionName("test");
- bulkUploadRoleFunction1.setFunctionCd("test");
-
- assertEquals(bulkUploadRoleFunction.getFunctionCd(), "test");
- assertEquals(bulkUploadRoleFunction.getFunctionName(), "test");
- assertEquals(bulkUploadRoleFunction.hashCode(), bulkUploadRoleFunction1.hashCode());
- assertTrue(bulkUploadRoleFunction.equals(bulkUploadRoleFunction1));
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java
deleted file mode 100644
index b2bbba68..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.BulkUploadUserRoles;
-
-public class BulkUploadUserRolesTest {
-
- public BulkUploadUserRoles mockBulkUploadUserRoles(){
- BulkUploadUserRoles bulkUploadUserRoles = new BulkUploadUserRoles();
-
- bulkUploadUserRoles.setRoleName("test");
- bulkUploadUserRoles.setOrgUserId("test");
- bulkUploadUserRoles.setAppNameSpace("test");
-
- return bulkUploadUserRoles;
- }
-
- @Test
- public void bulkUploadUserRolesTest(){
- BulkUploadUserRoles bulkUploadUserRoles = mockBulkUploadUserRoles();
-
- BulkUploadUserRoles bulkUploadUserRoles1 = new BulkUploadUserRoles();
-
- bulkUploadUserRoles1.setRoleName("test");
- bulkUploadUserRoles1.setOrgUserId("test");
- bulkUploadUserRoles1.setAppNameSpace("test");
-
- assertEquals(bulkUploadUserRoles.getRoleName(), "test");
- assertEquals(bulkUploadUserRoles.getOrgUserId(), "test");
- assertEquals(bulkUploadUserRoles.getAppNameSpace(), "test");
-
- assertEquals(bulkUploadUserRoles.hashCode(), bulkUploadUserRoles1.hashCode());
- assertTrue(bulkUploadUserRoles.equals(bulkUploadUserRoles1));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java
deleted file mode 100644
index 0ed06b12..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class BusinessCardApplicationRoleTest {
-
- public BusinessCardApplicationRole mockBusinessCardApplicationRole(){
- BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole();
-
- return businessCardApplicationRole;
- }
-
- @Test
- public void businessCardApplicationRoleTest(){
- BusinessCardApplicationRole businessCardApplicationRole = mockBusinessCardApplicationRole();
-
- BusinessCardApplicationRole businessCardApplicationRole1 = new BusinessCardApplicationRole();
-
- assertEquals(businessCardApplicationRole.hashCode(), businessCardApplicationRole1.hashCode());
- assertTrue(businessCardApplicationRole.equals(businessCardApplicationRole1));
- assertEquals(businessCardApplicationRole.toString(), "BusinessCardUserApplicationRoles [appName=null, roleName=null]");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java
deleted file mode 100644
index 9f5e6785..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class BusinessCardApplicationRolesListTest {
-
- public BusinessCardApplicationRolesList mockBusinessCardApplicationRolesList(){
- BusinessCardApplicationRolesList businessCardApplicationRolesList = new BusinessCardApplicationRolesList();
-
- return businessCardApplicationRolesList;
- }
-
- @Test
- public void businessCardApplicationRolesListTest(){
- BusinessCardApplicationRolesList businessCardApplicationRolesList = mockBusinessCardApplicationRolesList();
-
- BusinessCardApplicationRolesList businessCardApplicationRolesList1 = new BusinessCardApplicationRolesList();
-
- assertEquals(businessCardApplicationRolesList.hashCode(), businessCardApplicationRolesList1.hashCode());
- assertTrue(businessCardApplicationRolesList.equals(businessCardApplicationRolesList1));
- assertEquals(businessCardApplicationRolesList.toString(), "BusinessCardUserAppRoles [appName=null, roleNames=null]");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java
deleted file mode 100644
index 97c9c59f..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.CentralApp;
-
-public class CentralAppTest {
-
- public CentralApp mockCentralApp(){
- CentralApp centralApp = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
- "test", "test", "test", "test", null, "test", "test", "test", "test");
-
-
- /* public CentralApp(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name,
- String imageUrl, String description, String notes, String url, String alternateUrl, String restEndpoint,
- String mlAppName, String mlAppAdminId, String motsId, String appPassword, String open, String enabled,
- byte[] thumbnail, String username, String uebKey, String uebSecret, String uebTopicName)*/
-
- centralApp.setId((long)1);
- centralApp.setCreatedId((long)1);
- centralApp.setModifiedId((long)1);
- centralApp.setRowNum((long)1);
- centralApp.setName("test");
- centralApp.setImageUrl("test");
- centralApp.setDescription("test");
- centralApp.setNotes("test");
- centralApp.setUrl("test");
- centralApp.setAlternateUrl("test");
- centralApp.setRestEndpoint("test");
- centralApp.setMlAppName("test");
- centralApp.setMlAppAdminId("test");
- centralApp.setMotsId("test");
- centralApp.setAppPassword("test");
- centralApp.setOpen("test");
- centralApp.setEnabled("test");
- centralApp.setUsername("test");
- centralApp.setUebKey("test");
- centralApp.setUebSecret("test");
- centralApp.setUebTopicName("test");
-
- return centralApp;
- }
-
- @Test
- public void centralAppTest(){
- CentralApp centralApp = mockCentralApp();
-
- CentralApp centralApp1 = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
- "test", "test", "test", "test", null, "test", "test", "test", "test");
-
- /*centralApp1.setId((long)1);
- centralApp1.setCreatedId((long)1);
- centralApp1.setModifiedId((long)1);
- centralApp1.setRowNum((long)1);
- centralApp1.setName("test");
- centralApp1.setImageUrl("test");
- centralApp1.setDescription("test");
- centralApp1.setNotes("test");
- centralApp1.setUrl("test");
- centralApp1.setAlternateUrl("test");
- centralApp1.setRestEndpoint("test");
- centralApp1.setMlAppName("test");
- centralApp1.setMlAppAdminId("test");
- centralApp1.setMotsId("test");
- centralApp1.setAppPassword("test");
- centralApp1.setOpen("test");
- centralApp1.setEnabled("test");
- centralApp1.setUsername("test");
- centralApp1.setUebKey("test");
- centralApp1.setUebSecret("test");
- centralApp1.setUebTopicName("test");*/
-
- assertEquals(centralApp.getId(), new Long(1));
- assertEquals(centralApp.getCreatedId(), new Long(1));
- assertEquals(centralApp.getModifiedId(), new Long(1));
- assertEquals(centralApp.getRowNum(), new Long(1));
- assertEquals(centralApp.getName(), "test");
- assertEquals(centralApp.getImageUrl(), "test");
- assertEquals(centralApp.getDescription(), "test");
- assertEquals(centralApp.getNotes(), "test");
- assertEquals(centralApp.getUrl(), "test");
- assertEquals(centralApp.getAlternateUrl(), "test");
- assertEquals(centralApp.getRestEndpoint(), "test");
- assertEquals(centralApp.getMlAppName(), "test");
- assertEquals(centralApp.getMlAppAdminId(), "test");
- assertEquals(centralApp.getMotsId(), "test");
- assertEquals(centralApp.getAppPassword(), "test");
- assertEquals(centralApp.getOpen(), "test");
- assertEquals(centralApp.getEnabled(), "test");
- assertEquals(centralApp.getUsername(), "test");
- assertEquals(centralApp.getUebKey(), "test");
- assertEquals(centralApp.getUebSecret(), "test");
- assertEquals(centralApp.getUebTopicName(), "test");
-
- assertTrue(centralApp.equals(centralApp1));
- assertEquals(centralApp.hashCode(), centralApp1.hashCode());
- /* assertTrue(centralApp.equals(new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
- "test", "test", "test", "test", null, "test", "test", "test", "test")));*/
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java
deleted file mode 100644
index 6ba0a444..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import java.util.Date;
-import java.util.SortedSet;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
-import org.openecomp.portalapp.portal.transport.CentralRole;
-
-public class CentralRoleTest {
-
- public CentralRole mockCentralRole(){
- CentralRole centralRole = new CentralRole((long)1, null, null, (long)1, (long)1, (long)1,
- "test", false, 1, null, null, null);
-
- centralRole.setId((long)1);
- centralRole.setCreatedId((long)1);
- centralRole.setModifiedId((long)1);
- centralRole.setRowNum((long)1);
- centralRole.setName("test");
- centralRole.setActive(false);
- centralRole.setPriority(1);
-
- centralRole.setCreated(null);
- centralRole.setModified(null);
- centralRole.setRoleFunctions(null);
- centralRole.setChildRoles(null);
- centralRole.setParentRoles(null);
-
- return centralRole;
- }
-
- @Test
- public void centralRoleTest(){
- CentralRole centralRole = mockCentralRole();
-
- CentralRole centralRole1 = new CentralRole((long)1, null, null, (long)1, (long)1, (long)1,
- "test", false, 1, null, null, null);
-
- CentralRole centralRole2 = new CentralRole((long)1, "test");
-
- assertEquals(centralRole.getId(), new Long(1));
- assertEquals(centralRole.getCreatedId(), new Long(1));
- assertEquals(centralRole.getModifiedId(), new Long(1));
- assertEquals(centralRole.getRowNum(), new Long(1));
- assertEquals(centralRole.getName(), "test");
- assertEquals(centralRole.isActive(), false);
- assertEquals(centralRole.getCreated(), null);
- assertEquals(centralRole.getModified(), null);
- assertEquals(centralRole.getRoleFunctions(), null);
- assertEquals(centralRole.getChildRoles(), null);
- assertEquals(centralRole.getParentRoles(), null);
- assertEquals(centralRole.getPriority().toString(), "1");
- assertEquals(centralRole.hashCode(), centralRole1.hashCode());
- assertTrue(centralRole.equals(centralRole1));
- assertEquals(centralRole, centralRole1);
- assertEquals(centralRole2, new CentralRole((long)1, "test"));
- }
-
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java
deleted file mode 100644
index f3582647..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.CentralApp;
-import org.openecomp.portalapp.portal.transport.CentralRole;
-import org.openecomp.portalapp.portal.transport.CentralUserApp;
-
-public class CentralUserAppTest {
-
- public CentralUserApp mockCentralUserApp(){
- CentralUserApp centralUserApp = new CentralUserApp();
-
- CentralApp app = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
- "test", "test", "test", "test", null, "test", "test", "test", "test");
-
- CentralRole role = new CentralRole();
-
- centralUserApp.setUserId((long)1);
- centralUserApp.setApp(app);
- centralUserApp.setRole(role);
- centralUserApp.setPriority((short) 123);
-
- return centralUserApp;
- }
-
- @Test
- public void centralUserAppTest(){
- CentralUserApp centralUserApp = mockCentralUserApp();
-
- CentralApp app1 = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
- "test", "test", "test", "test", null, "test", "test", "test", "test");
-
- CentralRole role1 = new CentralRole();
-
- assertEquals(centralUserApp.getUserId(), new Long(1));
- assertEquals(centralUserApp.getPriority(), new Short((short) 123));
- assertEquals(centralUserApp.getApp(), app1);
- assertEquals(centralUserApp.getRole(), role1);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java
deleted file mode 100644
index 9df86bc9..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.CentralRole;
-import org.openecomp.portalapp.portal.transport.CentralUser;
-import org.openecomp.portalapp.portal.transport.CentralUserApp;
-
-public class CentralUserTest {
-
- public CentralUser mockCentralUser(){
- Set<CentralUserApp> userApps = new HashSet<CentralUserApp>();
- Set<CentralRole> pseudoRoles = new HashSet<CentralRole>();
- CentralUser centralUser = new CentralUser((long)1, null, null, (long)1, (long)1, (long)1, (long)1,
- (long)1, "test", "test", "test", "test", "test",
- "test", "test", (long)1, "test", "test", "test",
- "test", "test", "test", "test", "test", "test", "test",
- "test", "test", "test", "test",
- "test", "test", "test", "test", "test",
- "test", "test", "test", "test", "test",
- "test", "test", "test", "test", null,
- false, false, (long)1, (long)1, false, "test", userApps, pseudoRoles);
-
- return centralUser;
- }
-
- @Test
- public void centralRoleTest(){
- CentralUser centralUser = mockCentralUser();
-
- Set<CentralUserApp> userApps = new HashSet<CentralUserApp>();
- Set<CentralRole> pseudoRoles = new HashSet<CentralRole>();
- CentralUser centralUser1 = new CentralUser((long)1, null, null, (long)1, (long)1, (long)1, (long)1,
- (long)1, "test", "test", "test", "test", "test",
- "test", "test", (long)1, "test", "test", "test",
- "test", "test", "test", "test", "test", "test", "test",
- "test", "test", "test", "test",
- "test", "test", "test", "test", "test",
- "test", "test", "test", "test", "test",
- "test", "test", "test", "test", null,
- false, false, (long)1, (long)1, false, "test", userApps, pseudoRoles);
-
-
- assertEquals(centralUser, centralUser1);
- assertEquals(centralUser.hashCode(), centralUser1.hashCode());
- assertTrue(centralUser.equals(centralUser1));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java
deleted file mode 100644
index 6e8b4018..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EPAppsManualPreference;
-
-public class EPAppsManualPreferenceTest {
-
- public EPAppsManualPreference mockEPAppsManualPreference(){
- EPAppsManualPreference epAppsManualPreference = new EPAppsManualPreference();
-
- epAppsManualPreference.setAppid((long)1);
- epAppsManualPreference.setCol(1);
- epAppsManualPreference.setHeaderText("test");
- epAppsManualPreference.setImageLink("test");
- epAppsManualPreference.setOrder(1);
- epAppsManualPreference.setRestrictedApp(false);
- epAppsManualPreference.setRow(1);
- epAppsManualPreference.setSizeX(1);
- epAppsManualPreference.setSizeY(1);
- epAppsManualPreference.setSubHeaderText("test");
- epAppsManualPreference.setUrl("test");
- epAppsManualPreference.setAddRemoveApps(false);
-
- return epAppsManualPreference;
- }
-
- @Test
- public void epAppsManualPreferenceTest(){
-
- EPAppsManualPreference epAppsManualPreference = mockEPAppsManualPreference();
-
- assertEquals(epAppsManualPreference.getAppid(), new Long(1));
- assertEquals(epAppsManualPreference.getCol(), 1);
- assertEquals(epAppsManualPreference.getHeaderText(), "test");
- assertEquals(epAppsManualPreference.getImageLink(), "test");
- assertEquals(epAppsManualPreference.getOrder(), 1);
- assertEquals(epAppsManualPreference.isRestrictedApp(), false);
- assertEquals(epAppsManualPreference.getRow(), 1);
- assertEquals(epAppsManualPreference.getSizeX(), 1);
- assertEquals(epAppsManualPreference.getSizeY(), 1);
- assertEquals(epAppsManualPreference.getSubHeaderText(), "test");
- assertEquals(epAppsManualPreference.getUrl(), "test");
- assertEquals(epAppsManualPreference.isAddRemoveApps(), false);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java
deleted file mode 100644
index 6c67424a..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EPAppsSortPreference;
-
-public class EPAppsSortPreferenceTest {
-
- public EPAppsSortPreference mockEPAppsSortPreference(){
- EPAppsSortPreference epAppsSortPreference = new EPAppsSortPreference();
-
- epAppsSortPreference.setIndex(1);
- epAppsSortPreference.setValue("test");
- epAppsSortPreference.setTitle("test");
-
- return epAppsSortPreference;
- }
-
- @Test
- public void epAppsSortPreferenceTest(){
- EPAppsSortPreference epAppsSortPreference = mockEPAppsSortPreference();
-
- assertEquals(epAppsSortPreference.getIndex(), 1);
- assertEquals(epAppsSortPreference.getValue(), "test");
- assertEquals(epAppsSortPreference.getTitle(), "test");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java
deleted file mode 100644
index 78bb8474..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref;
-
-public class EPDeleteAppsManualSortPrefTest {
-
- public EPDeleteAppsManualSortPref mockEPDeleteAppsManualSortPref(){
- EPDeleteAppsManualSortPref epDeleteAppsManualSortPref = new EPDeleteAppsManualSortPref();
-
- epDeleteAppsManualSortPref.setAppId((long)1);
- epDeleteAppsManualSortPref.setSelect(false);
- epDeleteAppsManualSortPref.setPending(false);
-
- return epDeleteAppsManualSortPref;
- }
-
- @Test
- public void epDeleteAppsManualSortPrefTest(){
- EPDeleteAppsManualSortPref epDeleteAppsManualSortPref = mockEPDeleteAppsManualSortPref();
-
- assertEquals(epDeleteAppsManualSortPref.getAppId(), new Long(1));
- assertEquals(epDeleteAppsManualSortPref.isSelect(), false);
- assertEquals(epDeleteAppsManualSortPref.isPending(), false);
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java
deleted file mode 100644
index 9c82ad37..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EPUserAppCurrentRoles;
-
-public class EPUserAppCurrentRolesTest {
-
- public EPUserAppCurrentRoles mockEPUserAppCurrentRoles(){
- EPUserAppCurrentRoles epUserAppCurrentRoles = new EPUserAppCurrentRoles();
-
- epUserAppCurrentRoles.setRoleName("test");
- epUserAppCurrentRoles.setUserId((long)1);
- epUserAppCurrentRoles.setPriority("test");
- epUserAppCurrentRoles.setRoleId((long)1);
-
- return epUserAppCurrentRoles;
- }
-
- @Test
- public void epUserAppCurrentRolesTest(){
- EPUserAppCurrentRoles epUserAppCurrentRoles = mockEPUserAppCurrentRoles();
-
- EPUserAppCurrentRoles epUserAppCurrentRoles1 = new EPUserAppCurrentRoles();
-
- epUserAppCurrentRoles1.setRoleName("test");
- epUserAppCurrentRoles1.setUserId((long)1);
- epUserAppCurrentRoles1.setPriority("test");
- epUserAppCurrentRoles1.setRoleId((long)1);
-
- assertEquals(epUserAppCurrentRoles.getRoleName(), "test");
- assertEquals(epUserAppCurrentRoles.getUserId(), new Long(1));
- assertEquals(epUserAppCurrentRoles.getRoleId(), new Long(1));
- assertEquals(epUserAppCurrentRoles.getPriority(), "test");
- assertEquals(epUserAppCurrentRoles.hashCode(), epUserAppCurrentRoles1.hashCode());
- assertTrue(epUserAppCurrentRoles.equals(epUserAppCurrentRoles1));
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java
deleted file mode 100644
index d466d91c..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference;
-
-public class EPWidgetsSortPreferenceTest {
-
- public EPWidgetsSortPreference mockEPWidgetsSortPreference(){
- EPWidgetsSortPreference epWidgetsSortPreference = new EPWidgetsSortPreference();
-
- epWidgetsSortPreference.setSizeX(1);
- epWidgetsSortPreference.setSizeY(1);
- epWidgetsSortPreference.setHeaderText("test");
- epWidgetsSortPreference.setUrl("test");
- epWidgetsSortPreference.setWidgetid((long)1);
- epWidgetsSortPreference.setWidgetIdentifier("test");
- epWidgetsSortPreference.setRow(1);
- epWidgetsSortPreference.setCol(1);
-
- return epWidgetsSortPreference;
- }
-
- @Test
- public void epWidgetsSortPreferenceTest(){
- EPWidgetsSortPreference epWidgetsSortPreference = mockEPWidgetsSortPreference();
-
- assertEquals(epWidgetsSortPreference.getSizeX(), 1);
- assertEquals(epWidgetsSortPreference.getSizeY(), 1);
- assertEquals(epWidgetsSortPreference.getHeaderText(), "test");
- assertEquals(epWidgetsSortPreference.getUrl(), "test");
- assertEquals(epWidgetsSortPreference.getWidgetid(), new Long(1));
- assertEquals(epWidgetsSortPreference.getWidgetIdentifier(), "test");
- assertEquals(epWidgetsSortPreference.getRow(), 1);
- assertEquals(epWidgetsSortPreference.getRow(), 1);
-
- }
-
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java
deleted file mode 100644
index 928c3737..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EcompUserAppRoles;
-
-public class EcompUserAppRolesTest {
-
- public EcompUserAppRoles mockEcompUserAppRoles(){
- EcompUserAppRoles ecompUserAppRoles = new EcompUserAppRoles();
-
- ecompUserAppRoles.setAppId("test");
- ecompUserAppRoles.setUserId((long)1);
- ecompUserAppRoles.setPriority("test");
- ecompUserAppRoles.setRoleId((long)1);
- ecompUserAppRoles.setRoleName("test");
-
- return ecompUserAppRoles;
- }
-
- @Test
- public void ecompUserAppRolesTest(){
-
- EcompUserAppRoles ecompUserAppRoles = mockEcompUserAppRoles();
-
- assertEquals(ecompUserAppRoles.getAppId(), "test");
- assertEquals(ecompUserAppRoles.getPriority(), "test");
- assertEquals(ecompUserAppRoles.getRoleName(), "test");
- assertEquals(ecompUserAppRoles.getUserId(), new Long(1));
- assertEquals(ecompUserAppRoles.getRoleId(), new Long(1));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java
deleted file mode 100644
index 11fe2cf7..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EpNotificationItemExtVO;
-
-public class EpNotificationItemExtVOTest {
-
- public EpNotificationItemExtVO mockEpNotificationItemExtVO(){
- EpNotificationItemExtVO epNotificationItemExtVO = new EpNotificationItemExtVO();
-
- //epNotificationItemExtVO.setActiveYn("abc");
- epNotificationItemExtVO.setMsgHeader("test");
- epNotificationItemExtVO.setMsgDescription("test");
- epNotificationItemExtVO.setPriority(1);
- epNotificationItemExtVO.setCreatorId(1);
- epNotificationItemExtVO.setLoginId("test");
-
- return epNotificationItemExtVO;
- }
-
- @Test
- public void epNotificationItemExtVOTest(){
- EpNotificationItemExtVO epNotificationItemExtVO = mockEpNotificationItemExtVO();
-
- assertEquals(epNotificationItemExtVO.getMsgHeader(), "test");
- assertEquals(epNotificationItemExtVO.getMsgDescription(), "test");
- assertEquals(epNotificationItemExtVO.getPriority().toString(), "1");
- assertEquals(epNotificationItemExtVO.getCreatorId().toString(), "1");
- assertEquals(epNotificationItemExtVO.getLoginId(), "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java
deleted file mode 100644
index 6e1e48c6..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EpNotificationItem;
-
-public class EpNotificationItemTest {
-
- public EpNotificationItem mockEpNotificationItem(){
- EpNotificationItem epNotificationItem = new EpNotificationItem();
-
- epNotificationItem.setNotificationId((long)1);
- epNotificationItem.setIsForOnlineUsers("test");
- epNotificationItem.setIsForAllRoles("test");
- epNotificationItem.setActiveYn("test");
- epNotificationItem.setMsgHeader("test");
- epNotificationItem.setMsgDescription("test");
- epNotificationItem.setMsgSource("test");
-
- epNotificationItem.setPriority((long)1);
- epNotificationItem.setCreatedId((long)1);
- epNotificationItem.setNotificationHyperlink("test");
-
- return epNotificationItem;
- }
-
- @Test
- public void epNotificationItemTest(){
- EpNotificationItem epNotificationItem = mockEpNotificationItem();
-
- EpNotificationItem epNotificationItem1 = new EpNotificationItem();
- epNotificationItem1.setNotificationId((long)1);
- epNotificationItem1.setIsForOnlineUsers("test");
- epNotificationItem1.setIsForAllRoles("test");
- epNotificationItem1.setActiveYn("test");
- epNotificationItem1.setMsgHeader("test");
- epNotificationItem1.setMsgDescription("test");
- epNotificationItem1.setMsgSource("test");
-
- epNotificationItem1.setPriority((long)1);
- epNotificationItem1.setCreatedId((long)1);
- epNotificationItem1.setNotificationHyperlink("test");
-
- assertEquals(epNotificationItem.getNotificationId(), new Long(1));
- assertEquals(epNotificationItem.getIsForOnlineUsers(), "test");
- assertEquals(epNotificationItem.getIsForAllRoles(), "test");
- assertEquals(epNotificationItem.getActiveYn(), "test");
- assertEquals(epNotificationItem.getMsgHeader(), "test");
- assertEquals(epNotificationItem.getMsgDescription(), "test");
- assertEquals(epNotificationItem.getMsgSource(), "test");
- assertEquals(epNotificationItem.getPriority(), new Long(1));
- assertEquals(epNotificationItem.getCreatedId(), new Long(1));
- assertEquals(epNotificationItem.getNotificationHyperlink(), "test");
-
- assertEquals(epNotificationItem.toString(), "EpNotificationItem [notificationId=1, isForOnlineUsers=test, isForAllRoles=test, activeYn=test, msgHeader=test, msgDescription=test, msgSource=test, startTime=null, endTime=null, priority=1, creatorId=null, createdDate=null, roles=null, roleIds=null]");
- assertEquals(epNotificationItem.hashCode(), epNotificationItem1.hashCode());
- assertTrue(epNotificationItem.equals(epNotificationItem1));
-
- }
-
-}
-
-
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java
deleted file mode 100644
index 35a11833..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EpNotificationItemVO;
-
-public class EpNotificationItemVOTest {
-
- public EpNotificationItemVO mockEpNotificationItemVO(){
- EpNotificationItemVO epNotificationItemVO = new EpNotificationItemVO();
-
- epNotificationItemVO.setNotificationId(1);
- epNotificationItemVO.setIsForOnlineUsers('a');
- epNotificationItemVO.setIsForAllRoles('a');
- epNotificationItemVO.setActiveYn('a');
- epNotificationItemVO.setMsgHeader("test");
- epNotificationItemVO.setMsgDescription("test");
- epNotificationItemVO.setMsgSource("test");
- epNotificationItemVO.setPriority(1);
- epNotificationItemVO.setCreatorId(1);
- epNotificationItemVO.setLoginId("test");
- epNotificationItemVO.setNotificationHyperlink("test");
-
- return epNotificationItemVO;
- }
-
- @Test
- public void epNotificationItemVOTest(){
- EpNotificationItemVO epNotificationItemVO = mockEpNotificationItemVO();
-
- assertEquals(epNotificationItemVO.getNotificationId().toString(), "1");
- /*assertEquals(epNotificationItemVO.getIsForOnlineUsers(), 'a');
- assertEquals(epNotificationItemVO.getIsForAllRoles(), 'a');
- assertEquals(epNotificationItemVO.getActiveYn(), 'a');*/
- assertEquals(epNotificationItemVO.getMsgHeader(), "test");
- assertEquals(epNotificationItemVO.getMsgDescription(), "test");
- assertEquals(epNotificationItemVO.getMsgSource(), "test");
- assertEquals(epNotificationItemVO.getPriority().toString(), "1");
- assertEquals(epNotificationItemVO.getCreatorId().toString(), "1");
- assertEquals(epNotificationItemVO.getLoginId(), "test");
- assertEquals(epNotificationItemVO.getNotificationHyperlink(), "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java
deleted file mode 100644
index beb67ba9..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem;
-
-public class EpRoleNotificationItemTest {
-
- public EpRoleNotificationItem mockEpRoleNotificationItem(){
- EpRoleNotificationItem epRoleNotificationItem = new EpRoleNotificationItem();
-
- epRoleNotificationItem.setId((long)1);
- epRoleNotificationItem.setNotificationId((long)1);
- epRoleNotificationItem.setRoleId(1);
- epRoleNotificationItem.setRecvUserId(1);
-
- return epRoleNotificationItem;
- }
-
- @Test
- public void epRoleNotificationItemTest(){
- EpRoleNotificationItem epRoleNotificationItem = mockEpRoleNotificationItem();
-
- assertEquals(epRoleNotificationItem.getId(), new Long(1));
- assertEquals(epRoleNotificationItem.getNotificationId(), new Long(1));
- assertEquals(epRoleNotificationItem.getRoleId().toString(), "1");
- assertEquals(epRoleNotificationItem.getRecvUserId().toString(), "1");
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java
deleted file mode 100644
index f490973a..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.ExternalAccessPermsDetail;
-
-public class ExternalAccessPermsDetailTest {
-
- public ExternalAccessPermsDetail mockExternalAccessPermsDetail(){
- ExternalAccessPermsDetail externalAccessPermsDetail = new ExternalAccessPermsDetail();
-
- List<String> roles = new ArrayList<String>();
-
- externalAccessPermsDetail.setType("test");
- externalAccessPermsDetail.setInstance("test");
- externalAccessPermsDetail.setAction("test");
- externalAccessPermsDetail.setDescription("test");
- externalAccessPermsDetail.setRoles(roles);
-
- return externalAccessPermsDetail;
- }
-
- @Test
- public void externalAccessPermsDetailTest(){
- ExternalAccessPermsDetail externalAccessPermsDetail = mockExternalAccessPermsDetail();
-
- List<String> roles = new ArrayList<String>();
-
- assertEquals(externalAccessPermsDetail.getType(), "test");
- assertEquals(externalAccessPermsDetail.getInstance(), "test");
- assertEquals(externalAccessPermsDetail.getAction(), "test");
- assertEquals(externalAccessPermsDetail.getDescription(), "test");
- assertEquals(externalAccessPermsDetail.getRoles(), roles);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java
deleted file mode 100644
index dfae6042..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.ExternalAccessPerms;
-
-public class ExternalAccessPermsTest {
-
- public ExternalAccessPerms mockExternalAccessPerms(){
- ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms();
-
- externalAccessPerms.setType("test");
- externalAccessPerms.setInstance("test");
- externalAccessPerms.setAction("test");
- externalAccessPerms.setDescription("test");
-
- return externalAccessPerms;
- }
-
- @Test
- public void externalAccessPermsTest(){
- ExternalAccessPerms externalAccessPerms = mockExternalAccessPerms();
-
- ExternalAccessPerms externalAccessPerms1 = new ExternalAccessPerms("test", "test", "test");
- ExternalAccessPerms externalAccessPerms2 = new ExternalAccessPerms("test", "test", "test", "test");
- ExternalAccessPerms externalAccessPerms3 = new ExternalAccessPerms();
- externalAccessPerms3.setType("test");
- externalAccessPerms3.setInstance("test");
- externalAccessPerms3.setAction("test");
- externalAccessPerms3.setDescription("test");
-
- assertEquals(externalAccessPerms.getType(), "test");
- assertEquals(externalAccessPerms.getInstance(), "test");
- assertEquals(externalAccessPerms.getAction(), "test");
- assertEquals(externalAccessPerms.getDescription(), "test");
- assertEquals(externalAccessPerms.hashCode(), externalAccessPerms3.hashCode());
-
- assertTrue(externalAccessPerms1.equals(new ExternalAccessPerms("test", "test", "test")));
- assertTrue(externalAccessPerms2.equals(new ExternalAccessPerms("test", "test", "test", "test")));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java
deleted file mode 100644
index 4e736eba..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.ExternalAccessPerms;
-import org.openecomp.portalapp.portal.transport.ExternalAccessRolePerms;
-
-public class ExternalAccessRolePermsTest {
-
- public ExternalAccessRolePerms mockExternalAccessRolePerms(){
- ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms();
- externalAccessPerms.setAction("test");
- externalAccessPerms.setDescription("test");
- externalAccessPerms.setInstance("test");
- externalAccessPerms.setType("test");
- ExternalAccessRolePerms ExternalAccessRolePerms = new ExternalAccessRolePerms(externalAccessPerms, "test");
-
- return ExternalAccessRolePerms;
- }
-
- @Test
- public void externalAccessRolePermsTest(){
- ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms();
- externalAccessPerms.setAction("test");
- externalAccessPerms.setDescription("test");
- externalAccessPerms.setInstance("test");
- externalAccessPerms.setType("test");
-
- ExternalAccessRolePerms ExternalAccessRolePerms = mockExternalAccessRolePerms();
-
- assertEquals(ExternalAccessRolePerms.getRole(), "test");
- assertEquals(ExternalAccessRolePerms.getPerm(), externalAccessPerms);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java
deleted file mode 100644
index 19dee193..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.ExternalAccessRole;
-
-public class ExternalAccessRoleTest {
-
- public ExternalAccessRole mockExternalAccessRole(){
- ExternalAccessRole externalAccessRole = new ExternalAccessRole();
-
- externalAccessRole.setName("test");
- externalAccessRole.setDescription("test");
-
- return externalAccessRole;
- }
-
- @Test
- public void externalAccessRoleTest(){
- ExternalAccessRole externalAccessRole = mockExternalAccessRole();
-
- assertEquals(externalAccessRole.getName(), "test");
- assertEquals(externalAccessRole.getDescription(), "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java
deleted file mode 100644
index 6ffab981..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.ExternalAccessUserRoleDetail;
-import org.openecomp.portalapp.portal.transport.ExternalRoleDescription;
-
-public class ExternalAccessUserRoleDetailTest {
-
- public ExternalAccessUserRoleDetail mockExternalAccessUserRoleDetail(){
-
- ExternalRoleDescription externalRoleDescription = new ExternalRoleDescription();
- externalRoleDescription.setId("test");
- externalRoleDescription.setName("test");
- externalRoleDescription.setActive("test");
- externalRoleDescription.setPriority("test");
- externalRoleDescription.setAppId("test");
- externalRoleDescription.setAppRoleId("test");
-
- ExternalAccessUserRoleDetail externalAccessUserRoleDetail = new ExternalAccessUserRoleDetail("test", externalRoleDescription);
-
- externalAccessUserRoleDetail.setName("test");
- externalAccessUserRoleDetail.setDescription(externalRoleDescription);
- return externalAccessUserRoleDetail;
- }
-
- @Test
- public void externalAccessUserRoleDetailTest(){
- ExternalAccessUserRoleDetail externalAccessUserRoleDetail = mockExternalAccessUserRoleDetail();
-
- ExternalRoleDescription externalRoleDescription1 = new ExternalRoleDescription();
- externalRoleDescription1.setId("test");
- externalRoleDescription1.setName("test");
- externalRoleDescription1.setActive("test");
- externalRoleDescription1.setPriority("test");
- externalRoleDescription1.setAppId("test");
- externalRoleDescription1.setAppRoleId("test");
-
- ExternalAccessUserRoleDetail externalAccessUserRoleDetail1 = new ExternalAccessUserRoleDetail("test", externalRoleDescription1);
-
- assertEquals(externalAccessUserRoleDetail.getName(), externalAccessUserRoleDetail1.getName());
- assertEquals(externalAccessUserRoleDetail.getDescription(), externalAccessUserRoleDetail1.getDescription());
- assertEquals(externalAccessUserRoleDetail.hashCode(), externalAccessUserRoleDetail1.hashCode());
- assertTrue(externalAccessUserRoleDetail.equals(externalAccessUserRoleDetail1));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java
deleted file mode 100644
index d2be97b1..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.ExternalAccessUser;
-
-public class ExternalAccessUserTest {
-
- public ExternalAccessUser mockExternalAccessUser(){
- ExternalAccessUser externalAccessUser = new ExternalAccessUser("test", "test");
-
- return externalAccessUser;
- }
-
- @Test
- public void externalAccessUserTest(){
- ExternalAccessUser externalAccessUser = mockExternalAccessUser();
-
- assertEquals(externalAccessUser.getRole(), "test");
- assertEquals(externalAccessUser.getUser(), "test");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java
deleted file mode 100644
index 5b6fe825..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.ExternalRoleDescription;
-
-public class ExternalRoleDescriptionTest {
-
- public ExternalRoleDescription mockExternalRoleDescription(){
-
- ExternalRoleDescription externalRoleDescription = new ExternalRoleDescription();
-
- externalRoleDescription.setId("test");
- externalRoleDescription.setName("test");
- externalRoleDescription.setActive("test");
- externalRoleDescription.setPriority("test");
- externalRoleDescription.setAppId("test");
- externalRoleDescription.setAppRoleId("test");
-
- return externalRoleDescription;
- }
-
- @Test
- public void externalRoleDescriptionTest(){
- ExternalRoleDescription externalRoleDescription = mockExternalRoleDescription();
-
- assertEquals(externalRoleDescription.getId(), "test");
- assertEquals(externalRoleDescription.getName(), "test");
- assertEquals(externalRoleDescription.getActive(), "test");
- assertEquals(externalRoleDescription.getPriority(), "test");
- assertEquals(externalRoleDescription.getAppId(), "test");
- assertEquals(externalRoleDescription.getAppRoleId(), "test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java
deleted file mode 100644
index 7d4b96e5..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuItem;
-
-public class FunctionalMenuItemTest {
-
- public FunctionalMenuItem mockFunctionalMenuItem(){
- FunctionalMenuItem functionalMenuItem = new FunctionalMenuItem();
-
- List<Integer> roles = new ArrayList<Integer>();
-
- functionalMenuItem.setRestrictedApp(false);
- functionalMenuItem.setUrl("test");
- functionalMenuItem.setRoles(roles);
-
- return functionalMenuItem;
- }
-
- @Test
- public void functionalMenuItemTest(){
- FunctionalMenuItem functionalMenuItem = mockFunctionalMenuItem();
-
- FunctionalMenuItem functionalMenuItem1 = mockFunctionalMenuItem();
-
- List<Integer> roles = new ArrayList<Integer>();
-
- functionalMenuItem1.setRestrictedApp(false);
- functionalMenuItem1.setUrl("test");
- functionalMenuItem1.setRoles(roles);
-
- assertEquals(functionalMenuItem.getRoles(), functionalMenuItem1.getRoles());
- assertEquals(functionalMenuItem.toString(), "FunctionalMenuItem [menuId=null, column=null, text=null, parentMenuId=null, url=test, active_yn=null, appid=null, roles=[], restrictedApp=false]");
- // assertTrue(functionalMenuItem.normalize(), functionalMenuItem1.normalize());
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java
deleted file mode 100644
index 09f4bc67..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.FunctionalMenuRole;
-
-public class FunctionalMenuRoleTest {
-
- public FunctionalMenuRole mockFunctionalMenuRole(){
- FunctionalMenuRole functionalMenuRole = new FunctionalMenuRole();
-
- functionalMenuRole.setId(1);
- functionalMenuRole.setMenuId((long)1);
- functionalMenuRole.setAppId(1);
- functionalMenuRole.setRoleId(1);
-
- return functionalMenuRole;
- }
-
- @Test
- public void functionalMenuRoleTest(){
- FunctionalMenuRole functionalMenuRole = mockFunctionalMenuRole();
-
- FunctionalMenuRole functionalMenuRole1 = new FunctionalMenuRole();
- functionalMenuRole1.setId(1);
- functionalMenuRole1.setMenuId((long)1);
- functionalMenuRole1.setAppId(1);
- functionalMenuRole1.setRoleId(1);
-
- assertEquals(functionalMenuRole.getId().toString(), "1");
- assertEquals(functionalMenuRole.getMenuId(), new Long(1));
- assertEquals(functionalMenuRole.getAppId().toString(), "1");
- assertEquals(functionalMenuRole.getRoleId().toString(), "1");
- assertEquals(functionalMenuRole.toString(), "FunctionalMenuRole [id=1, menuId=1, appId=1, roleId=1]");
- assertTrue(functionalMenuRole.equals(functionalMenuRole1));
- assertEquals(functionalMenuRole.hashCode(), functionalMenuRole1.hashCode());
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java
deleted file mode 100644
index ef926f6a..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.RemoteRole;
-import org.openecomp.portalapp.portal.transport.RemoteUserWithRoles;
-
-public class RemoteUserWithRolesTest {
-
- public RemoteUserWithRoles mockRemoteUserWithRoles(){
- RemoteUserWithRoles remoteUserWithRoles = new RemoteUserWithRoles();
-
- List<RemoteRole> roles = new ArrayList<RemoteRole>();
- RemoteRole remoteRole = new RemoteRole();
- remoteRole.setId((long)1);
- remoteRole.setName("test");
- roles.add(remoteRole);
-
- remoteUserWithRoles.setOrgId((long)1);
- remoteUserWithRoles.setManagerId((long)1);
- remoteUserWithRoles.setFirstName("test");
- remoteUserWithRoles.setMiddleInitial("test");
- remoteUserWithRoles.setLastName("test");
- remoteUserWithRoles.setPhone("test");
- remoteUserWithRoles.setEmail("test");
- remoteUserWithRoles.setHrid("test");
- remoteUserWithRoles.setOrgUserId("test");
- remoteUserWithRoles.setOrgCode("test");
- remoteUserWithRoles.setOrgManagerUserId("test");
- remoteUserWithRoles.setJobTitle("test");
- remoteUserWithRoles.setLoginId("test");
- remoteUserWithRoles.setActive(false);
- remoteUserWithRoles.setRoles(roles);
-
- return remoteUserWithRoles;
- }
-
- @Test
- public void remoteUserWithRolesTest(){
- RemoteUserWithRoles remoteUserWithRoles = mockRemoteUserWithRoles();
-
- assertEquals(remoteUserWithRoles.getOrgId(), new Long(1));
- assertEquals(remoteUserWithRoles.getManagerId(), new Long(1));
- assertEquals(remoteUserWithRoles.getFirstName(), "test");
- assertEquals(remoteUserWithRoles.getMiddleInitial(), "test");
- assertEquals(remoteUserWithRoles.getLastName(), "test");
- assertEquals(remoteUserWithRoles.getPhone(), "test");
- assertEquals(remoteUserWithRoles.getEmail(), "test");
- assertEquals(remoteUserWithRoles.getHrid(), "test");
- assertEquals(remoteUserWithRoles.getOrgUserId(), "test");
- assertEquals(remoteUserWithRoles.getOrgCode(), "test");
- assertEquals(remoteUserWithRoles.getOrgManagerUserId(), "test");
- assertEquals(remoteUserWithRoles.getJobTitle(), "test");
- assertEquals(remoteUserWithRoles.getLoginId(), "test");
- assertEquals(remoteUserWithRoles.getActive(), false);
- assertEquals(remoteUserWithRoles.getRoles().size(), 1);
- assertEquals(remoteUserWithRoles.toString(), "RemoteUserWithRoles [orgId=1, managerId=1, firstName=test, middleInitial=test, lastName=test, phone=test, "
- + "email=test, hrid=test, orgUserId=test, orgCode=test, orgManagerUserId=test, jobTitle=test, loginId=test, active=false, roles=[RemoteRole [id=1, name=test]]]");
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java
deleted file mode 100644
index 66624c2a..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.RoleInAppForUser;
-
-public class RoleInAppForUserTest {
-
- public RoleInAppForUser mockRoleInAppForUser(){
- RoleInAppForUser roleInAppForUser = new RoleInAppForUser((long)1 , "test");
- roleInAppForUser.setRoleId((long)1);
- roleInAppForUser.setRoleName("test");
- roleInAppForUser.setIsApplied(false);
-
- return roleInAppForUser;
- }
-
- @Test
- public void roleInAppForUserTest(){
- RoleInAppForUser roleInAppForUser = mockRoleInAppForUser();
-
- RoleInAppForUser roleInAppForUser1 = new RoleInAppForUser((long)1 , "test");
- roleInAppForUser1.setRoleId((long)1);
- roleInAppForUser1.setRoleName("test");
- roleInAppForUser1.setIsApplied(false);
-
- assertEquals(roleInAppForUser.getRoleId(), new Long(1));
- assertEquals(roleInAppForUser.getRoleName(), "test");
- assertEquals(roleInAppForUser.getIsApplied(), false);
-
- assertEquals(roleInAppForUser.toString(), "RoleInAppForUser [roleId=1, roleName=test, isApplied=false]");
- assertTrue(roleInAppForUser.equals(roleInAppForUser1));
- assertEquals(roleInAppForUser.hashCode(), roleInAppForUser1.hashCode());
- //constructor
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java
deleted file mode 100644
index 632eeb4f..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.RemoteRole;
-import org.openecomp.portalapp.portal.transport.UserApplicationRoles;
-
-public class UserApplicationRolesTest {
-
- public UserApplicationRoles mockUserApplicationRoles(){
- UserApplicationRoles userApplicationRoles = new UserApplicationRoles();
-
- List<RemoteRole> roles = new ArrayList<RemoteRole>();
- RemoteRole remoteRole = new RemoteRole();
- remoteRole.setId((long)1);
- remoteRole.setName("test");
- roles.add(remoteRole);
-
- userApplicationRoles.setAppId((long)1);
- userApplicationRoles.setOrgUserId("test");
- userApplicationRoles.setFirstName("test");
- userApplicationRoles.setLastName("test");
- userApplicationRoles.setRoles(roles);
-
- return userApplicationRoles;
- }
-
- @Test
- public void userApplicationRolesTest(){
- UserApplicationRoles userApplicationRoles = mockUserApplicationRoles();
-
- UserApplicationRoles userApplicationRoles1 = new UserApplicationRoles();
-
- List<RemoteRole> roles = new ArrayList<RemoteRole>();
- RemoteRole remoteRole = new RemoteRole();
- remoteRole.setId((long)1);
- remoteRole.setName("test");
- roles.add(remoteRole);
-
- userApplicationRoles1.setAppId((long)1);
- userApplicationRoles1.setOrgUserId("test");
- userApplicationRoles1.setFirstName("test");
- userApplicationRoles1.setLastName("test");
- userApplicationRoles1.setRoles(roles);
-
- assertEquals(userApplicationRoles.getAppId(), userApplicationRoles1.getAppId());
- assertEquals(userApplicationRoles.getOrgUserId(), userApplicationRoles1.getOrgUserId());
- assertEquals(userApplicationRoles.getFirstName(), userApplicationRoles1.getFirstName());
- assertEquals(userApplicationRoles.getLastName(), userApplicationRoles1.getLastName());
- assertEquals(userApplicationRoles.getRoles(), userApplicationRoles1.getRoles());
-
-
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java
deleted file mode 100644
index 7267dcde..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.UserWithNameSurnameTitle;
-
-public class UserWithNameSurnameTitleTest {
-
- @Test
- public void userWithNameSurnameTitleTest(){
-
- UserWithNameSurnameTitle userWithNameSurnameTitle = new UserWithNameSurnameTitle("test", "test", "test", "test");
-
- assertEquals(userWithNameSurnameTitle, new UserWithNameSurnameTitle("test", "test", "test", "test"));
- assertEquals(userWithNameSurnameTitle.hashCode(), new UserWithNameSurnameTitle("test", "test", "test", "test").hashCode());
- assertTrue(userWithNameSurnameTitle.equals(new UserWithNameSurnameTitle("test", "test", "test", "test")));
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java
deleted file mode 100644
index 6681d0a4..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.openecomp.portalapp.portal.transport;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.transport.WidgetCatalogPersonalization;
-
-public class WidgetCatalogPersonalizationTest {
-
- public WidgetCatalogPersonalization mockWidgetCatalogPersonalization(){
- WidgetCatalogPersonalization widgetCatalogPersonalization = new WidgetCatalogPersonalization();
-
- widgetCatalogPersonalization.setWidgetId((long)1);
- widgetCatalogPersonalization.setSelect(false);
- return widgetCatalogPersonalization;
- }
-
- @Test
- public void widgetCatalogPersonalizationTest(){
- WidgetCatalogPersonalization widgetCatalogPersonalization = mockWidgetCatalogPersonalization();
-
- assertEquals(widgetCatalogPersonalization.getWidgetId(), new Long(1));
- assertEquals(widgetCatalogPersonalization.getSelect(), false);
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/exceptions/NoHealthyServiceExceptionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/exceptions/NoHealthyServiceExceptionTest.java
deleted file mode 100644
index 33389fbc..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/exceptions/NoHealthyServiceExceptionTest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.openecomp.portalapp.test.exceptions;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.portalapp.portal.exceptions.NoHealthyServiceException;
-
-public class NoHealthyServiceExceptionTest {
-
- public NoHealthyServiceException mockNoHealthyServiceException(){
- NoHealthyServiceException noHealthyServiceException = new NoHealthyServiceException("test");
-
- return noHealthyServiceException;
- }
-
- @Test
- public void noHealthyServiceExceptionTest(){
- NoHealthyServiceException noHealthyServiceException = mockNoHealthyServiceException();
-
- // assertEquals(noHealthyServiceException, new NoHealthyServiceException("test"));
- assertEquals(noHealthyServiceException.toString(), "NoHealthyServiceException [] test");
- }
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/ApplicationCommonContextTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/ApplicationCommonContextTestSuite.java
deleted file mode 100644
index cba7c57b..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/ApplicationCommonContextTestSuite.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.test.framework;
-
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.openecomp.portalsdk.core.conf.AppConfig;
-//import org.openecomp.portalapp.conf.ExternalAppConfig;
-//import org.openecomp.portalapp.conf.HibernateMappingLocations;
-import org.openecomp.portalsdk.core.conf.HibernateConfiguration;
-import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable;
-import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
-import org.openecomp.portalsdk.core.util.CacheManager;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.FilterType;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.transaction.TransactionConfiguration;
-import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
-import org.springframework.test.context.web.WebAppConfiguration;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-
-/**
- *
- * In order to write a unit test, 1. inherit this class 2. place the "war"
- * folder on your test class's classpath 3. run the test with the following VM
- * argument; This is important because when starting the application from
- * Container, the System Properties file (SystemProperties.java) can have the
- * direct path but, when running from the Mock Junit container, the path should
- * be prefixed with "classpath" to enable the mock container to search for the
- * file in the classpath -Dcontainer.classpath="classpath:"
- */
-
-@SuppressWarnings("deprecation")
-@RunWith(SpringJUnit4ClassRunner.class)
-@WebAppConfiguration
-@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class })
-@ActiveProfiles(value = "test")
-public class ApplicationCommonContextTestSuite {
-
- @Autowired
- public WebApplicationContext wac;
-
- private MockMvc mockMvc;
-
- @Before
- public void setup() {
- if (mockMvc == null) {
- this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
-
- }
- }
-
- public Object getBean(String name) {
- return this.wac.getBean(name);
- }
-
- public MockMvc getMockMvc() {
- return mockMvc;
- }
-
- public void setMockMvc(MockMvc mockMvc) {
- this.mockMvc = mockMvc;
- }
-
- public WebApplicationContext getWebApplicationContext() {
- return wac;
- }
-
-}
-
-@Configuration
-@ComponentScan(basePackages = "org.openecomp", excludeFilters = {
- // the following source configurations should not be scanned; instead of
- // using Exclusion filter, we can use the @Profile annotation to exclude
- // them
- @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.LogoutController*"),
- @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.SDKLoginController*"),
- @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalapp.conf.ExternalAppConfig*"),
- @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.*.*InitUebHandler*") })
-@Profile("test")
-class MockAppConfig extends AppConfig {
-
- @Bean
- HibernateMappingLocatable locatable() {
- return new MockHibernateMappingLocations();
- }
-
- @Bean
- HibernateConfiguration hibConfiguration() {
- return new HibernateConfiguration();
- }
-
- @Bean
- public SystemProperties systemProperties() {
- return new MockSystemProperties();
- }
-
- @Bean
- public AbstractCacheManager cacheManager() {
- return new CacheManager() {
-
- public void configure() throws IOException {
-
- }
- };
- }
-
- public String[] tileDefinitions() {
- return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml",
- "classpath:/WEB-INF/defs/definitions.xml" };
- }
-
- public void addInterceptors(InterceptorRegistry registry) {
- // registry.addInterceptor(new
- // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
- // registry.addInterceptor(resourceInterceptor());
- }
-
- public static class MockSystemProperties extends SystemProperties {
-
- public MockSystemProperties() {
- }
-
- }
-
-}
-
-@Profile("test")
-class MockHibernateMappingLocations implements HibernateMappingLocatable {
-
- public Resource[] getMappingLocations() {
- return new Resource[] { new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"),
- new ClassPathResource("WEB-INF/fusion/orm/EP.hbm.xml"),
- new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml") };
-
- }
-
- public String[] getPackagesToScan() {
- return new String[] { "org.openecomp", "src" };
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/MockitoTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/MockitoTestSuite.java
deleted file mode 100644
index 8c5d3d21..00000000
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/MockitoTestSuite.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-package org.openecomp.portalapp.test.framework;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-
-@RunWith(MockitoJUnitRunner.class)
-public class MockitoTestSuite {
-
-
- public MockHttpServletRequestWrapper mockedRequest = new MockHttpServletRequestWrapper(
- Mockito.mock(HttpServletRequest.class));
- public HttpServletResponse mockedResponse = Mockito.mock(HttpServletResponse.class);
-
- public MockHttpServletRequestWrapper getMockedRequest() {
- return mockedRequest;
- }
-
- public HttpServletResponse getMockedResponse() {
- return mockedResponse;
- }
-
- public class MockHttpServletRequestWrapper extends HttpServletRequestWrapper {
-
- HttpSession session = Mockito.mock(HttpSession.class);
-
- public MockHttpServletRequestWrapper(HttpServletRequest request) {
- super(request);
-
- }
-
- @Override
- public HttpSession getSession() {
-
- return session;
- }
-
- @Override
- public HttpSession getSession(boolean create) {
-
- return session;
- }
-
- }
-
-}
diff --git a/ecomp-portal-BE-common-test/src/main/resources/PopulateTestData.sql b/ecomp-portal-BE-common-test/src/main/resources/PopulateTestData.sql
deleted file mode 100644
index 5d1977b4..00000000
--- a/ecomp-portal-BE-common-test/src/main/resources/PopulateTestData.sql
+++ /dev/null
@@ -1,32 +0,0 @@
----
--- ================================================================================
--- ECOMP Portal
--- ================================================================================
--- Copyright (C) 2017 AT&T Intellectual Property
--- ================================================================================
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
--- ================================================================================
----
-insert into fn_user values(-1,null,null,'test',null,'test',null,null,null,null,null,null,null,'guestT',null,null,null,null,true,null,null,null,null,false,null,null,null,
-null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
-insert into fn_user_role values(-1,1, null,1);
-insert into fn_user_role values(-1,16, null,1);
-insert into fn_user_role values(-1,999, null,1);
-insert into fn_user_role values(-1,1010, null,1);
-insert into fn_menu_functional values(-1,3,'Network Analytics',5,'http://test.portal.onap.org:8080/welcome.htm','Y',null);
-insert into fn_menu_functional_roles values(-1, 137,456, 6214);
-insert into fn_menu_favorites values(-1, 141);
-insert into ep_web_analytics_source values(-1,1,'test_url','test');
-INSERT INTO ep_notification (notification_ID, is_for_online_users, is_for_all_roles, active_YN, msg_header, msg_description,msg_source,start_time,end_time,priority,creator_ID,created_date)
-VALUES ('-1', 'Y', 'N', 'Y', 'CISCO_1921C1_ISR_G2', '{}','aotstm','2017-03-26 12:18:55.0','2017-04-25 12:18:55.0','2',NULL,'2017-04-25 21:18:11.0');
-INSERT INTO ep_role_notification (ID,notification_ID,role_ID,recv_user_id ) VALUES (0,-1,NULL,10)
diff --git a/ecomp-portal-BE-common-test/src/main/resources/RemoveTestData.sql b/ecomp-portal-BE-common-test/src/main/resources/RemoveTestData.sql
deleted file mode 100644
index 5a3000a4..00000000
--- a/ecomp-portal-BE-common-test/src/main/resources/RemoveTestData.sql
+++ /dev/null
@@ -1,31 +0,0 @@
----
--- ================================================================================
--- ECOMP Portal
--- ================================================================================
--- Copyright (C) 2017 AT&T Intellectual Property
--- ================================================================================
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
--- ================================================================================
----
-delete from fn_user_role where user_id =-1;
-delete from ep_user_notification where user_id=-1;
-delete from fn_audit_log where user_id=-1;
-delete from fn_menu_favorites where user_id=-1 and menu_id=141;
-delete from fn_user where user_id=-1;
-delete from fn_menu_functional_roles where id=-1;
-delete from fn_menu_functional_ancestors where menu_id=-1;
-delete from fn_menu_functional where menu_id=-1;
-delete from fn_menu_favorites where user_id=-1 and menu_id=141;
-delete from ep_web_analytics_source where resource_id=-1;
-delete from ep_role_notification where notification_ID='-1';
-delete from ep_notification where notification_ID='-1';