1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.core.interceptor;
21
22
23 import org.apache.directory.server.core.DirectoryService;
24 import org.apache.directory.server.core.entry.ClonedServerEntry;
25 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
26 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
27 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
28 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
29 import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
30 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
31 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
32 import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
33 import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
34 import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
35 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
36 import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
37 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
38 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
39 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
40 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
41 import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
42 import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
43 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
44 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
45 import org.apache.directory.shared.ldap.name.LdapDN;
46
47 import javax.naming.NamingException;
48 import java.util.Iterator;
49
50
51 public class MockInterceptor implements Interceptor
52 {
53 InterceptorChainTest test;
54 String name;
55
56
57 public void setName( String name )
58 {
59 this.name = name;
60 }
61
62
63 public void setTest( InterceptorChainTest test )
64 {
65 this.test = test;
66 }
67
68
69 public String getName()
70 {
71 return this.name;
72 }
73
74
75 public void init( DirectoryService directoryService )
76 throws NamingException
77 {
78 }
79
80
81 public void destroy()
82 {
83 }
84
85
86 public ClonedServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws Exception
87 {
88 test.interceptors.add( this );
89 return next.getRootDSE( opContext );
90 }
91
92
93 public LdapDN getMatchedName ( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws Exception
94 {
95 test.interceptors.add( this );
96 return next.getMatchedName( opContext );
97 }
98
99
100 public LdapDN getSuffix ( NextInterceptor next, GetSuffixOperationContext opContext ) throws Exception
101 {
102 test.interceptors.add( this );
103 return next.getSuffix( opContext );
104 }
105
106
107 public Iterator<String> listSuffixes ( NextInterceptor next, ListSuffixOperationContext opContext ) throws Exception
108 {
109 test.interceptors.add( this );
110 return next.listSuffixes( opContext );
111 }
112
113
114 public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext )
115 throws Exception
116 {
117 test.interceptors.add( this );
118 next.addContextPartition( opContext );
119 }
120
121
122 public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws Exception
123 {
124 test.interceptors.add( this );
125 next.removeContextPartition( opContext );
126 }
127
128
129 public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception
130 {
131 test.interceptors.add( this );
132 return next.compare( opContext );
133 }
134
135
136 public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
137 {
138 test.interceptors.add( this );
139 next.delete( opContext );
140 }
141
142
143 public void add( NextInterceptor next, AddOperationContext opContext )
144 throws Exception
145 {
146 test.interceptors.add( this );
147 next.add( opContext );
148 }
149
150
151 public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
152 {
153 test.interceptors.add( this );
154 next.modify( opContext );
155 }
156
157
158 public EntryFilteringCursor list( NextInterceptor next, ListOperationContext opContext ) throws Exception
159 {
160 test.interceptors.add( this );
161 return next.list( opContext );
162 }
163
164
165 public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
166 {
167 test.interceptors.add( this );
168 return next.search( opContext );
169 }
170
171
172 public ClonedServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws Exception
173 {
174 test.interceptors.add( this );
175 return next.lookup( opContext );
176 }
177
178
179 public boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws Exception
180 {
181 test.interceptors.add( this );
182 return next.hasEntry( opContext );
183 }
184
185
186 public void rename( NextInterceptor next, RenameOperationContext opContext )
187 throws Exception
188 {
189 test.interceptors.add( this );
190 next.rename( opContext );
191 }
192
193
194 public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
195 {
196 test.interceptors.add( this );
197 next.move( opContext );
198 }
199
200
201 public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
202 throws Exception
203 {
204 test.interceptors.add( this );
205 next.moveAndRename( opContext );
206 }
207
208
209 public void bind( NextInterceptor next, BindOperationContext opContext )
210 throws Exception
211 {
212 test.interceptors.add( this );
213 next.bind( opContext );
214 }
215
216
217 public void unbind( NextInterceptor next, UnbindOperationContext opContext ) throws Exception
218 {
219 test.interceptors.add( this );
220 next.unbind( opContext );
221 }
222
223
224 public String toString()
225 {
226 return name;
227 }
228 }