2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
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 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.ecomp;
23 import org.junit.Test;
24 import org.mockito.Mockito;
25 import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
26 import org.onap.portalsdk.core.restful.domain.EcompRole;
27 import org.onap.portalsdk.core.restful.domain.EcompUser;
29 import javax.servlet.http.HttpServletRequest;
30 import java.util.List;
32 public class EcompIntImplTest {
34 private EcompIntImpl createTestSubject() {
35 return new EcompIntImpl();
38 @Test(expected=PortalAPIException.class)
39 public void testPushUser() throws Exception {
40 EcompIntImpl testSubject;
41 EcompUser user = null;
44 testSubject = createTestSubject();
45 testSubject.pushUser(user);
48 @Test(expected=PortalAPIException.class)
49 public void testEditUser() throws Exception {
50 EcompIntImpl testSubject;
52 EcompUser user = null;
55 testSubject = createTestSubject();
56 testSubject.editUser(loginId, user);
59 @Test(expected=PortalAPIException.class)
60 public void testGetUser() throws Exception {
61 EcompIntImpl testSubject;
66 testSubject = createTestSubject();
67 result = testSubject.getUser(loginId);
70 @Test(expected=PortalAPIException.class)
71 public void testGetUsers() throws Exception {
72 EcompIntImpl testSubject;
73 List<EcompUser> result;
76 testSubject = createTestSubject();
77 result = testSubject.getUsers();
81 public void testGetAvailableRoles() throws Exception {
82 EcompIntImpl testSubject;
83 List<EcompRole> result;
86 testSubject = createTestSubject();
87 result = testSubject.getAvailableRoles("Mock");
91 public void testPushUserRole() throws Exception {
92 EcompIntImpl testSubject;
94 List<EcompRole> roles = null;
97 testSubject = createTestSubject();
99 testSubject.pushUserRole(loginId, roles);
102 @Test(expected= PortalAPIException.class)
103 public void testGetUserRoles() throws Exception {
104 EcompIntImpl testSubject;
106 List<EcompRole> result;
109 testSubject = createTestSubject();
110 result = testSubject.getUserRoles(loginId);
114 public void testIsAppAuthenticated() throws Exception {
115 EcompIntImpl testSubject;
117 HttpServletRequest httpServletRequestImpl = Mockito.mock(HttpServletRequest.class);
119 testSubject = createTestSubject();
120 result = testSubject.isAppAuthenticated(httpServletRequestImpl);
124 public void testGetUserId() throws Exception {
125 EcompIntImpl testSubject;
126 HttpServletRequest httpServletRequestImpl = Mockito.mock(HttpServletRequest.class);
130 testSubject = createTestSubject();
131 result = testSubject.getUserId(httpServletRequestImpl);