Package org.apache.directory.server.core

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


     * the ManageDsaIt flag. 
     */
    @Test
    public void testRenameExistingReferralCoreAPIWithManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dnRoles = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );
        DN dnGroups = new DN( "ou=Groups,o=MNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "ou=Groups" );

        // First check that the object exists
        ServerEntry renamed = session.lookup( dnRoles );
        assertNotNull( renamed );

        // Also check that the new entry does not exist
        try
        {
            renamed = session.lookup( dnGroups );
            fail();
        }
        catch ( NameNotFoundException nnfe )
        {
            assertTrue( true );
        }
       
        // Now renames the referral
        session.rename( dnRoles, newRdn, false, true );

        // It should not be there anymore
        try
        {
            renamed = session.lookup( dnRoles );
            fail();
        }
        catch ( NameNotFoundException nnfe )
        {
            assertTrue( true );
        }

        // But the new one should be there
        renamed = session.lookup( dnGroups );
        assertNotNull( renamed );
    }
View Full Code Here


     * using the Core API, without the ManageDsaIt flag
     */
    @Test
    public void testRenameRdnExistIsReferralCoreAPIWithoutManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dn = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "ou=People" );

        try
        {
            session.rename( dn, 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 testRenameRdnExistIsReferralCoreAPIWithManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dn = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "ou=People" );

        try
        {
            session.rename( dn, newRdn, false, true );
            fail();
        }
        catch ( NameAlreadyBoundException nabe )
        {
            assertTrue( true );
View Full Code Here

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

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

     * to a new superior, using CoreAPI without the ManageDsaIT flag
     */
    @Test
    public void testMoveEntryWithReferralAncestorCoreAPIWithoutManageDsaIt() throws Exception
    {
        CoreSession coreSession = service.getAdminSession();
        DN orig = new DN( "cn=Alex,ou=roles,o=MNN,c=WW,ou=system" );
        DN dest = new DN( "cn=Alex,ou=People,o=MNN,c=WW,ou=system" );
       
        try
        {
            coreSession.move( orig, dest, false );
            fail();
        }
        catch ( ReferralException re )
        {
            int nbRefs = 0;
View Full Code Here

     * to a new superior, using CoreAPI with the ManageDsaIT flag
     */
    @Test
    public void testMoveEntryWithReferralAncestorCoreAPIWithManageDsaIt() throws Exception
    {
        CoreSession coreSession = service.getAdminSession();
        DN orig = new DN( "cn=Alex,ou=roles,o=MNN,c=WW,ou=system" );
        DN dest = new DN( "cn=Alex,ou=People,o=MNN,c=WW,ou=system" );
       
        try
        {
            coreSession.move( orig, dest, true );
            fail();
        }
        catch ( PartialResultException pre )
        {
            assertTrue( true );
View Full Code Here

     * without a ManageDsaIT.
     */
    @Test
    public void testModifyEntryWithAncestorCoreAPIWithoutManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
       
        try
        {
            ClientAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
            session.modify( new DN( "cn=Emmanuel Lecharny,ou=Roles,c=MNN,o=WW,ou=system" ), mods );
            fail();
        }
        catch ( NameNotFoundException nnfe )
        {
            assertTrue( true );
View Full Code Here

     * with a ManageDsaIT flag.
     */
    @Test
    public void testModifyEntryWithAncestorCoreAPIWithManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
       
        try
        {
            ClientAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
            session.modify( new DN( "cn=Emmanuel Lecharny,ou=Roles,c=MNN,o=WW,ou=system" ), mods, true );
            fail();
        }
        catch ( NameNotFoundException nnfe )
        {
            assertTrue( true );
View Full Code Here

     * and no ManageDsaIT flag
     */
    @Test
    public void testModifyExistingEntryReferralCoreAPIWithoutManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
       
        try
        {
            ClientAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
            session.modify( new DN( "ou=Roles,o=MNN,c=WW,ou=system" ), mods, false );
            fail();
        }
        catch ( ReferralException re )
        {
            int nbRefs = 0;
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.