You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/02/10 11:49:57 UTC
svn commit: r376623 [2/38] - in /directory/sandbox/akarasulu/rc1/apacheds:
core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/
core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/
core-shared/src/main/java/org/a...
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/AttributeTypeLiteral.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/AttributeTypeLiteral.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/AttributeTypeLiteral.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/AttributeTypeLiteral.java Fri Feb 10 02:48:07 2006
@@ -54,8 +54,7 @@
// C O N S T R U C T O R S
// ------------------------------------------------------------------------
-
- public AttributeTypeLiteral( String oid )
+ public AttributeTypeLiteral(String oid)
{
this.oid = oid;
}
@@ -65,137 +64,162 @@
// Accessors and mutators
// ------------------------------------------------------------------------
-
public boolean isObsolete()
{
return obsolete;
}
+
public void setObsolete( boolean obsolete )
{
this.obsolete = obsolete;
}
+
public boolean isSingleValue()
{
return singleValue;
}
+
public void setSingleValue( boolean singleValue )
{
this.singleValue = singleValue;
}
+
public boolean isCollective()
{
return collective;
}
+
public void setCollective( boolean collective )
{
this.collective = collective;
}
+
public boolean isNoUserModification()
{
return noUserModification;
}
+
public void setNoUserModification( boolean noUserModification )
{
this.noUserModification = noUserModification;
}
+
public String getOid()
{
return oid;
}
+
public String getDescription()
{
return description;
}
+
public void setDescription( String description )
{
this.description = description;
}
+
public String getSuperior()
{
return superior;
}
+
public void setSuperior( String superior )
{
this.superior = superior;
}
+
public String getEquality()
{
return equality;
}
+
public void setEquality( String equality )
{
this.equality = equality;
}
+
public String getOrdering()
{
return ordering;
}
+
public void setOrdering( String ordering )
{
this.ordering = ordering;
}
+
public String getSubstr()
{
return substr;
}
+
public void setSubstr( String substr )
{
this.substr = substr;
}
+
public String getSyntax()
{
return syntax;
}
+
public void setSyntax( String syntax )
{
this.syntax = syntax;
}
+
public UsageEnum getUsage()
{
return usage;
}
+
public void setUsage( UsageEnum usage )
{
this.usage = usage;
}
+
public String[] getNames()
{
return names;
}
+
public void setNames( String[] names )
{
this.names = names;
}
+
public int getLength()
{
return length;
}
+
public void setLength( int length )
{
this.length = length;
@@ -206,7 +230,6 @@
// Object overrides
// ------------------------------------------------------------------------
-
public int hashCode()
{
return getOid().hashCode();
@@ -220,7 +243,7 @@
return true;
}
- if ( ! ( obj instanceof AttributeTypeLiteral ) )
+ if ( !( obj instanceof AttributeTypeLiteral ) )
{
return false;
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/DirectorySchemaToolMojo.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/DirectorySchemaToolMojo.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/DirectorySchemaToolMojo.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/DirectorySchemaToolMojo.java Fri Feb 10 02:48:07 2006
@@ -54,13 +54,13 @@
* @parameter expression="src/main/schema"
*/
private File sourceDirectory;
-
+
/**
* The target directory into which the plugin generates schema java sources.
* @parameter expression="target/generated-sources"
*/
private File outputDirectory;
-
+
/**
* The default package to use for generated schema classes.
* @parameter expression="org.apache.directory.server.core.schema.bootstrap"
@@ -72,7 +72,7 @@
* @parameter expression="uid=admin,ou=system"
*/
private String defaultOwner;
-
+
/**
* The set of schemas to generate classes for.
* @parameter
@@ -84,7 +84,7 @@
* @parameter expression="true"
*/
private boolean verboseOutput;
-
+
/**
* @parameter expression="${project}"
* @required
@@ -126,8 +126,8 @@
context.put( "package", schema.getPackageName() );
context.put( "classname", schemaCapped.toString() + "Schema" );
context.put( "schema", schema.getSchemaName() );
- context.put( "owner", schema.getOwner() ) ;
- context.put( "deps", schema.getDependencies() ) ;
+ context.put( "owner", schema.getOwner() );
+ context.put( "deps", schema.getDependencies() );
Reader fileIn = getResourceReader( "Schema.template" );
Writer writer = getResourceWriter( schema.getPackageName(), schema.getUnqualifiedClassName() );
@@ -159,52 +159,52 @@
context.put( "package", schema.getPackageName() );
context.put( "classname", schema.getUnqualifiedClassName( type ) );
context.put( "schema", schema.getSchemaName() );
- context.put( "owner", schema.getOwner() ) ;
- context.put( "type", type.getName().substring( 0, type.getName().length() - 8 ) ) ;
+ context.put( "owner", schema.getOwner() );
+ context.put( "type", type.getName().substring( 0, type.getName().length() - 8 ) );
String typeName = null;
- switch( type.getValue() )
+ switch ( type.getValue() )
{
- case( ProducerTypeEnum.COMPARATOR_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.COMPARATOR_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.COMPARATOR_PRODUCER";
break;
- case( ProducerTypeEnum.DIT_CONTENT_RULE_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.DIT_CONTENT_RULE_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.DIT_CONTENT_RULE_PRODUCER";
break;
- case( ProducerTypeEnum.DIT_STRUCTURE_RULE_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.DIT_STRUCTURE_RULE_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.DIT_STRUCTURE_RULE_PRODUCER";
break;
- case( ProducerTypeEnum.MATCHING_RULE_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.MATCHING_RULE_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.MATCHING_RULE_PRODUCER";
break;
- case( ProducerTypeEnum.MATCHING_RULE_USE_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.MATCHING_RULE_USE_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.MATCHING_RULE_USE_PRODUCER";
break;
- case( ProducerTypeEnum.NAME_FORM_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.NAME_FORM_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.NAME_FORM_PRODUCER";
break;
- case( ProducerTypeEnum.NORMALIZER_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.NORMALIZER_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.NORMALIZER_PRODUCER";
break;
- case( ProducerTypeEnum.SYNTAX_CHECKER_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.SYNTAX_CHECKER_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.SYNTAX_CHECKER_PRODUCER";
break;
- case( ProducerTypeEnum.SYNTAX_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.SYNTAX_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.SYNTAX_PRODUCER";
break;
- case( ProducerTypeEnum.STATE_FACTORY_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.STATE_FACTORY_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.STATE_FACTORY_PRODUCER";
break;
- case( ProducerTypeEnum.OBJECT_FACTORY_PRODUCER_VAL ):
+ case ( ProducerTypeEnum.OBJECT_FACTORY_PRODUCER_VAL ):
typeName = "ProducerTypeEnum.OBJECT_FACTORY_PRODUCER";
break;
default:
throw new IllegalStateException( "Unexpected producer: " + type.getName() );
}
- context.put( "typeName", typeName ) ;
- runVelocity( schema.getPackageName(), schema.getUnqualifiedClassName( type ),
- context, "typeless.template", type );
+ context.put( "typeName", typeName );
+ runVelocity( schema.getPackageName(), schema.getUnqualifiedClassName( type ), context, "typeless.template",
+ type );
}
}
@@ -227,12 +227,13 @@
context.put( "package", schema.getPackageName() );
context.put( "classname", schema.getUnqualifiedClassName( type ) );
context.put( "schema", schema.getSchemaName() );
- context.put( "owner", schema.getOwner() ) ;
+ context.put( "owner", schema.getOwner() );
context.put( "schemaDepCount", new Integer( schema.getDependencies().length ) );
- context.put( "schemaDeps", new String[] { "dep1", "dep2" } ) ;
+ context.put( "schemaDeps", new String[]
+ { "dep1", "dep2" } );
context.put( "attrTypes", attributeTypes );
- runVelocity( schema.getPackageName(), schema.getUnqualifiedClassName( type ),
- context, "AttributeTypes.template", type );
+ runVelocity( schema.getPackageName(), schema.getUnqualifiedClassName( type ), context,
+ "AttributeTypes.template", type );
}
@@ -254,18 +255,18 @@
context.put( "package", schema.getPackageName() );
context.put( "classname", schema.getUnqualifiedClassName( type ) );
context.put( "schema", schema.getSchemaName() );
- context.put( "owner", schema.getOwner() ) ;
+ context.put( "owner", schema.getOwner() );
context.put( "schemaDepCount", new Integer( schema.getDependencies().length ) );
- context.put( "schemaDeps", new String[] { "dep1", "dep2" } ) ;
+ context.put( "schemaDeps", new String[]
+ { "dep1", "dep2" } );
context.put( "objectClasses", objectClasses );
- runVelocity( schema.getPackageName(), schema.getUnqualifiedClassName( type ),
- context, "ObjectClasses.template", type );
+ runVelocity( schema.getPackageName(), schema.getUnqualifiedClassName( type ), context,
+ "ObjectClasses.template", type );
}
-
protected void runVelocity( String pkg, String uqcn, VelocityContext context, String template, ProducerTypeEnum type )
- throws Exception
+ throws Exception
{
Reader fileIn = getResourceReader( template );
Writer writer = getResourceWriter( pkg, uqcn );
@@ -286,7 +287,7 @@
String[] comps = path.split( "/" );
File file = new File( base );
- if ( ! file.exists() )
+ if ( !file.exists() )
{
file.mkdirs();
}
@@ -295,7 +296,7 @@
{
file = new File( file, comps[ii] );
- if ( ! file.exists() )
+ if ( !file.exists() )
{
file.mkdirs();
}
@@ -319,8 +320,8 @@
{
// check to see if any of the classes are available in the java
// source directory, if so we return true
- File defaultFile = new File( project.getBuild().getSourceDirectory()
- + File.separator + getFilePath( defaultClass ) );
+ File defaultFile = new File( project.getBuild().getSourceDirectory() + File.separator
+ + getFilePath( defaultClass ) );
return defaultFile.exists();
}
@@ -331,25 +332,25 @@
path += ".java";
return path;
}
-
-
+
+
private boolean isStale( BootstrapSchema schema )
{
String pkgPath = schema.getPackageName().replace( '.', File.separatorChar );
File dir = new File( outputDirectory, pkgPath );
File schemaClassFile = new File( dir, schema.getUnqualifiedClassName() + ".java" );
-
- if ( ! schemaClassFile.exists() )
+
+ if ( !schemaClassFile.exists() )
{
return true;
}
-
+
File schemaFile = new File( sourceDirectory, schema.getSchemaName() + ".schema" );
return schemaFile.lastModified() > schemaClassFile.lastModified();
}
-
-
- public void execute() throws MojoExecutionException
+
+
+ public void execute() throws MojoExecutionException
{
// Bypass if no schemas have yet been defined
if ( schemas == null || schemas.length == 0 )
@@ -357,16 +358,16 @@
getLog().warn( "No schemas defined for directory plugin!" );
return;
}
-
+
// Make sure schema configurations have a name field and set defaults
// for any other missing properties of the bean: pkg and owner.
for ( int ii = 0; ii < schemas.length; ii++ )
{
Schema schema = schemas[ii];
-
+
if ( schema.getName() == null )
{
- String msg = ii + "th schema configuration element must specify a name.";
+ String msg = ii + "th schema configuration element must specify a name.";
getLog().error( msg );
throw new MojoExecutionException( msg );
}
@@ -375,13 +376,13 @@
{
schema.setPkg( defaultPackage );
}
-
+
if ( schema.getOwner() == null )
{
schema.setOwner( defaultOwner );
}
- }
-
+ }
+
// Report configuration if verbose output is enabled
if ( verboseOutput )
{
@@ -389,18 +390,20 @@
}
// Create output directory if it does not exist
- if ( ! outputDirectory.exists() )
+ if ( !outputDirectory.exists() )
{
outputDirectory.mkdirs();
}
-
+
// Generate for each schema
for ( int ii = 0; ii < schemas.length; ii++ )
{
try
{
- BootstrapSchema bootstrapSchema = new AbstractBootstrapSchema( schemas[ii].getOwner(),
- schemas[ii].getName(), schemas[ii].getPkg(), schemas[ii].getDependencies() ){};
+ BootstrapSchema bootstrapSchema = new AbstractBootstrapSchema( schemas[ii].getOwner(), schemas[ii]
+ .getName(), schemas[ii].getPkg(), schemas[ii].getDependencies() )
+ {
+ };
if ( isStale( bootstrapSchema ) )
{
@@ -417,10 +420,11 @@
throw new MojoExecutionException( "Failed while generating sources for " + schemas[ii].getName(), e );
}
}
-
+
project.addCompileSourceRoot( outputDirectory.getPath() );
}
+
private void report()
{
getLog().info( "===================================================================" );
@@ -430,13 +434,13 @@
getLog().info( "defaultPackage = " + defaultPackage );
getLog().info( "defaultOwner = " + defaultOwner );
getLog().info( "----------------------------- schemas -----------------------------" );
-
+
if ( schemas != null )
{
for ( int ii = 0; ii < schemas.length; ii++ )
{
getLog().info( "SCHEMA: " + schemas[ii].getName() );
-
+
if ( schemas[ii].getDependencies() != null )
{
StringBuffer buf = new StringBuffer();
@@ -447,17 +451,17 @@
}
getLog().info( "DEPENDENCIES: " + buf.toString() );
}
-
+
getLog().info( "PACKAGE: " + schemas[ii].getPkg() );
getLog().info( "OWNER: " + schemas[ii].getOwner() );
-
+
if ( ii + 1 < schemas.length )
{
getLog().info( "" );
}
}
}
-
+
getLog().info( "===================================================================" );
}
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ObjectClassLiteral.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ObjectClassLiteral.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ObjectClassLiteral.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ObjectClassLiteral.java Fri Feb 10 02:48:07 2006
@@ -47,8 +47,7 @@
// C O N S T R U C T O R S
// ------------------------------------------------------------------------
-
- public ObjectClassLiteral( String oid )
+ public ObjectClassLiteral(String oid)
{
this.oid = oid;
}
@@ -58,82 +57,96 @@
// Accessors and mutators
// ------------------------------------------------------------------------
-
public boolean isObsolete()
{
return obsolete;
}
+
public void setObsolete( boolean obsolete )
{
this.obsolete = obsolete;
}
+
public String getOid()
{
return oid;
}
+
public void setOid( String oid )
{
this.oid = oid;
}
+
public String getDescription()
{
return description;
}
+
public void setDescription( String description )
{
this.description = description;
}
+
public String[] getNames()
{
return names;
}
+
public void setNames( String[] names )
{
this.names = names;
}
+
public String[] getSuperiors()
{
return superiors;
}
+
public void setSuperiors( String[] superiors )
{
this.superiors = superiors;
}
+
public String[] getMust()
{
return must;
}
+
public void setMust( String[] must )
{
this.must = must;
}
+
public String[] getMay()
{
return may;
}
+
public void setMay( String[] may )
{
this.may = may;
}
+
public ObjectClassTypeEnum getClassType()
{
return classType;
}
+
public void setClassType( ObjectClassTypeEnum classType )
{
this.classType = classType;
@@ -144,7 +157,6 @@
// Object overrides
// ------------------------------------------------------------------------
-
public int hashCode()
{
return getOid().hashCode();
@@ -158,7 +170,7 @@
return true;
}
- if ( ! ( obj instanceof ObjectClassLiteral ) )
+ if ( !( obj instanceof ObjectClassLiteral ) )
{
return false;
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/OpenLdapAttributeTypeParser.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/OpenLdapAttributeTypeParser.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/OpenLdapAttributeTypeParser.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/OpenLdapAttributeTypeParser.java Fri Feb 10 02:48:07 2006
@@ -16,6 +16,7 @@
*/
package org.apache.directory.server.core.tools.schema;
+
/**
* Document me.
*
@@ -24,5 +25,5 @@
*/
public class OpenLdapAttributeTypeParser
{
-
+
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/OpenLdapSchemaParser.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/OpenLdapSchemaParser.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/OpenLdapSchemaParser.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/OpenLdapSchemaParser.java Fri Feb 10 02:48:07 2006
@@ -98,8 +98,7 @@
{
if ( schemaObject == null || schemaObject.trim().equals( "" ) )
{
- throw new ParseException( "The schemaObject is either null or is "
- + "the empty String!", 0 );
+ throw new ParseException( "The schemaObject is either null or is " + "the empty String!", 0 );
}
this.schemaIn = new ByteArrayInputStream( schemaObject.getBytes() );
@@ -124,25 +123,25 @@
}
catch ( RecognitionException e )
{
- String msg = "Parser failure on:\n\t" + subject ;
+ String msg = "Parser failure on:\n\t" + subject;
msg += "\nAntlr exception trace:\n" + ExceptionUtils.getFullStackTrace( e );
init();
throw new ParseException( msg, e.getColumn() );
}
catch ( TokenStreamException e2 )
{
- String msg = "Parser failure on:\n\t" + subject ;
+ String msg = "Parser failure on:\n\t" + subject;
msg += "\nAntlr exception trace:\n" + ExceptionUtils.getFullStackTrace( e2 );
init();
throw new ParseException( msg, 0 );
}
}
-
byte[] buf = new byte[128];
private InputStream schemaIn;
private Thread producerThread;
+
/**
* Thread safe method parses a stream of OpenLDAP schemaObject elements/objects.
*
@@ -183,10 +182,9 @@
public void setParserMonitor( ParserMonitor monitor )
{
- this.monitor = monitor ;
+ this.monitor = monitor;
this.parser.setParserMonitor( monitor );
}
-
class DataProducer implements Runnable
{
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ParserMonitor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ParserMonitor.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ParserMonitor.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ParserMonitor.java Fri Feb 10 02:48:07 2006
@@ -16,6 +16,7 @@
*/
package org.apache.directory.server.core.tools.schema;
+
/**
* A monitor for the OpenLdap parser.
*
@@ -26,7 +27,9 @@
{
void matchedProduction( String prod );
+
void startedParse( String s );
+
void finishedParse( String s );
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ParserMonitorAdapter.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ParserMonitorAdapter.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ParserMonitorAdapter.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ParserMonitorAdapter.java Fri Feb 10 02:48:07 2006
@@ -32,9 +32,11 @@
{
}
+
public void startedParse( String s )
{
}
+
public void finishedParse( String s )
{
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/Schema.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/Schema.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/Schema.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/Schema.java Fri Feb 10 02:48:07 2006
@@ -23,14 +23,14 @@
private String[] dependencies;
private String pkg;
private String owner;
-
-
+
+
public void setDependencies( String[] dependencies )
{
this.dependencies = dependencies;
}
-
-
+
+
public String[] getDependencies()
{
return dependencies;
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ConsoleParserMonitor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ConsoleParserMonitor.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ConsoleParserMonitor.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ConsoleParserMonitor.java Fri Feb 10 02:48:07 2006
@@ -16,6 +16,7 @@
*/
package org.apache.directory.server.core.tools.schema;
+
import org.apache.directory.server.core.tools.schema.ParserMonitor;
@@ -39,6 +40,7 @@
}
}
+
public void startedParse( String s )
{
if ( System.getProperties().containsKey( TRACE_KEY ) )
@@ -46,6 +48,7 @@
System.out.println( s );
}
}
+
public void finishedParse( String s )
{
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/OpenLdapSchemaParserTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/OpenLdapSchemaParserTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/OpenLdapSchemaParserTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/OpenLdapSchemaParserTest.java Fri Feb 10 02:48:07 2006
@@ -56,9 +56,9 @@
public void testSimpleAttributeTypeNoLength() throws Exception
{
- String attributeTypeData = "attributetype ( 2.5.4.14 NAME 'searchGuide'\n" +
- " DESC 'RFC2256: search guide, obsoleted by enhancedSearchGuide'\n" +
- " SYNTAX 1.3.6.1.4.1.1466.115.121.1.25 )";
+ String attributeTypeData = "attributetype ( 2.5.4.14 NAME 'searchGuide'\n"
+ + " DESC 'RFC2256: search guide, obsoleted by enhancedSearchGuide'\n"
+ + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.25 )";
parser.parse( attributeTypeData );
Map attributeTypes = parser.getAttributeTypes();
@@ -74,11 +74,9 @@
public void testSimpleAttributeTypeParse() throws Exception
{
- String attributeTypeData = "# adding a comment \n" +
- "attributetype ( 2.5.4.2 NAME 'knowledgeInformation'\n" +
- " DESC 'RFC2256: knowledge information'\n" +
- " EQUALITY caseIgnoreMatch\n" +
- " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";
+ String attributeTypeData = "# adding a comment \n" + "attributetype ( 2.5.4.2 NAME 'knowledgeInformation'\n"
+ + " DESC 'RFC2256: knowledge information'\n" + " EQUALITY caseIgnoreMatch\n"
+ + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";
parser.parse( attributeTypeData );
Map attributeTypes = parser.getAttributeTypes();
AttributeTypeLiteral type = ( AttributeTypeLiteral ) attributeTypes.get( "2.5.4.2" );
@@ -94,11 +92,9 @@
public void testAttributeTypeParseWithDescQuotes() throws Exception
{
- String attributeTypeData = "# adding a comment \n" +
- "attributetype ( 2.5.4.2 NAME 'knowledgeInformation'\n" +
- " DESC 'RFC2256: \"knowledge\" information'\n" +
- " EQUALITY caseIgnoreMatch\n" +
- " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";
+ String attributeTypeData = "# adding a comment \n" + "attributetype ( 2.5.4.2 NAME 'knowledgeInformation'\n"
+ + " DESC 'RFC2256: \"knowledge\" information'\n" + " EQUALITY caseIgnoreMatch\n"
+ + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";
parser.parse( attributeTypeData );
Map attributeTypes = parser.getAttributeTypes();
AttributeTypeLiteral type = ( AttributeTypeLiteral ) attributeTypes.get( "2.5.4.2" );
@@ -114,11 +110,10 @@
public void testComplexAttributeTypeParse() throws Exception
{
- String attributeTypeData = "# adding a comment \n" +
- "attributetype ( 2.5.4.2 NAME ( 'knowledgeInformation' 'asdf' ) \n" +
- " DESC 'RFC2256: knowledge information'\n" +
- " EQUALITY caseIgnoreMatch\n" +
- " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";
+ String attributeTypeData = "# adding a comment \n"
+ + "attributetype ( 2.5.4.2 NAME ( 'knowledgeInformation' 'asdf' ) \n"
+ + " DESC 'RFC2256: knowledge information'\n" + " EQUALITY caseIgnoreMatch\n"
+ + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";
parser.parse( attributeTypeData );
Map attributeTypes = parser.getAttributeTypes();
AttributeTypeLiteral type = ( AttributeTypeLiteral ) attributeTypes.get( "2.5.4.2" );
@@ -134,11 +129,9 @@
public void testObjectClassParse() throws Exception
{
- String objectClassData = "objectclass ( 2.5.6.6 NAME 'person'\n" +
- " DESC 'RFC2256: a person'\n" +
- " SUP top STRUCTURAL\n" +
- " MUST ( sn $ cn )\n" +
- " MAY ( userPassword $ telephoneNumber $ seeAlso $ description ) )";
+ String objectClassData = "objectclass ( 2.5.6.6 NAME 'person'\n" + " DESC 'RFC2256: a person'\n"
+ + " SUP top STRUCTURAL\n" + " MUST ( sn $ cn )\n"
+ + " MAY ( userPassword $ telephoneNumber $ seeAlso $ description ) )";
parser.parse( objectClassData );
Map objectClasses = parser.getObjectClassTypes();
ObjectClassLiteral objectClass = ( ObjectClassLiteral ) objectClasses.get( "2.5.6.6" );
@@ -159,21 +152,18 @@
public void testObjectClassMultipleNames() throws Exception
{
- String objectClassData = "objectclass ( 0.9.2342.19200300.100.4.4\n" +
- "\tNAME ( 'pilotPerson' 'newPilotPerson' )\n" +
- "\tSUP person STRUCTURAL\n" +
- "\tMAY ( userid $ textEncodedORAddress $ rfc822Mailbox $\n" +
- "\t\tfavouriteDrink $ roomNumber $ userClass $\n" +
- "\t\thomeTelephoneNumber $ homePostalAddress $ secretary $\n" +
- "\t\tpersonalTitle $ preferredDeliveryMethod $ businessCategory $\n" +
- "\t\tjanetMailbox $ otherMailbox $ mobileTelephoneNumber $\n" +
- "\t\tpagerTelephoneNumber $ organizationalStatus $\n" +
- "\t\tmailPreferenceOption $ personalSignature )\n" +
- "\t)";
+ String objectClassData = "objectclass ( 0.9.2342.19200300.100.4.4\n"
+ + "\tNAME ( 'pilotPerson' 'newPilotPerson' )\n" + "\tSUP person STRUCTURAL\n"
+ + "\tMAY ( userid $ textEncodedORAddress $ rfc822Mailbox $\n"
+ + "\t\tfavouriteDrink $ roomNumber $ userClass $\n"
+ + "\t\thomeTelephoneNumber $ homePostalAddress $ secretary $\n"
+ + "\t\tpersonalTitle $ preferredDeliveryMethod $ businessCategory $\n"
+ + "\t\tjanetMailbox $ otherMailbox $ mobileTelephoneNumber $\n"
+ + "\t\tpagerTelephoneNumber $ organizationalStatus $\n"
+ + "\t\tmailPreferenceOption $ personalSignature )\n" + "\t)";
parser.parse( objectClassData );
Map objectClasses = parser.getObjectClassTypes();
- ObjectClassLiteral objectClass = ( ObjectClassLiteral )
- objectClasses.get( "0.9.2342.19200300.100.4.4" );
+ ObjectClassLiteral objectClass = ( ObjectClassLiteral ) objectClasses.get( "0.9.2342.19200300.100.4.4" );
assertNotNull( objectClass );
assertEquals( "0.9.2342.19200300.100.4.4", objectClass.getOid() );
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapSchema.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapSchema.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapSchema.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/AbstractBootstrapSchema.java Fri Feb 10 02:48:07 2006
@@ -49,30 +49,25 @@
// C O N S T R U C T O R S
// ------------------------------------------------------------------------
-
- protected AbstractBootstrapSchema( String schemaName )
+ protected AbstractBootstrapSchema(String schemaName)
{
this( null, schemaName, null, null );
}
- protected AbstractBootstrapSchema( String owner, String schemaName )
+ protected AbstractBootstrapSchema(String owner, String schemaName)
{
this( owner, schemaName, null, null );
}
- protected AbstractBootstrapSchema( String owner, String schemaName,
- String packageName )
+ protected AbstractBootstrapSchema(String owner, String schemaName, String packageName)
{
this( owner, schemaName, packageName, null );
}
- protected AbstractBootstrapSchema( String owner,
- String schemaName,
- String packageName,
- String[] dependencies )
+ protected AbstractBootstrapSchema(String owner, String schemaName, String packageName, String[] dependencies)
{
if ( owner == null )
{
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchema.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchema.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchema.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchema.java Fri Feb 10 02:48:07 2006
@@ -34,6 +34,7 @@
*/
String getOwner();
+
/**
* Gets the name of the logical schema the objects of this BootstrapSchema
* belong to: e.g. krb5-kdc may be the logical LDAP schema name.
@@ -42,6 +43,7 @@
*/
String getSchemaName();
+
/**
* Gets the package name of the schema's object factories.
*
@@ -49,6 +51,7 @@
*/
String getPackageName();
+
/**
* Gets the names of other schemas that this objects within this
* BootstrapSchema depends upon. These dependent schemas are those
@@ -58,6 +61,7 @@
*/
String[] getDependencies();
+
/**
* Gets the base class name for bootstrap Schema class files. This name
* is the schema name with the first character capitalized and qualified
@@ -68,6 +72,7 @@
*/
String getBaseClassName();
+
/**
* Gets the default base class name for bootstrap Schema class files. This
* name is the schema name with the first character capitalized and qualified
@@ -78,6 +83,7 @@
*/
String getDefaultBaseClassName();
+
/**
* Gets the class name for bootstrap Schema class producer type.
*
@@ -85,6 +91,7 @@
*/
String getFullClassName( ProducerTypeEnum type );
+
/**
* If the base class name for the target class does not resolve, we attempt
* to load another backup class using this default base class name which
@@ -94,12 +101,14 @@
*/
String getFullDefaultBaseClassName( ProducerTypeEnum type );
+
/**
* Gets the unqualified class name for bootstrap Schema class producer type.
*
* @return the bootstrap schema class name for a producer type in this schema
*/
String getUnqualifiedClassName( ProducerTypeEnum type );
+
/**
* Gets the unqualified class name for Schema class.
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/ProducerTypeEnum.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/ProducerTypeEnum.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/ProducerTypeEnum.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-shared/src/main/java/org/apache/directory/server/core/schema/bootstrap/ProducerTypeEnum.java Fri Feb 10 02:48:07 2006
@@ -46,15 +46,13 @@
*/
public class ProducerTypeEnum extends ValuedEnum
{
- private static final long serialVersionUID = 3257284725524475954L;
+ private static final long serialVersionUID = 3257284725524475954L;
- private static final String[] producers = {
- "NormalizerProducer", "ComparatorProducer", "SyntaxCheckerProducer",
- "SyntaxProducer", "MatchingRuleProducer", "AttributeTypeProducer",
- "ObjectClassProducer", "MatchingRuleUseProducer", "DitContentRuleProducer",
- "NameFormProducer", "DitStructureRuleProducer",
- "StateFactoryProducer", "ObjectFactoryProducer"
- };
+ private static final String[] producers =
+ { "NormalizerProducer", "ComparatorProducer", "SyntaxCheckerProducer", "SyntaxProducer",
+ "MatchingRuleProducer", "AttributeTypeProducer", "ObjectClassProducer", "MatchingRuleUseProducer",
+ "DitContentRuleProducer", "NameFormProducer", "DitStructureRuleProducer", "StateFactoryProducer",
+ "ObjectFactoryProducer" };
/** value for Normalizer BootstrapProducers */
public static final int NORMALIZER_PRODUCER_VAL = 0;
@@ -83,46 +81,44 @@
/** value for ObjectFactory BootstrapProducers */
public static final int OBJECT_FACTORY_PRODUCER_VAL = 12;
-
/** enum for BootstrapProducers of Normalizer schema objects */
- public static final ProducerTypeEnum NORMALIZER_PRODUCER =
- new ProducerTypeEnum( producers[0], NORMALIZER_PRODUCER_VAL );
+ public static final ProducerTypeEnum NORMALIZER_PRODUCER = new ProducerTypeEnum( producers[0],
+ NORMALIZER_PRODUCER_VAL );
/** enum for BootstrapProducers of Comparator schema objects */
- public static final ProducerTypeEnum COMPARATOR_PRODUCER =
- new ProducerTypeEnum( producers[1], COMPARATOR_PRODUCER_VAL );
+ public static final ProducerTypeEnum COMPARATOR_PRODUCER = new ProducerTypeEnum( producers[1],
+ COMPARATOR_PRODUCER_VAL );
/** enum for BootstrapProducers of SyntaxChecker schema objects */
- public static final ProducerTypeEnum SYNTAX_CHECKER_PRODUCER =
- new ProducerTypeEnum( producers[2], SYNTAX_CHECKER_PRODUCER_VAL );
+ public static final ProducerTypeEnum SYNTAX_CHECKER_PRODUCER = new ProducerTypeEnum( producers[2],
+ SYNTAX_CHECKER_PRODUCER_VAL );
/** enum for BootstrapProducers of Syntax schema objects */
- public static final ProducerTypeEnum SYNTAX_PRODUCER =
- new ProducerTypeEnum( producers[3], SYNTAX_PRODUCER_VAL );
+ public static final ProducerTypeEnum SYNTAX_PRODUCER = new ProducerTypeEnum( producers[3], SYNTAX_PRODUCER_VAL );
/** enum for BootstrapProducers of MatchingRule schema objects */
- public static final ProducerTypeEnum MATCHING_RULE_PRODUCER =
- new ProducerTypeEnum( producers[4], MATCHING_RULE_PRODUCER_VAL );
+ public static final ProducerTypeEnum MATCHING_RULE_PRODUCER = new ProducerTypeEnum( producers[4],
+ MATCHING_RULE_PRODUCER_VAL );
/** enum for BootstrapProducers of AttributeType schema objects */
- public static final ProducerTypeEnum ATTRIBUTE_TYPE_PRODUCER =
- new ProducerTypeEnum( producers[5], ATTRIBUTE_TYPE_PRODUCER_VAL );
+ public static final ProducerTypeEnum ATTRIBUTE_TYPE_PRODUCER = new ProducerTypeEnum( producers[5],
+ ATTRIBUTE_TYPE_PRODUCER_VAL );
/** enum for BootstrapProducers of ObjectClass schema objects */
- public static final ProducerTypeEnum OBJECT_CLASS_PRODUCER =
- new ProducerTypeEnum( producers[6], OBJECT_CLASS_PRODUCER_VAL );
+ public static final ProducerTypeEnum OBJECT_CLASS_PRODUCER = new ProducerTypeEnum( producers[6],
+ OBJECT_CLASS_PRODUCER_VAL );
/** enum for BootstrapProducers of MatchingRule schema objects */
- public static final ProducerTypeEnum MATCHING_RULE_USE_PRODUCER =
- new ProducerTypeEnum( producers[7], MATCHING_RULE_USE_PRODUCER_VAL );
+ public static final ProducerTypeEnum MATCHING_RULE_USE_PRODUCER = new ProducerTypeEnum( producers[7],
+ MATCHING_RULE_USE_PRODUCER_VAL );
/** enum for BootstrapProducers of DitContentRule schema objects */
- public static final ProducerTypeEnum DIT_CONTENT_RULE_PRODUCER =
- new ProducerTypeEnum( producers[8], DIT_CONTENT_RULE_PRODUCER_VAL );
+ public static final ProducerTypeEnum DIT_CONTENT_RULE_PRODUCER = new ProducerTypeEnum( producers[8],
+ DIT_CONTENT_RULE_PRODUCER_VAL );
/** enum for BootstrapProducers of NameForm schema objects */
- public static final ProducerTypeEnum NAME_FORM_PRODUCER =
- new ProducerTypeEnum( producers[9], NAME_FORM_PRODUCER_VAL );
+ public static final ProducerTypeEnum NAME_FORM_PRODUCER = new ProducerTypeEnum( producers[9],
+ NAME_FORM_PRODUCER_VAL );
/** enum for BootstrapProducers of DitStructureRule schema objects */
- public static final ProducerTypeEnum DIT_STRUCTURE_RULE_PRODUCER =
- new ProducerTypeEnum( producers[10], DIT_STRUCTURE_RULE_PRODUCER_VAL );
+ public static final ProducerTypeEnum DIT_STRUCTURE_RULE_PRODUCER = new ProducerTypeEnum( producers[10],
+ DIT_STRUCTURE_RULE_PRODUCER_VAL );
/** enum for BootstrapProducers of StateFactory schema objects */
- public static final ProducerTypeEnum STATE_FACTORY_PRODUCER =
- new ProducerTypeEnum( producers[11], STATE_FACTORY_PRODUCER_VAL );
+ public static final ProducerTypeEnum STATE_FACTORY_PRODUCER = new ProducerTypeEnum( producers[11],
+ STATE_FACTORY_PRODUCER_VAL );
/** enum for BootstrapProducers of ObjectFactory schema objects */
- public static final ProducerTypeEnum OBJECT_FACTORY_PRODUCER =
- new ProducerTypeEnum( producers[12], OBJECT_FACTORY_PRODUCER_VAL );
+ public static final ProducerTypeEnum OBJECT_FACTORY_PRODUCER = new ProducerTypeEnum( producers[12],
+ OBJECT_FACTORY_PRODUCER_VAL );
/**
@@ -132,12 +128,12 @@
* @param name a string name for the enumeration value.
* @param value the integer value of the enumeration.
*/
- private ProducerTypeEnum( final String name, final int value )
+ private ProducerTypeEnum(final String name, final int value)
{
super( name, value );
}
-
-
+
+
/**
* Gets the enumeration type for the attributeType producerType string regardless
* of case.
@@ -200,11 +196,10 @@
return ProducerTypeEnum.OBJECT_FACTORY_PRODUCER;
}
- throw new IllegalArgumentException( "Unknown ProducerTypeEnum string"
- + producerType );
+ throw new IllegalArgumentException( "Unknown ProducerTypeEnum string" + producerType );
}
-
-
+
+
/**
* Gets a List of the enumerations.
*
@@ -214,8 +209,8 @@
{
return EnumUtils.getEnumList( ProducerTypeEnum.class );
}
-
-
+
+
/**
* Gets the Map of ProducerTypeEnum objects by name.
*
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractNonAdminTestCase.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractNonAdminTestCase.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractNonAdminTestCase.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractNonAdminTestCase.java Fri Feb 10 02:48:07 2006
@@ -17,8 +17,6 @@
package org.apache.directory.server.core.unit;
-
-
/**
* Adds extra code to perform operations as another user besides the admin user.
*
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java Fri Feb 10 02:48:07 2006
@@ -44,7 +44,7 @@
import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
-
+
/**
* A simple testcase for testing JNDI provider functionality.
*
@@ -53,34 +53,23 @@
*/
public abstract class AbstractTestCase extends TestCase
{
- public static final String LDIF = "dn: uid=akarasulu,ou=users,ou=system\n" +
- "cn: Alex Karasulu\n" +
- "sn: Karasulu\n" +
- "givenname: Alex\n" +
- "objectclass: top\n" +
- "objectclass: person\n" +
- "objectclass: organizationalPerson\n" +
- "objectclass: inetOrgPerson\n" +
- "ou: Engineering\n" +
- "ou: People\n" +
- "l: Bogusville\n" +
- "uid: akarasulu\n" +
- "mail: akarasulu@apache.org\n" +
- "telephonenumber: +1 408 555 4798\n" +
- "facsimiletelephonenumber: +1 408 555 9751\n" +
- "roomnumber: 4612\n" +
- "userpassword: test\n";
-
+ public static final String LDIF = "dn: uid=akarasulu,ou=users,ou=system\n" + "cn: Alex Karasulu\n"
+ + "sn: Karasulu\n" + "givenname: Alex\n" + "objectclass: top\n" + "objectclass: person\n"
+ + "objectclass: organizationalPerson\n" + "objectclass: inetOrgPerson\n" + "ou: Engineering\n" + "ou: People\n"
+ + "l: Bogusville\n" + "uid: akarasulu\n" + "mail: akarasulu@apache.org\n"
+ + "telephonenumber: +1 408 555 4798\n" + "facsimiletelephonenumber: +1 408 555 9751\n" + "roomnumber: 4612\n"
+ + "userpassword: test\n";
+
private final String username;
-
+
private final String password;
/** the context root for the system partition */
protected LdapContext sysRoot;
-
+
/** flag whether to delete database files for each test or not */
protected boolean doDelete = true;
-
+
protected MutableStartupConfiguration configuration = new MutableStartupConfiguration();
/** A testEntries of entries as Attributes to add to the DIT for testing */
@@ -92,11 +81,12 @@
/** Load resources relative to this class */
private Class loadClass;
- private Hashtable overrides = new Hashtable();
+ private Hashtable overrides = new Hashtable();
+
- protected AbstractTestCase( String username, String password )
+ protected AbstractTestCase(String username, String password)
{
- if( username == null || password == null )
+ if ( username == null || password == null )
{
throw new NullPointerException();
}
@@ -104,7 +94,7 @@
this.username = username;
this.password = password;
}
-
+
/**
* Sets the LDIF path as a relative resource path to use with the
@@ -259,14 +249,14 @@
protected LdapContext setSysRoot( Hashtable env ) throws NamingException
{
Hashtable envFinal = new Hashtable( env );
- if ( ! envFinal.containsKey( Context.PROVIDER_URL ) )
+ if ( !envFinal.containsKey( Context.PROVIDER_URL ) )
{
envFinal.put( Context.PROVIDER_URL, "ou=system" );
}
-
+
envFinal.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
envFinal.putAll( overrides );
-
+
// We have to initiate the first run as an admin at least.
Hashtable adminEnv = new Hashtable( envFinal );
adminEnv.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
@@ -278,6 +268,7 @@
return sysRoot = new InitialLdapContext( envFinal, null );
}
+
/**
* Overrides default JNDI environment properties. Please call this method
* to override any JNDI environment properties this test case will set.
@@ -312,7 +303,13 @@
env.put( Context.SECURITY_CREDENTIALS, "secret" );
env.put( Context.SECURITY_AUTHENTICATION, "simple" );
- try { new InitialContext( env ); } catch( Exception e ) {}
+ try
+ {
+ new InitialContext( env );
+ }
+ catch ( Exception e )
+ {
+ }
sysRoot = null;
Runtime.getRuntime().gc();
testEntries.clear();
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationTest.java Fri Feb 10 02:48:07 2006
@@ -72,12 +72,12 @@
*/
protected void setUp() throws Exception
{
- super.doDelete = !( getName().equals("test1AdminAccountCreation") ||
- getName().equals("test2AccountExistsOnRestart") );
+ super.doDelete = !( getName().equals( "test1AdminAccountCreation" ) || getName().equals(
+ "test2AccountExistsOnRestart" ) );
- if ( getName().equals( "test5BuildDbNoPassWithPrincAuthNone" ) ||
- getName().equals( "test6BuildDbNoPassNotAdminPrinc" ) ||
- getName().equals( "test4BuildDbNoPassNoPrincAuthNone" ) )
+ if ( getName().equals( "test5BuildDbNoPassWithPrincAuthNone" )
+ || getName().equals( "test6BuildDbNoPassNotAdminPrinc" )
+ || getName().equals( "test4BuildDbNoPassNoPrincAuthNone" ) )
{
return;
}
@@ -112,7 +112,7 @@
DirContext ctx = ( DirContext ) sysRoot.lookup( "uid=admin" );
Attributes attrs = ctx.getAttributes( "" );
performAdminAccountChecks( attrs );
- assertTrue( ArrayUtils.isEquals( attrs.get( "userPassword" ).get(), "secret".getBytes() ));
+ assertTrue( ArrayUtils.isEquals( attrs.get( "userPassword" ).get(), "secret".getBytes() ) );
}
@@ -127,7 +127,7 @@
Attributes attrs = ctx.getAttributes( "" );
performAdminAccountChecks( attrs );
- assertTrue( ArrayUtils.isEquals( attrs.get( "userPassword" ).get(), "secret".getBytes() ));
+ assertTrue( ArrayUtils.isEquals( attrs.get( "userPassword" ).get(), "secret".getBytes() ) );
}
@@ -176,14 +176,14 @@
tearDown();
Hashtable env = new Hashtable( configuration.toJndiEnvironment() );
env.put( Context.SECURITY_AUTHENTICATION, "none" );
-
+
configuration.setAllowAnonymousAccess( false );
try
{
setSysRoot( env );
fail( "should not get here due to exception" );
}
- catch( LdapNoPermissionException e )
+ catch ( LdapNoPermissionException e )
{
}
tearDown();
@@ -206,12 +206,12 @@
{
initial.lookup( "uid=admin" );
fail( "should not get here due to exception cuz anonymous user is "
- + "not allowed read access to the admin account entry" );
+ + "not allowed read access to the admin account entry" );
}
- catch( LdapConfigurationException e )
+ catch ( LdapConfigurationException e )
{
}
- catch( LdapNoPermissionException e )
+ catch ( LdapNoPermissionException e )
{
}
}
@@ -240,7 +240,7 @@
setSysRoot( env );
fail( "should not get here due to exception" );
}
- catch( ConfigurationException e )
+ catch ( ConfigurationException e )
{
}
}
@@ -269,7 +269,7 @@
setSysRoot( env );
fail( "should not get here due to exception" );
}
- catch( ConfigurationException e )
+ catch ( ConfigurationException e )
{
}
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AbstractAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AbstractAuthorizationTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AbstractAuthorizationTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AbstractAuthorizationTest.java Fri Feb 10 02:48:07 2006
@@ -56,7 +56,6 @@
// Utility methods used by subclasses
// -----------------------------------------------------------------------
-
/**
* Gets a context at ou=system as the admin user.
*
@@ -108,8 +107,8 @@
objectClass.add( "top" );
objectClass.add( "groupOfUniqueNames" );
group.put( "uniqueMember", firstMemberDn );
- adminCtx.createSubcontext( "cn="+cn+",ou=groups", group );
- return new LdapName( "cn="+cn+",ou=groups,ou=system" );
+ adminCtx.createSubcontext( "cn=" + cn + ",ou=groups", group );
+ return new LdapName( "cn=" + cn + ",ou=groups,ou=system" );
}
@@ -123,7 +122,7 @@
public void deleteUser( String uid ) throws NamingException
{
DirContext adminCtx = getContextAsAdmin();
- adminCtx.destroySubcontext( "uid="+uid+",ou=users" );
+ adminCtx.destroySubcontext( "uid=" + uid + ",ou=users" );
}
@@ -150,8 +149,8 @@
objectClass.add( "inetOrgPerson" );
user.put( "sn", uid );
user.put( "cn", uid );
- adminCtx.createSubcontext( "uid="+uid+",ou=users", user );
- return new LdapName( "uid="+uid+",ou=users,ou=system" );
+ adminCtx.createSubcontext( "uid=" + uid + ",ou=users", user );
+ return new LdapName( "uid=" + uid + ",ou=users,ou=system" );
}
@@ -166,10 +165,8 @@
public void addUserToGroup( String userUid, String groupCn ) throws NamingException
{
DirContext adminCtx = getContextAsAdmin();
- Attributes changes = new BasicAttributes( "uniqueMember",
- "uid="+userUid+",ou=users,ou=system", true );
- adminCtx.modifyAttributes( "cn="+groupCn+",ou=groups",
- DirContext.ADD_ATTRIBUTE, changes );
+ Attributes changes = new BasicAttributes( "uniqueMember", "uid=" + userUid + ",ou=users,ou=system", true );
+ adminCtx.modifyAttributes( "cn=" + groupCn + ",ou=groups", DirContext.ADD_ATTRIBUTE, changes );
}
@@ -183,10 +180,8 @@
public void removeUserFromGroup( String userUid, String groupCn ) throws NamingException
{
DirContext adminCtx = getContextAsAdmin();
- Attributes changes = new BasicAttributes( "uniqueMember",
- "uid="+userUid+",ou=users,ou=system", true );
- adminCtx.modifyAttributes( "cn="+groupCn+",ou=groups",
- DirContext.REMOVE_ATTRIBUTE, changes );
+ Attributes changes = new BasicAttributes( "uniqueMember", "uid=" + userUid + ",ou=users,ou=system", true );
+ adminCtx.modifyAttributes( "cn=" + groupCn + ",ou=groups", DirContext.REMOVE_ATTRIBUTE, changes );
}
@@ -259,9 +254,10 @@
DirContext adminCtx = getContextAsAdmin();
// modify ou=system to be an AP for an A/C AA if it is not already
- Attributes ap = adminCtx.getAttributes( "", new String[] { "administrativeRole" } );
+ Attributes ap = adminCtx.getAttributes( "", new String[]
+ { "administrativeRole" } );
Attribute administrativeRole = ap.get( "administrativeRole" );
- if ( administrativeRole == null || ! administrativeRole.contains( SubentryService.AC_AREA ) )
+ if ( administrativeRole == null || !administrativeRole.contains( SubentryService.AC_AREA ) )
{
Attributes changes = new BasicAttributes( "administrativeRole", SubentryService.AC_AREA, true );
adminCtx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationTest.java Fri Feb 10 02:48:07 2006
@@ -56,7 +56,7 @@
try
{
- LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+ LdapName userName = new LdapName( "uid=" + uid + ",ou=users,ou=system" );
DirContext userContext = getContextAs( userName, password );
userContext.createSubcontext( entryRdn, testEntry );
@@ -88,15 +88,11 @@
// Gives grantAdd perm to all users in the Administrators group for
// entries and all attribute types and values
- createAccessControlSubentry( "administratorAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " +
- "userPermissions { { " +
- "protectedItems {entry, allUserAttributeTypesAndValues}, " +
- "grantsAndDenials { grantAdd, grantBrowse } } } } }" );
+ createAccessControlSubentry( "administratorAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " + "userPermissions { { "
+ + "protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + "grantsAndDenials { grantAdd, grantBrowse } } } } }" );
// see if we can now add that test entry which we could not before
// add op should still fail since billd is not in the admin group
@@ -124,15 +120,11 @@
assertFalse( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
// now add a subentry that enables user billyd to add an entry below ou=system
- createAccessControlSubentry( "billydAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " +
- "userPermissions { { " +
- "protectedItems {entry, allUserAttributeTypesAndValues}, " +
- "grantsAndDenials { grantAdd, grantBrowse } } } } }" );
+ createAccessControlSubentry( "billydAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " + "userPermissions { { "
+ + "protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + "grantsAndDenials { grantAdd, grantBrowse } } } } }" );
// should work now that billyd is authorized by name
assertTrue( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
@@ -153,15 +145,11 @@
assertFalse( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
// now add a subentry that enables user billyd to add an entry below ou=system
- createAccessControlSubentry( "billyAddBySubtree", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { subtree { { base \"ou=users,ou=system\" } } }, " +
- "userPermissions { { " +
- "protectedItems {entry, allUserAttributeTypesAndValues}, " +
- "grantsAndDenials { grantAdd, grantBrowse } } } } }" );
+ createAccessControlSubentry( "billyAddBySubtree", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { subtree { { base \"ou=users,ou=system\" } } }, " + "userPermissions { { "
+ + "protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + "grantsAndDenials { grantAdd, grantBrowse } } } } }" );
// should work now that billyd is authorized by the subtree userClass
assertTrue( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
@@ -182,15 +170,10 @@
assertFalse( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
// now add a subentry that enables anyone to add an entry below ou=system
- createAccessControlSubentry( "anybodyAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { allUsers }, " +
- "userPermissions { { " +
- "protectedItems {entry, allUserAttributeTypesAndValues}, " +
- "grantsAndDenials { grantAdd, grantBrowse } } } } }" );
+ createAccessControlSubentry( "anybodyAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, "
+ + "userPermissions { { " + "protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + "grantsAndDenials { grantAdd, grantBrowse } } } } }" );
// see if we can now add that test entry which we could not before
// should work now with billyd now that all users are authorized
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminTest.java Fri Feb 10 02:48:07 2006
@@ -85,10 +85,12 @@
try
{
- sysRoot.modifyAttributes( "uid=admin",
- DirContext.REPLACE_ATTRIBUTE, attributes );
+ sysRoot.modifyAttributes( "uid=admin", DirContext.REPLACE_ATTRIBUTE, attributes );
fail( "User 'uid=admin,ou=system' should not be able to modify attributes on admin" );
- } catch( Exception e ) { }
+ }
+ catch ( Exception e )
+ {
+ }
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationTest.java Fri Feb 10 02:48:07 2006
@@ -53,7 +53,7 @@
* @throws javax.naming.NamingException if there are problems conducting the test
*/
public boolean checkCanCompareTelephoneNumberAs( String uid, String password, String entryRdn, String number )
- throws NamingException
+ throws NamingException
{
// create the entry with the telephoneNumber attribute to compare
Attributes testEntry = new BasicAttributes( "ou", "testou", true );
@@ -61,14 +61,14 @@
testEntry.put( objectClass );
objectClass.add( "top" );
objectClass.add( "organizationalUnit" );
- testEntry.put( "telephoneNumber", "867-5309" ); // jenny don't change your number
+ testEntry.put( "telephoneNumber", "867-5309" ); // jenny don't change your number
DirContext adminContext = getContextAsAdmin();
try
{
// create the entry as admin
- LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+ LdapName userName = new LdapName( "uid=" + uid + ",ou=users,ou=system" );
adminContext.createSubcontext( entryRdn, testEntry );
// compare the telephone numbers
@@ -106,15 +106,11 @@
// Gives grantCompare, and grantRead perm to all users in the Administrators group for
// entries and all attribute types and values
- createAccessControlSubentry( "administratorAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " +
- "userPermissions { { " +
- "protectedItems {entry, allUserAttributeTypesAndValues}, " +
- "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
+ createAccessControlSubentry( "administratorAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " + "userPermissions { { "
+ + "protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
// see if we can now add that test entry which we could not before
// add op should still fail since billd is not in the admin group
@@ -142,15 +138,11 @@
assertFalse( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309" ) );
// now add a subentry that enables user billyd to compare an entry below ou=system
- createAccessControlSubentry( "billydAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " +
- "userPermissions { { " +
- "protectedItems {entry, allUserAttributeTypesAndValues}, " +
- "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
+ createAccessControlSubentry( "billydAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " + "userPermissions { { "
+ + "protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
// should work now that billyd is authorized by name
assertTrue( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309" ) );
@@ -171,15 +163,11 @@
assertFalse( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309" ) );
// now add a subentry that enables user billyd to compare an entry below ou=system
- createAccessControlSubentry( "billyAddBySubtree", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { subtree { { base \"ou=users,ou=system\" } } }, " +
- "userPermissions { { " +
- "protectedItems {entry, allUserAttributeTypesAndValues}, " +
- "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
+ createAccessControlSubentry( "billyAddBySubtree", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { subtree { { base \"ou=users,ou=system\" } } }, " + "userPermissions { { "
+ + "protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
// should work now that billyd is authorized by the subtree userClass
assertTrue( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309" ) );
@@ -200,22 +188,19 @@
assertFalse( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309" ) );
// now add a subentry that enables anyone to add an entry below ou=system
- createAccessControlSubentry( "anybodyAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { allUsers }, " +
- "userPermissions { { " +
- "protectedItems {entry, allUserAttributeTypesAndValues}, " +
- "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
+ createAccessControlSubentry( "anybodyAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, "
+ + "userPermissions { { " + "protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
// see if we can now compare that test entry's number which we could not before
// should work with billyd now that all users are authorized
assertTrue( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309" ) );
}
-
- public void testPasswordCompare() throws NamingException {
+
+
+ public void testPasswordCompare() throws NamingException
+ {
DirContext adminCtx = getContextAsAdmin();
Attributes user = new BasicAttributes( "uid", "bob", true );
user.put( "userPassword", "bobspassword".getBytes() );
@@ -230,7 +215,7 @@
adminCtx.createSubcontext( "uid=bob,ou=users", user );
ServerLdapContext ctx = ( ServerLdapContext ) adminCtx.lookup( "" );
- assertTrue(ctx.compare(new LdapName( "uid=bob,ou=users,ou=system"), "userPassword", "bobspassword"));
+ assertTrue( ctx.compare( new LdapName( "uid=bob,ou=users,ou=system" ), "userPassword", "bobspassword" ) );
}
-
+
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationTest.java Fri Feb 10 02:48:07 2006
@@ -63,7 +63,7 @@
try
{
// create the entry as the admin
- LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+ LdapName userName = new LdapName( "uid=" + uid + ",ou=users,ou=system" );
adminContext.createSubcontext( entryRdn, testEntry );
// delete the newly created context as the user
@@ -95,15 +95,10 @@
// Gives grantRemove perm to all users in the Administrators group for
// entries and all attribute types and values
- createAccessControlSubentry( "administratorAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " +
- "userPermissions { { " +
- "protectedItems {entry}, " +
- "grantsAndDenials { grantRemove, grantBrowse } } } } }" );
+ createAccessControlSubentry( "administratorAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " + "userPermissions { { "
+ + "protectedItems {entry}, " + "grantsAndDenials { grantRemove, grantBrowse } } } } }" );
// see if we can now delete that test entry which we could not before
// delete op should still fail since billd is not in the admin group
@@ -131,15 +126,10 @@
assertFalse( checkCanDeleteEntryAs( "billyd", "billyd", "ou=testou" ) );
// now add a subentry that enables user billyd to delete an entry below ou=system
- createAccessControlSubentry( "billydAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " +
- "userPermissions { { " +
- "protectedItems {entry}, " +
- "grantsAndDenials { grantRemove, grantBrowse } } } } }" );
+ createAccessControlSubentry( "billydAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " + "userPermissions { { "
+ + "protectedItems {entry}, " + "grantsAndDenials { grantRemove, grantBrowse } } } } }" );
// should work now that billyd is authorized by name
assertTrue( checkCanDeleteEntryAs( "billyd", "billyd", "ou=testou" ) );
@@ -160,15 +150,10 @@
assertFalse( checkCanDeleteEntryAs( "billyd", "billyd", "ou=testou" ) );
// now add a subentry that enables user billyd to delte an entry below ou=system
- createAccessControlSubentry( "billyAddBySubtree", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { subtree { { base \"ou=users,ou=system\" } } }, " +
- "userPermissions { { " +
- "protectedItems {entry}, " +
- "grantsAndDenials { grantRemove, grantBrowse } } } } }" );
+ createAccessControlSubentry( "billyAddBySubtree", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
+ + "userClasses { subtree { { base \"ou=users,ou=system\" } } }, " + "userPermissions { { "
+ + "protectedItems {entry}, " + "grantsAndDenials { grantRemove, grantBrowse } } } } }" );
// should work now that billyd is authorized by the subtree userClass
assertTrue( checkCanDeleteEntryAs( "billyd", "billyd", "ou=testou" ) );
@@ -189,15 +174,10 @@
assertFalse( checkCanDeleteEntryAs( "billyd", "billyd", "ou=testou" ) );
// now add a subentry that enables anyone to add an entry below ou=system
- createAccessControlSubentry( "anybodyAdd", "{ " +
- "identificationTag \"addAci\", " +
- "precedence 14, " +
- "authenticationLevel none, " +
- "itemOrUserFirst userFirst: { " +
- "userClasses { allUsers }, " +
- "userPermissions { { " +
- "protectedItems {entry}, " +
- "grantsAndDenials { grantRemove, grantBrowse } } } } }" );
+ createAccessControlSubentry( "anybodyAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
+ + "authenticationLevel none, " + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, "
+ + "userPermissions { { " + "protectedItems {entry}, "
+ + "grantsAndDenials { grantRemove, grantBrowse } } } } }" );
// see if we can now delete that test entry which we could not before
// should work now with billyd now that all users are authorized