diff options
author | 2019-12-17 20:49:19 +0000 | |
---|---|---|
committer | 2019-12-17 20:49:19 +0000 | |
commit | 059edd0c134cecfa6939f35fb8eb847d4c40631f (patch) | |
tree | 3c6ccb2f32a30842b9acca236754f48f63bb290b /portal-BE/src/test | |
parent | ba2d7bcaf4ce42fd0c8742dc462ef0160bdfd8f7 (diff) | |
parent | 9a391d0c4cca00a1cd448a6ce3fa755d42c8fd5d (diff) |
Merge "Dao object moved from dao packege to package by component in service folder"
Diffstat (limited to 'portal-BE/src/test')
9 files changed, 54 insertions, 57 deletions
diff --git a/portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java index e00dc5ca..ca0cf920 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java @@ -45,13 +45,13 @@ import static org.junit.jupiter.api.Assertions.assertNull; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; -import org.onap.portal.dao.fn.FnLanguageDao; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.PortalRestResponse; import org.onap.portal.domain.dto.PortalRestStatusEnum; import org.onap.portal.domain.dto.fn.FnLanguageDto; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -69,7 +69,7 @@ class LanguageControllerTest { @Autowired private LanguageController languageController; @Autowired - private FnLanguageDao fnLanguageDao; + private FnLanguageService fnLanguageService; @Autowired private FnUserService fnUserService; @@ -89,7 +89,7 @@ class LanguageControllerTest { assertEquals(expected.getMessage(), actual.getMessage()); assertEquals(expected.getStatus(), actual.getStatus()); //Clean up - fnLanguageDao.delete(fnLanguage); + fnLanguageService.delete(fnLanguage); } @Test @@ -109,7 +109,7 @@ class LanguageControllerTest { assertEquals(expected.getMessage(), actual.getMessage()); assertEquals(expected.getStatus(), actual.getStatus()); //Clean up - fnLanguageDao.delete(fnLanguage); + fnLanguageService.delete(fnLanguage); } @Test @@ -138,7 +138,7 @@ class LanguageControllerTest { //Clean up - fnLanguageDao.delete(fnLanguage); + fnLanguageService.delete(fnLanguage); } @Test @@ -162,7 +162,7 @@ class LanguageControllerTest { //Clean up - fnLanguageDao.delete(fnLanguage); + fnLanguageService.delete(fnLanguage); } diff --git a/portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java index 0316683f..7c654ad4 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java @@ -47,7 +47,7 @@ import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.PortalRestResponse; import org.onap.portal.domain.dto.PortalRestStatusEnum; import org.onap.portal.domain.dto.transport.ProfileDetail; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.user.FnUserService; import org.onap.portalsdk.core.onboarding.exception.CipherUtilException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; diff --git a/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java index e83c2470..e9f9627e 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java @@ -45,11 +45,11 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.onap.portal.domain.dto.ecomp.ExternalSystemAccess; -import org.onap.portal.service.fn.FnAppService; -import org.onap.portal.service.fn.FnLanguageService; -import org.onap.portal.service.fn.FnRoleService; -import org.onap.portal.service.fn.FnUserRoleService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.app.FnAppService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.role.FnRoleService; +import org.onap.portal.service.userRole.FnUserRoleService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java index 27ce3484..65525dbe 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java @@ -51,18 +51,17 @@ import java.util.List; import javax.transaction.Transactional; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.portal.dao.fn.FnLanguageDao; import org.onap.portal.domain.db.ep.EpMicroserviceParameter; import org.onap.portal.domain.db.ep.EpWidgetCatalog; import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.ecomp.WidgetCatalog; -import org.onap.portal.service.ep.EpMicroserviceParameterService; -import org.onap.portal.service.ep.EpWidgetCatalogParameterService; -import org.onap.portal.service.ep.EpWidgetCatalogService; -import org.onap.portal.service.fn.FnLanguageService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; +import org.onap.portal.service.widgetCatalogParameter.EpWidgetCatalogParameterService; +import org.onap.portal.service.widgetCatalog.EpWidgetCatalogService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -88,8 +87,6 @@ public class WidgetsCatalogControllerTest { private EpMicroserviceParameterService epMicroserviceParameterService; @Autowired private EpWidgetCatalogService epWidgetCatalogService; - @Autowired - private FnLanguageDao fnLanguageDao; @Test public void getUserWidgetCatalog() { @@ -172,7 +169,7 @@ public class WidgetsCatalogControllerTest { EpMicroserviceParameter parameter = new EpMicroserviceParameter(); epMicroserviceParameterService.save(parameter); FnUser user = buildFnUser(); - FnLanguage language = fnLanguageDao.getByLanguageAlias("EN"); + FnLanguage language = fnLanguageService.getByLanguageAlias("EN"); user.setLanguageId(language); fnUserService.saveFnUser(user); EpWidgetCatalogParameter data = EpWidgetCatalogParameter.builder() diff --git a/portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java index 168fcc7a..9da6e733 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java @@ -53,8 +53,6 @@ import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.portal.dao.fn.FnLanguageDao; -import org.onap.portal.dao.fn.FnUserDao; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.db.fn.FnWidget; @@ -62,8 +60,9 @@ import org.onap.portal.domain.dto.transport.FieldsValidator; import org.onap.portal.domain.dto.transport.OnboardingWidget; import org.onap.portal.domain.dto.transport.WidgetCatalogPersonalization; import org.onap.portal.framework.MockitoTestSuite; -import org.onap.portal.service.WidgetService; -import org.onap.portal.service.fn.FnLanguageService; +import org.onap.portal.service.user.FnUserService; +import org.onap.portal.service.widget.WidgetService; +import org.onap.portal.service.language.FnLanguageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -89,14 +88,11 @@ public class WidgetsControllerTest { @Autowired private WidgetsController widgetsController; @Autowired - private FnUserDao fnUserDao; - @Autowired - private FnLanguageDao fnLanguageDao; - @Autowired private WidgetService widgetService; @Autowired private FnLanguageService fnLanguageService; - + @Autowired + FnUserService fnUserService; private FnLanguage language; private FnUser questUser; private FnUser notQuestUser; @@ -120,14 +116,14 @@ public class WidgetsControllerTest { public void getOnboardingWidgetsQuestUserTest() { UsernamePasswordAuthenticationToken questPrincipal = new UsernamePasswordAuthenticationToken("questUser", "demo123"); - fnUserDao.save(questUser); + fnUserService.save(questUser); List<OnboardingWidget> onboardingWidgets = widgetsController .getOnboardingWidgets(questPrincipal, request, response); assertNull(onboardingWidgets); //Clean up - fnUserDao.delete(questUser); - fnLanguageDao.delete(language); + fnUserService.delete(questUser); + fnLanguageService.delete(language); } @Test @@ -135,7 +131,7 @@ public class WidgetsControllerTest { UsernamePasswordAuthenticationToken notQuestprincipal = new UsernamePasswordAuthenticationToken( "notQuestUser", "demo123"); - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); List<OnboardingWidget> expected = new ArrayList<>(); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); @@ -143,7 +139,7 @@ public class WidgetsControllerTest { .getOnboardingWidgets(notQuestprincipal, request, response); assertEquals(expected, actual); - fnUserDao.delete(notQuestUser); + fnUserService.delete(notQuestUser); } @Test @@ -151,19 +147,19 @@ public class WidgetsControllerTest { UsernamePasswordAuthenticationToken notQuestprincipal = new UsernamePasswordAuthenticationToken( "notQuestUser", "demo123"); - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("test"); List<OnboardingWidget> actual = widgetsController .getOnboardingWidgets(notQuestprincipal, request, response); assertNull(actual); - fnUserDao.delete(notQuestUser); + fnUserService.delete(notQuestUser); } @Test public void putOnboardingWidgetSameWidget() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -199,7 +195,7 @@ public class WidgetsControllerTest { @Test public void putOnboardingWidgetAOP() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -236,7 +232,7 @@ public class WidgetsControllerTest { @Test public void putOnboardingWidgetAOPXSSTest() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -264,7 +260,7 @@ public class WidgetsControllerTest { @Test public void postOnboardingWidgetXSS() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -290,7 +286,7 @@ public class WidgetsControllerTest { @Test public void postOnboardingWidget() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -315,7 +311,7 @@ public class WidgetsControllerTest { @Test public void deleteOnboardingWidgetSCFORBIDDEN() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() diff --git a/portal-BE/src/test/java/org/onap/portal/service/ep/EpMicroserviceParameterServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/ep/EpMicroserviceParameterServiceTest.java index b4427ef3..e11a696c 100644 --- a/portal-BE/src/test/java/org/onap/portal/service/ep/EpMicroserviceParameterServiceTest.java +++ b/portal-BE/src/test/java/org/onap/portal/service/ep/EpMicroserviceParameterServiceTest.java @@ -45,6 +45,7 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.onap.portal.domain.db.ep.EpMicroserviceParameter; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; diff --git a/portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java index ad1ee60d..7c7b0b7a 100644 --- a/portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java +++ b/portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java @@ -43,19 +43,20 @@ package org.onap.portal.service.ep; import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.LocalDateTime; -import java.util.Collections; -import java.util.HashSet; + import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.onap.portal.controller.WidgetsCatalogController; -import org.onap.portal.dao.fn.FnLanguageDao; import org.onap.portal.domain.db.ep.EpMicroserviceParameter; import org.onap.portal.domain.db.ep.EpWidgetCatalog; import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; -import org.onap.portal.service.fn.FnLanguageService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; +import org.onap.portal.service.user.FnUserService; +import org.onap.portal.service.widgetCatalog.EpWidgetCatalogService; +import org.onap.portal.service.widgetCatalogParameter.EpWidgetCatalogParameterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -77,7 +78,7 @@ class EpWidgetCatalogParameterServiceTest { private final FnUserService fnUserService; private final EpMicroserviceParameterService epMicroserviceParameterService; private final EpWidgetCatalogService epWidgetCatalogService; - private final FnLanguageDao fnLanguageDao; + private final FnLanguageService fnLanguageService; @Autowired public EpWidgetCatalogParameterServiceTest( @@ -85,13 +86,13 @@ class EpWidgetCatalogParameterServiceTest { WidgetsCatalogController widgetsCatalogController, FnUserService fnUserService, EpMicroserviceParameterService epMicroserviceParameterService, - EpWidgetCatalogService epWidgetCatalogService, FnLanguageDao fnLanguageDao) { + EpWidgetCatalogService epWidgetCatalogService, FnLanguageService fnLanguageService) { this.epWidgetCatalogParameterService = epWidgetCatalogParameterService; this.widgetsCatalogController = widgetsCatalogController; this.fnUserService = fnUserService; this.epMicroserviceParameterService = epMicroserviceParameterService; this.epWidgetCatalogService = epWidgetCatalogService; - this.fnLanguageDao = fnLanguageDao; + this.fnLanguageService = fnLanguageService; } @Test @@ -154,7 +155,7 @@ class EpWidgetCatalogParameterServiceTest { } private FnUser buildFnUser() { - FnLanguage language = fnLanguageDao.getByLanguageAlias("EN"); + FnLanguage language = fnLanguageService.getByLanguageAlias("EN"); return FnUser.builder() .lastLoginDate(LocalDateTime.now()) .activeYn(true) diff --git a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java index fbb09e15..68b1a80b 100644 --- a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java +++ b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java @@ -49,6 +49,8 @@ import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.ecomp.EPUserAppCatalogRoles; +import org.onap.portal.service.user.FnUserService; +import org.onap.portal.service.userRole.FnUserRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; diff --git a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java index 56cbe815..49c018e7 100644 --- a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java +++ b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java @@ -48,10 +48,12 @@ import java.util.Arrays; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; -import org.onap.portal.dao.fn.FnLanguageDao; +import org.onap.portal.service.language.FnLanguageService; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnLuTimezone; import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.service.luTimezone.FnLuTimezoneService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -71,8 +73,6 @@ class FnUserServiceTest { private FnLuTimezoneService fnLuTimezoneService; @Autowired private FnLanguageService fnLanguageService; - @Autowired - private FnLanguageDao fnLanguageDao; @Test void saveUser(){ @@ -96,7 +96,7 @@ class FnUserServiceTest { expected.setCountryCd("US"); expected.setLanguageId(fnLanguageService.findById(1L).orElse(new FnLanguage())); expected.setGuest(false); - FnLanguage language = fnLanguageDao.getByLanguageAlias("EN"); + FnLanguage language = fnLanguageService.getByLanguageAlias("EN"); expected.setLanguageId(language); //When |