directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ole Ersoy (JIRA)" <j...@apache.org>
Subject [jira] Closed: (DIRSERVER-932) Syntax Entry Attempt Gets "Unexpected exception.];"
Date Wed, 16 May 2007 19:47:16 GMT

     [ https://issues.apache.org/jira/browse/DIRSERVER-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ole Ersoy closed DIRSERVER-932.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.1

This test runs OK:


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 );
    }
}


> Syntax Entry Attempt Gets "Unexpected exception.];"
> ---------------------------------------------------
>
>                 Key: DIRSERVER-932
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-932
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.1
>         Environment: Fedora Core 6 x86_64
>            Reporter: Ole Ersoy
>            Priority: Blocker
>             Fix For: 1.5.1
>
>
> I've created a "Schema Syntaxes Container":
> ou=syntaxes, cn=das, ou=schema
> As well as a "Schema SyntaxCheckers Container":
> ou=syntaxCheckers, cn=das, ou=schema
> I am able to add a syntax checker via JNDI,
> and I can add a Syntax entry using LS, but
> when I try to add a Syntax entry with JNDI
> I get this exception:
> javax.naming.NamingException: [LDAP: error code 80 - failed to add entry m-oid=1.3.6.1.4.1.18060.0.4.0.0.1.1.5.5.5.5,ou=syntaxes,cn=das,ou=schema:
Unexpected exception.]; remaining name 'm-oid=1.3.6.1.4.1.18060.0.4.0.0.1.1.5.5.5.5'
> Initially I thought maybe it was due to me not having
> a corresponding syntaxChecker entry, so I created
> one, but the exception is still thrown.
> Here is the JNDI code I'm using in the test:
>         DirContext syntaxesContext =
>             InitialContextCreator.
>             createSchemaSyntaxesContext( dasSchemaContext);
>         Attributes attributes = new BasicAttributes();
>         Attribute attribute = new BasicAttribute(
>             "objectClass",
>             "metaSyntax");
>         attribute.add("metaTop");
>         attribute.add("top");
>         attributes.put( "m-oid","1.3.6.1.4.1.18060.0.4.0.0.1.1.5.5.5.5" );
>         syntaxesContext.createSubcontext(
>             "m-oid=1.3.6.1.4.1.18060.0.4.0.0.1.1.5.5.5.5",
>             attributes);
> The full trace that JUnit gives me looks
> like this:
> javax.naming.NamingException: [LDAP: error code 80 - failed to add entry m-oid=1.3.6.1.4.1.18060.0.4.0.0.1.1.5.5.5.5,ou=syntaxes,cn=das,ou=schema:
Unexpected exception.]; remaining name 'm-oid=1.3.6.1.4.1.18060.0.4.0.0.1.1.5.5.5.5'
>     at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3049)
>     at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2951)
>     at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2758)
>     at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(LdapCtx.java:774)
>     at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_createSubcontext(ComponentDirContext.java:319)
>     at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.createSubcontext(PartialCompositeDirContext.java:248)
>     at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.createSubcontext(PartialCompositeDirContext.java:236)
>     at org.apache.tuscany.das.ldap.configuration.v100.ConnectionManagerTest.testBigTime(ConnectionManagerTest.java:342)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at junit.framework.TestCase.runTest(TestCase.java:154)
>     at junit.framework.TestCase.runBare(TestCase.java:127)
>     at junit.framework.TestResult$1.protect(TestResult.java:106)
>     at junit.framework.TestResult.runProtected(TestResult.java:124)
>     at junit.framework.TestResult.run(TestResult.java:109)
>     at junit.framework.TestCase.run(TestCase.java:118)
>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
>     at junit.framework.TestSuite.run(TestSuite.java:203)
>     at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message