Package org.apache.directory.server.core.api.changelog

Examples of org.apache.directory.server.core.api.changelog.Tag


        if ( changeLog == null || !changeLog.isEnabled() )
        {
            throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
        }

        Tag latest = changeLog.getLatest();

        if ( null != latest )
        {
            if ( latest.getRevision() < changeLog.getCurrentRevision() )
            {
                return revert( latest.getRevision() );
            }
            else
            {
                LOG.info( "Ignoring request to revert without changes since the latest tag." );
                return changeLog.getCurrentRevision();
View Full Code Here


                return new Statement()
                {
                    @Override
                    public void evaluate() throws Throwable
                    {
                        Tag tag = directoryService.getChangeLog().tag();
                        DSAnnotationProcessor.applyLdifs( description, directoryService );
                        LOG.debug( "Tagged change log: {}", tag );
                        try
                        {
                            base.evaluate();
                        }
                        finally
                        {
                            if ( directoryService.getChangeLog().getCurrentRevision() > tag.getRevision() )
                            {
                                LOG.debug( "Reverting to tag: {}", tag );
                                directoryService.revert( tag.getRevision() );
                            }
                            else
                            {
                                LOG.debug( "No changes made, nothing to revert" );
                            }
View Full Code Here

        if ( changeLog == null || !changeLog.isEnabled() )
        {
            throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
        }

        Tag latest = changeLog.getLatest();

        if ( null != latest )
        {
            if ( latest.getRevision() < changeLog.getCurrentRevision() )
            {
                return revert( latest.getRevision() );
            }
            else
            {
                LOG.info( "Ignoring request to revert without changes since the latest tag." );
                return changeLog.getCurrentRevision();
View Full Code Here

        if ( changeLog == null || !changeLog.isEnabled() )
        {
            throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
        }

        Tag latest = changeLog.getLatest();

        if ( null != latest )
        {
            if ( latest.getRevision() < changeLog.getCurrentRevision() )
            {
                return revert( latest.getRevision() );
            }
            else
            {
                LOG.info( "Ignoring request to revert without changes since the latest tag." );
                return changeLog.getCurrentRevision();
View Full Code Here

        if ( changeLog == null || !changeLog.isEnabled() )
        {
            throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
        }

        Tag latest = changeLog.getLatest();

        if ( null != latest )
        {
            if ( latest.getRevision() < changeLog.getCurrentRevision() )
            {
                return revert( latest.getRevision() );
            }
            else
            {
                LOG.info( "Ignoring request to revert without changes since the latest tag." );
                return changeLog.getCurrentRevision();
View Full Code Here

        if ( changeLog == null || !changeLog.isEnabled() )
        {
            throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
        }

        Tag latest = changeLog.getLatest();

        if ( null != latest )
        {
            if ( latest.getRevision() < changeLog.getCurrentRevision() )
            {
                return revert( latest.getRevision() );
            }
            else
            {
                LOG.info( "Ignoring request to revert without changes since the latest tag." );
                return changeLog.getCurrentRevision();
View Full Code Here

    if ( changeLog == null || !changeLog.isEnabled() )
    {
      throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
    }

    Tag latest = changeLog.getLatest();

    if ( null != latest )
    {
      if ( latest.getRevision() < changeLog.getCurrentRevision() )
      {
        return revert( latest.getRevision() );
      }
      else
      {
        LOG.info( "Ignoring request to revert without changes since the latest tag." );
        return changeLog.getCurrentRevision();
View Full Code Here

        sysRoot.add( entry );

        assertEquals( revision + 1, getService().getChangeLog().getCurrentRevision() );

        Tag t0 = getService().getChangeLog().tag();
        assertEquals( t0, getService().getChangeLog().getLatest() );
        assertEquals( revision + 1, getService().getChangeLog().getCurrentRevision() );
        assertEquals( revision + 1, t0.getRevision() );

        // add another test entry
        entry = new DefaultEntry( "ou=test1,ou=system",
      "objectClass: organizationalUnit",
      "ou: test1" );
     
        sysRoot.add( entry );
        assertEquals( revision + 2, getService().getChangeLog().getCurrentRevision() );

        Tag t1 = getService().getChangeLog().tag();
        assertEquals( t1, getService().getChangeLog().getLatest() );
        assertEquals( revision + 2, getService().getChangeLog().getCurrentRevision() );
        assertEquals( revision + 2, t1.getRevision() );

        getService().shutdown();
        getService().startup();

        sysRoot = getAdminConnection( getService() );
        assertEquals( revision + 2, getService().getChangeLog().getCurrentRevision() );
        assertEquals( t1, getService().getChangeLog().getLatest() );
        assertEquals( revision + 2, t1.getRevision() );

        // add third test entry
        entry = new DefaultEntry( "ou=test2,ou=system",
      "objectClass: organizationalUnit",
      "ou: test2" );

        sysRoot.add( entry );
        assertEquals( revision + 3, getService().getChangeLog().getCurrentRevision() );

        getService().revert();

        assertPresent( sysRoot, "ou=test0,ou=system" ); // test present
        assertPresent( sysRoot, "ou=test1,ou=system" ); // test present

        assertNotPresent( sysRoot, "ou=test2,ou=system" );
        assertEquals( revision + 4, getService().getChangeLog().getCurrentRevision() );
        assertEquals( t1, getService().getChangeLog().getLatest() );

        getService().revert( t0.getRevision() );
        assertPresent( sysRoot, "ou=test0,ou=system" ); // test present
        assertNotPresent( sysRoot, "ou=test1,ou=system" );
        assertNotPresent( sysRoot, "ou=test2,ou=system" );
        assertEquals( revision + 7, getService().getChangeLog().getCurrentRevision() );
        assertEquals( t1, getService().getChangeLog().getLatest() );

        // no sync this time but should happen automatically
        getService().shutdown();
        getService().startup();

        sysRoot = getAdminConnection( getService() );
        assertEquals( revision + 7, getService().getChangeLog().getCurrentRevision() );
        assertEquals( t1, getService().getChangeLog().getLatest() );
        assertEquals( revision + 2, t1.getRevision() );

        getService().revert( revision );
        assertNotPresent( sysRoot, "ou=test0,ou=system" );
        assertNotPresent( sysRoot, "ou=test1,ou=system" );
        assertNotPresent( sysRoot, "ou=test2,ou=system" );
View Full Code Here

    public void testTagPersistenceAcrossRestarts() throws Exception, InterruptedException
    {
        LdapConnection sysRoot = getAdminConnection( getService() );
        long revision = getService().getChangeLog().getCurrentRevision();

        Tag t0 = getService().getChangeLog().tag();
        assertEquals( t0, getService().getChangeLog().getLatest() );
        assertEquals( revision, getService().getChangeLog().getCurrentRevision() );

        // add new test entry
        Entry entry = new DefaultEntry( "ou=test,ou=system",
View Full Code Here

    @Test
    public void testRevertAddOperations() throws Exception
    {
        LdapConnection sysRoot = getAdminConnection( getService() );
        Tag t0 = getService().getChangeLog().tag();
        Entry entry = new DefaultEntry( "ou=test,ou=system",
            "objectClass: organizationalUnit",
            "ou: test" );

        sysRoot.add( entry );

        assertPresent( sysRoot, "ou=test,ou=system" );
        getService().revert( t0.getRevision() );

        assertNotPresent( sysRoot, "ou=test,ou=system" );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.api.changelog.Tag

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.