You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/03/29 11:24:04 UTC
svn commit: r1669877 - in /directory/shared/trunk/ldap/client/api/src:
main/java/org/apache/directory/ldap/client/api/
test/java/org/apache/directory/ldap/client/api/
Author: elecharny
Date: Sun Mar 29 09:24:03 2015
New Revision: 1669877
URL: http://svn.apache.org/r1669877
Log:
Added missing AL.20 headers
Modified:
directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultLdapConnectionValidator.java
directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionValidator.java
directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LookupLdapConnectionValidator.java
directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/MonitoringLdapConnection.java
directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/Wrapper.java
directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/MockLdapConnectionFactory.java
directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/ValidatingPoolableLdapConnectionFactoryTest.java
Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultLdapConnectionValidator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultLdapConnectionValidator.java?rev=1669877&r1=1669876&r2=1669877&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultLdapConnectionValidator.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultLdapConnectionValidator.java Sun Mar 29 09:24:03 2015
@@ -1,4 +1,22 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.directory.ldap.client.api;
Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionValidator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionValidator.java?rev=1669877&r1=1669876&r2=1669877&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionValidator.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionValidator.java Sun Mar 29 09:24:03 2015
@@ -1,4 +1,22 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.directory.ldap.client.api;
Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LookupLdapConnectionValidator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LookupLdapConnectionValidator.java?rev=1669877&r1=1669876&r2=1669877&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LookupLdapConnectionValidator.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LookupLdapConnectionValidator.java Sun Mar 29 09:24:03 2015
@@ -1,10 +1,30 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.directory.ldap.client.api;
+
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.name.Dn;
+
/**
* An implementation of {@link LdapConnectionValidator} that attempts a simple
* lookup on the rootDSE.
@@ -24,7 +44,7 @@ final public class LookupLdapConnectionV
{
try
{
- return connection.isConnected()
+ return connection.isConnected()
&& connection.isAuthenticated()
&& ( connection.lookup( Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE ) != null );
}
Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/MonitoringLdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/MonitoringLdapConnection.java?rev=1669877&r1=1669876&r2=1669877&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/MonitoringLdapConnection.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/MonitoringLdapConnection.java Sun Mar 29 09:24:03 2015
@@ -1,6 +1,25 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.directory.ldap.client.api;
+
import org.apache.directory.api.asn1.DecoderException;
import org.apache.directory.api.asn1.util.Oid;
import org.apache.directory.api.ldap.extras.extended.startTls.StartTlsRequest;
@@ -11,14 +30,20 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.message.ExtendedResponse;
import org.apache.directory.api.ldap.model.name.Dn;
+
+/**
+ *
+ * TODO MonitoringLdapConnection.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
public final class MonitoringLdapConnection extends LdapConnectionWrapper
{
private static final Oid START_TLS_OID;
-
- static
+ static
{
- try
+ try
{
START_TLS_OID = Oid.fromString( StartTlsRequest.EXTENSION_OID );
}
@@ -28,28 +53,35 @@ public final class MonitoringLdapConnect
}
}
-
private boolean bindCalled = false;
private boolean startTlsCalled = false;
-
- MonitoringLdapConnection( LdapConnection connection )
+
+
+ MonitoringLdapConnection( LdapConnection connection )
{
super( connection );
}
-
- public boolean bindCalled() {
+
+
+ public boolean bindCalled()
+ {
return bindCalled;
}
-
- public void resetMonitors() {
+
+
+ public void resetMonitors()
+ {
bindCalled = false;
startTlsCalled = false;
}
-
- public boolean startTlsCalled() {
+
+
+ public boolean startTlsCalled()
+ {
return startTlsCalled;
}
+
@Override
public void bind() throws LdapException
{
@@ -57,6 +89,7 @@ public final class MonitoringLdapConnect
bindCalled = true;
}
+
@Override
public void anonymousBind() throws LdapException
{
@@ -64,6 +97,7 @@ public final class MonitoringLdapConnect
bindCalled = true;
}
+
@Override
public void bind( String name ) throws LdapException
{
@@ -71,6 +105,7 @@ public final class MonitoringLdapConnect
bindCalled = true;
}
+
@Override
public void bind( String name, String credentials ) throws LdapException
{
@@ -78,6 +113,7 @@ public final class MonitoringLdapConnect
bindCalled = true;
}
+
@Override
public void bind( Dn name ) throws LdapException
{
@@ -85,6 +121,7 @@ public final class MonitoringLdapConnect
bindCalled = true;
}
+
@Override
public void bind( Dn name, String credentials ) throws LdapException
{
@@ -92,6 +129,7 @@ public final class MonitoringLdapConnect
bindCalled = true;
}
+
@Override
public BindResponse bind( BindRequest bindRequest ) throws LdapException
{
@@ -100,46 +138,56 @@ public final class MonitoringLdapConnect
return response;
}
+
@Override
public ExtendedResponse extended( String oid ) throws LdapException
{
- if ( StartTlsRequest.EXTENSION_OID.equals( oid ) ) {
+ if ( StartTlsRequest.EXTENSION_OID.equals( oid ) )
+ {
startTlsCalled = true;
}
return connection.extended( oid );
}
+
@Override
public ExtendedResponse extended( String oid, byte[] value ) throws LdapException
{
- if ( StartTlsRequest.EXTENSION_OID.equals( oid ) ) {
+ if ( StartTlsRequest.EXTENSION_OID.equals( oid ) )
+ {
startTlsCalled = true;
}
return connection.extended( oid, value );
}
+
@Override
public ExtendedResponse extended( Oid oid ) throws LdapException
{
- if ( START_TLS_OID.equals( oid ) ) {
+ if ( START_TLS_OID.equals( oid ) )
+ {
startTlsCalled = true;
}
return connection.extended( oid );
}
+
@Override
public ExtendedResponse extended( Oid oid, byte[] value ) throws LdapException
{
- if ( START_TLS_OID.equals( oid ) ) {
+ if ( START_TLS_OID.equals( oid ) )
+ {
startTlsCalled = true;
}
return connection.extended( oid, value );
}
+
@Override
public ExtendedResponse extended( ExtendedRequest extendedRequest ) throws LdapException
{
- if ( extendedRequest.hasControl( StartTlsRequest.EXTENSION_OID ) ) {
+ if ( extendedRequest.hasControl( StartTlsRequest.EXTENSION_OID ) )
+ {
startTlsCalled = true;
}
return connection.extended( extendedRequest );
Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/Wrapper.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/Wrapper.java?rev=1669877&r1=1669876&r2=1669877&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/Wrapper.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/Wrapper.java Sun Mar 29 09:24:03 2015
@@ -1,5 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.directory.ldap.client.api;
+
/**
* An interface for defining wrapper objects. An implementation of this class
* <b>MUST</b> implement <code>T</code> as well
Modified: directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/MockLdapConnectionFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/MockLdapConnectionFactory.java?rev=1669877&r1=1669876&r2=1669877&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/MockLdapConnectionFactory.java (original)
+++ directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/MockLdapConnectionFactory.java Sun Mar 29 09:24:03 2015
@@ -1,32 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.directory.ldap.client.api;
+
import java.util.LinkedList;
import java.util.Queue;
import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.ldap.client.api.DefaultLdapConnectionFactory;
-import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.LdapConnectionConfig;
-public class MockLdapConnectionFactory extends DefaultLdapConnectionFactory
+
+public class MockLdapConnectionFactory extends DefaultLdapConnectionFactory
{
Queue<LdapConnection> connections = new LinkedList<LdapConnection>();
-
- public MockLdapConnectionFactory( LdapConnectionConfig config ) {
+
+
+ public MockLdapConnectionFactory( LdapConnectionConfig config )
+ {
super( config );
}
-
- public MockLdapConnectionFactory addConnection( LdapConnection connection ) {
+
+
+ public MockLdapConnectionFactory addConnection( LdapConnection connection )
+ {
this.connections.add( connection );
return this;
}
+
@Override
public LdapConnection newLdapConnection() throws LdapException
{
return bindConnection( this.connections.remove() );
}
+
@Override
public LdapConnection newUnboundLdapConnection()
{
Modified: directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/ValidatingPoolableLdapConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/ValidatingPoolableLdapConnectionFactoryTest.java?rev=1669877&r1=1669876&r2=1669877&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/ValidatingPoolableLdapConnectionFactoryTest.java (original)
+++ directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/ValidatingPoolableLdapConnectionFactoryTest.java Sun Mar 29 09:24:03 2015
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.directory.ldap.client.api;
@@ -36,7 +55,7 @@ public class ValidatingPoolableLdapConne
public void testPoolWithBind()
{
PoolTester tester = new PoolTester();
-
+
// no bind
tester.execute(
new WithConnection()
@@ -160,7 +179,7 @@ public class ValidatingPoolableLdapConne
public void testPoolWithStartTls()
{
PoolTester tester = new PoolTester();
-
+
// extended( String )
tester.execute(
new WithConnection()
@@ -172,7 +191,7 @@ public class ValidatingPoolableLdapConne
verifyAdminBind( connection, times( counts.adminBindCount ) );
}
} );
-
+
// extended( String, byte[] )
tester.execute(
new WithConnection()
@@ -180,11 +199,12 @@ public class ValidatingPoolableLdapConne
@Override
public void execute( LdapConnection connection, Counts counts ) throws LdapException
{
- connection.extended( StartTlsRequest.EXTENSION_OID, new byte[] {} );
+ connection.extended( StartTlsRequest.EXTENSION_OID, new byte[]
+ {} );
verifyAdminBind( connection, times( counts.adminBindCount ) );
}
} );
-
+
// extended( Oid )
tester.execute(
new WithConnection()
@@ -203,7 +223,7 @@ public class ValidatingPoolableLdapConne
verifyAdminBind( connection, times( counts.adminBindCount ) );
}
} );
-
+
// extended( Oid, byte[] )
tester.execute(
new WithConnection()
@@ -213,7 +233,8 @@ public class ValidatingPoolableLdapConne
{
try
{
- connection.extended( Oid.fromString( StartTlsRequest.EXTENSION_OID ), new byte[] {} );
+ connection.extended( Oid.fromString( StartTlsRequest.EXTENSION_OID ), new byte[]
+ {} );
}
catch ( DecoderException e )
{
@@ -222,7 +243,7 @@ public class ValidatingPoolableLdapConne
verifyAdminBind( connection, times( counts.adminBindCount ) );
}
} );
-
+
// extended( ExtendedRequest )
tester.execute(
new WithConnection()
@@ -241,8 +262,8 @@ public class ValidatingPoolableLdapConne
{
verify( connection, mode ).bind( ADMIN_DN, ADMIN_CREDENTIALS );
}
-
-
+
+
private static final LdapConnection verify( LdapConnection connection, VerificationMode mode )
{
if ( MOCK_UTIL.isMock( connection ) )
@@ -261,7 +282,8 @@ public class ValidatingPoolableLdapConne
throw new NotAMockException( "connection is not a mock, nor a wrapper for a connection that is one" );
}
- private static final class Counts {
+ private static final class Counts
+ {
private int adminBindCount = 0;
private int unBindCount = 0;
}
@@ -269,7 +291,7 @@ public class ValidatingPoolableLdapConne
public static final class InternalMonitoringLdapConnection extends LdapConnectionWrapper
{
private static final Oid START_TLS_OID;
-
+
static
{
try
@@ -287,34 +309,46 @@ public class ValidatingPoolableLdapConne
private Counts counts = new Counts();
private boolean startTlsCalled = false;
private boolean unBindCalled = false;
-
- InternalMonitoringLdapConnection( LdapConnection connection )
+
+
+ InternalMonitoringLdapConnection( LdapConnection connection )
{
super( connection );
}
-
- private int incrementBorrowedCount() {
+
+
+ private int incrementBorrowedCount()
+ {
return ++borrowedCount;
}
-
- public boolean bindCalled() {
+
+
+ public boolean bindCalled()
+ {
return bindCalled;
}
-
- public void resetMonitors() {
+
+
+ public void resetMonitors()
+ {
bindCalled = false;
startTlsCalled = false;
unBindCalled = false;
}
-
- public boolean startTlsCalled() {
+
+
+ public boolean startTlsCalled()
+ {
return startTlsCalled;
}
-
- public boolean unBindCalled() {
+
+
+ public boolean unBindCalled()
+ {
return unBindCalled;
}
+
@Override
public void bind() throws LdapException
{
@@ -322,6 +356,7 @@ public class ValidatingPoolableLdapConne
bindCalled = true;
}
+
@Override
public void anonymousBind() throws LdapException
{
@@ -329,6 +364,7 @@ public class ValidatingPoolableLdapConne
bindCalled = true;
}
+
@Override
public void bind( String name ) throws LdapException
{
@@ -336,17 +372,20 @@ public class ValidatingPoolableLdapConne
bindCalled = true;
}
+
@Override
public void bind( String name, String credentials ) throws LdapException
{
connection.bind( name, credentials );
if ( ADMIN_DN.equals( name )
- && ADMIN_CREDENTIALS.equals( credentials ) ) {
+ && ADMIN_CREDENTIALS.equals( credentials ) )
+ {
counts.adminBindCount++;
}
bindCalled = true;
}
+
@Override
public void bind( Dn name ) throws LdapException
{
@@ -354,6 +393,7 @@ public class ValidatingPoolableLdapConne
bindCalled = true;
}
+
@Override
public void bind( Dn name, String credentials ) throws LdapException
{
@@ -361,6 +401,7 @@ public class ValidatingPoolableLdapConne
bindCalled = true;
}
+
@Override
public BindResponse bind( BindRequest bindRequest ) throws LdapException
{
@@ -369,60 +410,71 @@ public class ValidatingPoolableLdapConne
return response;
}
+
@Override
public ExtendedResponse extended( String oid ) throws LdapException
{
- if ( StartTlsRequest.EXTENSION_OID.equals( oid ) ) {
+ if ( StartTlsRequest.EXTENSION_OID.equals( oid ) )
+ {
startTlsCalled = true;
}
return connection.extended( oid );
}
+
@Override
public ExtendedResponse extended( String oid, byte[] value ) throws LdapException
{
- if ( StartTlsRequest.EXTENSION_OID.equals( oid ) ) {
+ if ( StartTlsRequest.EXTENSION_OID.equals( oid ) )
+ {
startTlsCalled = true;
}
return connection.extended( oid, value );
}
+
@Override
public ExtendedResponse extended( Oid oid ) throws LdapException
{
- if ( START_TLS_OID.equals( oid ) ) {
+ if ( START_TLS_OID.equals( oid ) )
+ {
startTlsCalled = true;
}
return connection.extended( oid );
}
+
@Override
public ExtendedResponse extended( Oid oid, byte[] value ) throws LdapException
{
- if ( START_TLS_OID.equals( oid ) ) {
+ if ( START_TLS_OID.equals( oid ) )
+ {
startTlsCalled = true;
}
return connection.extended( oid, value );
}
+
@Override
public ExtendedResponse extended( ExtendedRequest extendedRequest ) throws LdapException
{
- if ( extendedRequest.hasControl( StartTlsRequest.EXTENSION_OID ) ) {
+ if ( extendedRequest.hasControl( StartTlsRequest.EXTENSION_OID ) )
+ {
startTlsCalled = true;
}
return connection.extended( extendedRequest );
}
-
+
+
@Override
- public void unBind() throws LdapException {
+ public void unBind() throws LdapException
+ {
counts.unBindCount++;
unBindCalled = true;
connection.unBind();
}
}
-
-
+
private static class PoolTester
{
private LdapConnectionConfig config;
@@ -441,12 +493,12 @@ public class ValidatingPoolableLdapConne
config.setCredentials( ADMIN_CREDENTIALS );
MockLdapConnectionFactory mockConnectionFactory = new MockLdapConnectionFactory( config );
- mockConnectionFactory.addConnection(
+ mockConnectionFactory.addConnection(
new InternalMonitoringLdapConnection( mockConnection ) );
validator = mock( LdapConnectionValidator.class );
when( validator.validate( any( LdapConnection.class ) ) ).thenReturn( true );
- ValidatingPoolableLdapConnectionFactory poolableFactory =
+ ValidatingPoolableLdapConnectionFactory poolableFactory =
new ValidatingPoolableLdapConnectionFactory( mockConnectionFactory );
poolableFactory.setValidator( validator );
@@ -466,7 +518,7 @@ public class ValidatingPoolableLdapConne
{
connection = pool.getConnection();
assertNotNull( connection );
- internal = (InternalMonitoringLdapConnection)((LdapConnectionWrapper)connection).wrapped();
+ internal = ( InternalMonitoringLdapConnection ) ( ( LdapConnectionWrapper ) connection ).wrapped();
borrowedCount = internal.incrementBorrowedCount();
org.mockito.Mockito.verify( validator, times( 2 * borrowedCount - 1 ) ).validate( connection );
internal.resetMonitors();
@@ -502,8 +554,7 @@ public class ValidatingPoolableLdapConne
}
}
}
-
-
+
private static interface WithConnection
{
/**