Examples of Csn


Examples of org.apache.directory.shared.ldap.model.csn.Csn

    @Test
    public void testCSNInvalidChangeCount()
    {
        try
        {
            new Csn( "20010101000000.000000Z#00#abc#000001" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }

        try
        {
            new Csn( "20010101000000.000000Z#00000G#abc#000001" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn

    @Test
    public void testCSNNoReplica()
    {
        try
        {
            new Csn( "20010101000000.000000Z#000001##000001" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn

    @Test
    public void testCSNInvalidReplica()
    {
        try
        {
            new Csn( "20010101000000.000000Z#000001#a12-b3é#000001" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn

    @Test
    public void testCSNNoOpNumber()
    {
        try
        {
            new Csn( "20010101000000.000000Z#000000#abc" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }
       
        try
        {
            new Csn( "20010101000000.000000Z#000000#abc#  " );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn

    @Test
    public void testCSNInvalidOpNumber()
    {
        try
        {
            new Csn( "20010101000000.000000Z#000000#abc#000zzz" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }

        try
        {
            new Csn( "20010101000000.000000Z#000000#abc#00000" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }

        try
        {
            new Csn( "20010101000000.000000Z#000000#abc#" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }

        try
        {
            new Csn( "20010101000000.000000Z#000000#abc#00000G" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn


    @Test
    public void testCSNToBytes()
    {
        Csn csn = new Csn( "20010101000000.000000Z#000000#abc#000001" );

        byte[] bytes = csn.getBytes();

        byte[] expected = new byte[]
            {
                '2', '0', '0', '1', '0', '1', '0', '1',
                '0', '0', '0', '0', '0', '0', '.', '0',
                '0', '0', '0', '0', '0', 'Z', '#', '0',
                '0', '0', '0', '0', '0', '#', 'a', 'b',
                'c', '#', '0', '0', '0', '0', '0', '1'
            };
       
        assertTrue( Arrays.equals( expected, bytes ) );

        Csn deserializedCSN = new Csn( bytes );
        assertEquals( csn, deserializedCSN );
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn

     * starting in the middle.
     */
    @Test
    public void testJournalWriting() throws Exception
    {
        Csn entryCsn = csnFactory.newInstance();
        Csn firstCsn = entryCsn;
        Csn csn100 = null;

        for ( int i = 0; i < 1000; i++ )
        {
            if ( i == 100 )
            {
                csn100 = entryCsn;
            }
           
            Entry entry = new DefaultEntry( schemaManager, "ou=test" + i + ",ou=system",
                "ObjectClass: top",
                "ObjectClass: organizationalUnit",
                "ou", "test" + i,
                "entryCsn", entryCsn.toString()
                );
           
            ReplicaEventMessage replicaEventMessage = new ReplicaEventMessage( ChangeType.ADD, entry );
            journal.put( entryCsn.toString(), replicaEventMessage );
            journal.sync();

            entryCsn = csnFactory.newInstance();
        }
       
        // Now check that the ReplicaEventMessages has been written
        ReplicaEventMessage firstMessage = journal.get( firstCsn.toString() );
       
        assertEquals( ChangeType.ADD, firstMessage.getChangeType());
        assertEquals( "test0", firstMessage.getEntry().get( "ou" ).getString() );
       
        // Read entry from the 100th element
        Cursor<Tuple<String, ReplicaEventMessage>> cursor = journal.cursor( csn100.toString() );
        int pos = 100;
       
        while ( cursor.next() )
        {
            Tuple<String, ReplicaEventMessage> tuple = cursor.get();
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn

     * remaining ones.
     */
    @Test
    public void testJournalTruncate() throws Exception
    {
        Csn entryCsn = csnFactory.newInstance();

        for ( int i = 0; i < 1000; i++ )
        {
            Entry entry = new DefaultEntry( schemaManager, "ou=test" + i + ",ou=system",
                "ObjectClass: top",
                "ObjectClass: organizationalUnit",
                "ou", "test" + i,
                "entryCsn", entryCsn.toString()
                );
           
            ReplicaEventMessage replicaEventMessage = new ReplicaEventMessage( ChangeType.ADD, entry );
            journal.put( entryCsn.toString(), replicaEventMessage );
            journal.sync();

            entryCsn = csnFactory.newInstance();
        }
       
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn

     */
    @Test
    @Ignore( "Performance test" )
    public void testJournalPerf() throws Exception
    {
        Csn entryCsn = csnFactory.newInstance();

        // The write perf
        long t0 = System.currentTimeMillis();

        for ( int i = 0; i < 100000; i++ )
        {
            Entry entry = new DefaultEntry( schemaManager, "ou=test" + i + ",ou=system",
                "ObjectClass: top",
                "ObjectClass: organizationalUnit",
                "ou", "test" + i,
                "entryCsn", entryCsn.toString()
                );
           
            ReplicaEventMessage replicaEventMessage = new ReplicaEventMessage( ChangeType.ADD, entry );
            journal.put( entryCsn.toString(), replicaEventMessage );
            journal.sync();
            recman.commit();

            entryCsn = csnFactory.newInstance();
        }
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.csn.Csn

    @Test
    public void testNullCSNs()
    {
        assertEquals( 0, comparator.compare( null, null ) );
       
        Csn csn2 = new Csn( System.currentTimeMillis(), 1, 1, 1 );
        assertEquals( -1, comparator.compare( null, csn2.toString() ) );

        assertEquals( 1, comparator.compare( csn2.toString(), null ) );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.