You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/24 15:11:01 UTC
svn commit: r1235258 [5/8] - in /directory/apacheds/trunk:
core-annotations/src/main/java/org/apache/directory/server/core/annotations/
core-annotations/src/main/java/org/apache/directory/server/core/factory/
core-annotations/src/test/java/org/apache/d...
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SchemaSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SchemaSynchronizer.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SchemaSynchronizer.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SchemaSynchronizer.java Tue Jan 24 14:10:56 2012
@@ -86,6 +86,7 @@ public class SchemaSynchronizer implemen
/** A static Dn referencing ou=schema */
private final Dn ouSchemaDn;
+
/**
* Creates and initializes a new instance of Schema synchronizer
*
@@ -113,7 +114,8 @@ public class SchemaSynchronizer implemen
* Depending in the existence of this attribute in the previous entry, we will
* have to update the entry or not.
*/
- public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade ) throws LdapException
+ public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade )
+ throws LdapException
{
Entry entry = modifyContext.getEntry();
List<Modification> mods = modifyContext.getModItems();
@@ -136,15 +138,16 @@ public class SchemaSynchronizer implemen
}
else if ( disabledInEntry != null )
{
- hasModification = modifyDisable( modifyContext, ModificationOperation.REMOVE_ATTRIBUTE, null, disabledInEntry );
+ hasModification = modifyDisable( modifyContext, ModificationOperation.REMOVE_ATTRIBUTE, null,
+ disabledInEntry );
}
-
return hasModification;
}
- public void moveAndRename( Dn oriChildName, Dn newParentName, Rdn newRn, boolean deleteOldRn, Entry entry, boolean cascaded ) throws LdapException
+ public void moveAndRename( Dn oriChildName, Dn newParentName, Rdn newRn, boolean deleteOldRn, Entry entry,
+ boolean cascaded ) throws LdapException
{
}
@@ -161,10 +164,11 @@ public class SchemaSynchronizer implemen
Dn dn = entry.getDn();
Dn parentDn = dn.getParent();
- if ( !parentDn.equals(ouSchemaDn) )
+ if ( !parentDn.equals( ouSchemaDn ) )
{
- throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_380, ouSchemaDn.getName(),
- parentDn.getNormName() ) );
+ throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_380,
+ ouSchemaDn.getName(),
+ parentDn.getNormName() ) );
}
// check if the new schema is enabled or disabled
@@ -176,7 +180,7 @@ public class SchemaSynchronizer implemen
// If the attribute is absent, then the schema is enabled by default
isEnabled = true;
}
- else if ( ! disabled.contains( "TRUE" ) )
+ else if ( !disabled.contains( "TRUE" ) )
{
isEnabled = true;
}
@@ -233,7 +237,7 @@ public class SchemaSynchronizer implemen
// to make sure it's not depended upon by another schema
Set<String> dependents = schemaManager.listDependentSchemaNames( schemaName );
- if ( ( dependents != null ) && ! dependents.isEmpty() )
+ if ( ( dependents != null ) && !dependents.isEmpty() )
{
String msg = I18n.err( I18n.ERR_381, dependents );
LOG.warn( msg );
@@ -248,7 +252,6 @@ public class SchemaSynchronizer implemen
}
-
/**
* Responds to the rdn (commonName) of the metaSchema object being
* changed. Changes all the schema entities associated with the
@@ -263,7 +266,7 @@ public class SchemaSynchronizer implemen
String rdnAttribute = newRdn.getUpType();
String rdnAttributeOid = registries.getAttributeTypeRegistry().getOidByName( rdnAttribute );
- if ( ! rdnAttributeOid.equals( cnAT.getOid() ) )
+ if ( !rdnAttributeOid.equals( cnAT.getOid() ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
I18n.err( I18n.ERR_382, rdnAttribute ) );
@@ -364,7 +367,6 @@ public class SchemaSynchronizer implemen
// private utility methods
// -----------------------------------------------------------------------
-
/**
* Modify the Disable flag (the flag can be set to true or false).
*
@@ -394,11 +396,11 @@ public class SchemaSynchronizer implemen
switch ( modOp )
{
- /*
- * If the user is adding a new m-disabled attribute to an enabled schema,
- * we check that the value is "TRUE" and disable that schema if so.
- */
- case ADD_ATTRIBUTE :
+ /*
+ * If the user is adding a new m-disabled attribute to an enabled schema,
+ * we check that the value is "TRUE" and disable that schema if so.
+ */
+ case ADD_ATTRIBUTE:
if ( disabledInEntry == null && "TRUE".equalsIgnoreCase( disabledInMods.getString() ) )
{
return disableSchema( getSchemaName( name ) );
@@ -410,7 +412,7 @@ public class SchemaSynchronizer implemen
* If the user is removing the m-disabled attribute we check if the schema is currently
* disabled. If so we enable the schema.
*/
- case REMOVE_ATTRIBUTE :
+ case REMOVE_ATTRIBUTE:
if ( ( disabledInEntry != null ) && ( "TRUE".equalsIgnoreCase( disabledInEntry.getString() ) ) )
{
return enableSchema( getSchemaName( name ) );
@@ -423,7 +425,7 @@ public class SchemaSynchronizer implemen
* currently disabled and enable it if the new state has it as enabled. If the
* schema is not disabled we disable it if the mods set m-disabled to true.
*/
- case REPLACE_ATTRIBUTE :
+ case REPLACE_ATTRIBUTE:
boolean isCurrentlyDisabled = false;
@@ -568,23 +570,24 @@ public class SchemaSynchronizer implemen
if ( isEnabled )
{
// check to make sure all the dependencies are also enabled
- Map<String,Schema> loaded = registries.getLoadedSchemas();
+ Map<String, Schema> loaded = registries.getLoadedSchemas();
- for ( Value<?> value:dependencies )
+ for ( Value<?> value : dependencies )
{
String dependency = value.getString();
- if ( ! loaded.containsKey( dependency ) )
+ if ( !loaded.containsKey( dependency ) )
{
throw new LdapUnwillingToPerformException(
- ResultCodeEnum.UNWILLING_TO_PERFORM, "Unwilling to perform operation on enabled schema with disabled or missing dependencies: "
- + dependency );
+ ResultCodeEnum.UNWILLING_TO_PERFORM,
+ "Unwilling to perform operation on enabled schema with disabled or missing dependencies: "
+ + dependency );
}
}
}
else
{
- for ( Value<?> value:dependencies )
+ for ( Value<?> value : dependencies )
{
String dependency = value.getString();
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java Tue Jan 24 14:10:56 2012
@@ -126,7 +126,7 @@ public class SyntaxCheckerSynchronizer e
else
{
String msg = I18n.err( I18n.ERR_386, entry.getDn().getName(),
- Strings.listToString(schemaManager.getErrors()) );
+ Strings.listToString( schemaManager.getErrors() ) );
LOG.info( msg );
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg );
}
@@ -151,7 +151,7 @@ public class SyntaxCheckerSynchronizer e
// Get the SyntaxChecker's instance
String schemaName = getSchemaName( entry.getDn() );
-
+
// Get the Schema
Schema schema = schemaManager.getLoadedSchema( schemaName );
@@ -159,7 +159,7 @@ public class SyntaxCheckerSynchronizer e
{
// The schema is disabled, nothing to do.
LOG.debug( "The SyntaxChecker {} cannot be deleted from the disabled schema {}", dn.getName(), schemaName );
-
+
return;
}
@@ -201,7 +201,7 @@ public class SyntaxCheckerSynchronizer e
else
{
String msg = I18n.err( I18n.ERR_386, entry.getDn().getName(),
- Strings.listToString(schemaManager.getErrors()) );
+ Strings.listToString( schemaManager.getErrors() ) );
LOG.info( msg );
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg );
}
@@ -327,7 +327,7 @@ public class SyntaxCheckerSynchronizer e
}
}
-
+
/**
* Check that a SyntaxChecker exists in the SyntaxCheckerRegistry, and if so,
* return it.
@@ -338,7 +338,7 @@ public class SyntaxCheckerSynchronizer e
if ( schemaManager.getSyntaxCheckerRegistry().contains( oid ) )
{
- return (SyntaxChecker)schemaManager.getSyntaxCheckerRegistry().get( oid );
+ return ( SyntaxChecker ) schemaManager.getSyntaxCheckerRegistry().get( oid );
}
else
{
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SyntaxSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SyntaxSynchronizer.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SyntaxSynchronizer.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/registries/synchronizers/SyntaxSynchronizer.java Tue Jan 24 14:10:56 2012
@@ -128,7 +128,7 @@ public class SyntaxSynchronizer extends
{
// We have some error : reject the addition and get out
String msg = I18n.err( I18n.ERR_399, entry.getDn().getName(),
- Strings.listToString(schemaManager.getErrors()) );
+ Strings.listToString( schemaManager.getErrors() ) );
LOG.info( msg );
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg );
}
@@ -209,13 +209,13 @@ public class SyntaxSynchronizer extends
// Get the schema
Schema schema = schemaManager.getLoadedSchema( schemaName );
-
+
if ( schema.isDisabled() )
{
// The schema is disabled, nothing to do.
- LOG.debug( "The Syntax {} cannot be removed from the disabled schema {}.",
+ LOG.debug( "The Syntax {} cannot be removed from the disabled schema {}.",
dn.getName(), schemaName );
-
+
return;
}
@@ -233,8 +233,8 @@ public class SyntaxSynchronizer extends
else
{
// We have some error : reject the deletion and get out
- String msg = I18n.err( I18n.ERR_400, entry.getDn().getName(),
- Strings.listToString(errors) );
+ String msg = I18n.err( I18n.ERR_400, entry.getDn().getName(),
+ Strings.listToString( errors ) );
LOG.info( msg );
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg );
}
@@ -259,8 +259,9 @@ public class SyntaxSynchronizer extends
if ( dependees.size() != 0 )
{
- throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_401, oldOid,
- getNames( dependees ) ) );
+ throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_401,
+ oldOid,
+ getNames( dependees ) ) );
}
Entry targetEntry = ( Entry ) entry.clone();
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/LdapClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/LdapClassLoader.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/LdapClassLoader.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/LdapClassLoader.java Tue Jan 24 14:10:56 2012
@@ -62,33 +62,33 @@ public class LdapClassLoader extends Cla
{
private static final Logger LOG = LoggerFactory.getLogger( LdapClassLoader.class );
public static final String DEFAULT_SEARCH_CONTEXTS_CONFIG = "cn=classLoaderDefaultSearchContext,ou=configuration,ou=system";
-
+
private Dn defaultSearchDn;
private DirectoryService directoryService;
/** A storage for the ObjectClass attributeType */
private AttributeType OBJECT_CLASS_AT;
-
+
public LdapClassLoader( DirectoryService directoryService ) throws LdapException
{
super( LdapClassLoader.class.getClassLoader() );
this.directoryService = directoryService;
defaultSearchDn = directoryService.getDnFactory().create( DEFAULT_SEARCH_CONTEXTS_CONFIG );
-
+
OBJECT_CLASS_AT = directoryService.getSchemaManager().getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
}
-
+
private byte[] findClassInDIT( List<Dn> searchContexts, String name ) throws ClassNotFoundException
{
// Set up the search filter
- BranchNode filter = new AndNode( );
+ BranchNode filter = new AndNode();
AttributeType fqjcnAt = directoryService.getSchemaManager().getAttributeType( "fullyQualifiedJavaClassName" );
filter.addNode( new EqualityNode<String>( fqjcnAt, new StringValue( name ) ) );
filter.addNode( new EqualityNode<String>( OBJECT_CLASS_AT,
new StringValue( ApacheSchemaConstants.JAVA_CLASS_OC ) ) );
-
+
try
{
for ( Dn base : searchContexts )
@@ -98,7 +98,7 @@ public class LdapClassLoader extends Cla
{
cursor = directoryService.getAdminSession()
.search( base, SearchScope.SUBTREE, filter, AliasDerefMode.DEREF_ALWAYS, null );
-
+
cursor.beforeFirst();
if ( cursor.next() ) // there should be only one!
{
@@ -108,7 +108,7 @@ public class LdapClassLoader extends Cla
if ( cursor.next() )
{
Entry other = cursor.get();
- LOG.warn( "More than one class found on classpath at locations: {} \n\tand {}",
+ LOG.warn( "More than one class found on classpath at locations: {} \n\tand {}",
classEntry, other );
}
@@ -131,21 +131,21 @@ public class LdapClassLoader extends Cla
throw new ClassNotFoundException();
}
-
-
+
+
public Class<?> findClass( String name ) throws ClassNotFoundException
{
byte[] classBytes = null;
- try
- {
+ try
+ {
// TODO we should cache this information and register with the event
// service to get notified if this changes so we can update the cached
// copy - there's absolutely no reason why we should be performing this
// lookup every time!!!
-
+
Entry configEntry = null;
-
+
try
{
configEntry = directoryService.getAdminSession().lookup( defaultSearchDn );
@@ -154,22 +154,22 @@ public class LdapClassLoader extends Cla
{
LOG.debug( "No configuration data found for class loader default search contexts." );
}
-
+
if ( configEntry != null )
{
List<Dn> searchContexts = new ArrayList<Dn>();
Attribute attr = configEntry.get( "classLoaderDefaultSearchContext" );
-
+
for ( Value<?> val : attr )
{
Dn dn = directoryService.getDnFactory().create( val.getString() );
searchContexts.add( dn );
}
-
+
try
{
classBytes = findClassInDIT( searchContexts, name );
-
+
LOG.debug( "Class " + name + " found under default search contexts." );
}
catch ( ClassNotFoundException e )
@@ -177,35 +177,35 @@ public class LdapClassLoader extends Cla
LOG.debug( "Class " + name + " could not be found under default search contexts." );
}
}
-
+
if ( classBytes == null )
{
List<Dn> namingContexts = new ArrayList<Dn>();
-
+
Set<String> suffixes = directoryService.getPartitionNexus().listSuffixes();
- for ( String suffix:suffixes )
+ for ( String suffix : suffixes )
{
Dn dn = directoryService.getDnFactory().create( suffix );
namingContexts.add( dn );
}
-
+
classBytes = findClassInDIT( namingContexts, name );
}
- }
+ }
catch ( ClassNotFoundException e )
{
String msg = I18n.err( I18n.ERR_293, name );
LOG.debug( msg );
throw new ClassNotFoundException( msg );
}
- catch ( Exception e )
+ catch ( Exception e )
{
String msg = I18n.err( I18n.ERR_70, name );
LOG.error( msg, e );
throw new ClassNotFoundException( msg );
}
-
+
return defineClass( name, classBytes, 0, classBytes.length );
}
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcEngine.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcEngine.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcEngine.java Tue Jan 24 14:10:56 2012
@@ -32,14 +32,14 @@ import org.apache.directory.shared.ldap.
*/
public interface StoredProcEngine
{
-
+
/**
* Returns the unique identifier of the supported stored procedure language.
*
*/
public String getSPLangId();
-
-
+
+
/**
* Registers an entry found to be contaning a stored procedure unit which this engine can operate on.
*
@@ -47,8 +47,8 @@ public interface StoredProcEngine
* This method should be called before an attempt to invoke a stored procedure via this Engine.
*/
public void setSPUnitEntry( final Entry spUnit );
-
-
+
+
/**
* Invokes the stored procedure handled by the engine.
*
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcEngineConfig.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcEngineConfig.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcEngineConfig.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcEngineConfig.java Tue Jan 24 14:10:56 2012
@@ -18,7 +18,6 @@
*
*/
-
package org.apache.directory.server.core.api.sp;
@@ -34,8 +33,8 @@ public interface StoredProcEngineConfig
*
*/
public Class<? extends StoredProcEngine> getStoredProcEngineType();
-
-
+
+
/**
* Returns the unique language identifier of the {@link StoredProcEngine}.
*
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java Tue Jan 24 14:10:56 2012
@@ -52,7 +52,7 @@ import org.apache.directory.shared.ldap.
public class StoredProcExecutionManager
{
private final static Set<AttributeTypeOptions> EMPTY_ATTRIBS = Collections.emptySet();
-
+
private final String storedProcContainer;
private final List<StoredProcEngineConfig> storedProcEngineConfigs;
@@ -64,12 +64,14 @@ public class StoredProcExecutionManager
* @param storedProcContainer The base of the DIT subtree used for storing stored procedure units.
* @param storedProcEngineConfigs A list of {@link StoredProcEngineConfig}s to register different {@link StoredProcEngine}s with this manager.
*/
- public StoredProcExecutionManager( final String storedProcContainer, final List<StoredProcEngineConfig> storedProcEngineConfigs )
+ public StoredProcExecutionManager( final String storedProcContainer,
+ final List<StoredProcEngineConfig> storedProcEngineConfigs )
{
this.storedProcContainer = storedProcContainer;
this.storedProcEngineConfigs = storedProcEngineConfigs;
}
-
+
+
/**
* Finds and returns a stored procedure unit entry whose identifier name
* is extracted from fullSPName.
@@ -85,10 +87,11 @@ public class StoredProcExecutionManager
controls.setReturningAttributes( SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
String spUnitName = StoredProcUtils.extractStoredProcUnitName( fullSPName );
-
+
AttributeType storeProcUnitNamAT = session.getDirectoryService()
.getSchemaManager().lookupAttributeTypeRegistry( "storedProcUnitName" );
- ExprNode filter = new EqualityNode<String>( storeProcUnitNamAT, new StringValue( storeProcUnitNamAT, spUnitName ) );
+ ExprNode filter = new EqualityNode<String>( storeProcUnitNamAT,
+ new StringValue( storeProcUnitNamAT, spUnitName ) );
Dn dn = session.getDirectoryService().getDnFactory().create( storedProcContainer );
EntryFilteringCursor results = session.search( dn, SearchScope.SUBTREE, filter,
AliasDerefMode.DEREF_ALWAYS, EMPTY_ATTRIBS );
@@ -96,10 +99,10 @@ public class StoredProcExecutionManager
{
Entry entry = results.get();
results.close();
-
+
return entry;
}
-
+
return null;
}
@@ -114,7 +117,8 @@ public class StoredProcExecutionManager
*/
public StoredProcEngine getStoredProcEngineInstance( Entry spUnitEntry ) throws LdapException
{
- String spLangId = ( String ) ((ClonedServerEntry)spUnitEntry).getOriginalEntry().get( "storedProcLangId" ).getString();
+ String spLangId = ( String ) ( ( ClonedServerEntry ) spUnitEntry ).getOriginalEntry().get( "storedProcLangId" )
+ .getString();
for ( StoredProcEngineConfig engineConfig : storedProcEngineConfigs )
{
@@ -122,7 +126,7 @@ public class StoredProcExecutionManager
{
Class<? extends StoredProcEngine> engineType = engineConfig.getStoredProcEngineType();
StoredProcEngine engine;
-
+
try
{
engine = engineType.newInstance();
@@ -139,8 +143,8 @@ public class StoredProcExecutionManager
ne.initCause( e );
throw ne;
}
-
- engine.setSPUnitEntry( (Entry)((ClonedServerEntry)spUnitEntry).getOriginalEntry() );
+
+ engine.setSPUnitEntry( ( Entry ) ( ( ClonedServerEntry ) spUnitEntry ).getOriginalEntry() );
return engine;
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcUtils.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcUtils.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcUtils.java Tue Jan 24 14:10:56 2012
@@ -18,7 +18,6 @@
*
*/
-
package org.apache.directory.server.core.api.sp;
@@ -29,22 +28,24 @@ package org.apache.directory.server.core
*/
public class StoredProcUtils
{
-
+
/** The delimiter used to tokenize a full SP name into the unit and SP name */
public static final String SPUnitDelimiter = ":";
+
public static String extractStoredProcName( String fullSPName )
{
int delimiter = fullSPName.lastIndexOf( SPUnitDelimiter );
String spName = fullSPName.substring( delimiter + SPUnitDelimiter.length() );
return spName;
}
-
+
+
public static String extractStoredProcUnitName( String fullSPName )
{
int delimiter = fullSPName.lastIndexOf( SPUnitDelimiter );
String className = fullSPName.substring( 0, delimiter );
return className;
}
-
+
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/JavaStoredProcEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/JavaStoredProcEngine.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/JavaStoredProcEngine.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/JavaStoredProcEngine.java Tue Jan 24 14:10:56 2012
@@ -18,7 +18,6 @@
*
*/
-
package org.apache.directory.server.core.api.sp.java;
@@ -60,7 +59,7 @@ public class JavaStoredProcEngine implem
ClassLoader loader = new LdapJavaStoredProcClassLoader( javaByteCode );
Class<?> clazz;
-
+
try
{
clazz = loader.loadClass( className );
@@ -75,7 +74,7 @@ public class JavaStoredProcEngine implem
Method proc;
try
{
- proc = MethodUtils.getAssignmentCompatibleMethod(clazz, spName, types);
+ proc = MethodUtils.getAssignmentCompatibleMethod( clazz, spName, types );
}
catch ( NoSuchMethodException e )
{
@@ -130,6 +129,6 @@ public class JavaStoredProcEngine implem
return types.toArray( EMPTY_CLASS_ARRAY );
}
- private static Class<?>[] EMPTY_CLASS_ARRAY = new Class[ 0 ];
+ private static Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/JavaStoredProcEngineConfig.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/JavaStoredProcEngineConfig.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/JavaStoredProcEngineConfig.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/JavaStoredProcEngineConfig.java Tue Jan 24 14:10:56 2012
@@ -18,9 +18,9 @@
*
*/
-
package org.apache.directory.server.core.api.sp.java;
+
import org.apache.directory.server.core.api.sp.StoredProcEngine;
import org.apache.directory.server.core.api.sp.StoredProcEngineConfig;
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/LdapJavaStoredProcClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/LdapJavaStoredProcClassLoader.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/LdapJavaStoredProcClassLoader.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/java/LdapJavaStoredProcClassLoader.java Tue Jan 24 14:10:56 2012
@@ -47,7 +47,7 @@ public class LdapJavaStoredProcClassLoad
public Class<?> findClass( String name ) throws ClassNotFoundException
{
byte[] classBytes;
-
+
try
{
classBytes = javaByteCodeAttr.getBytes();
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/RefinementEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/RefinementEvaluator.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/RefinementEvaluator.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/RefinementEvaluator.java Tue Jan 24 14:10:56 2012
@@ -47,7 +47,7 @@ public class RefinementEvaluator
// C O N S T R U C T O R S
// ------------------------------------------------------------------------
- public RefinementEvaluator(RefinementLeafEvaluator leafEvaluator)
+ public RefinementEvaluator( RefinementLeafEvaluator leafEvaluator )
{
this.leafEvaluator = leafEvaluator;
}
@@ -59,27 +59,27 @@ public class RefinementEvaluator
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_295 ) );
}
-
+
if ( objectClasses == null )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_296 ) );
}
-
+
if ( !( SchemaConstants.OBJECT_CLASS_AT_OID.equals( objectClasses.getAttributeType().getOid() ) ) )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_297 ) );
}
-
+
if ( node.isLeaf() )
{
return leafEvaluator.evaluate( ( SimpleNode ) node, objectClasses );
}
- BranchNode bnode = (BranchNode) node;
+ BranchNode bnode = ( BranchNode ) node;
if ( node instanceof OrNode )
{
- for ( ExprNode child:bnode.getChildren() )
+ for ( ExprNode child : bnode.getChildren() )
{
if ( evaluate( child, objectClasses ) )
{
@@ -91,7 +91,7 @@ public class RefinementEvaluator
}
else if ( node instanceof AndNode )
{
- for ( ExprNode child:bnode.getChildren() )
+ for ( ExprNode child : bnode.getChildren() )
{
if ( !evaluate( child, objectClasses ) )
{
@@ -100,7 +100,7 @@ public class RefinementEvaluator
}
return true;
-
+
}
else if ( node instanceof NotNode )
{
@@ -110,7 +110,7 @@ public class RefinementEvaluator
}
throw new IllegalArgumentException( I18n.err( I18n.ERR_243, node ) );
-
+
}
else
{
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/RefinementLeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/RefinementLeafEvaluator.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/RefinementLeafEvaluator.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/RefinementLeafEvaluator.java Tue Jan 24 14:10:56 2012
@@ -53,7 +53,7 @@ public class RefinementLeafEvaluator
*
* @param schemaManager The server schemaManager
*/
- public RefinementLeafEvaluator( SchemaManager schemaManager)
+ public RefinementLeafEvaluator( SchemaManager schemaManager )
{
this.schemaManager = schemaManager;
OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
@@ -76,12 +76,12 @@ public class RefinementLeafEvaluator
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_295 ) );
}
-
- if ( !( node instanceof EqualityNode) )
+
+ if ( !( node instanceof EqualityNode ) )
{
throw new LdapException( I18n.err( I18n.ERR_301, node ) );
}
-
+
if ( node.isSchemaAware() )
{
if ( !node.getAttributeType().equals( OBJECT_CLASS_AT ) )
@@ -90,18 +90,17 @@ public class RefinementLeafEvaluator
}
}
else if ( !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) &&
- !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+ !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT_OID ) )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_302, node.getAttribute() ) );
}
-
if ( null == objectClasses )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_303 ) );
}
-
- if ( !( objectClasses.isInstanceOf( OBJECT_CLASS_AT ) ) )
+
+ if ( !( objectClasses.isInstanceOf( OBJECT_CLASS_AT ) ) )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_304 ) );
}
@@ -114,15 +113,15 @@ public class RefinementLeafEvaluator
{
return true;
}
-
+
if ( Character.isDigit( value.charAt( 0 ) ) )
{
Iterator<String> list = schemaManager.getGlobalOidRegistry().getNameSet( value ).iterator();
-
+
while ( list.hasNext() )
{
String objectClass = list.next();
-
+
if ( objectClasses.contains( objectClass ) )
{
return true;
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/Subentry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/Subentry.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/Subentry.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/Subentry.java Tue Jan 24 14:10:56 2012
@@ -86,7 +86,7 @@ public class Subentry
public final boolean isCollectiveAdminRole()
{
return administrativeRoles.contains( AdministrativeRole.CollectiveAttributeInnerArea ) ||
- administrativeRoles.contains( AdministrativeRole.CollectiveAttributeSpecificArea );
+ administrativeRoles.contains( AdministrativeRole.CollectiveAttributeSpecificArea );
}
@@ -105,7 +105,7 @@ public class Subentry
public final boolean isAccessControlAdminRole()
{
return administrativeRoles.contains( AdministrativeRole.AccessControlSpecificArea ) ||
- administrativeRoles.contains( AdministrativeRole.AccessControlInnerArea );
+ administrativeRoles.contains( AdministrativeRole.AccessControlInnerArea );
}
@@ -115,7 +115,7 @@ public class Subentry
public final boolean isTriggersAdminRole()
{
return administrativeRoles.contains( AdministrativeRole.TriggerExecutionSpecificArea ) ||
- administrativeRoles.contains( AdministrativeRole.TriggerExecutionInnerArea );
+ administrativeRoles.contains( AdministrativeRole.TriggerExecutionInnerArea );
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryCache.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryCache.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryCache.java Tue Jan 24 14:10:56 2012
@@ -40,16 +40,17 @@ public class SubentryCache implements It
{
/** The default cache size limit */
private static final int DEFAULT_CACHE_MAX_SIZE = 1000;
-
+
/** The cache size limit */
private int cacheMaxSize = DEFAULT_CACHE_MAX_SIZE;
-
+
/** The current cache size */
private AtomicInteger cacheSize;
-
+
/** The Subentry cache */
private final Map<Dn, Subentry> cache;
-
+
+
/**
* Creates a new instance of SubentryCache with a default maximum size.
*/
@@ -58,8 +59,8 @@ public class SubentryCache implements It
cache = new ConcurrentHashMap<Dn, Subentry>();
cacheSize = new AtomicInteger( 0 );
}
-
-
+
+
/**
* Creates a new instance of SubentryCache with a specific maximum size.
*/
@@ -69,8 +70,8 @@ public class SubentryCache implements It
cacheSize = new AtomicInteger( 0 );
cacheMaxSize = maxSize;
}
-
-
+
+
/**
* Retrieve a Subentry given a Dn. If there is none, null will be returned.
*
@@ -81,8 +82,8 @@ public class SubentryCache implements It
{
return cache.get( dn );
}
-
-
+
+
/**
* Remove a Subentry for a given Dn
*
@@ -93,16 +94,16 @@ public class SubentryCache implements It
public final Subentry removeSubentry( Dn dn )
{
Subentry oldSubentry = cache.remove( dn );
-
+
if ( oldSubentry != null )
{
cacheSize.decrementAndGet();
}
-
+
return oldSubentry;
}
-
-
+
+
/**
* Stores a new Subentry into the cache, associated with a Dn
*
@@ -117,18 +118,18 @@ public class SubentryCache implements It
{
// TODO : Throw an exception here
}
-
+
Subentry oldSubentry = cache.put( dn, subentry );
-
+
if ( oldSubentry == null )
{
cacheSize.getAndIncrement();
}
-
+
return oldSubentry;
}
-
-
+
+
/**
* Tells if there is a Subentry associated with a Dn
* @param dn The Dn
@@ -138,8 +139,8 @@ public class SubentryCache implements It
{
return cache.containsKey( dn );
}
-
-
+
+
/**
* @return An Iterator over the Subentry's DNs
*/
@@ -147,8 +148,8 @@ public class SubentryCache implements It
{
return cache.keySet().iterator();
}
-
-
+
+
/**
* @return The number of elements in the cache
*/
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java Tue Jan 24 14:10:56 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.api.subtree;
+
import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.api.subtree.Subentry;
import org.apache.directory.server.core.api.subtree.SubentryCache;
@@ -36,6 +37,7 @@ import org.apache.directory.shared.ldap.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
public class SubentryUtils
{
/** The logger for this class */
@@ -55,15 +57,16 @@ public class SubentryUtils
/** A reference to the AccessControlSubentries AT */
protected static AttributeType SUBSCHEMA_SUBENTRY_AT;
-
+
/** A reference to the TriggerExecutionSubentries AT */
protected static AttributeType TRIGGER_EXECUTION_SUBENTRIES_AT;
+
public SubentryUtils( DirectoryService directoryService )
{
this.directoryService = directoryService;
this.schemaManager = directoryService.getSchemaManager();
-
+
// Init the At we use locally
ACCESS_CONTROL_SUBENTRIES_AT = schemaManager.getAttributeType( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );
COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT = schemaManager
@@ -72,8 +75,8 @@ public class SubentryUtils
TRIGGER_EXECUTION_SUBENTRIES_AT = schemaManager
.getAttributeType( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
}
-
-
+
+
//-------------------------------------------------------------------------------------------
// Shared method
//-------------------------------------------------------------------------------------------
@@ -90,7 +93,7 @@ public class SubentryUtils
public Entry getSubentryAttributes( Dn dn, Entry entryAttrs ) throws LdapException
{
Entry subentryAttrs = new DefaultEntry( schemaManager, dn );
-
+
SubentryCache subentryCache = directoryService.getSubentryCache();
SubtreeEvaluator evaluator = directoryService.getEvaluator();
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java Tue Jan 24 14:10:56 2012
@@ -79,9 +79,9 @@ public class SubtreeEvaluator
// AP Dn and the subentry base
Dn subentryBaseDn = apDn;
subentryBaseDn = subentryBaseDn.add( subtree.getBase() );
-
+
String s = subentryBaseDn.toString();
-
+
if ( !entryDn.isDescendantOf( subentryBaseDn ) )
{
// The entry Dn is not part of the subtree specification, get out
@@ -97,9 +97,9 @@ public class SubtreeEvaluator
* are rejected.
*/
int entryRelativeDnSize = entryDn.size() - subentryBaseDn.size();
-
+
if ( ( subtree.getMaxBaseDistance() != SubtreeSpecification.UNBOUNDED_MAX ) &&
- ( entryRelativeDnSize > subtree.getMaxBaseDistance() ) )
+ ( entryRelativeDnSize > subtree.getMaxBaseDistance() ) )
{
return false;
}
@@ -117,12 +117,12 @@ public class SubtreeEvaluator
* as well and reject if the relative names are equal.
*/
// Now, get the entry's relative part
-
- if ( ( subtree.getChopBeforeExclusions().size() != 0 ) ||
- ( subtree.getChopAfterExclusions().size() != 0 ) )
+
+ if ( ( subtree.getChopBeforeExclusions().size() != 0 ) ||
+ ( subtree.getChopAfterExclusions().size() != 0 ) )
{
Dn entryRelativeDn = entryDn.getDescendantOf( apDn ).getDescendantOf( subtree.getBase() );
-
+
for ( Dn chopBeforeDn : subtree.getChopBeforeExclusions() )
{
if ( entryRelativeDn.isDescendantOf( chopBeforeDn ) )
@@ -130,7 +130,7 @@ public class SubtreeEvaluator
return false;
}
}
-
+
for ( Dn chopAfterDn : subtree.getChopAfterExclusions() )
{
if ( entryRelativeDn.isDescendantOf( chopAfterDn ) && !chopAfterDn.equals( entryRelativeDn ) )
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java Tue Jan 24 14:10:56 2012
@@ -206,7 +206,7 @@ public class MockCoreSession implements
}
else if ( value instanceof byte[] )
{
- val = new StringValue( attributeType, Strings.utf8ToString((byte[]) value) );
+ val = new StringValue( attributeType, Strings.utf8ToString( ( byte[] ) value ) );
}
else
{
@@ -217,7 +217,7 @@ public class MockCoreSession implements
{
if ( value instanceof String )
{
- val = new BinaryValue( attributeType, Strings.getBytesUtf8((String) value) );
+ val = new BinaryValue( attributeType, Strings.getBytesUtf8( ( String ) value ) );
}
else if ( value instanceof byte[] )
{
@@ -511,7 +511,7 @@ public class MockCoreSession implements
OperationManager operationManager = directoryService.getOperationManager();
LookupOperationContext lookupContext = new LookupOperationContext( this, dn, attrIds );
lookupContext.addRequestControls( controls );
-
+
return operationManager.lookup( lookupContext );
}
@@ -812,7 +812,7 @@ public class MockCoreSession implements
public boolean isAnonymous()
{
- return Strings.isEmpty(getEffectivePrincipal().getName());
+ return Strings.isEmpty( getEffectivePrincipal().getName() );
}
@@ -861,12 +861,12 @@ public class MockCoreSession implements
return exists( new Dn( dn ) );
}
-
+
public boolean exists( Dn dn ) throws LdapException
{
HasEntryOperationContext hasEntryContext = new HasEntryOperationContext( this, dn );
OperationManager operationManager = directoryService.getOperationManager();
-
+
return operationManager.hasEntry( hasEntryContext );
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java Tue Jan 24 14:10:56 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.api;
+
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -31,6 +32,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.util.exception.NotImplementedException;
+
public class MockCursor implements Cursor<Entry>
{
final int count;
@@ -38,13 +40,13 @@ public class MockCursor implements Curso
SchemaManager schemaManager;
- public MockCursor(int count)
+ public MockCursor( int count )
{
this.count = count;
}
- public boolean available()
+ public boolean available()
{
return ii < count;
}
@@ -70,7 +72,7 @@ public class MockCursor implements Curso
}
ii++;
-
+
return new Object();
}
@@ -123,7 +125,7 @@ public class MockCursor implements Curso
}
- public boolean next()
+ public boolean next()
{
if ( ii >= count )
{
@@ -131,7 +133,7 @@ public class MockCursor implements Curso
}
ii++;
-
+
return true;
}
@@ -142,7 +144,7 @@ public class MockCursor implements Curso
{
return false;
}
-
+
ii--;
return true;
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java Tue Jan 24 14:10:56 2012
@@ -75,6 +75,7 @@ public class MockDirectoryService implem
this.count = count;
}
+
public Hashtable<String, Object> getEnvironment()
{
return null;
@@ -332,11 +333,13 @@ public class MockDirectoryService implem
}
+
public void setChangeLog( ChangeLog changeLog )
{
}
+
public ChangeLog getChangeLog()
{
return null;
@@ -354,6 +357,7 @@ public class MockDirectoryService implem
return null;
}
+
public Entry newEntry( String ldif, String dn )
{
return null;
@@ -386,20 +390,23 @@ public class MockDirectoryService implem
public CoreSession getSession( Dn principalDn, byte[] credentials, String saslMechanism, String saslAuthId )
throws LdapException
- {
+ {
return null;
- }
+ }
+
public CoreSession getAdminSession()
{
return null;
}
+
public EventService getEventService()
{
return null;
}
+
public void setEventService( EventService eventService )
{
}
@@ -450,24 +457,29 @@ public class MockDirectoryService implem
{
}
+
public void setJournal( Journal journal )
{
}
+
public String getContextCsn()
{
return null;
}
+
public long getSyncPeriodMillis()
{
return 0;
}
+
public void setContextCsn( String lastCommittedCsnVal )
{
}
+
public void setSyncPeriodMillis( long syncPeriodMillis )
{
}
@@ -575,7 +587,7 @@ public class MockDirectoryService implem
@Override
- public void addFirst( Interceptor interceptor ) throws LdapException
+ public void addFirst( Interceptor interceptor ) throws LdapException
{
// TODO Auto-generated method stub
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java Tue Jan 24 14:10:56 2012
@@ -171,7 +171,7 @@ public class MockInterceptor extends Bas
/**
* {@inheritDoc}
*/
- public void move( MoveOperationContext moveContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
interceptors.add( this );
next( moveContext );
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java Tue Jan 24 14:10:56 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.api;
+
import java.util.List;
import org.apache.directory.server.core.api.CoreSession;
@@ -36,6 +37,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+
public class MockOperation implements OperationContext
{
final int count;
@@ -45,7 +47,8 @@ public class MockOperation implements Op
public MockOperation( SchemaManager schemaManager, int count ) throws Exception
{
this.count = count;
- this.session = new MockCoreSession( new LdapPrincipal( schemaManager, new Dn( schemaManager ), AuthenticationLevel.STRONG ),
+ this.session = new MockCoreSession( new LdapPrincipal( schemaManager, new Dn( schemaManager ),
+ AuthenticationLevel.STRONG ),
new MockDirectoryService( count ) );
}
@@ -190,8 +193,8 @@ public class MockOperation implements Op
public void throwReferral()
{
}
-
-
+
+
public boolean isReferralThrown()
{
return false;
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java Tue Jan 24 14:10:56 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.api;
+
import org.apache.directory.server.core.api.OperationManager;
import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
@@ -39,25 +40,28 @@ import org.apache.directory.server.core.
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.exception.LdapException;
+
public class MockOperationManager implements OperationManager
{
int count;
-
+
+
public MockOperationManager( int count )
{
this.count = count;
}
-
+
+
public void add( AddOperationContext addContext ) throws LdapException
{
}
-
+
public void bind( BindOperationContext bindContext ) throws LdapException
{
}
-
+
public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
return false;
@@ -68,42 +72,51 @@ public class MockOperationManager implem
{
}
+
public Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException
{
return null;
}
+
public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
{
return false;
}
+
public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
{
return null;
}
+
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
return null;
}
+
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
}
+
public void move( MoveOperationContext moveContext ) throws LdapException
{
}
+
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
}
+
public void rename( RenameOperationContext renameContext ) throws LdapException
{
}
+
public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
MockCursor cursor = new MockCursor( count );
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/changelog/TagTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/changelog/TagTest.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/changelog/TagTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/changelog/TagTest.java Tue Jan 24 14:10:56 2012
@@ -130,6 +130,6 @@ public class TagTest
assertFalse( tagC.equals( tagA ) );
assertFalse( tagA.equals( tagANull ) );
assertFalse( tagANull.equals( tagA ) );
- assertFalse( tagD.equals( tagA ));
+ assertFalse( tagD.equals( tagA ) );
}
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/ClonedServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/ClonedServerEntryTest.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/ClonedServerEntryTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/ClonedServerEntryTest.java Tue Jan 24 14:10:56 2012
@@ -51,6 +51,7 @@ public class ClonedServerEntryTest
private static Entry clonedServerEntryB1;
private static Entry clonedServerEntryC1;
+
/**
* Initialize name instances
*/
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java Tue Jan 24 14:10:56 2012
@@ -132,7 +132,7 @@ public class SchemaAwareEntryTest
if ( errors.size() != 0 )
{
- fail( "Schema load failed : " + Exceptions.printErrors(errors) );
+ fail( "Schema load failed : " + Exceptions.printErrors( errors ) );
}
atObjectClass = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
@@ -652,7 +652,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a binary value
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( atCN, test4 );
assertFalse( entry.get( atCN ).contains( test4 ) );
@@ -671,9 +671,9 @@ public class SchemaAwareEntryTest
AttributeType atPassword = schemaManager.lookupAttributeTypeRegistry( "userPassword" );
AttributeType atJpegPhoto = schemaManager.lookupAttributeTypeRegistry( "jpegPhoto" );
- byte[] test1 = Strings.getBytesUtf8("test1");
- byte[] test2 = Strings.getBytesUtf8("test2");
- byte[] test3 = Strings.getBytesUtf8("test3");
+ byte[] test1 = Strings.getBytesUtf8( "test1" );
+ byte[] test2 = Strings.getBytesUtf8( "test2" );
+ byte[] test3 = Strings.getBytesUtf8( "test3" );
// Test that we can't inject a null AT
try
@@ -731,7 +731,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( atPassword, "test4" );
assertNotNull( entry.get( atPassword ) );
@@ -751,9 +751,9 @@ public class SchemaAwareEntryTest
AttributeType atPassword = schemaManager.lookupAttributeTypeRegistry( "userPassword" );
- byte[] b1 = Strings.getBytesUtf8("test1");
- byte[] b2 = Strings.getBytesUtf8("test2");
- byte[] b3 = Strings.getBytesUtf8("test3");
+ byte[] b1 = Strings.getBytesUtf8( "test1" );
+ byte[] b2 = Strings.getBytesUtf8( "test2" );
+ byte[] b3 = Strings.getBytesUtf8( "test3" );
Value<String> test1 = new StringValue( atDC, "test1" );
Value<String> test2 = new StringValue( atDC, "test2" );
@@ -808,7 +808,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( atDC, test4 );
assertFalse( entry.contains( atDC, test4 ) );
@@ -848,7 +848,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] b4 = Strings.getBytesUtf8("test4");
+ byte[] b4 = Strings.getBytesUtf8( "test4" );
entry.add( atPassword, "test4" );
assertNotNull( entry.get( atPassword ) );
@@ -903,7 +903,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a binary value
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( "DC", test4 );
assertFalse( entry.contains( "DC", test4 ) );
@@ -921,9 +921,9 @@ public class SchemaAwareEntryTest
AttributeType atPassword = schemaManager.lookupAttributeTypeRegistry( "userPassword" );
- byte[] test1 = Strings.getBytesUtf8("test1");
- byte[] test2 = Strings.getBytesUtf8("test2");
- byte[] test3 = Strings.getBytesUtf8("test3");
+ byte[] test1 = Strings.getBytesUtf8( "test1" );
+ byte[] test2 = Strings.getBytesUtf8( "test2" );
+ byte[] test3 = Strings.getBytesUtf8( "test3" );
// Test a simple addition
entry.add( "userPassword", test1 );
@@ -959,7 +959,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( "userPassword", "test4" );
assertNotNull( entry.get( atPassword ) );
@@ -979,9 +979,9 @@ public class SchemaAwareEntryTest
AttributeType atPassword = schemaManager.lookupAttributeTypeRegistry( "userPassword" );
- byte[] b1 = Strings.getBytesUtf8("test1");
- byte[] b2 = Strings.getBytesUtf8("test2");
- byte[] b3 = Strings.getBytesUtf8("test3");
+ byte[] b1 = Strings.getBytesUtf8( "test1" );
+ byte[] b2 = Strings.getBytesUtf8( "test2" );
+ byte[] b3 = Strings.getBytesUtf8( "test3" );
Value<String> test1 = new StringValue( atEMail, "test1" );
Value<String> test2 = new StringValue( atEMail, "test2" );
@@ -1029,7 +1029,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( "eMail", test4 );
assertFalse( entry.contains( "cN", test4 ) );
@@ -1071,7 +1071,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] b4 = Strings.getBytesUtf8("test4");
+ byte[] b4 = Strings.getBytesUtf8( "test4" );
entry.add( "userPASSWORD", "test4" );
assertNotNull( entry.get( atPassword ) );
@@ -1123,7 +1123,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a binary value
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( "email", atEMail, test4 );
assertFalse( entry.contains( "email", test4 ) );
@@ -1141,9 +1141,9 @@ public class SchemaAwareEntryTest
AttributeType atPassword = schemaManager.lookupAttributeTypeRegistry( "userPassword" );
- byte[] test1 = Strings.getBytesUtf8("test1");
- byte[] test2 = Strings.getBytesUtf8("test2");
- byte[] test3 = Strings.getBytesUtf8("test3");
+ byte[] test1 = Strings.getBytesUtf8( "test1" );
+ byte[] test2 = Strings.getBytesUtf8( "test2" );
+ byte[] test3 = Strings.getBytesUtf8( "test3" );
// Test a simple addition
entry.add( "userPassword", atPassword, test1 );
@@ -1179,7 +1179,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( "userPassword", atPassword, "test4" );
assertNotNull( entry.get( atPassword ) );
@@ -1199,9 +1199,9 @@ public class SchemaAwareEntryTest
AttributeType atPassword = schemaManager.lookupAttributeTypeRegistry( "userPassword" );
- byte[] b1 = Strings.getBytesUtf8("test1");
- byte[] b2 = Strings.getBytesUtf8("test2");
- byte[] b3 = Strings.getBytesUtf8("test3");
+ byte[] b1 = Strings.getBytesUtf8( "test1" );
+ byte[] b2 = Strings.getBytesUtf8( "test2" );
+ byte[] b3 = Strings.getBytesUtf8( "test3" );
Value<String> test1 = new StringValue( atEMail, "test1" );
Value<String> test2 = new StringValue( atEMail, "test2" );
@@ -1249,7 +1249,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] test4 = Strings.getBytesUtf8("test4");
+ byte[] test4 = Strings.getBytesUtf8( "test4" );
entry.add( "eMail", atEMail, test4 );
assertFalse( entry.contains( "cN", test4 ) );
@@ -1291,7 +1291,7 @@ public class SchemaAwareEntryTest
entry.clear();
// Test the addition of a String value. It should be converted to a byte array
- byte[] b4 = Strings.getBytesUtf8("test4");
+ byte[] b4 = Strings.getBytesUtf8( "test4" );
entry.add( "userPASSWORD", atPassword, "test4" );
assertNotNull( entry.get( atPassword ) );
@@ -1689,11 +1689,11 @@ public class SchemaAwareEntryTest
expected.add( atSN );
expected.add( atPwd );
expected.add( atC );
-
+
for ( Attribute attribute : attributes )
{
AttributeType attributeType = attribute.getAttributeType();
-
+
assertTrue( expected.contains( attributeType ) );
}
}
@@ -2724,10 +2724,10 @@ public class SchemaAwareEntryTest
assertTrue( true );
}
- byte[] password = Strings.getBytesUtf8("test");
- byte[] test1 = Strings.getBytesUtf8("test1");
- byte[] test2 = Strings.getBytesUtf8("test2");
- byte[] test3 = Strings.getBytesUtf8("test3");
+ byte[] password = Strings.getBytesUtf8( "test" );
+ byte[] test1 = Strings.getBytesUtf8( "test1" );
+ byte[] test2 = Strings.getBytesUtf8( "test2" );
+ byte[] test3 = Strings.getBytesUtf8( "test3" );
// Add a single value
atPwd = schemaManager.lookupAttributeTypeRegistry( "userPassword" );
@@ -2913,10 +2913,10 @@ public class SchemaAwareEntryTest
}
// Add a single value
- byte[] test = Strings.getBytesUtf8("test");
- byte[] test1 = Strings.getBytesUtf8("test1");
- byte[] test2 = Strings.getBytesUtf8("test2");
- byte[] test3 = Strings.getBytesUtf8("test3");
+ byte[] test = Strings.getBytesUtf8( "test" );
+ byte[] test1 = Strings.getBytesUtf8( "test1" );
+ byte[] test2 = Strings.getBytesUtf8( "test2" );
+ byte[] test3 = Strings.getBytesUtf8( "test3" );
entry.put( "userPassword", test );
@@ -3070,9 +3070,9 @@ public class SchemaAwareEntryTest
assertEquals( "2.5.4.35", entry.get( atPassword ).getId() );
// Test that we can add some new attributes with values
- byte[] test1 = Strings.getBytesUtf8("test1");
- byte[] test2 = Strings.getBytesUtf8("test2");
- byte[] test3 = Strings.getBytesUtf8("test3");
+ byte[] test1 = Strings.getBytesUtf8( "test1" );
+ byte[] test2 = Strings.getBytesUtf8( "test2" );
+ byte[] test3 = Strings.getBytesUtf8( "test3" );
Attribute result = entry.put( "UserPassword", atPassword, test1, test2, test3 );
assertNotNull( result );
@@ -3505,8 +3505,8 @@ public class SchemaAwareEntryTest
AttributeType atPassword = schemaManager.lookupAttributeTypeRegistry( "userPassword" );
- byte[] b1 = Strings.getBytesUtf8("test1");
- byte[] b2 = Strings.getBytesUtf8("test2");
+ byte[] b1 = Strings.getBytesUtf8( "test1" );
+ byte[] b2 = Strings.getBytesUtf8( "test2" );
Value<String> test1 = new StringValue( atCN, "test1" );
Value<String> test2 = new StringValue( atCN, "test2" );
@@ -3646,14 +3646,14 @@ public class SchemaAwareEntryTest
entry.put( "ObjectClass", atOC, strValueTop, strValuePerson );
entry.put( "UserPassword", atPwd, binValue1, binValue2, binNullValue );
- String expected =
- "Entry\n" +
- " dn[n]: dc=example,dc=com\n" +
- " ObjectClass: top\n" +
- " ObjectClass: person\n" +
- " UserPassword: '0x61 0x62 '\n" +
- " UserPassword: '0x62 '\n" +
- " UserPassword: ''\n";
+ String expected =
+ "Entry\n" +
+ " dn[n]: dc=example,dc=com\n" +
+ " ObjectClass: top\n" +
+ " ObjectClass: person\n" +
+ " UserPassword: '0x61 0x62 '\n" +
+ " UserPassword: '0x62 '\n" +
+ " UserPassword: ''\n";
assertEquals( expected, entry.toString() );
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareModificationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareModificationTest.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareModificationTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareModificationTest.java Tue Jan 24 14:10:56 2012
@@ -176,7 +176,7 @@ public class SchemaAwareModificationTest
if ( errors.size() != 0 )
{
- fail( "Schema load failed : " + Exceptions.printErrors(errors) );
+ fail( "Schema load failed : " + Exceptions.printErrors( errors ) );
}
atCN = schemaManager.lookupAttributeTypeRegistry( "cn" );
@@ -247,7 +247,7 @@ public class SchemaAwareModificationTest
assertTrue( copy instanceof DefaultModification );
assertTrue( copy instanceof DefaultModification );
assertFalse( copy.equals( clientModification ) );
- assertTrue( copy.getAttribute() instanceof Attribute);
+ assertTrue( copy.getAttribute() instanceof Attribute );
assertEquals( atC, copy.getAttribute().getAttributeType() );
assertEquals( ModificationOperation.ADD_ATTRIBUTE, copy.getOperation() );
assertTrue( copy.getAttribute().contains( "test1", "test2" ) );
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/sp/StoredProcUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/sp/StoredProcUtilsTest.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/sp/StoredProcUtilsTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/sp/StoredProcUtilsTest.java Tue Jan 24 14:10:56 2012
@@ -18,9 +18,9 @@
*
*/
-
package org.apache.directory.server.core.api.sp;
+
import com.mycila.junit.concurrent.Concurrency;
import com.mycila.junit.concurrent.ConcurrentJunitRunner;
import org.junit.Test;
@@ -28,6 +28,7 @@ import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
+
@RunWith(ConcurrentJunitRunner.class)
@Concurrency()
public class StoredProcUtilsTest
@@ -38,10 +39,10 @@ public class StoredProcUtilsTest
String fullSPName = "Greeter:seyHello";
String expectedSPUnitName = "Greeter";
String expectedSPName = "seyHello";
-
+
String actualSPUnitName = StoredProcUtils.extractStoredProcUnitName( fullSPName );
String actualSPName = StoredProcUtils.extractStoredProcName( fullSPName );
-
+
assertEquals( expectedSPUnitName, actualSPUnitName );
assertEquals( expectedSPName, actualSPName );
}
Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java Tue Jan 24 14:10:56 2012
@@ -44,10 +44,10 @@ public class ArrayMarshaller<E> implemen
/** marshaller to be used for marshalling the keys */
private Marshaller<E> keyMarshaller;
-
+
/** key Comparator for the AvlTree */
private Comparator<E> comparator;
-
+
/**
* Creates a new instance of AvlTreeMarshaller with a custom key
@@ -90,7 +90,7 @@ public class ArrayMarshaller<E> implemen
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream( byteStream );
byte[] data = null;
-
+
try
{
out.writeByte( 0 ); // represents the start of an Array byte stream
@@ -100,42 +100,42 @@ public class ArrayMarshaller<E> implemen
{
E value = tree.get( position );
byte[] bytes = keyMarshaller.serialize( value );
-
+
// Write the key length
out.writeInt( bytes.length );
-
+
// Write the key if its length is not null
if ( bytes.length != 0 )
{
out.write( bytes );
}
}
-
+
out.flush();
data = byteStream.toByteArray();
-
+
// Try to deserialize, just to see
try
{
deserialize( data );
}
- catch (NullPointerException npe )
+ catch ( NullPointerException npe )
{
- System.out.println( I18n.err( I18n.ERR_438, Strings.dumpBytes(data) ) );
+ System.out.println( I18n.err( I18n.ERR_438, Strings.dumpBytes( data ) ) );
throw npe;
}
out.close();
}
- catch( IOException e )
+ catch ( IOException e )
{
e.printStackTrace();
}
-
+
return data;
}
-
+
/**
* Creates an Array from given bytes of data.
*
@@ -151,36 +151,37 @@ public class ArrayMarshaller<E> implemen
{
throw new IOException( I18n.err( I18n.ERR_439 ) );
}
-
+
if ( ( data.length == 1 ) && ( data[0] == 0 ) )
{
- E[] array = (E[])new Object[]{};
+ E[] array = ( E[] ) new Object[]
+ {};
ArrayTree<E> tree = new ArrayTree<E>( comparator, array );
return tree;
}
-
+
ByteArrayInputStream bin = new ByteArrayInputStream( data );
DataInputStream din = new DataInputStream( bin );
-
+
byte startByte = din.readByte();
-
- if( startByte != 0 )
+
+ if ( startByte != 0 )
{
throw new IOException( I18n.err( I18n.ERR_440 ) );
}
-
+
int size = din.readInt();
- E[] nodes = (E[])new Object[size];
-
+ E[] nodes = ( E[] ) new Object[size];
+
for ( int i = 0; i < size; i++ )
{
// Read the object's size
int dataSize = din.readInt();
-
+
if ( dataSize != 0 )
{
- byte[] bytes = new byte[ dataSize ];
-
+ byte[] bytes = new byte[dataSize];
+
din.readFully( bytes );
E key = keyMarshaller.deserialize( bytes );
nodes[i] = key;
@@ -188,12 +189,12 @@ public class ArrayMarshaller<E> implemen
}
ArrayTree<E> arrayTree = new ArrayTree<E>( comparator, nodes );
-
+
return arrayTree;
}
- catch (NullPointerException npe )
+ catch ( NullPointerException npe )
{
- System.out.println( I18n.err( I18n.ERR_441, Strings.dumpBytes(data) ) );
+ System.out.println( I18n.err( I18n.ERR_441, Strings.dumpBytes( data ) ) );
throw npe;
}
}