Added oparent to sdc main
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / ecomp / EcompIntImplTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
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  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.ecomp;
22
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;
28
29 import javax.servlet.http.HttpServletRequest;
30 import java.util.List;
31
32 public class EcompIntImplTest {
33
34     private EcompIntImpl createTestSubject() {
35         return new EcompIntImpl();
36     }
37
38     @Test(expected=PortalAPIException.class)
39     public void testPushUser() throws Exception {
40         EcompIntImpl testSubject;
41         EcompUser user = null;
42
43         // default test
44         testSubject = createTestSubject();
45         testSubject.pushUser(user);
46     }
47
48     @Test(expected=PortalAPIException.class)
49     public void testEditUser() throws Exception {
50         EcompIntImpl testSubject;
51         String loginId = "";
52         EcompUser user = null;
53
54         // default test
55         testSubject = createTestSubject();
56         testSubject.editUser(loginId, user);
57     }
58
59     @Test(expected=PortalAPIException.class)
60     public void testGetUser() throws Exception {
61         EcompIntImpl testSubject;
62         String loginId = "";
63         EcompUser result;
64
65         // default test
66         testSubject = createTestSubject();
67         result = testSubject.getUser(loginId);
68     }
69
70     @Test(expected=PortalAPIException.class)
71     public void testGetUsers() throws Exception {
72         EcompIntImpl testSubject;
73         List<EcompUser> result;
74
75         // default test
76         testSubject = createTestSubject();
77         result = testSubject.getUsers();
78     }
79
80     @Test
81     public void testGetAvailableRoles() throws Exception {
82         EcompIntImpl testSubject;
83         List<EcompRole> result;
84
85         // default test
86         testSubject = createTestSubject();
87         result = testSubject.getAvailableRoles("Mock");
88     }
89
90     @Test(expected= PortalAPIException.class)
91     public void testGetUserRoles() throws Exception {
92         EcompIntImpl testSubject;
93         String loginId = "";
94         List<EcompRole> result;
95
96         // default test
97         testSubject = createTestSubject();
98         result = testSubject.getUserRoles(loginId);
99     }
100
101     @Test
102     public void testIsAppAuthenticated() throws Exception {
103         EcompIntImpl testSubject;
104         boolean result;
105         HttpServletRequest httpServletRequestImpl = Mockito.mock(HttpServletRequest.class);
106         // default test
107         testSubject = createTestSubject();
108         result = testSubject.isAppAuthenticated(httpServletRequestImpl);
109     }
110
111     @Test
112     public void testGetUserId() throws Exception {
113         EcompIntImpl testSubject;
114         HttpServletRequest httpServletRequestImpl = Mockito.mock(HttpServletRequest.class);
115         String result;
116
117         // default test
118         testSubject = createTestSubject();
119         result = testSubject.getUserId(httpServletRequestImpl);
120     }
121 }