Add doc folder.
[portal.git] / ecomp-portal-BE-common-test / src / main / java / org / openecomp / portalapp / portal / test / service / FunctionalMenuServiceImplTest.java
1 /*-
2  * ================================================================================
3  * ECOMP Portal
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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  * ================================================================================
19  */
20 package org.openecomp.portalapp.portal.test.service;
21
22 import static org.junit.Assert.assertTrue;
23
24 import java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28
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;
35
36 public class FunctionalMenuServiceImplTest extends ApplicationCommonContextTestSuite {
37
38         @Autowired
39         FunctionalMenuService functionalMenuService;
40
41         @Test
42         public void getAppListTestService() throws Exception {
43
44                 String userId = "guestT";
45                 List<BusinessCardApplicationRole> userAppRolesActualResult = null;
46
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));
56
57         }
58
59         @Test
60         public void getFunctionalMenuRoleTest() throws Exception {
61
62                 FunctionalMenuRole expectedFunctionalMenuRole = new FunctionalMenuRole();
63                 expectedFunctionalMenuRole.setId(new Integer(-1));
64
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));
71
72         }
73 }