directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r811743 - in /directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core: BogusCursor.java MockDirectoryService.java MockOperationManager.java
Date Sun, 06 Sep 2009 01:45:15 GMT
Author: elecharny
Date: Sun Sep  6 01:45:14 2009
New Revision: 811743

URL: http://svn.apache.org/viewvc?rev=811743&view=rev
Log:
First Mock objects addition

Added:
    directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/BogusCursor.java
    directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java
    directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockOperationManager.java

Added: directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/BogusCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/BogusCursor.java?rev=811743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/BogusCursor.java
(added)
+++ directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/BogusCursor.java
Sun Sep  6 01:45:14 2009
@@ -0,0 +1,165 @@
+
+package org.apache.directory.server.core;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.ldap.cursor.ClosureMonitor;
+import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.cursor.CursorIterator;
+
+class BogusCursor implements Cursor<ServerEntry>
+{
+    final int count;
+    int ii;
+    DirectoryService directoryService;
+
+
+    public BogusCursor(int count)
+    {
+        this.count = count;
+    }
+
+
+    public boolean available() 
+    {
+        return ii < count;
+    }
+
+
+    public void close() throws NamingException
+    {
+        ii = count;
+    }
+
+
+    public boolean hasMoreElements()
+    {
+        return ii < count;
+    }
+
+
+    public Object nextElement()
+    {
+        if ( ii >= count )
+        {
+            throw new NoSuchElementException();
+        }
+
+        ii++;
+        
+        return new Object();
+    }
+
+
+    public void after( ServerEntry element ) throws Exception
+    {
+    }
+
+
+    public void afterLast() throws Exception
+    {
+    }
+
+
+    public void before( ServerEntry element ) throws Exception
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public void beforeFirst() throws Exception
+    {
+        ii = -1;
+    }
+
+
+    public boolean first() throws Exception
+    {
+        ii = 0;
+        return ii < count;
+    }
+
+
+    public ServerEntry get() throws Exception
+    {
+        return new DefaultServerEntry( directoryService.getRegistries() );
+    }
+
+
+    public boolean isClosed() throws Exception
+    {
+        return false;
+    }
+
+
+    public boolean isElementReused()
+    {
+        return false;
+    }
+
+
+    public boolean last() throws Exception
+    {
+        ii = count;
+        return true;
+    }
+
+
+    public boolean next() 
+    {
+        if ( ii >= count )
+        {
+            return false;
+        }
+
+        ii++;
+        
+        return true;
+    }
+
+
+    public boolean previous() throws Exception
+    {
+        if ( ii < 0 )
+        {
+            return false;
+        }
+        
+        ii--;
+        return true;
+    }
+
+
+    public Iterator<ServerEntry> iterator()
+    {
+        return new CursorIterator<ServerEntry>( this );
+    }
+
+
+    public void close( Exception reason ) throws Exception
+    {
+    }
+
+
+    public void setClosureMonitor( ClosureMonitor monitor )
+    {
+    }
+
+
+    public DirectoryService getDirectoryService()
+    {
+        return directoryService;
+    }
+
+
+    public void setDirectoryService( DirectoryService directoryService )
+    {
+        this.directoryService = directoryService;
+    }
+}

