update the package name
[dmaap/messagerouter/msgrtr.git] / src / test / java / org / onap / dmaap / mr / cambria / metabroker / TopicImplem.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 java.util.Set;
24
25 import org.onap.dmaap.dmf.mr.metabroker.Topic;
26 import com.att.nsa.configs.ConfigDbException;
27 import com.att.nsa.security.NsaAcl;
28 import com.att.nsa.security.NsaApiKey;
29
30 public class TopicImplem implements Topic {
31         private String name, owner, description;
32         boolean isTransactionEnabled;
33         private Set<String> set = null;
34         private  NsaAcl readerAcl, writerAcl;
35         
36         public TopicImplem() {
37                 name = getName();
38                 owner = getOwner();
39                 description = getDescription();
40                 isTransactionEnabled = true;
41                 readerAcl = getReaderAcl();
42                 writerAcl = getWriterAcl();
43         }
44         
45         public TopicImplem(String topic, String description, String ownerApiKey, boolean transactionEnabled) {
46                 
47                 this.name = topic;
48                 this.owner = ownerApiKey;
49                 this.description = description;
50                 isTransactionEnabled = transactionEnabled;
51                 
52                 
53         }
54         @Override
55         public Set<String> getOwners() {
56                 // TODO Auto-generated method stub
57                 for (int i = 0; i < 5; i++) {
58                         set.add("string" + (i + 1));
59                 }
60                 return set;
61         }
62
63         @Override
64         public String getName() {
65                 // TODO Auto-generated method stub
66                 return "testTopic";
67         }
68
69         @Override
70         public String getOwner() {
71                 // TODO Auto-generated method stub
72                 return "owner";
73         }
74
75         @Override
76         public String getDescription() {
77                 // TODO Auto-generated method stub
78                 return "topic for testing purposes";
79         }
80
81         @Override
82         public boolean isTransactionEnabled() {
83                 // TODO Auto-generated method stub
84                 return true;
85         }
86
87         @Override
88         public NsaAcl getReaderAcl() {
89                 // TODO Auto-generated method stub
90                 return new NsaAcl();
91         }
92
93         @Override
94         public NsaAcl getWriterAcl() {
95                 // TODO Auto-generated method stub
96                 return new NsaAcl();
97         }
98
99         @Override
100         public void checkUserRead(NsaApiKey user) throws AccessDeniedException {
101                 // TODO Auto-generated method stub
102                 NsaApiKey u = user;
103         }
104
105         @Override
106         public void checkUserWrite(NsaApiKey user) throws AccessDeniedException {
107                 // TODO Auto-generated method stub
108                 
109                 NsaApiKey u = user;
110         }
111
112         @Override
113         public void permitWritesFromUser(String publisherId, NsaApiKey asUser)
114                         throws AccessDeniedException, ConfigDbException {
115                 // TODO Auto-generated method stub
116                 String id = publisherId;
117                 
118         }
119
120         @Override
121         public void denyWritesFromUser(String publisherId, NsaApiKey asUser)
122                         throws AccessDeniedException, ConfigDbException {
123                 // TODO Auto-generated method stub
124                 String id = publisherId;
125                 
126         }
127
128         @Override
129         public void permitReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException, ConfigDbException {
130                 // TODO Auto-generated method stub
131                 String id = consumerId;
132         }
133
134         @Override
135         public void denyReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException, ConfigDbException {
136                 // TODO Auto-generated method stub
137                 String id = consumerId;
138         }
139
140 }