Package org.apache.directory.server.core

Examples of org.apache.directory.server.core.CoreSession


   
    @Test
    public void testLdifMoveAndRenameWithDeletingOldDN() throws Exception
    {
        CoreSession session = injectEntries();

        DN childDn1 = new DN( "dc=child1,ou=test,ou=system" );
        childDn1.normalize( schemaManager.getNormalizerMapping() );

        DN childDn2 = new DN( "dc=child2,ou=test,ou=system" );
View Full Code Here


   
    @Test
    public void testLdifMoveAndRenameRetainingOldDN() throws Exception
    {
        CoreSession session = injectEntries();

        DN childDn1 = new DN( "dc=child1,ou=test,ou=system" );
        childDn1.normalize( schemaManager.getNormalizerMapping() );

        DN childDn2 = new DN( "dc=child2,ou=test,ou=system" );
View Full Code Here

   
    private CoreSession injectEntries() throws Exception
    {
        DN adminDn = new DN( "uid=admin,ou=system" ).normalize( schemaManager.getNormalizerMapping() );
        CoreSession session = new MockCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), new MockDirectoryService( 1 ) );
        AddOperationContext addCtx = new AddOperationContext( session );
       
        ClonedServerEntry rootEntry = createEntry( "ou=test,ou=system" );
        rootEntry.put( "ObjectClass", "top", "domain" );
        rootEntry.put( "ou", "test" );
View Full Code Here

            Subject subject = getSubject( ldapSession.getLdapServer() );
            final String saslHost = ( String ) ldapSession.getSaslProperty( SaslConstants.SASL_HOST );
            final Map<String, String> saslProps = ( Map<String, String> ) ldapSession
                .getSaslProperty( SaslConstants.SASL_PROPS );

            CoreSession adminSession = ldapSession.getLdapServer().getDirectoryService().getAdminSession();

            final CallbackHandler callbackHandler = new GssapiCallbackHandler( ldapSession, adminSession, bindRequest );

            ss = ( SaslServer ) Subject.doAs( subject, new PrivilegedExceptionAction<SaslServer>()
            {
View Full Code Here

    }


    private PrincipalStoreEntry findPrincipal( LdapServer ldapServer, GetPrincipal getPrincipal ) throws Exception
    {
        CoreSession adminSession = ldapServer.getDirectoryService().getAdminSession();
        return ( PrincipalStoreEntry ) getPrincipal.execute( adminSession, new DN( ldapServer.getSearchBaseDn() ) );
    }
View Full Code Here

        try
        {
            for ( Partition partition : directoryService.getPartitions() )
            {
                partition.setSchemaManager( schemaManager );
                CoreSession adminSession = new DefaultCoreSession(
                    new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
   
                AddContextPartitionOperationContext opCtx =
                    new AddContextPartitionOperationContext( adminSession, partition );
                addContextPartition( opCtx );
View Full Code Here

        systemEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
        systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ),
            NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) );
        DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
        adminDn.normalize( schemaManager.getNormalizerMapping() );
        CoreSession adminSession = new DefaultCoreSession(
            new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
        AddOperationContext addOperationContext = new AddOperationContext( adminSession, systemEntry );
       
        if ( !system.hasEntry( new EntryOperationContext( adminSession, systemEntry.getDn() ) ) )
        {
View Full Code Here

        {
            try
            {
                DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
                adminDn.normalize( schemaManager.getNormalizerMapping() );
                CoreSession adminSession = new DefaultCoreSession(
                    new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
                removeContextPartition( new RemoveContextPartitionOperationContext(
                    adminSession, new DN( suffix ) ) );
            }
            catch ( Exception e )
View Full Code Here

     * using the Core API without the ManageDsaIT flag.
     */
    @Test
    public void testMoveAndRenameEntrySuperiorHasReferralAncestorCoreAPIWithoutManageDsaIT() throws Exception
    {
        CoreSession coreSession = service.getAdminSession();
        DN dn = new DN( "cn=Emmanuel Lecharny,ou=apache,ou=Roles,o=MNN,c=WW,ou=system" );
        DN newParent = new DN( "o=PNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "cn=Alex" );
       
        try
        {
            coreSession.moveAndRename( dn, newParent, newRdn, false, false );
            fail();
        }
        catch ( ReferralException re )
        {
            int nbRefs = 0;
View Full Code Here

     * using the Core API with the ManageDsaIT flag
     */
    @Test
    public void testMoveAndRenameSuperiorHasReferralAncestorCoreAPIWithManageDsaIT() throws Exception
    {
        CoreSession coreSession = service.getAdminSession();
        DN dn = new DN( "cn=Emmanuel Lecharny,ou=apache,ou=Roles,o=MNN,c=WW,ou=system" );
        DN newParent = new DN( "o=PNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "cn=Alex" );
       
        try
        {
            coreSession.moveAndRename( dn, newParent, newRdn, false, true );
            fail();
        }
        catch ( PartialResultException pre )
        {
            assertTrue( true );
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.CoreSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.