Added: directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java?rev=811743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java
(added)
+++ directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockDirectoryService.java
Sun Sep  6 01:45:14 2009
@@ -0,0 +1,450 @@
+
+package org.apache.directory.server.core;
+
+import java.io.File;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.directory.server.core.changelog.ChangeLog;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.event.EventService;
+import org.apache.directory.server.core.interceptor.Interceptor;
+import org.apache.directory.server.core.interceptor.InterceptorChain;
+import org.apache.directory.server.core.journal.Journal;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.replication.ReplicationConfiguration;
+import org.apache.directory.server.core.schema.SchemaChangeManager;
+import org.apache.directory.server.core.schema.SchemaService;
+import org.apache.directory.shared.ldap.csn.Csn;
+import org.apache.directory.shared.ldap.ldif.LdifEntry;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+
+class MockDirectoryService implements DirectoryService
+{
+    int count;
+    
+    
+    public MockDirectoryService( int count )
+    {
+        this.count = count;
+    }
+    
+    public Hashtable<String, Object> getEnvironment()
+    {
+        return null;
+    }
+
+
+    public void setEnvironment( Hashtable<String, Object> environment )
+    {
+    }
+
+
+    public long revert( long revision ) throws NamingException
+    {
+        return 0;
+    }
+
+
+    public long revert() throws NamingException
+    {
+        return 0;
+    }
+
+
+    public PartitionNexus getPartitionNexus()
+    {
+        return null;
+    }
+
+
+    public InterceptorChain getInterceptorChain()
+    {
+        return null;
+    }
+
+
+    public void addPartition( Partition partition ) throws NamingException
+    {
+    }
+
+
+    public void removePartition( Partition partition ) throws NamingException
+    {
+    }
+
+
+    public Registries getRegistries()
+    {
+        return null;
+    }
+
+
+    public ReferralManager getReferralManager()
+    {
+        return null;
+    }
+
+
+    public void setReferralManager( ReferralManager referralManager )
+    {
+    }
+
+
+    public void setRegistries( Registries registries )
+    {
+    }
+
+
+    public SchemaService getSchemaService()
+    {
+        return null;
+    }
+
+
+    public void setSchemaService( SchemaService schemaService )
+    {
+
+    }
+
+
+    public SchemaChangeManager getSchemaManager()
+    {
+        return null;
+    }
+
+
+    public void setSchemaManager( SchemaChangeManager schemaManager )
+    {
+    }
+
+
+    public void startup() throws NamingException
+    {
+    }
+
+
+    public void shutdown() throws NamingException
+    {
+    }
+
+
+    public void sync() throws NamingException
+    {
+    }
+
+
+    public boolean isStarted()
+    {
+        return true;
+    }
+
+
+    public LdapContext getJndiContext() throws NamingException
+    {
+        return null;
+    }
+
+
+    public DirectoryService getDirectoryService()
+    {
+        return null;
+    }
+
+
+    public void setInstanceId( String instanceId )
+    {
+
+    }
+
+
+    public String getInstanceId()
+    {
+        return null;
+    }
+
+
+    public Set<? extends Partition> getPartitions()
+    {
+        return null;
+    }
+
+
+    public void setPartitions( Set<? extends Partition> partitions )
+    {
+    }
+
+
+    public boolean isAccessControlEnabled()
+    {
+        return false;
+    }
+
+
+    public void setAccessControlEnabled( boolean accessControlEnabled )
+    {
+    }
+
+
+    public boolean isAllowAnonymousAccess()
+    {
+        return false;
+    }
+
+
+    public void setAllowAnonymousAccess( boolean enableAnonymousAccess )
+    {
+
+    }
+
+
+    public List<Interceptor> getInterceptors()
+    {
+        return null;
+    }
+
+
+    public void setInterceptors( List<Interceptor> interceptors )
+    {
+
+    }
+
+
+    public List<LdifEntry> getTestEntries()
+    {
+        return null;
+    }
+
+
+    public void setTestEntries( List<? extends LdifEntry> testEntries )
+    {
+    }
+
+
+    public File getWorkingDirectory()
+    {
+        return null;
+    }
+
+
+    public void setWorkingDirectory( File workingDirectory )
+    {
+    }
+
+
+    public void validate()
+    {
+    }
+
+
+    public void setShutdownHookEnabled( boolean shutdownHookEnabled )
+    {
+
+    }
+
+
+    public boolean isShutdownHookEnabled()
+    {
+        return false;
+    }
+
+
+    public void setExitVmOnShutdown( boolean exitVmOnShutdown )
+    {
+
+    }
+
+
+    public boolean isExitVmOnShutdown()
+    {
+        return false;
+    }
+
+
+    public void setMaxSizeLimit( int maxSizeLimit )
+    {
+
+    }
+
+
+    public int getMaxSizeLimit()
+    {
+        return 0;
+    }
+
+
+    public void setMaxTimeLimit( int maxTimeLimit )
+    {
+
+    }
+
+
+    public int getMaxTimeLimit()
+    {
+        return 0;
+    }
+
+
+    public void setSystemPartition( Partition systemPartition )
+    {
+
+    }
+
+
+    public Partition getSystemPartition()
+    {
+        return null;
+    }
+
+
+    public boolean isDenormalizeOpAttrsEnabled()
+    {
+        return false;
+    }
+
+
+    public void setDenormalizeOpAttrsEnabled( boolean denormalizeOpAttrsEnabled )
+    {
+
+    }
+    
+    public void setChangeLog( ChangeLog changeLog )
+    {
+        
+    }
+    
+    public ChangeLog getChangeLog()
+    {
+        return null;
+    }
+
+
+    public Journal getJournal()
+    {
+        return null;
+    }
+
+
+    public ServerEntry newEntry( LdapDN dn ) throws NamingException
+    {
+        return null;
+    }
+    
+    public ServerEntry newEntry( String ldif, String dn )
+    {
+        return null;
+    }
+
+
+    public OperationManager getOperationManager()
+    {
+        return new MockOperationManager( count );
+    }
+
+
+    public CoreSession getSession() throws Exception
+    {
+        return null;
+    }
+
+
+    public CoreSession getSession( LdapPrincipal principal ) throws Exception
+    {
+        return null;
+    }
+
+
+    public CoreSession getSession( LdapDN principalDn, byte[] credentials ) throws Exception
+    {
+        return null;
+    }
+
+    
+    public CoreSession getSession( LdapDN principalDn, byte[] credentials, String saslMechanism,
String saslAuthId )
+        throws Exception
+    {
+        return null;
+    }
+
+    public CoreSession getAdminSession() throws Exception
+    {
+        return null;
+    }
+
+    public EventService getEventService()
+    {
+        return null;
+    }
+
+    public void setEventService( EventService eventService )
+    {
+    }
+    
+    public boolean isPasswordHidden()
+    {
+        return false;
+    }
+    
+    public void setPassordHidden( boolean passwordHidden )
+    {
+    }
+
+
+    public int getMaxPDUSize()
+    {
+        return Integer.MAX_VALUE;
+    }
+
+
+    public void setMaxPDUSize( int maxPDUSize )
+    {
+        // Do nothing
+    }
+
+    
+    public Interceptor getInterceptor( String interceptorName )
+    {
+        return null;
+    }
+    
+    
+    public Csn getCSN()
+    {
+        return null;
+    }
+    
+    
+    public int getReplicaId()
+    {
+        return 0;
+    }
+    
+    
+    public void setReplicaId( int replicaId )
+    {
+        
+    }
+
+    public void setJournal( Journal journal )
+    {
+        
+    }
+
+    public void setReplicationConfiguration( ReplicationConfiguration replicationConfig )
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public ReplicationConfiguration getReplicationConfiguration()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}

