@Override public Control[] getRequestControls() throws NamingException { if ( ! (delegating instanceof LdapContext)) throw Assert.unsupported(); return ((LdapContext) delegating).getRequestControls(); }
private NamingEnumeration<SearchResult> searchWithPagination() throws NamingException, IOException { Control[] controlsBackup = null; Object binaryAttributesBackup = null; // backup and set environment if (pageSize != 0 && context instanceof LdapContext) { controlsBackup = ((LdapContext)context).getRequestControls(); ((LdapContext)context).setRequestControls(new Control[]{ new PagedResultsControl(pageSize, cookie, Control.CRITICAL) }); } if (binaryAttributes != null && binaryAttributes.size() != 0) { // set attributes which should be returned in binary form binaryAttributesBackup = context.getEnvironment().get(ENV_BINARY_ATTRIBUTES); context.addToEnvironment(ENV_BINARY_ATTRIBUTES, String.join(" ", binaryAttributes)); } NamingEnumeration<SearchResult> results = context.search(new LdapName(searchDn), filter, filterArgs, createSearchControls()); // revert environment change if (binaryAttributes != null && binaryAttributes.size() != 0) { if (binaryAttributesBackup == null) { context.removeFromEnvironment(ENV_BINARY_ATTRIBUTES); } else { context.addToEnvironment(ENV_BINARY_ATTRIBUTES, binaryAttributesBackup); } } if (pageSize != 0 && context instanceof LdapContext) { ((LdapContext)context).setRequestControls(controlsBackup); } return results; }
@Override public Object operation() throws NamingException { return ((LdapContext) getDelegate()).getRequestControls(); } }.perform();
@Override public Control[] getRequestControls() throws NamingException { if ( ! (delegating instanceof LdapContext)) throw Assert.unsupported(); return ((LdapContext) delegating).getRequestControls(); }
@Override public Object operation() throws NamingException { return ((LdapContext) getDelegate()).getRequestControls(); } }.perform();
@Override public Control[] getRequestControls() throws NamingException { if ( ! (delegating instanceof LdapContext)) throw Assert.unsupported(); return ((LdapContext) delegating).getRequestControls(); }
@Override public Control[] getRequestControls() throws NamingException { if ( ! (delegating instanceof LdapContext)) throw Assert.unsupported(); return ((LdapContext) delegating).getRequestControls(); }
/** * @see javax.naming.ldap.LdapContext#getRequestControls() */ public Control[] getRequestControls() throws NamingException { this.assertOpen(); return this.getDelegateLdapContext().getRequestControls(); }
/** * @see LdapContext#getRequestControls() */ public Control[] getRequestControls() throws NamingException { this.assertOpen(); return this.getDelegateLdapContext().getRequestControls(); }
/** * @see javax.naming.ldap.LdapContext#getRequestControls() */ public Control[] getRequestControls() throws NamingException { this.assertOpen(); return this.getDelegateLdapContext().getRequestControls(); }
/** * @see LdapContext#getRequestControls() */ public Control[] getRequestControls() throws NamingException { this.assertOpen(); return this.getDelegateLdapContext().getRequestControls(); }
public Control[] getRequestControls() throws NamingException { check(); return getOriginal().getRequestControls(); }
/** * @see javax.naming.ldap.LdapContext#getRequestControls() */ public Control[] getRequestControls() throws NamingException { this.assertOpen(); return this.getDelegateLdapContext().getRequestControls(); }
/** * @see LdapContext#getRequestControls() */ public Control[] getRequestControls() throws NamingException { this.assertOpen(); return this.getDelegateLdapContext().getRequestControls(); }
/** * @see javax.naming.ldap.LdapContext#getRequestControls() */ public Control[] getRequestControls() throws NamingException { this.assertOpen(); return this.getDelegateLdapContext().getRequestControls(); }
@Test public void testPreProcessWithNullControlsShouldAdd() throws NamingException { when(ldapContextMock.getRequestControls()).thenReturn(null); tested.preProcess(ldapContextMock); verify(ldapContextMock).setRequestControls(new Control[] { requestControlMock }); }
@Test public void testPreProcessWithNoExistingControlsShouldAdd() throws NamingException { when(ldapContextMock.getRequestControls()).thenReturn(new Control[0]); tested.preProcess(ldapContextMock); verify(ldapContextMock).setRequestControls(new Control[]{requestControlMock}); }
@Test public void testPreProcessWithExistingControlOfSameClassShouldReplace() throws Exception { when(ldapContextMock.getRequestControls()).thenReturn(new Control[]{requestControl2Mock}); tested.preProcess(ldapContextMock); verify(ldapContextMock).setRequestControls(new Control[] { requestControlMock }); }
@Test public void testPreProcessWithExistingControlOfDifferentClassShouldAdd() throws Exception { SortControl existingControl = new SortControl(new String[] { "cn" }, true); when(ldapContextMock.getRequestControls()).thenReturn(new Control[]{existingControl}); tested.preProcess(ldapContextMock); verify(ldapContextMock).setRequestControls(new Control[] { existingControl, requestControlMock }); }
@Test public void testPreProcessWithExistingControlOfSameClassAndPropertyFalseShouldAdd() throws Exception { when(ldapContextMock.getRequestControls()).thenReturn(new Control[] { requestControl2Mock }); tested.setReplaceSameControlEnabled(false); tested.preProcess(ldapContextMock); verify(ldapContextMock).setRequestControls(new Control[]{requestControl2Mock, requestControlMock}); }