2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package com.att.nsa.cambria.metabroker;
\r
23 import static org.junit.Assert.*;
\r
25 import org.junit.After;
\r
26 import org.junit.Before;
\r
27 import org.junit.Test;
\r
29 import com.att.nsa.configs.ConfigDbException;
\r
30 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
\r
32 public class TopicImplemTest {
\r
35 public void setUp() throws Exception {
\r
39 public void tearDown() throws Exception {
\r
44 public void testGetOwners() {
\r
46 assertNotNull(new TopicImplem().getOwner());
\r
51 public void testGetName() {
\r
53 assertNotNull(new TopicImplem().getName());
\r
58 public void testGetOwner() {
\r
60 assertNotNull(new TopicImplem().getOwner());
\r
65 public void testGetDescription() {
\r
67 assertNotNull(new TopicImplem().getDescription());
\r
72 public void testIsTransactionEnabled() {
\r
74 assertTrue(new TopicImplem().isTransactionEnabled());
\r
79 public void testGetReaderAcl() {
\r
80 new TopicImplem().getReaderAcl();
\r
86 public void testGetWriterAcl() {
\r
87 new TopicImplem().getReaderAcl();
\r
94 public void testCheckUserRead() {
\r
96 new TopicImplem().checkUserRead(null);
\r
97 } catch (AccessDeniedException e) {
\r
98 // TODO Auto-generated catch block
\r
99 e.printStackTrace();
\r
106 public void testCheckUserWrite() {
\r
108 new TopicImplem().checkUserWrite(null);
\r
109 } catch (AccessDeniedException e) {
\r
110 // TODO Auto-generated catch block
\r
111 e.printStackTrace();
\r
118 public void testPermitWritesFromUser() {
\r
120 new TopicImplem().permitWritesFromUser("publisherId", null);
\r
121 } catch (AccessDeniedException e) {
\r
122 // TODO Auto-generated catch block
\r
123 e.printStackTrace();
\r
124 } catch (ConfigDbException e) {
\r
125 // TODO Auto-generated catch block
\r
126 e.printStackTrace();
\r
133 public void testDenyWritesFromUser() {
\r
135 new TopicImplem().denyWritesFromUser("publisherId", null);
\r
136 } catch (AccessDeniedException e) {
\r
137 // TODO Auto-generated catch block
\r
138 e.printStackTrace();
\r
139 } catch (ConfigDbException e) {
\r
140 // TODO Auto-generated catch block
\r
141 e.printStackTrace();
\r
148 public void testPermitReadsByUser() {
\r
150 new TopicImplem().permitReadsByUser("consumerId", null);
\r
151 } catch (AccessDeniedException e) {
\r
152 // TODO Auto-generated catch block
\r
153 e.printStackTrace();
\r
154 } catch (ConfigDbException e) {
\r
155 // TODO Auto-generated catch block
\r
156 e.printStackTrace();
\r
163 public void testDenyReadsByUser() {
\r
165 new TopicImplem().denyReadsByUser("consumerId", null);
\r
166 } catch (AccessDeniedException e) {
\r
167 // TODO Auto-generated catch block
\r
168 e.printStackTrace();
\r
169 } catch (ConfigDbException e) {
\r
170 // TODO Auto-generated catch block
\r
171 e.printStackTrace();
\r