update the package name
[dmaap/messagerouter/msgrtr.git] / src / test / java / org / onap / dmaap / mr / cambria / metabroker / TopicImplemTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Engine
4  * ================================================================================
5  * Copyright (C) 2017 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.onap.dmaap.mr.cambria.metabroker;
22
23 import static org.junit.Assert.*;
24
25 import org.junit.After;
26 import org.junit.Before;
27 import org.junit.Test;
28
29 import com.att.nsa.configs.ConfigDbException;
30 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
31
32 public class TopicImplemTest {
33
34         @Before
35         public void setUp() throws Exception {
36         }
37
38         @After
39         public void tearDown() throws Exception {
40         }
41
42         
43         @Test
44         public void testGetOwners() {
45
46                 assertNotNull(new TopicImplem().getOwner());
47
48         }
49         
50         @Test
51         public void testGetName() {
52
53                 assertNotNull(new TopicImplem().getName());
54
55         }
56         
57         @Test
58         public void testGetOwner() {
59
60                 assertNotNull(new TopicImplem().getOwner());
61
62         }
63         
64         @Test
65         public void testGetDescription() {
66
67                 assertNotNull(new TopicImplem().getDescription());
68
69         }
70         
71         @Test
72         public void testIsTransactionEnabled() {
73
74                 assertTrue(new TopicImplem().isTransactionEnabled());
75
76         }
77         
78         @Test
79         public void testGetReaderAcl() {
80                 new TopicImplem().getReaderAcl();
81                 assertTrue(true);
82
83         }
84         
85         @Test
86         public void testGetWriterAcl() {
87                 new TopicImplem().getReaderAcl();
88                 assertTrue(true);
89
90         }
91         
92
93         @Test
94         public void testCheckUserRead() {
95                 try {
96                         new TopicImplem().checkUserRead(null);
97                 } catch (AccessDeniedException e) {
98                         // TODO Auto-generated catch block
99                         e.printStackTrace();
100                 }
101                 assertTrue(true);
102
103         }
104         
105         @Test
106         public void testCheckUserWrite() {
107                 try {
108                         new TopicImplem().checkUserWrite(null);
109                 } catch (AccessDeniedException e) {
110                         // TODO Auto-generated catch block
111                         e.printStackTrace();
112                 }
113                 assertTrue(true);
114
115         }
116         
117         @Test
118         public void testPermitWritesFromUser() {
119                 try {
120                         new TopicImplem().permitWritesFromUser("publisherId", null);
121                 } catch (AccessDeniedException e) {
122                         // TODO Auto-generated catch block
123                         e.printStackTrace();
124                 } catch (ConfigDbException e) {
125                         // TODO Auto-generated catch block
126                         e.printStackTrace();
127                 }
128                 assertTrue(true);
129
130         }
131         
132         @Test
133         public void testDenyWritesFromUser() {
134                 try {
135                         new TopicImplem().denyWritesFromUser("publisherId", null);
136                 } catch (AccessDeniedException e) {
137                         // TODO Auto-generated catch block
138                         e.printStackTrace();
139                 } catch (ConfigDbException e) {
140                         // TODO Auto-generated catch block
141                         e.printStackTrace();
142                 }
143                 assertTrue(true);
144
145         }
146         
147         @Test
148         public void testPermitReadsByUser() {
149                 try {
150                         new TopicImplem().permitReadsByUser("consumerId", null);
151                 } catch (AccessDeniedException e) {
152                         // TODO Auto-generated catch block
153                         e.printStackTrace();
154                 } catch (ConfigDbException e) {
155                         // TODO Auto-generated catch block
156                         e.printStackTrace();
157                 }
158                 assertTrue(true);
159
160         }
161         
162         @Test
163         public void testDenyReadsByUser() {
164                 try {
165                         new TopicImplem().denyReadsByUser("consumerId", null);
166                 } catch (AccessDeniedException e) {
167                         // TODO Auto-generated catch block
168                         e.printStackTrace();
169                 } catch (ConfigDbException e) {
170                         // TODO Auto-generated catch block
171                         e.printStackTrace();
172                 }
173                 assertTrue(true);
174
175         }
176 }