2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalapp.portal.test.service;
22 import static org.junit.Assert.assertTrue;
24 import java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.List;
29 import org.junit.Test;
30 import org.openecomp.portalapp.portal.service.FunctionalMenuService;
31 import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole;
32 import org.openecomp.portalapp.portal.transport.FunctionalMenuRole;
33 import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite;
34 import org.springframework.beans.factory.annotation.Autowired;
36 public class FunctionalMenuServiceImplTest extends ApplicationCommonContextTestSuite {
39 FunctionalMenuService functionalMenuService;
42 public void getAppListTestService() throws Exception {
44 String userId = "guestT";
45 List<BusinessCardApplicationRole> userAppRolesActualResult = null;
47 List<BusinessCardApplicationRole> userAppRolesExpectedResult = new ArrayList<BusinessCardApplicationRole>();
48 BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole();
49 businessCardApplicationRole.setAppName("ECOMP Portal");
50 businessCardApplicationRole.setRoleName("System Administrator");
51 userAppRolesExpectedResult.add(businessCardApplicationRole);
52 Map<String, String> params = new HashMap<String, String>();
53 params.put("userId", userId);
54 userAppRolesActualResult = functionalMenuService.getUserAppRolesList(userId);
55 assertTrue(userAppRolesActualResult.contains(businessCardApplicationRole));
60 public void getFunctionalMenuRoleTest() throws Exception {
62 FunctionalMenuRole expectedFunctionalMenuRole = new FunctionalMenuRole();
63 expectedFunctionalMenuRole.setId(new Integer(-1));
65 expectedFunctionalMenuRole.setMenuId((long) 137);
66 expectedFunctionalMenuRole.setAppId(new Integer(456));
67 expectedFunctionalMenuRole.setRoleId(new Integer(6214));
68 List<FunctionalMenuRole> actualFunctionalMenuRoleList = null;
69 actualFunctionalMenuRoleList = functionalMenuService.getFunctionalMenuRole();
70 assertTrue(actualFunctionalMenuRoleList.contains(expectedFunctionalMenuRole));