Added: directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockOperationManager.java?rev=811743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockOperationManager.java
(added)
+++ directory/apacheds/branches/apacheds-schema/core-mock/src/main/java/org/apache/directory/server/core/MockOperationManager.java
Sun Sep  6 01:45:14 2009
@@ -0,0 +1,117 @@
+
+package org.apache.directory.server.core;
+
+import java.util.Set;
+
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.BindOperationContext;
+import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
+import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
+import org.apache.directory.server.core.interceptor.context.ListOperationContext;
+import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+class MockOperationManager implements OperationManager
+{
+    int count;
+    
+    public MockOperationManager( int count )
+    {
+        this.count = count;
+    }
+    
+    public void add( AddOperationContext opContext ) throws Exception
+    {
+    }
+
+    
+    public void bind( BindOperationContext opContext ) throws Exception
+    {
+    }
+
+    
+    public boolean compare( CompareOperationContext opContext ) throws Exception
+    {
+        return false;
+    }
+
+
+    public void delete( DeleteOperationContext opContext ) throws Exception
+    {
+    }
+
+    public LdapDN getMatchedName( GetMatchedNameOperationContext opContext ) throws Exception
+    {
+        return null;
+    }
+
+    public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
+    {
+        return null;
+    }
+
+    public LdapDN getSuffix( GetSuffixOperationContext opContext ) throws Exception
+    {
+        return null;
+    }
+
+    public boolean hasEntry( EntryOperationContext opContext ) throws Exception
+    {
+        return false;
+    }
+
+    public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
+    {
+        return null;
+    }
+
+    public Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws
Exception
+    {
+        return null;
+    }
+
+    public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
+    {
+        return null;
+    }
+
+    public void modify( ModifyOperationContext opContext ) throws Exception
+    {
+    }
+
+    public void move( MoveOperationContext opContext ) throws Exception
+    {
+    }
+
+    public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
+    {
+    }
+
+    public void rename( RenameOperationContext opContext ) throws Exception
+    {
+    }
+
+    public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
+    {
+        return new BaseEntryFilteringCursor( new BogusCursor( count ), opContext );
+    }
+
+
+    public void unbind( UnbindOperationContext opContext ) throws Exception
+    {
+    }
+}



Mime
View raw message