Package org.apache.directory.api.ldap.model.ldif

Examples of org.apache.directory.api.ldap.model.ldif.LdifControl



    @Test
    public void testControlCriticalWithDataSerialization() throws IOException, ClassNotFoundException
    {
        LdifControl ldifControl1 = new LdifControl( controlCriticalWithData.getOid() );
        ldifControl1.setCritical( controlCriticalWithData.isCritical() );
        ldifControl1.setValue( ( ( OpaqueControl ) controlCriticalWithData ).getEncodedValue() );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        ldifControl1.writeExternal( out );

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        LdifControl ldifControl2 = new LdifControl();
        ldifControl2.readExternal( in );

        assertEquals( ldifControl1, ldifControl2 );
    }
View Full Code Here



    @Test
    public void testControlCriticalNoDataSerialization() throws IOException, ClassNotFoundException
    {
        LdifControl ldifControl1 = new LdifControl( controlCriticalNoData.getOid() );
        ldifControl1.setCritical( controlCriticalNoData.isCritical() );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        ldifControl1.writeExternal( out );

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        LdifControl ldifControl2 = new LdifControl();
        ldifControl2.readExternal( in );

        assertEquals( ldifControl1, ldifControl2 );
    }
View Full Code Here


    @Test
    public void testControlCriticalEmptyDataSerialization() throws IOException, ClassNotFoundException
    {
        LdifControl ldifControl1 = new LdifControl( controlCriticalEmptyData.getOid() );
        ldifControl1.setCritical( controlCriticalEmptyData.isCritical() );
        ldifControl1.setValue( ( ( OpaqueControl ) controlCriticalEmptyData ).getEncodedValue() );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        ldifControl1.writeExternal( out );

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        LdifControl ldifControl2 = new LdifControl();
        ldifControl2.readExternal( in );

        assertEquals( ldifControl1, ldifControl2 );
    }
View Full Code Here


    @Test
    public void testControlNoCriticalWithDataSerialization() throws IOException, ClassNotFoundException
    {
        LdifControl ldifControl1 = new LdifControl( controlNoCriticalWithData.getOid() );
        ldifControl1.setCritical( controlNoCriticalWithData.isCritical() );
        ldifControl1.setValue( ( ( OpaqueControl ) controlNoCriticalWithData ).getEncodedValue() );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        ldifControl1.writeExternal( out );

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        LdifControl ldifControl2 = new LdifControl();
        ldifControl2.readExternal( in );

        assertEquals( ldifControl1, ldifControl2 );
    }
View Full Code Here


    @Test
    public void testControlNoCriticalNoDataSerialization() throws IOException, ClassNotFoundException
    {
        LdifControl ldifControl1 = new LdifControl( controlNoCriticalNoData.getOid() );
        ldifControl1.setCritical( controlNoCriticalNoData.isCritical() );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        ldifControl1.writeExternal( out );

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        LdifControl ldifControl2 = new LdifControl();
        ldifControl2.readExternal( in );

        assertEquals( ldifControl1, ldifControl2 );
    }
View Full Code Here


    @Test
    public void testControlNoCriticalEmptyDataSerialization() throws IOException, ClassNotFoundException
    {
        LdifControl ldifControl1 = new LdifControl( controlNoCriticalEmptyData.getOid() );
        ldifControl1.setCritical( controlNoCriticalEmptyData.isCritical() );
        ldifControl1.setValue( ( ( OpaqueControl ) controlNoCriticalEmptyData ).getEncodedValue() );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        ldifControl1.writeExternal( out );

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        LdifControl ldifControl2 = new LdifControl();
        ldifControl2.readExternal( in );

        assertEquals( ldifControl1, ldifControl2 );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.ldif.LdifControl

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.