001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    package org.apache.directory.server.core;
021    
022    import java.util.Collection;
023    import java.util.List;
024    
025    import javax.naming.NamingException;
026    
027    import org.apache.directory.server.core.entry.ClonedServerEntry;
028    import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
029    import org.apache.directory.server.core.filtering.EntryFilteringCursor;
030    import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
031    import org.apache.directory.server.core.interceptor.context.OperationContext;
032    import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
033    import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
034    import org.apache.directory.shared.ldap.entry.Modification;
035    import org.apache.directory.shared.ldap.entry.ServerEntry;
036    import org.apache.directory.shared.ldap.message.control.Control;
037    import org.apache.directory.shared.ldap.name.DN;
038    
039    public class MockOperation implements OperationContext
040    {
041        final int count;
042        final CoreSession session;
043    
044    
045        public MockOperation( int count ) throws Exception 
046        {
047            this.count = count;
048            this.session = new MockCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ), 
049                new MockDirectoryService( count ) );
050        }
051    
052    
053        public EntryFilteringCursor search( SearchOperationContext opContext )
054            throws NamingException
055        {
056            return new BaseEntryFilteringCursor( new MockCursor( count ), opContext );
057        }
058    
059    
060        public EntryFilteringCursor search( SearchOperationContext opContext, Collection<String> bypass ) throws NamingException
061        {
062            return new BaseEntryFilteringCursor( new MockCursor( count ), opContext );
063        }
064    
065    
066        public void addRequestControl( Control requestControl )
067        {
068        }
069    
070    
071        public void addRequestControls( Control[] requestControls )
072        {
073        }
074    
075    
076        public void addResponseControl( Control responseControl )
077        {
078        }
079    
080    
081        public Collection<String> getByPassed()
082        {
083            return null;
084        }
085    
086    
087        public DN getDn()
088        {
089            return null;
090        }
091    
092    
093        public String getName()
094        {
095            return null;
096        }
097    
098    
099        public Control getRequestControl( String numericOid )
100        {
101            return null;
102        }
103    
104    
105        public Control getResponseControl( String numericOid )
106        {
107            return null;
108        }
109    
110    
111        public int getResponseControlCount()
112        {
113            return 0;
114        }
115    
116    
117        public Control[] getResponseControls()
118        {
119            return null;
120        }
121    
122    
123        public CoreSession getSession()
124        {
125            return session;
126        }
127    
128    
129        public boolean hasBypass()
130        {
131            return false;
132        }
133    
134    
135        public boolean hasRequestControl( String numericOid )
136        {
137            return false;
138        }
139    
140    
141        public boolean hasRequestControls()
142        {
143            return false;
144        }
145    
146    
147        public boolean hasResponseControl( String numericOid )
148        {
149            return false;
150        }
151    
152    
153        public boolean hasResponseControls()
154        {
155            return false;
156        }
157    
158    
159        public boolean isBypassed( String interceptorName )
160        {
161            return false;
162        }
163    
164    
165        public boolean isCollateralOperation()
166        {
167            return false;
168        }
169    
170    
171        public ClonedServerEntry lookup( DN dn, Collection<String> bypass ) throws Exception
172        {
173            return null;
174        }
175    
176    
177        public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception
178        {
179            return null;
180        }
181    
182    
183        public LookupOperationContext newLookupContext( DN dn )
184        {
185            return null;
186        }
187    
188    
189        public void setByPassed( Collection<String> byPassed )
190        {
191        }
192    
193    
194        public void setCollateralOperation( boolean collateralOperation )
195        {
196        }
197    
198    
199        public void setDn( DN dn )
200        {
201        }
202    
203    
204        public LdapPrincipal getEffectivePrincipal()
205        {
206            return null;
207        }
208    
209    
210        public OperationContext getFirstOperation()
211        {
212            return null;
213        }
214    
215    
216        public OperationContext getLastOperation()
217        {
218            return null;
219        }
220    
221    
222        public OperationContext getNextOperation()
223        {
224            return null;
225        }
226    
227    
228        public OperationContext getPreviousOperation()
229        {
230            return null;
231        }
232    
233    
234        public boolean isFirstOperation()
235        {
236            return false;
237        }
238    
239    
240        public void add( ServerEntry entry, Collection<String> bypass ) throws Exception
241        {
242        }
243    
244    
245        public void delete( DN dn, Collection<String> bypass ) throws Exception
246        {
247        }
248    
249    
250        public void modify( DN dn, List<Modification> mods, Collection<String> bypass ) throws Exception
251        {
252        }
253    
254    
255        public boolean hasEntry( DN dn, Collection<String> byPass ) throws Exception
256        {
257            return false;
258        }
259    
260    
261        public ReferralHandlingMode getReferralHandlingMode()
262        {
263            return null;
264        }
265    
266    
267        public void setReferralHandlingMode( ReferralHandlingMode referralHandlingMode )
268        {
269        }
270    
271    
272        public ClonedServerEntry getEntry()
273        {
274            return null;
275        }
276    
277    
278        public void setEntry( ClonedServerEntry entry )
279        {
280        }
281    
282    
283        public void throwReferral()
284        {
285        }
286        
287        
288        public boolean isReferralThrown()
289        {
290            return false;
291        }
292    
293    
294        public void ignoreReferral()
295        {
296        }
297    
298    
299        public boolean isReferralIgnored()
300        {
301            return false;
302        }
303    }