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 023 import java.io.File; 024 import java.util.Hashtable; 025 import java.util.List; 026 import java.util.Set; 027 028 import javax.naming.NamingException; 029 import javax.naming.ldap.LdapContext; 030 031 import org.apache.directory.server.core.changelog.ChangeLog; 032 import org.apache.directory.server.core.event.EventService; 033 import org.apache.directory.server.core.interceptor.Interceptor; 034 import org.apache.directory.server.core.interceptor.InterceptorChain; 035 import org.apache.directory.server.core.journal.Journal; 036 import org.apache.directory.server.core.partition.Partition; 037 import org.apache.directory.server.core.partition.PartitionNexus; 038 import org.apache.directory.server.core.replication.ReplicationConfiguration; 039 import org.apache.directory.server.core.schema.SchemaService; 040 import org.apache.directory.shared.ldap.csn.Csn; 041 import org.apache.directory.shared.ldap.entry.ServerEntry; 042 import org.apache.directory.shared.ldap.ldif.LdifEntry; 043 import org.apache.directory.shared.ldap.name.DN; 044 import org.apache.directory.shared.ldap.schema.SchemaManager; 045 046 047 public class MockDirectoryService implements DirectoryService 048 { 049 int count; 050 051 052 public MockDirectoryService( int count ) 053 { 054 this.count = count; 055 } 056 057 public Hashtable<String, Object> getEnvironment() 058 { 059 return null; 060 } 061 062 063 public void setEnvironment( Hashtable<String, Object> environment ) 064 { 065 } 066 067 068 public long revert( long revision ) throws NamingException 069 { 070 return 0; 071 } 072 073 074 public long revert() throws NamingException 075 { 076 return 0; 077 } 078 079 080 public PartitionNexus getPartitionNexus() 081 { 082 return null; 083 } 084 085 086 public InterceptorChain getInterceptorChain() 087 { 088 return null; 089 } 090 091 092 public void addPartition( Partition partition ) throws NamingException 093 { 094 } 095 096 097 public void removePartition( Partition partition ) throws NamingException 098 { 099 } 100 101 102 public SchemaManager getSchemaManager() 103 { 104 return null; 105 } 106 107 108 public ReferralManager getReferralManager() 109 { 110 return null; 111 } 112 113 114 public void setReferralManager( ReferralManager referralManager ) 115 { 116 } 117 118 119 public void setSchemaManager( SchemaManager schemaManager ) 120 { 121 } 122 123 124 public SchemaService getSchemaService() 125 { 126 return null; 127 } 128 129 130 public void setSchemaService( SchemaService schemaService ) 131 { 132 133 } 134 135 136 public void startup() throws NamingException 137 { 138 } 139 140 141 public void shutdown() throws NamingException 142 { 143 } 144 145 146 public void sync() throws NamingException 147 { 148 } 149 150 151 public boolean isStarted() 152 { 153 return true; 154 } 155 156 157 public LdapContext getJndiContext() throws NamingException 158 { 159 return null; 160 } 161 162 163 public DirectoryService getDirectoryService() 164 { 165 return null; 166 } 167 168 169 public void setInstanceId( String instanceId ) 170 { 171 172 } 173 174 175 public String getInstanceId() 176 { 177 return null; 178 } 179 180 181 public Set<? extends Partition> getPartitions() 182 { 183 return null; 184 } 185 186 187 public void setPartitions( Set<? extends Partition> partitions ) 188 { 189 } 190 191 192 public boolean isAccessControlEnabled() 193 { 194 return false; 195 } 196 197 198 public void setAccessControlEnabled( boolean accessControlEnabled ) 199 { 200 } 201 202 203 public boolean isAllowAnonymousAccess() 204 { 205 return false; 206 } 207 208 209 public void setAllowAnonymousAccess( boolean enableAnonymousAccess ) 210 { 211 212 } 213 214 215 public List<Interceptor> getInterceptors() 216 { 217 return null; 218 } 219 220 221 public void setInterceptors( List<Interceptor> interceptors ) 222 { 223 224 } 225 226 227 public List<LdifEntry> getTestEntries() 228 { 229 return null; 230 } 231 232 233 public void setTestEntries( List<? extends LdifEntry> testEntries ) 234 { 235 } 236 237 238 public File getWorkingDirectory() 239 { 240 return null; 241 } 242 243 244 public void setWorkingDirectory( File workingDirectory ) 245 { 246 } 247 248 249 public void validate() 250 { 251 } 252 253 254 public void setShutdownHookEnabled( boolean shutdownHookEnabled ) 255 { 256 257 } 258 259 260 public boolean isShutdownHookEnabled() 261 { 262 return false; 263 } 264 265 266 public void setExitVmOnShutdown( boolean exitVmOnShutdown ) 267 { 268 269 } 270 271 272 public boolean isExitVmOnShutdown() 273 { 274 return false; 275 } 276 277 278 public void setMaxSizeLimit( long maxSizeLimit ) 279 { 280 281 } 282 283 284 public long getMaxSizeLimit() 285 { 286 return 0; 287 } 288 289 290 public void setMaxTimeLimit( int maxTimeLimit ) 291 { 292 293 } 294 295 296 public int getMaxTimeLimit() 297 { 298 return 0; 299 } 300 301 302 public void setSystemPartition( Partition systemPartition ) 303 { 304 305 } 306 307 308 public Partition getSystemPartition() 309 { 310 return null; 311 } 312 313 314 public boolean isDenormalizeOpAttrsEnabled() 315 { 316 return false; 317 } 318 319 320 public void setDenormalizeOpAttrsEnabled( boolean denormalizeOpAttrsEnabled ) 321 { 322 323 } 324 325 public void setChangeLog( ChangeLog changeLog ) 326 { 327 328 } 329 330 public ChangeLog getChangeLog() 331 { 332 return null; 333 } 334 335 336 public Journal getJournal() 337 { 338 return null; 339 } 340 341 342 public ServerEntry newEntry( DN dn ) throws NamingException 343 { 344 return null; 345 } 346 347 public ServerEntry newEntry( String ldif, String dn ) 348 { 349 return null; 350 } 351 352 353 public OperationManager getOperationManager() 354 { 355 return new MockOperationManager( count ); 356 } 357 358 359 public CoreSession getSession() throws Exception 360 { 361 return null; 362 } 363 364 365 public CoreSession getSession( LdapPrincipal principal ) throws Exception 366 { 367 return null; 368 } 369 370 371 public CoreSession getSession( DN principalDn, byte[] credentials ) throws Exception 372 { 373 return null; 374 } 375 376 377 public CoreSession getSession( DN principalDn, byte[] credentials, String saslMechanism, String saslAuthId ) 378 throws Exception 379 { 380 return null; 381 } 382 383 public CoreSession getAdminSession() throws Exception 384 { 385 return null; 386 } 387 388 public EventService getEventService() 389 { 390 return null; 391 } 392 393 public void setEventService( EventService eventService ) 394 { 395 } 396 397 public boolean isPasswordHidden() 398 { 399 return false; 400 } 401 402 public void setPasswordHidden( boolean passwordHidden ) 403 { 404 } 405 406 407 public int getMaxPDUSize() 408 { 409 return Integer.MAX_VALUE; 410 } 411 412 413 public void setMaxPDUSize( int maxPDUSize ) 414 { 415 // Do nothing 416 } 417 418 419 public Interceptor getInterceptor( String interceptorName ) 420 { 421 return null; 422 } 423 424 425 public Csn getCSN() 426 { 427 return null; 428 } 429 430 431 public int getReplicaId() 432 { 433 return 0; 434 } 435 436 437 public void setReplicaId( int replicaId ) 438 { 439 440 } 441 442 public void setJournal( Journal journal ) 443 { 444 445 } 446 447 public void setReplicationConfiguration( ReplicationConfiguration replicationConfig ) 448 { 449 // TODO Auto-generated method stub 450 451 } 452 453 public ReplicationConfiguration getReplicationConfiguration() 454 { 455 // TODO Auto-generated method stub 456 return null; 457 } 458 }