Package org.apache.directory.server.core

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


     * Test deletion of an entry with an ancestor referral, using the core api.
     */
    @Test
    public void testDeleteEntryWithAncestorCoreAPI() throws Exception
    {
        CoreSession session = service.getAdminSession();
       
        try
        {
            session.delete( new DN( "cn=Emmanuel Lecharny,ou=Roles" ) );
            fail();
        }
        catch ( NameNotFoundException nnfe )
        {
            assertTrue( true );
View Full Code Here


     * Test deletion of an existing entry with no ancestor referral, using the core api.
     */
    @Test
    public void testDeleteExistingEntryNotReferral() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dn = new DN( "cn=Alex Karasulu,o=MNN,c=WW,ou=system" );
       
        session.delete( dn );
       
        try
        {
            session.lookup( dn, new String[]{} );
            fail();
        }
        catch ( NameNotFoundException nnfe )
        {
            assertTrue( true );
View Full Code Here

     * using JNDI, with 'ignore'.
     */
    @Test
    public void testDeleteExistingEntryReferralJNDIIgnore() throws Exception
    {
        CoreSession session = service.getAdminSession();

        // Set to 'throw'
        MNNCtx.addToEnvironment( Context.REFERRAL, "ignore" );

        MNNCtx.destroySubcontext( "ou=Roles" );

        DN dn = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );
       
        // We should not find the entry
        try
        {
            session.lookup( dn, new String[]{} );
            fail();
        }
        catch ( NameNotFoundException nnfe )
        {
            assertTrue( true );
View Full Code Here

     * using the CoreAPI, without the ManageDsaIT control.
     */
    @Test
    public void testDeleteExistingEntryReferralCoreAPINoManageDSAIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dn = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );

        try
        {
            session.delete( dn, false );
            fail();
        }
        catch ( ReferralException re )
        {
            int nbRefs = 0;
View Full Code Here

     * using the CoreAPI, with the ManageDsaIT control.
     */
    @Test
    public void testDeleteExistingEntryReferralCoreAPIManageDSAIT() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dn = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );

        session.delete( dn, true );

        // We should not find the entry
        try
        {
            session.lookup( dn, new String[]{} );
            fail();
        }
        catch ( NameNotFoundException nnfe )
        {
            assertTrue( true );
View Full Code Here

     * @throws Exception if something goes wrong.
     */
    @Test
    public void testAddNewEntryWithReferralAncestorCoreAPImanageDsaIT() throws Exception
    {
        CoreSession session = service.getAdminSession();
       
        try
        {
            session.add( serverEntry, true );
            fail();
        }
        catch ( PartialResultException pre )
        {
            assertTrue( true );
View Full Code Here

     * in its ancestor, without the ManageDsaIt flag.
     */
    @Test
    public void testAddNewEntryWithReferralAncestorCoreAPINoManageDsaIT() throws Exception
    {
        CoreSession session = service.getAdminSession();

        try
        {
            session.add( serverEntry, false );
            fail();
        }
        catch ( ReferralException re )
        {
            assertTrue( true );
View Full Code Here

     * in its ancestor, using the Core API without the ManageDsaIT flag.
     */
    @Test
    public void testRenameNotExistingSuperiorReferralAncestorCoreAPIWithoutManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();

        try
        {
            DN dn = new DN( "cn=Emmanuel Lecharny,ou=apache,ou=roles,o=MNN,c=WW,ou=system" );
            RDN newRdn = new RDN( "cn=Alex Karasulu" );
            session.rename( dn, newRdn, false, false );
            fail();
        }
        catch ( ReferralException re )
        {
            int nbRefs = 0;
View Full Code Here

     * in its ancestor, using the Core API with the ManageDsaIT flag.
     */
    @Test
    public void testRenameNotExistingSuperiorReferralAncestorCoreAPIWithManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
        try
        {
            DN dn = new DN( "cn=Emmanuel Lecharny,ou=apache,ou=roles,o=MNN,c=WW,ou=system" );
            RDN newRdn = new RDN( "cn=Alex Karasulu" );
            session.rename( dn, newRdn, false, true );
            fail();
        }
        catch ( PartialResultException pre )
        {
            assertTrue( true );
View Full Code Here

     * the ManageDsaIt flag.
     */
    @Test
    public void testRenameExistingReferralCoreApiWithoutManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();

        try
        {
            DN dn = new DN( "ou=roles,o=MNN,c=WW,ou=system" );
            RDN newRdn = new RDN( "cn=Alex Karasulu" );
            session.rename( dn, newRdn, false, 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.