-/*-\r
- * ================================================================================\r
- * ECOMP Portal\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ================================================================================\r
- */\r
-package org.openecomp.portalapp.portal.test.service;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.junit.Test;\r
-import org.openecomp.portalapp.portal.service.FunctionalMenuService;\r
-import org.openecomp.portalapp.portal.test.framework.ApplicationCommonContextTestSuite;\r
-import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole;\r
-import org.openecomp.portalapp.portal.transport.FunctionalMenuRole;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-\r
-\r
-\r
-\r
-public class FunctionalMenuServiceImplTest extends ApplicationCommonContextTestSuite{\r
-\r
- \r
- @Autowired\r
- FunctionalMenuService functionalMenuService;\r
- \r
- \r
- \r
- @Test\r
- public void getAppListTestService() throws Exception {\r
- \r
- String userId ="guest";\r
- List<BusinessCardApplicationRole> userAppRolesActualResult = null;\r
- \r
- List<BusinessCardApplicationRole> userAppRolesExpectedResult = new ArrayList<BusinessCardApplicationRole>();\r
- BusinessCardApplicationRole businessCardApplicationRole= new BusinessCardApplicationRole();\r
- businessCardApplicationRole.setAppName("ECOMP Portal");\r
- businessCardApplicationRole.setRoleName("System Administrator"); \r
- userAppRolesExpectedResult.add(businessCardApplicationRole);\r
- Map<String, String> params = new HashMap<String, String>();\r
- params.put("userId", userId);\r
- userAppRolesActualResult =functionalMenuService.getUserAppRolesList(userId);\r
- assertTrue(userAppRolesActualResult.contains(businessCardApplicationRole));\r
- \r
- \r
- }\r
- \r
-\r
- @Test\r
- public void getFunctionalMenuRoleTest() throws Exception {\r
- \r
- FunctionalMenuRole expectedFunctionalMenuRole = new FunctionalMenuRole();\r
- \r
- expectedFunctionalMenuRole.setId(new Integer(99999999)) ;\r
- expectedFunctionalMenuRole.setMenuId((long) 137);\r
- expectedFunctionalMenuRole.setAppId(new Integer(456));\r
- expectedFunctionalMenuRole.setRoleId(new Integer(6214));\r
- List<FunctionalMenuRole> actualFunctionalMenuRoleList = null;\r
- actualFunctionalMenuRoleList = functionalMenuService.getFunctionalMenuRole();\r
- assertEquals(expectedFunctionalMenuRole.getAppId(),actualFunctionalMenuRoleList.get(actualFunctionalMenuRoleList.size()-1).getAppId());\r
- assertEquals(expectedFunctionalMenuRole.getMenuId(),actualFunctionalMenuRoleList.get(actualFunctionalMenuRoleList.size()-1).getMenuId());\r
- assertEquals(expectedFunctionalMenuRole.getId(),actualFunctionalMenuRoleList.get(actualFunctionalMenuRoleList.size()-1).getId());\r
- assertEquals(expectedFunctionalMenuRole.getRoleId(),actualFunctionalMenuRoleList.get(actualFunctionalMenuRoleList.size()-1).getRoleId());\r
- \r
- }\r
- \r
-}\r
-\r
-\r
+/*-
+ * ================================================================================
+ * 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));
+
+ }
+}