Package javax.naming.ldap

Examples of javax.naming.ldap.SortResponseControl


  public void testSortResponseControl018(){

    String Id="test";
    boolean crit=false;
    byte[] ber={48,3,10,1,0};
    SortResponseControl src=null;
    byte[] temp=null;
    try {
     
      src=new SortResponseControl(Id,crit,ber);
      temp=src.getEncodedValue();
    } catch (IOException e) {
      fail("The bytes are in the ASN.1 BER.");
    }
    for(int i=0;i<ber.length;i++){
      ber[i]=0;
   
    }
    for(int i=0;i<ber.length;i++){
      assertSame(ber[i],src.getEncodedValue()[i]);
    }
  }
View Full Code Here


   * <p>Here we are testing if the isSorted method returns the correct answer for sorted results.</p>
   * <p>The expected result in this case is true.</p>
   */
  public void testIsSorted001() {

    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",true,new byte[]{48,3,10,1,0});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
    assertTrue(src.isSorted());
  }
View Full Code Here

   * <p>Here we are testing if the isSorted method returns the correct answer for unsorted results.</p>
   * <p>The expected result in this case is false.</p>
   */
  public void testIsSorted002() {

    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",false,new byte[]{48,6,10,1,16,4,1,32});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
    assertFalse(src.isSorted());
   
  }
View Full Code Here

   * <p>Test method for 'javax.naming.ldap.SortResponseControl.getResultCode()'</p>
   * <p>Here we are testing if the correct result code is returned.</p>
   * <p>The expected result is zero.</p>
   */
  public void testGetResultCode001() {
    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",true,new byte[]{48,3,10,1,0});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
    assertEquals(0,src.getResultCode());
   
  }
View Full Code Here

   * <p>Here we are testing if the correct result code is returned. Here the sort key does not exist
   * so the error must be no such attribute.</p>
   * <p>The expected result is 16.</p>
   */
  public void testGetResultCode002() {
    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",true,new byte[]{48,6,10,1,16,4,1,32});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
    assertEquals(16,src.getResultCode());
   
  }
View Full Code Here

   * <p>Here we are testing if the correct result code is returned. Here the sort key does exist
   * but the error must be unwillingToPerform.</p>
   * <p>The expected result is 53.</p>
   */
  public void testGetResultCode003() {
    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",true,new byte[]{48,7,10,1,53,4,2,67,78});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
    assertEquals(53,src.getResultCode());
   
  }
View Full Code Here

   * <p>Here we are testing if the correct result code is returned. Here the sort key does exist
   * but the error must be unwillingToPerform.</p>
   * <p>The expected result is 100.</p>
   */
  public void testGetResultCode004() {
    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",true,new byte[]{48,7,10,1,100,4,2,67,78});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
    assertEquals(100,src.getResultCode());
   
  }
View Full Code Here

   * <p>Here we are testing if this method gets the correct attribute ID.</p>
   * <p>The expected result is in this case is null because no ID was returned by the server.</p>
   */
  public void testGetAttributeID001() {

    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",true,new byte[]{48,3,10,1,80});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
    assertEquals(null,src.getAttributeID());
  }
View Full Code Here

   * <p>Here we are testing if this method gets the correct NamingException.</p>
   * <p>The expected result is a not null naming exception.</p>
   */
  public void testGetException001() {

    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",true,new byte[]{48,3,10,1,80});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
   
    if(src.getException()!=null&&src.getException() instanceof NamingException){
     
    }else{
      fail("The exception must be like NamingException");
    }
   
View Full Code Here

   * <p>Here we are testing if this method gets the correct NamingException.</p>
   * <p>The expected result is a not null NoSuchAttributeException.</p>
   */
  public void testGetException002() {

    SortResponseControl src=null;
    try{
      src=new SortResponseControl("test",true,new byte[]{48,3,10,1,16});
    }catch (IOException e) {
      fail("Failed with:"+e);
    }
   
    if(src.getException()!=null&&src.getException() instanceof NoSuchAttributeException){
     
    }else{
      fail("The exception must be like NoSuchAttributeException");
    }
   
View Full Code Here

TOP

Related Classes of javax.naming.ldap.SortResponseControl

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.