directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject Re: [JNDI] Possible Bug?
Date Thu, 17 May 2007 16:36:35 GMT
Hey Emmanuel,

That make sense.
I'll just file them as JIRA from now on then.
Coming right up.

Cheers,
- Ole



Emmanuel Lecharny wrote:
> Ole Ersoy a écrit :
> 
>> Hey Guys,
> 
> Hey,
> 
> this sounds like a bug if it hangs. Can you create a JIR for it, and 
> attach the test to it? If it's not a bug, we will simply close the JIRA, 
> and if it's a bug, we will fix it.
> 
> As a rule of thumb, even if you are not sure that it's a bug, but think 
> it is, fill a JIRA : it won't be lost on the ML. We really prefer to 
> discard invalid bugs from JIRA than missing one possible bug simply 
> because we forget to fix it as soon as it hit the ML. Remember that we 
> receive an average of 17 mails per day in Directory dev only 
> (http://people.apache.org/~coar/mlists.html#directory.apache.org), not 
> conting Users and Commits
> 
> Thanks !
> 
>>
>> I do a lookup like this inside a test:
>>         syntaxContext.lookup(xsdSyntaxStringRDN);
>> //      syntaxContext.lookup("monkeywrench");
>>
>> If I leave the monkeywrench lookup commented
>> out, the test runs fine repeatedly.
>>
>> If I comment in the monkeywrench the
>> test just hangs.  I was expecting
>> a NamingException.
>>
>> Could this be a bug?
>>
>> I pasted a self contained test for this
>> below.
>>
>> Cheers,
>> - Ole
>>
>>
>> package org.apache.tuscany.das.ldap.create.test;
>>
>> import java.util.Hashtable;
>>
>> import javax.naming.NamingException;
>> import javax.naming.directory.Attribute;
>> import javax.naming.directory.Attributes;
>> import javax.naming.directory.BasicAttribute;
>> import javax.naming.directory.BasicAttributes;
>> import javax.naming.directory.DirContext;
>> import javax.naming.directory.InitialDirContext;
>>
>> import junit.framework.TestCase;
>>
>> public class CreateSyntaxEntrySelfContainedTest extends TestCase
>> {
>>     private static final String XSD_CONTEXT_RDN     = "cn=xsd";
>>     private static final String XSD_SYNTAX_RDN      = "ou=syntaxes";
>>     private static final String OID    = 
>> "1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233";
>>
>>     private DirContext directoryContext = null;
>>     private DirContext xsdContext       = null;
>>     private DirContext syntaxContext    = null;
>>     private String xsdSyntaxStringRDN = "m-oid" + "=" + OID;
>>
>>
>>     public void setUp() throws NamingException
>>     {
>>         directoryContext    = connect();
>>         xsdContext          = createXSDSchemaContext();
>>         syntaxContext       = createSyntaxContext();
>>     }
>>
>>     public void tearDown() throws NamingException
>>     {
>>         syntaxContext.destroySubcontext( xsdSyntaxStringRDN );
>>         syntaxContext.close();
>>         xsdContext.destroySubcontext( XSD_SYNTAX_RDN );
>>         xsdContext.close();
>>         directoryContext.destroySubcontext( XSD_CONTEXT_RDN );
>>         directoryContext.close();
>>     }
>>
>>     public DirContext connect() throws NamingException
>>     {
>>                 Hashtable<String,String> env = new Hashtable<String, 
>> String>();
>>
>>                 env.put(
>>                     DirContext.INITIAL_CONTEXT_FACTORY,
>>                     "com.sun.jndi.ldap.LdapCtxFactory" );
>>                 env.put(
>>                     DirContext.PROVIDER_URL,
>>                     "ldap://localhost:10389/ou=schema");
>>                 env.put(
>>                     DirContext.SECURITY_AUTHENTICATION,
>>                     "simple");
>>                 env.put(
>>                     DirContext.SECURITY_PRINCIPAL,
>>                     "uid=admin,ou=system" );
>>                 env.put(
>>                     DirContext.SECURITY_CREDENTIALS,
>>                    "secret" );
>>                 return new InitialDirContext(env);
>>     }
>>
>>     public DirContext createXSDSchemaContext() throws NamingException
>>     {
>>         Attributes xsdAttributes = new BasicAttributes();
>>
>>         Attribute topAttribute = new BasicAttribute(
>>             "objectClass",
>>             "top");
>>
>>         Attribute metaSchemaAttribute = new BasicAttribute(
>>             "objectClass",
>>             "metaSchema");
>>
>>         Attribute xsdAttribute = new BasicAttribute(
>>             "cn",
>>             "xsd");
>>
>>         Attribute mDependenciesAttribute = new BasicAttribute(
>>             "m-dependencies", "system");
>>
>>         xsdAttributes.put( xsdAttribute );
>>         xsdAttributes.put( topAttribute );
>>         xsdAttributes.put( metaSchemaAttribute );
>>         xsdAttributes.put( mDependenciesAttribute );
>>
>>         return directoryContext.createSubcontext(
>>             XSD_CONTEXT_RDN, xsdAttributes );
>>     }
>>
>>
>>     public DirContext createSyntaxContext() throws NamingException
>>     {
>>         Attribute syntaxesAttribute = new BasicAttribute(
>>             "ou", "syntaxes");
>>
>>         Attribute organizationUnitAttribute = new BasicAttribute(
>>             "objectClass", "organizationalUnit");
>>
>>         Attribute topAttribute = new BasicAttribute(
>>             "objectClass",
>>             "top");
>>
>>         Attribute metaSchemaAttribute = new BasicAttribute(
>>             "objectClass",
>>             "metaSchema");
>>
>>         Attributes syntaxAttributes = new BasicAttributes();
>>         syntaxAttributes.put( syntaxesAttribute );
>>         syntaxAttributes.put( topAttribute );
>>         syntaxAttributes.put( metaSchemaAttribute );
>>         syntaxAttributes.put( organizationUnitAttribute);
>>
>>         return ( DirContext ) xsdContext.createSubcontext( 
>> XSD_SYNTAX_RDN, syntaxAttributes );
>>     }
>>
>>     public void testCreateSyntaxSchemaEntry() throws NamingException
>>     {
>>         Attribute objectClassAttribute = new BasicAttribute(
>>             "objectClass",
>>             "top" );
>>
>>         objectClassAttribute.add( "metaTop" );
>>         objectClassAttribute.add( "metaSyntax" );
>>
>>         Attribute oidAttribute = new BasicAttribute(
>>             "m-oid",
>>             OID);
>>
>>         Attribute descriptionAttribute = new BasicAttribute(
>>             "m-description",
>>             "xsd:String");
>>
>>         Attributes attributes = new BasicAttributes();
>>
>>         attributes.put( objectClassAttribute );
>>         attributes.put( oidAttribute );
>>         attributes.put( descriptionAttribute );
>>
>>         syntaxContext.createSubcontext( xsdSyntaxStringRDN, attributes );
>>         syntaxContext.lookup(xsdSyntaxStringRDN);
>> //      syntaxContext.lookup("monkeywrench");
>>     }
>> }
>>
>>
>>
>>
>>
> 
> 

Mime
View raw message