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.Set;
023    
024    import org.apache.directory.server.core.entry.ClonedServerEntry;
025    import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
026    import org.apache.directory.server.core.filtering.EntryFilteringCursor;
027    import org.apache.directory.server.core.interceptor.context.AddOperationContext;
028    import org.apache.directory.server.core.interceptor.context.BindOperationContext;
029    import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
030    import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
031    import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
032    import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
033    import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
034    import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
035    import org.apache.directory.server.core.interceptor.context.ListOperationContext;
036    import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
037    import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
038    import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
039    import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
040    import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
041    import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
042    import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
043    import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
044    import org.apache.directory.shared.ldap.name.DN;
045    
046    public class MockOperationManager implements OperationManager
047    {
048        int count;
049        
050        public MockOperationManager( int count )
051        {
052            this.count = count;
053        }
054        
055        public void add( AddOperationContext opContext ) throws Exception
056        {
057        }
058    
059        
060        public void bind( BindOperationContext opContext ) throws Exception
061        {
062        }
063    
064        
065        public boolean compare( CompareOperationContext opContext ) throws Exception
066        {
067            return false;
068        }
069    
070    
071        public void delete( DeleteOperationContext opContext ) throws Exception
072        {
073        }
074    
075        public DN getMatchedName( GetMatchedNameOperationContext opContext ) throws Exception
076        {
077            return null;
078        }
079    
080        public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
081        {
082            return null;
083        }
084    
085        public DN getSuffix( GetSuffixOperationContext opContext ) throws Exception
086        {
087            return null;
088        }
089    
090        public boolean hasEntry( EntryOperationContext opContext ) throws Exception
091        {
092            return false;
093        }
094    
095        public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
096        {
097            return null;
098        }
099    
100        public Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws Exception
101        {
102            return null;
103        }
104    
105        public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
106        {
107            return null;
108        }
109    
110        public void modify( ModifyOperationContext opContext ) throws Exception
111        {
112        }
113    
114        public void move( MoveOperationContext opContext ) throws Exception
115        {
116        }
117    
118        public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
119        {
120        }
121    
122        public void rename( RenameOperationContext opContext ) throws Exception
123        {
124        }
125    
126        public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
127        {
128            MockCursor cursor = new MockCursor( count );
129            cursor.setSchemaManager( opContext.getSession().getDirectoryService().getSchemaManager() );
130            return new BaseEntryFilteringCursor( cursor, opContext );
131        }
132    
133    
134        public void unbind( UnbindOperationContext opContext ) throws Exception
135        {
136        }
137    }