Mass removal of all Tabs (Style Warnings)
[aaf/authz.git] / auth / auth-batch / src / test / java / org / onap / aaf / auth / helpers / test / JU_UserRole.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
4  * ===========================================================================
5  * Copyright (c) 2018 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
22 package org.onap.aaf.auth.helpers.test;
23
24 import static org.junit.Assert.*;
25 import org.junit.After;
26 import org.junit.Before;
27 import org.junit.Test;
28 import org.mockito.Mock;
29 import org.mockito.Mockito;
30 import org.onap.aaf.auth.actions.URDelete;
31 import org.onap.aaf.auth.dao.cass.UserRoleDAO;
32 import org.onap.aaf.auth.env.AuthzTrans;
33 import org.onap.aaf.auth.helpers.UserRole;
34
35 import junit.framework.Assert;
36
37 import static org.mockito.Mockito.*;
38
39 import java.io.PrintStream;
40 import java.util.Date;
41
42 import org.junit.Test;
43
44 public class JU_UserRole {
45     
46     UserRole userRole;
47     UserRole userRole1;
48     Date date;
49     PrintStream ds;
50     
51     @Before
52     public void setUp() {
53         date = new Date();
54         userRole = new UserRole("user", "ns", "rname", date);
55         userRole = new UserRole("user", "role", "ns", "rname", date);
56     }
57
58     @Test
59     public void testTotalLoaded() {
60         Assert.assertEquals(0, userRole.totalLoaded());
61     }
62     
63     @Test
64     public void testDeleted() {
65         Assert.assertEquals(0, userRole.deleted());
66     }
67     
68     @Test
69     public void testExpunge() {
70         userRole.expunge();
71     }
72     
73     @Test
74     public void testSetDeleteStream() {
75         userRole.setDeleteStream(ds);
76     }
77     
78     @Test
79     public void testSetRecoverStream() {
80         userRole.setRecoverStream(ds);
81     }
82     
83     @Test
84     public void testUrdd() {
85         Assert.assertTrue(userRole.urdd() instanceof UserRoleDAO.Data);
86     }
87     
88     @Test
89     public void testUser() {
90         Assert.assertEquals("user", userRole.user());
91     }
92     
93     @Test
94     public void testRole() {
95         Assert.assertEquals("role", userRole.role());
96     }
97     
98     @Test
99     public void testNs() {
100         Assert.assertEquals("ns", userRole.ns());
101     }
102     
103     @Test
104     public void testRName() {
105         Assert.assertEquals("rname", userRole.rname());
106     }
107     
108     @Test
109     public void testExpires() {
110         Assert.assertEquals(date, userRole.expires());
111         userRole.expires(date);
112     }
113     
114     @Test
115     public void testToString() {
116         Assert.assertTrue(userRole.toString() instanceof String);
117     }
118     
119     @Test
120     public void testGet() {
121         userRole.get("u", "r");
122     }
123     
124     @Test
125     public void testResetLocalData() {
126         userRole.resetLocalData();
127     }
128     
129     @Test
130     public void testSizeForDeletion() {
131         Assert.assertEquals(0, userRole.sizeForDeletion());
132     }
133     
134     @Test
135     public void testPendingDelete() {
136         Assert.assertFalse(userRole.pendingDelete(userRole));
137     }
138     
139     @Test
140     public void testActuateDeletionNow() {
141         AuthzTrans trans = mock(AuthzTrans.class);
142         URDelete urd = mock(URDelete.class);
143         userRole.actuateDeletionNow(trans,urd);
144     }
145
146 }