Examples of SortResponseControl


Examples of javax.naming.ldap.SortResponseControl

  }

    public void testSerializationCompatibility() throws Exception{
        String Id = "test";
        boolean crit = true;
        SortResponseControl object;
        byte[] ber = { 48, 3, 10, 1, 0 };
        object = new SortResponseControl(Id, crit, ber);
        SerializationTest.verifyGolden(this, object, SORTRESPONSECONTROL_COMPARATOR);
    }
View Full Code Here

Examples of javax.naming.ldap.SortResponseControl

    String Id=null;
    boolean crit=true;
    byte[] ber=null;
    try {
      SortResponseControl src=new SortResponseControl(Id,crit,ber);
      fail("Some arguments are null, so an exception must be thrown.");
    } catch (IOException e) {
      fail("Failed with:"+e);
    } catch (NullPointerException e) {
     
View Full Code Here

Examples of javax.naming.ldap.SortResponseControl

    String Id=null;
    boolean crit=true;
    byte[] ber={};
    try {
      SortResponseControl src=new SortResponseControl(Id,crit,ber);
      fail("Insufficient data.");
    } catch (IOException e) {
   
    }
  }
View Full Code Here

Examples of javax.naming.ldap.SortResponseControl

    String Id=null;
    boolean crit=false;
    byte[] ber={};
    try {
      SortResponseControl src=new SortResponseControl(Id,crit,ber);
      fail("Insufficient data.");
    } catch (IOException e) {
   
    }
  }
View Full Code Here

Examples of javax.naming.ldap.SortResponseControl

    String Id=null;
    boolean crit=false;
    byte[] ber=new String("ID").getBytes();
    try {
      SortResponseControl src=new SortResponseControl(Id,crit,ber);
      fail("The bytes are not in the ASN.1 BER.");
    } catch (IOException e) {
     
    }
  }
View Full Code Here

Examples of javax.naming.ldap.SortResponseControl

    String Id=null;
    boolean crit=false;
    try {
      byte[] ber={48,3,10,1,0};
      assertNotNull(new SortResponseControl(Id,crit,ber));
     
    } catch (IOException e) {
      fail("The bytes are in the ASN.1 BER.");
    }
  }
View Full Code Here

Examples of javax.naming.ldap.SortResponseControl

    String Id="";
    boolean crit=false;
    try {
      byte[] ber=null;
      SortResponseControl src=new SortResponseControl(Id,crit,ber);
      fail("The bytes are not in the ASN.1 BER.");
    } catch (IOException e) {
      fail("Should raise another exception.");
    } catch (NullPointerException e) {
     
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.controls.SortResponseControl

                0x04, 0x02, 'c', 'n'
            } );
        buffer.flip();
       
        SortResponseDecorator decorator = new SortResponseDecorator( codec );
        SortResponseControl control = ( SortResponseControl ) decorator.decode( buffer.array() );
       
        assertEquals( SortResultCode.SUCCESS, control.getSortResult() );
        assertEquals( "cn", control.getAttributeName() );
       
        ByteBuffer encoded = ByteBuffer.allocate( buffer.capacity() );
        decorator.computeLength();
        decorator.encode( encoded );
        assertTrue( Arrays.equals( buffer.array(), encoded.array() ) );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.controls.SortResponseControl

                0x0A, 0x01, 0x10
            } );
        buffer.flip();
       
        SortResponseDecorator decorator = new SortResponseDecorator( codec );
        SortResponseControl control = ( SortResponseControl ) decorator.decode( buffer.array() );
       
        assertEquals( SortResultCode.NOSUCHATTRIBUTE, control.getSortResult() );
        assertNull( control.getAttributeName() );
       
        ByteBuffer encoded = ByteBuffer.allocate( buffer.capacity() );
        decorator.computeLength();
        decorator.encode( encoded );
        assertTrue( Arrays.equals( buffer.array(), encoded.array() ) );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.controls.SortResponseControl

        OperationManager operationManager = directoryService.getOperationManager();

        // Check if we received serverside sort Control
        SortRequestControl sortControl = ( SortRequestControl ) searchRequest.getControls().get( SortRequestControl.OID );
       
        SortResponseControl sortRespCtrl = null;
       
        SearchResultDone done = searchRequest.getResultResponse();
       
        LdapResult ldapResult = done.getLdapResult();
       
        if( sortControl != null )
        {
            sortRespCtrl = canSort( sortControl, ldapResult, getDirectoryService().getSchemaManager() );
           
            if ( sortControl.isCritical() && ( sortRespCtrl.getSortResult() != SortResultCode.SUCCESS ) )
            {
                ldapResult.setResultCode( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION );
                done.addControl( sortRespCtrl );
               
                return new EmptyCursor<Entry>();
            }
        }

        Cursor<Entry> cursor = null;

        try
        {
            cursor = operationManager.search( searchContext );
           
            if ( ( sortRespCtrl != null ) && ( sortRespCtrl.getSortResult() == SortResultCode.SUCCESS ) )
            {
                cursor = sortResults( cursor, sortControl, getDirectoryService().getSchemaManager() );
            }

            // the below condition is to satisfy the scenario 6 in section 2 of rfc2891
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.