当前位置: 首页>>代码示例>>Java>>正文


Java PagedResultsResponseControl类代码示例

本文整理汇总了Java中javax.naming.ldap.PagedResultsResponseControl的典型用法代码示例。如果您正苦于以下问题:Java PagedResultsResponseControl类的具体用法?Java PagedResultsResponseControl怎么用?Java PagedResultsResponseControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PagedResultsResponseControl类属于javax.naming.ldap包,在下文中一共展示了PagedResultsResponseControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareNextPage

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
private boolean prepareNextPage(LdapContext ldapContext) throws Exception {
    Control[] responseControls = ldapContext.getResponseControls();

    byte[] cookie = null;
    if (responseControls != null) {
        for (Control responseControl : responseControls) {
            if (responseControl instanceof PagedResultsResponseControl) {
                PagedResultsResponseControl prrc = (PagedResultsResponseControl) responseControl;
                cookie = prrc.getCookie();
            }
        }
    }

    if (cookie == null) {
        return false;
    } else {
        ldapContext.setRequestControls(new Control[]{new PagedResultsControl(pageSize, cookie, Control.CRITICAL)});
        return true;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:LdapProducer.java

示例2: readResultResponsePageCookie

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
private byte[] readResultResponsePageCookie( final Control[] controls )
{
    if ( controls != null )
    {
        for ( Control control : controls )
        {
            if ( control instanceof PagedResultsResponseControl )
            {
                final PagedResultsResponseControl prrc = ( PagedResultsResponseControl ) control;
                final byte[] cookie = prrc.getCookie();
                if ( cookie != null )
                {
                    return cookie;
                }
            }
        }
    }
    return null;
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:20,代码来源:JNDIProviderImpl.java

示例3: getCookie

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
private byte[] getCookie(final LdapContext ctx) throws NamingException, IOException {
    byte[] cookie = null;
    // Examine the paged results control response
    final Control[] controls = ctx.getResponseControls();
    if (controls != null) {
        for (int i = 0; i < controls.length; i++) {
            if (controls[i] instanceof PagedResultsResponseControl) {
                final PagedResultsResponseControl prrc = (PagedResultsResponseControl) controls[i];
                cookie = prrc.getCookie();
            }
        }
    }
    // Re-activate paged results
    ctx.setRequestControls(new Control[] { new PagedResultsControl(PAGE_SIZE, cookie, Control.CRITICAL) });
    return cookie;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:17,代码来源:LDAPLoginManagerImpl.java

示例4: testPagedResultsResponseControl011

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String, boolean, byte[])'</p>
 * <p>Here we are testing if this method constructs a paged-results response control.</p>
 * <p>The expected result is that the byte array must be copy not clone so any chance in original affect the response.</p>
 */
public void testPagedResultsResponseControl011() {

	try {
		byte[] b={48,5,2,1,0,4,0};
		byte[] c={48,5,2,1,0,4,0};
		PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
		byte[] aux = x.getEncodedValue().clone();
		for (int i = 0; i < b.length; i++) {
			b[i]=1;
		}
		for (int i = 0; i < b.length; i++) {
			assertSame(c[i],aux[i]);
			assertSame(b[i],x.getEncodedValue()[i]);
		}
	} catch (IOException e) {
		fail("The arguments are ok.");
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:TestPagedResultsResponseControl.java

示例5: assertDeserialized

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    PagedResultsResponseControl initThr = (PagedResultsResponseControl) initial;
    PagedResultsResponseControl dserThr = (PagedResultsResponseControl) deserialized;

    // verify ResultSize
    int initResultSize = initThr.getResultSize();
    int dserResultSize = dserThr.getResultSize();
    assertTrue(initResultSize == dserResultSize);
    
    // verify Cookie
    byte[] initCookie = initThr.getCookie();
    byte[] dserCookie = dserThr.getCookie();
    assertTrue(Arrays.equals(initCookie, dserCookie));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:TestPagedResultsResponseControl.java

示例6: testPostProcess

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
@Test
public void testPostProcess() throws Exception {
    int resultSize = 50;
    byte pageSize = 8;

    byte[] value = new byte[1];
    value[0] = pageSize;
    byte[] cookie = encodeValue(resultSize, value);
    PagedResultsResponseControl control = new PagedResultsResponseControl(
            "dummy", true, cookie);

    when(ldapContextMock.getResponseControls()).thenReturn(new Control[] { control });
    tested.postProcess(ldapContextMock);

    PagedResultsCookie returnedCookie = tested.getCookie();
    assertThat(returnedCookie.getCookie()[0]).isEqualTo((byte)8);
    assertThat(tested.getPageSize()).isEqualTo(20);
    assertThat(tested.getResultSize()).isEqualTo(50);
}
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:20,代码来源:PagedResultsDirContextProcessorTest.java

示例7: getPagedResponseCookie

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
private byte[] getPagedResponseCookie(Control[] controls) {
if (controls != null) {
    for (Control control : controls) {
	if (control instanceof PagedResultsResponseControl) {
	    PagedResultsResponseControl prrc = (PagedResultsResponseControl) control;
	    return prrc.getCookie();
	}
    }
}
return null;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:LdapService.java

示例8: testPagedResultsResponseControl003

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String, boolean, byte[])'</p>
 * <p>Here we are testing if this method constructs a paged-results response control.</p>
 * <p>The expected result is a IOexception.</p>
 */
public void testPagedResultsResponseControl003() {

	try {
		byte[] b={};
		PagedResultsResponseControl x=new PagedResultsResponseControl(null,false,b);
		fail("The byte array must not be empty.");
	} catch (IOException e) {
		
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:TestPagedResultsResponseControl.java

示例9: testPagedResultsResponseControl004

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String, boolean, byte[])'</p>
 * <p>Here we are testing if this method constructs a paged-results response control.</p>
 * <p>The expected result is a IOexception.</p>
 */
public void testPagedResultsResponseControl004() {

	try {
		byte[] b={};
		PagedResultsResponseControl x=new PagedResultsResponseControl(null,true,b);
		fail("The byte array must not be empty.");
	} catch (IOException e) {
		
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:TestPagedResultsResponseControl.java

示例10: testPagedResultsResponseControl005

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String, boolean, byte[])'</p>
 * <p>Here we are testing if this method constructs a paged-results response control.</p>
 * <p>The expected result is a IOexception.</p>
 */
public void testPagedResultsResponseControl005() {

	try {
		byte[] b={1,2,3,4,0};
		PagedResultsResponseControl x=new PagedResultsResponseControl(null,false,b);
		fail("The byte array is not ok.");
	} catch (IOException e) {
		
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:TestPagedResultsResponseControl.java

示例11: testPagedResultsResponseControl006

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String, boolean, byte[])'</p>
 * <p>Here we are testing if this method constructs a paged-results response control.</p>
 * <p>The expected result is a IOexception.</p>
 */
public void testPagedResultsResponseControl006() {

	try {
		byte[] b={1,2,3,4,0};
		PagedResultsResponseControl x=new PagedResultsResponseControl(null,true,b);
		fail("The byte array is not ok.");
	} catch (IOException e) {
		
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:TestPagedResultsResponseControl.java

示例12: testPagedResultsResponseControl007

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String, boolean, byte[])'</p>
 * <p>Here we are testing if this method constructs a paged-results response control.</p>
 * <p>The expected result is an instance of the class.</p>
 */
public void testPagedResultsResponseControl007() {

	try {
		byte[] b={48,5,2,1,0,4,0};
		PagedResultsResponseControl x=new PagedResultsResponseControl(null,true,b);
		
	} catch (IOException e) {
		fail("The arguments are ok.");
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:TestPagedResultsResponseControl.java

示例13: testPagedResultsResponseControl008

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String, boolean, byte[])'</p>
 * <p>Here we are testing if this method constructs a paged-results response control.</p>
 * <p>The expected result is an instance of the class.</p>
 */
public void testPagedResultsResponseControl008() {

	try {
		byte[] b={48,5,2,1,0,4,0};
		PagedResultsResponseControl x=new PagedResultsResponseControl(null,false,b);
		
	} catch (IOException e) {
		fail("The arguments are ok.");
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:TestPagedResultsResponseControl.java

示例14: testPagedResultsResponseControl010

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String, boolean, byte[])'</p>
 * <p>Here we are testing if this method constructs a paged-results response control.</p>
 * <p>The expected result is an instance of the class.</p>
 */
public void testPagedResultsResponseControl010() {

	try {
		byte[] b={48,5,2,1,0,4,0};
		PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
		
	} catch (IOException e) {
		fail("The arguments are ok.");
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:TestPagedResultsResponseControl.java

示例15: testGetResultSize001

import javax.naming.ldap.PagedResultsResponseControl; //导入依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.getResultSize()'</p>
 * <p>Here we are testing if this method retrieves (an estimate of) the number of entries in the search result.</p>
 * <p>The expected result is in this case zero.</p> 
 */
public void testGetResultSize001() {

	byte[] b={48,5,2,1,0,4,0};
	try {
		PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
		assertEquals(0,x.getResultSize());
	} catch (IOException e) {
		fail("Failed with:"+e);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:TestPagedResultsResponseControl.java


注:本文中的javax.naming.ldap.PagedResultsResponseControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。