Package org.apache.directory.shared.ldap.model.csn

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


    @Test
    public void testCSN()
    {
        long ts = System.currentTimeMillis();

        Csn csn = new Csn( sdf.format( new Date( ts ) ) + "#123456#abc#654321" );

        assertEquals( ts/1000, csn.getTimestamp()/1000 );
       
        // ALl the value are converted from hex to int
        assertEquals( 1193046, csn.getChangeCount() );
        assertEquals( 6636321, csn.getOperationNumber() );
        assertEquals( 2748, csn.getReplicaId() );
    }
View Full Code Here


    @Test
    public void testCSNNull()
    {
        try
        {
            new Csn( (String)null );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

    @Test
    public void testCSNEmpty()
    {
        try
        {
            new Csn( "" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

    @Test
    public void testCSNTimestampOnly()
    {
        try
        {
            new Csn( sdf.format( new Date( System.currentTimeMillis() ) ) );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

    public void testCSNInvalidTS()
    {
        try
        {
            // A missing 'Z'
            new Csn( "20010101000000.000000#000001#abc#000001" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }
       
        try
        {
            // Missing milliseconds
            new Csn( "20000101000000.Z#000001#abc#000001" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }

        try
        {
            // Missing dot
            new Csn( "20010101000000000000Z#0x1#abc#0x1" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }

        try
        {
            // Missing dot and millis
            new Csn( "20010101000000Z#000001#abc#000001" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
        }

        try
        {
            // Invalid date
            new Csn( "200A01010000Z#000001#abc#000001" );
            fail();
        }
        catch ( InvalidCSNException ice )
        {
            assertTrue( true );
View Full Code Here

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

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

    @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

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

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

TOP

Related Classes of org.apache.directory.shared.ldap.model.csn.Csn

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.