You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2011/01/06 21:24:42 UTC
svn commit: r1056057 [1/2] -
/directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/
Author: akarasulu
Date: Thu Jan 6 20:24:41 2011
New Revision: 1056057
URL: http://svn.apache.org/viewvc?rev=1056057&view=rev
Log:
hiding message implementations
Added:
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/AddRequestImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindRequestImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindResponseImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/CompareRequestImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/DeleteRequestImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedRequestImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedResponseImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/LdapResultImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ModifyDnRequestImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ModifyRequestImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ReferralImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/SearchResponseDoneImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/SearchResponseEntryImplTest.java
directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/SearchResponseReferenceImplTest.java
Added: directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/AddRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/AddRequestImplTest.java?rev=1056057&view=auto
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/AddRequestImplTest.java (added)
+++ directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/AddRequestImplTest.java Thu Jan 6 20:24:41 2011
@@ -0,0 +1,377 @@
+/*
+ * 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.shared.ldap.codec.message;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.ldap.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.*;
+import org.apache.directory.shared.ldap.message.control.Control;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * TestCase for the AddRequestImpl class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class AddRequestImplTest
+{
+ private static final Map<String, Control> EMPTY_CONTROL_MAP = new HashMap<String, Control>();
+
+
+ /**
+ * Creates and populates a AttributeImpl with a specific id.
+ *
+ * @param id
+ * the id for the attribute
+ * @return the AttributeImpl assembled for testing
+ */
+ private EntryAttribute getAttribute( String id )
+ {
+ EntryAttribute attr = new DefaultEntryAttribute( id );
+ attr.add( "value0" );
+ attr.add( "value1" );
+ attr.add( "value2" );
+ return attr;
+ }
+
+
+ /**
+ * Creates and populates a LockableAttributes object
+ *
+ * @return
+ */
+ private Entry getEntry()
+ {
+ Entry entry = new DefaultEntry();
+
+ try
+ {
+ entry.put( getAttribute( "attr0" ) );
+ entry.put( getAttribute( "attr1" ) );
+ entry.put( getAttribute( "attr2" ) );
+ }
+ catch ( LdapException ne )
+ {
+ // Do nothing
+ }
+
+ return entry;
+ }
+
+
+ /**
+ * Tests the same object referrence for equality.
+ */
+ @Test
+ public void testEqualsSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ assertTrue( req.equals( req ) );
+ }
+
+
+ /**
+ * Tests for equality using exact copies.
+ */
+ @Test
+ public void testEqualsExactCopy() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ req0.setEntryDn( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setEntry( getEntry() );
+
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ req1.setEntryDn( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setEntry( getEntry() );
+
+ assertTrue( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the IDs are different.
+ */
+ @Test
+ public void testNotEqualDiffId() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 7 );
+ req0.setEntryDn( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setEntry( getEntry() );
+
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ req1.setEntryDn( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setEntry( getEntry() );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the DN names are different.
+ */
+ @Test
+ public void testNotEqualDiffName() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ req0.setEntry( getEntry() );
+ req0.setEntryDn( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ req1.setEntry( getEntry() );
+ req1.setEntryDn( new DN( "cn=admin,dc=apache,dc=org" ) );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the DN names are different.
+ */
+ @Test
+ public void testNotEqualDiffAttributes() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ Entry entry0 = getEntry();
+ entry0.setDn( new DN( "cn=admin,dc=apache,dc=org" ) );
+ req0.setEntry( entry0 );
+
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ req1.setEntryDn( new DN( "cn=admin,dc=apache,dc=org" ) );
+
+ assertTrue( req0.equals( req1 ) );
+ assertTrue( req1.equals( req0 ) );
+
+ Entry entry1 = getEntry();
+ entry1.setDn( new DN( "cn=admin,dc=apache,dc=org" ) );
+ req1.setEntry( entry1 );
+
+ assertTrue( req0.equals( req1 ) );
+ assertTrue( req1.equals( req0 ) );
+
+ req1.getEntry().put( "asdf", "asdf" );
+
+ assertTrue( req0.equals( req1 ) );
+ assertTrue( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Tests for equality even when another BindRequest implementation is used.
+ */
+ @Test
+ public void testEqualsDiffImpl()
+ {
+ AddRequest req0 = new AddRequest()
+ {
+ public Entry getEntry()
+ {
+ return AddRequestImplTest.this.getEntry();
+ }
+
+
+ public void setEntry( Entry entry )
+ {
+ }
+
+
+ public DN getEntryDn()
+ {
+ return null;
+ }
+
+
+ public void setEntryDn( DN entryDn )
+ {
+ }
+
+
+ public MessageTypeEnum getResponseType()
+ {
+ return MessageTypeEnum.ADD_RESPONSE;
+ }
+
+
+ public boolean hasResponse()
+ {
+ return true;
+ }
+
+
+ public MessageTypeEnum getType()
+ {
+ return MessageTypeEnum.ADD_REQUEST;
+ }
+
+
+ public Map<String, Control> getControls()
+ {
+ return EMPTY_CONTROL_MAP;
+ }
+
+
+ public void addControl( Control control ) throws MessageException
+ {
+ }
+
+
+ public void removeControl( Control control ) throws MessageException
+ {
+ }
+
+
+ public int getMessageId()
+ {
+ return 5;
+ }
+
+
+ public Object get( Object key )
+ {
+ return null;
+ }
+
+
+ public Object put( Object key, Object value )
+ {
+ return null;
+ }
+
+
+ public void abandon()
+ {
+ }
+
+
+ public boolean isAbandoned()
+ {
+ return false;
+ }
+
+
+ public void addAbandonListener( AbandonListener listener )
+ {
+ }
+
+
+ public ResultResponse getResultResponse()
+ {
+ return null;
+ }
+
+
+ public void addAllControls( Control[] controls ) throws MessageException
+ {
+ }
+
+
+ public boolean hasControl( String oid )
+ {
+ return false;
+ }
+
+
+ public void addAttributeType( String type ) throws LdapException
+ {
+ }
+
+
+ public void addAttributeValue( String value )
+ {
+ }
+
+
+ public void addAttributeValue( Value<?> value )
+ {
+ }
+
+
+ public void addAttributeValue( byte[] value )
+ {
+ }
+
+
+ public String getCurrentAttributeType()
+ {
+ return null;
+ }
+
+
+ public Control getCurrentControl()
+ {
+ return null;
+ }
+
+
+ public int getControlsLength()
+ {
+ return 0;
+ }
+
+
+ public void setControlsLength( int controlsLength )
+ {
+ }
+
+
+ public int getMessageLength()
+ {
+ return 0;
+ }
+
+
+ public void setMessageLength( int messageLength )
+ {
+ }
+
+
+ public Control getControl( String oid )
+ {
+ return null;
+ }
+
+
+ public void setMessageId( int messageId )
+ {
+ }
+ };
+
+ org.apache.directory.shared.ldap.codec.message.AddRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.AddRequestImpl( 5 );
+ req1.setEntry( getEntry() );
+ assertTrue( req1.equals( req0 ) );
+ }
+}
Added: directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindRequestImplTest.java?rev=1056057&view=auto
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindRequestImplTest.java (added)
+++ directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindRequestImplTest.java Thu Jan 6 20:24:41 2011
@@ -0,0 +1,402 @@
+/*
+ * 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.shared.ldap.codec.message;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.*;
+import org.apache.directory.shared.ldap.message.control.Control;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * TestCases for the methods of the BindRequestImpl class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
+ * $Rev: 923524 $
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class BindRequestImplTest
+{
+ private static final Map<String, Control> EMPTY_CONTROL_MAP = new HashMap<String, Control>();
+
+
+ /**
+ * Tests the same object referrence for equality.
+ */
+ @Test
+ public void testEqualsSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ assertTrue( req.equals( req ) );
+ }
+
+
+ /**
+ * Tests for equality using exact copies.
+ */
+ @Test
+ public void testEqualsExactCopy() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req0.setCredentials( "password".getBytes() );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setSimple( true );
+ req0.setVersion3( true );
+
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req1.setCredentials( "password".getBytes() );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setSimple( true );
+ req1.setVersion3( true );
+
+ assertTrue( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the IDs are different.
+ */
+ @Test
+ public void testNotEqualDiffId() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 7 );
+ req0.setCredentials( "password".getBytes() );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setSimple( true );
+ req0.setVersion3( true );
+
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req1.setCredentials( "password".getBytes() );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setSimple( true );
+ req1.setVersion3( true );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the credentials are different.
+ */
+ @Test
+ public void testNotEqualDiffCreds() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req0.setCredentials( "abcdefg".getBytes() );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setSimple( true );
+ req0.setVersion3( true );
+
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req1.setCredentials( "password".getBytes() );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setSimple( true );
+ req1.setVersion3( true );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the DN names are different.
+ */
+ @Test
+ public void testNotEqualDiffName() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req0.setCredentials( "password".getBytes() );
+ req0.setName( new DN( "uid=akarasulu,dc=example,dc=com" ) );
+ req0.setSimple( true );
+ req0.setVersion3( true );
+
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req1.setCredentials( "password".getBytes() );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setSimple( true );
+ req1.setVersion3( true );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the auth mechanisms are different.
+ */
+ @Test
+ public void testNotEqualDiffSimple() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req0.setCredentials( "password".getBytes() );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setSimple( false );
+ req0.setVersion3( true );
+
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req1.setCredentials( "password".getBytes() );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setSimple( true );
+ req1.setVersion3( true );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the bind LDAP versions are different.
+ */
+ @Test
+ public void testNotEqualDiffVersion() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req0.setCredentials( "password".getBytes() );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setSimple( true );
+ req0.setVersion3( false );
+
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ req1.setCredentials( "password".getBytes() );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setSimple( true );
+ req1.setVersion3( true );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Tests for equality even when another BindRequest implementation is used.
+ */
+ @Test
+ public void testEqualsDiffImpl()
+ {
+ BindRequest req0 = new BindRequest()
+ {
+ public boolean isSimple()
+ {
+ return true;
+ }
+
+
+ public boolean getSimple()
+ {
+ return true;
+ }
+
+
+ public void setSimple( boolean a_isSimple )
+ {
+ }
+
+
+ public byte[] getCredentials()
+ {
+ return null;
+ }
+
+
+ public void setCredentials( String credentials )
+ {
+ }
+
+
+ public void setCredentials( byte[] credentials )
+ {
+ }
+
+
+ public DN getName()
+ {
+ return null;
+ }
+
+
+ public void setName( DN name )
+ {
+ }
+
+
+ public boolean isVersion3()
+ {
+ return true;
+ }
+
+
+ public boolean getVersion3()
+ {
+ return true;
+ }
+
+
+ public void setVersion3( boolean a_isVersion3 )
+ {
+ }
+
+
+ public MessageTypeEnum getResponseType()
+ {
+ return MessageTypeEnum.BIND_REQUEST;
+ }
+
+
+ public boolean hasResponse()
+ {
+ return true;
+ }
+
+
+ public MessageTypeEnum getType()
+ {
+ return MessageTypeEnum.BIND_REQUEST;
+ }
+
+
+ public Map<String, Control> getControls()
+ {
+ return EMPTY_CONTROL_MAP;
+ }
+
+
+ public void addControl( Control control ) throws MessageException
+ {
+ }
+
+
+ public void removeControl( Control control ) throws MessageException
+ {
+ }
+
+
+ public int getMessageId()
+ {
+ return 5;
+ }
+
+
+ public Object get( Object a_key )
+ {
+ return null;
+ }
+
+
+ public Object put( Object a_key, Object a_value )
+ {
+ return null;
+ }
+
+
+ public String getSaslMechanism()
+ {
+ return null;
+ }
+
+
+ public void setSaslMechanism( String saslMechanism )
+ {
+ }
+
+
+ public ResultResponse getResultResponse()
+ {
+ return null;
+ }
+
+
+ public void addAllControls( Control[] controls ) throws MessageException
+ {
+ }
+
+
+ public boolean hasControl( String oid )
+ {
+ return false;
+ }
+
+
+ public void abandon()
+ {
+ }
+
+
+ public void addAbandonListener( AbandonListener listener )
+ {
+ }
+
+
+ public boolean isAbandoned()
+ {
+ return false;
+ }
+
+
+ public Control getCurrentControl()
+ {
+ return null;
+ }
+
+
+ public int getControlsLength()
+ {
+ return 0;
+ }
+
+
+ public void setControlsLength( int controlsLength )
+ {
+ }
+
+
+ public int getMessageLength()
+ {
+ return 0;
+ }
+
+
+ public void setMessageLength( int messageLength )
+ {
+ }
+
+
+ public Control getControl( String oid )
+ {
+ return null;
+ }
+
+
+ public void setMessageId( int messageId )
+ {
+ }
+ };
+
+ org.apache.directory.shared.ldap.codec.message.BindRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.BindRequestImpl( 5 );
+ assertTrue( req1.equals( req0 ) );
+ }
+}
Added: directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindResponseImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindResponseImplTest.java?rev=1056057&view=auto
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindResponseImplTest.java (added)
+++ directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/BindResponseImplTest.java Thu Jan 6 20:24:41 2011
@@ -0,0 +1,198 @@
+/*
+ * 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.shared.ldap.codec.message;
+
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.codec.message.BindResponseImpl;
+import org.apache.directory.shared.ldap.codec.message.LdapResultImpl;
+import org.apache.directory.shared.ldap.codec.message.ReferralImpl;
+import org.apache.directory.shared.ldap.message.Referral;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Tests the methods of the BindResponseImpl class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
+ * $Rev: 946353 $
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class BindResponseImplTest
+
+{
+ /**
+ * Tests to make sure the same object returns true with equals().
+ */
+ @Test
+ public void testEqualsSameObj()
+ {
+ BindResponseImpl resp = new BindResponseImpl( 1 );
+ assertTrue( "same object should be equal", resp.equals( resp ) );
+ }
+
+
+ /**
+ * Tests to make sure newly created objects with same id are equal.
+ */
+ @Test
+ public void testEqualsNewWithSameId()
+ {
+ BindResponseImpl resp0 = new BindResponseImpl( 1 );
+ BindResponseImpl resp1 = new BindResponseImpl( 1 );
+ assertTrue( "default copy with same id should be equal", resp0.equals( resp1 ) );
+ assertTrue( "default copy with same id should be equal", resp1.equals( resp0 ) );
+ }
+
+
+ /**
+ * Tests to make sure the same object has the same hashCode.
+ */
+ @Test
+ public void testHashCodeSameObj()
+ {
+ BindResponseImpl resp = new BindResponseImpl( 1 );
+ assertTrue( resp.hashCode() == resp.hashCode() );
+ }
+
+
+ /**
+ * Tests to make sure newly created objects with same id have the same hashCode.
+ */
+ @Test
+ public void testHashCodeNewWithSameId()
+ {
+ BindResponseImpl resp0 = new BindResponseImpl( 1 );
+ BindResponseImpl resp1 = new BindResponseImpl( 1 );
+ assertTrue( resp1.hashCode() == resp0.hashCode() );
+ }
+
+
+ /**
+ * Tests to make sure newly created objects with same different id are not
+ * equal.
+ */
+ @Test
+ public void testNotEqualsNewWithDiffId()
+ {
+ BindResponseImpl resp0 = new BindResponseImpl( 1 );
+ BindResponseImpl resp1 = new org.apache.directory.shared.ldap.codec.message.BindResponseImpl( 2 );
+ assertFalse( "different id objects should not be equal", resp0.equals( resp1 ) );
+ assertFalse( "different id objects should not be equal", resp1.equals( resp0 ) );
+ }
+
+
+ /**
+ * Tests to make sure newly created objects with same different saslCreds
+ * are not equal.
+ */
+ @Test
+ public void testNotEqualsNewWithDiffSaslCreds()
+ {
+ BindResponseImpl resp0 = new BindResponseImpl( 1 );
+ resp0.setServerSaslCreds( new byte[2] );
+ BindResponseImpl resp1 = new BindResponseImpl( 1 );
+ resp1.setServerSaslCreds( new byte[3] );
+ assertFalse( "different serverSaslCreds objects should not be equal", resp0.equals( resp1 ) );
+ assertFalse( "different serverSaslCreds objects should not be equal", resp1.equals( resp0 ) );
+ }
+
+
+ /**
+ * Tests for equality of two fully loaded identical BindResponse PDUs.
+ */
+ @Test
+ public void testEqualsWithTheWorks() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.LdapResultImpl r0 = new org.apache.directory.shared.ldap.codec.message.LdapResultImpl();
+ LdapResultImpl r1 = new org.apache.directory.shared.ldap.codec.message.LdapResultImpl();
+
+ r0.setErrorMessage( "blah blah blah" );
+ r1.setErrorMessage( "blah blah blah" );
+
+ r0.setMatchedDn( new DN( "dc=example,dc=com" ) );
+ r1.setMatchedDn( new DN( "dc=example,dc=com" ) );
+
+ r0.setResultCode( ResultCodeEnum.TIME_LIMIT_EXCEEDED );
+ r1.setResultCode( ResultCodeEnum.TIME_LIMIT_EXCEEDED );
+
+ Referral refs0 = new ReferralImpl();
+ refs0.addLdapUrl( "ldap://someserver.com" );
+ refs0.addLdapUrl( "ldap://anotherserver.org" );
+
+ Referral refs1 = new ReferralImpl();
+ refs1.addLdapUrl( "ldap://someserver.com" );
+ refs1.addLdapUrl( "ldap://anotherserver.org" );
+
+ BindResponseImpl resp0 = new BindResponseImpl( 1 );
+ BindResponseImpl resp1 = new BindResponseImpl( 1 );
+
+ resp0.setServerSaslCreds( "password".getBytes() );
+ resp1.setServerSaslCreds( "password".getBytes() );
+
+ assertTrue( "loaded carbon copies should be equal", resp0.equals( resp1 ) );
+ assertTrue( "loaded carbon copies should be equal", resp1.equals( resp0 ) );
+ }
+
+
+ /**
+ * Tests for equal hashCode of two fully loaded identical BindResponse PDUs.
+ */
+ @Test
+ public void testHashCodeWithTheWorks() throws LdapException
+ {
+ LdapResultImpl r0 = new LdapResultImpl();
+ org.apache.directory.shared.ldap.codec.message.LdapResultImpl r1 = new org.apache.directory.shared.ldap.codec.message.LdapResultImpl();
+
+ r0.setErrorMessage( "blah blah blah" );
+ r1.setErrorMessage( "blah blah blah" );
+
+ r0.setMatchedDn( new DN( "dc=example,dc=com" ) );
+ r1.setMatchedDn( new DN( "dc=example,dc=com" ) );
+
+ r0.setResultCode( ResultCodeEnum.TIME_LIMIT_EXCEEDED );
+ r1.setResultCode( ResultCodeEnum.TIME_LIMIT_EXCEEDED );
+
+ Referral refs0 = new ReferralImpl();
+ refs0.addLdapUrl( "ldap://someserver.com" );
+ refs0.addLdapUrl( "ldap://anotherserver.org" );
+
+ Referral refs1 = new ReferralImpl();
+ refs1.addLdapUrl( "ldap://someserver.com" );
+ refs1.addLdapUrl( "ldap://anotherserver.org" );
+
+ BindResponseImpl resp0 = new BindResponseImpl( 1 );
+ BindResponseImpl resp1 = new BindResponseImpl( 1 );
+
+ resp0.setServerSaslCreds( "password".getBytes() );
+ resp1.setServerSaslCreds( "password".getBytes() );
+
+ assertTrue( resp0.hashCode() == resp1.hashCode() );
+ }
+}
Added: directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/CompareRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/CompareRequestImplTest.java?rev=1056057&view=auto
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/CompareRequestImplTest.java (added)
+++ directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/CompareRequestImplTest.java Thu Jan 6 20:24:41 2011
@@ -0,0 +1,352 @@
+/*
+ * 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.shared.ldap.codec.message;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.*;
+import org.apache.directory.shared.ldap.message.control.Control;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * TestCase for the CompareRequestImpl class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class CompareRequestImplTest
+{
+ private static final Map<String, Control> EMPTY_CONTROL_MAP = new HashMap<String, Control>();
+
+
+ /**
+ * Tests the same object reference for equality.
+ */
+ @Test
+ public void testEqualsSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ assertTrue( req.equals( req ) );
+ }
+
+
+ /**
+ * Tests for equality using exact copies.
+ */
+ @Test
+ public void testEqualsExactCopy() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setAttributeId( "objectClass" );
+ req0.setAssertionValue( "top" );
+
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setAttributeId( "objectClass" );
+ req1.setAssertionValue( "top" );
+
+ assertTrue( req0.equals( req1 ) );
+ assertTrue( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Tests the same object reference for equal hashCode.
+ */
+ @Test
+ public void testHashCodeSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ assertTrue( req.hashCode() == req.hashCode() );
+ }
+
+
+ /**
+ * Tests for equal hashCode using exact copies.
+ */
+ @Test
+ public void testHashCodeExactCopy() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req0.setAttributeId( "objectClass" );
+ req0.setAssertionValue( "top" );
+
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+ req1.setAttributeId( "objectClass" );
+ req1.setAssertionValue( "top" );
+
+ assertTrue( req0.hashCode() == req1.hashCode() );
+ }
+
+
+ /**
+ * Test for inequality when only the IDs are different.
+ */
+ @Test
+ public void testNotEqualDiffId() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 7 );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ assertFalse( req0.equals( req1 ) );
+ assertFalse( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the attributeIds are different.
+ */
+ @Test
+ public void testNotEqualDiffAttributeIds() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req0.setName( new DN( "cn=admin,dc=apache,dc=org" ) );
+ req0.setAttributeId( "dc" );
+ req0.setAssertionValue( "apache.org" );
+
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=apache,dc=org" ) );
+ req1.setAttributeId( "nisDomain" );
+ req1.setAssertionValue( "apache.org" );
+
+ assertFalse( req0.equals( req1 ) );
+ assertFalse( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the Assertion values are different.
+ */
+ @Test
+ public void testNotEqualDiffValue() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req0.setName( new DN( "cn=admin,dc=apache,dc=org" ) );
+ req0.setAttributeId( "dc" );
+ req0.setAssertionValue( "apache.org" );
+
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=apache,dc=org" ) );
+ req1.setAttributeId( "dc" );
+ req1.setAssertionValue( "nagoya.apache.org" );
+
+ assertFalse( req0.equals( req1 ) );
+ assertFalse( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Tests for equality even when another CompareRequest implementation is
+ * used.
+ */
+ @Test
+ public void testEqualsDiffImpl()
+ {
+ CompareRequest req0 = new CompareRequest()
+ {
+ public Value<?> getAssertionValue()
+ {
+ return null;
+ }
+
+
+ public void setAssertionValue( String value )
+ {
+
+ }
+
+
+ public void setAssertionValue( byte[] value )
+ {
+
+ }
+
+
+ public String getAttributeId()
+ {
+ return null;
+ }
+
+
+ public void setAttributeId( String attrId )
+ {
+
+ }
+
+
+ public DN getName()
+ {
+ return null;
+ }
+
+
+ public void setName( DN name )
+ {
+ }
+
+
+ public MessageTypeEnum getResponseType()
+ {
+ return MessageTypeEnum.COMPARE_RESPONSE;
+ }
+
+
+ public boolean hasResponse()
+ {
+ return true;
+ }
+
+
+ public MessageTypeEnum getType()
+ {
+ return MessageTypeEnum.COMPARE_REQUEST;
+ }
+
+
+ public Map<String, Control> getControls()
+ {
+ return EMPTY_CONTROL_MAP;
+ }
+
+
+ public void addControl( Control a_control ) throws MessageException
+ {
+ }
+
+
+ public void removeControl( Control a_control ) throws MessageException
+ {
+ }
+
+
+ public int getMessageId()
+ {
+ return 5;
+ }
+
+
+ public Object get( Object a_key )
+ {
+ return null;
+ }
+
+
+ public Object put( Object a_key, Object a_value )
+ {
+ return null;
+ }
+
+
+ public void abandon()
+ {
+ }
+
+
+ public boolean isAbandoned()
+ {
+ return false;
+ }
+
+
+ public void addAbandonListener( AbandonListener listener )
+ {
+ }
+
+
+ public ResultResponse getResultResponse()
+ {
+ return null;
+ }
+
+
+ public void addAllControls( Control[] controls ) throws MessageException
+ {
+ }
+
+
+ public boolean hasControl( String oid )
+ {
+ return false;
+ }
+
+
+ public Control getCurrentControl()
+ {
+ return null;
+ }
+
+
+ public int getControlsLength()
+ {
+ return 0;
+ }
+
+
+ public void setControlsLength( int controlsLength )
+ {
+ }
+
+
+ public int getMessageLength()
+ {
+ return 0;
+ }
+
+
+ public void setMessageLength( int messageLength )
+ {
+ }
+
+
+ public Control getControl( String oid )
+ {
+ return null;
+ }
+
+
+ public void setMessageId( int messageId )
+ {
+ }
+ };
+
+ org.apache.directory.shared.ldap.codec.message.CompareRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.CompareRequestImpl( 5 );
+ assertTrue( req1.equals( req0 ) );
+ assertFalse( req0.equals( req1 ) );
+ }
+}
Added: directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/DeleteRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/DeleteRequestImplTest.java?rev=1056057&view=auto
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/DeleteRequestImplTest.java (added)
+++ directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/DeleteRequestImplTest.java Thu Jan 6 20:24:41 2011
@@ -0,0 +1,284 @@
+/*
+ * 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.shared.ldap.codec.message;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.*;
+import org.apache.directory.shared.ldap.message.control.Control;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * TestCase for the methods of the DeleteRequestImpl class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class DeleteRequestImplTest
+{
+ private static final Map<String, Control> EMPTY_CONTROL_MAP = new HashMap<String, Control>();
+
+
+ /**
+ * Tests the same object reference for equality.
+ */
+ @Test
+ public void testEqualsSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ assertTrue( req.equals( req ) );
+ }
+
+
+ /**
+ * Tests for equality using exact copies.
+ */
+ @Test
+ public void testEqualsExactCopy() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ assertTrue( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Tests the same object reference for equal hashCode.
+ */
+ @Test
+ public void testHashCodeSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ assertTrue( req.hashCode() == req.hashCode() );
+ }
+
+
+ /**
+ * Tests for equal hashCode using exact copies.
+ */
+ @Test
+ public void testHashCodeExactCopy() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ assertTrue( req0.hashCode() == req1.hashCode() );
+ }
+
+
+ /**
+ * Test for inequality when only the IDs are different.
+ */
+ @Test
+ public void testNotEqualDiffId() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 7 );
+ req0.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the DN names are different.
+ */
+ @Test
+ public void testNotEqualDiffName() throws LdapException
+ {
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ req0.setName( new DN( "uid=akarasulu,dc=example,dc=com" ) );
+
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ req1.setName( new DN( "cn=admin,dc=example,dc=com" ) );
+
+ assertFalse( req0.equals( req1 ) );
+ }
+
+
+ /**
+ * Tests for equality even when another DeleteRequest implementation is
+ * used.
+ */
+ @Test
+ public void testEqualsDiffImpl()
+ {
+ DeleteRequest req0 = new DeleteRequest()
+ {
+ public DN getName()
+ {
+ return null;
+ }
+
+
+ public void setName( DN name )
+ {
+ }
+
+
+ public MessageTypeEnum getResponseType()
+ {
+ return MessageTypeEnum.DEL_RESPONSE;
+ }
+
+
+ public boolean hasResponse()
+ {
+ return true;
+ }
+
+
+ public MessageTypeEnum getType()
+ {
+ return MessageTypeEnum.DEL_REQUEST;
+ }
+
+
+ public Map<String, Control> getControls()
+ {
+ return EMPTY_CONTROL_MAP;
+ }
+
+
+ public void addControl( Control control ) throws MessageException
+ {
+ }
+
+
+ public void removeControl( Control control ) throws MessageException
+ {
+ }
+
+
+ public int getMessageId()
+ {
+ return 5;
+ }
+
+
+ public Object get( Object key )
+ {
+ return null;
+ }
+
+
+ public Object put( Object key, Object value )
+ {
+ return null;
+ }
+
+
+ public void abandon()
+ {
+ }
+
+
+ public boolean isAbandoned()
+ {
+ return false;
+ }
+
+
+ public void addAbandonListener( AbandonListener listener )
+ {
+ }
+
+
+ public ResultResponse getResultResponse()
+ {
+ return null;
+ }
+
+
+ public void addAllControls( Control[] controls ) throws MessageException
+ {
+ }
+
+
+ public boolean hasControl( String oid )
+ {
+ return false;
+ }
+
+
+ public Control getCurrentControl()
+ {
+ return null;
+ }
+
+
+ public int getControlsLength()
+ {
+ return 0;
+ }
+
+
+ public void setControlsLength( int controlsLength )
+ {
+ }
+
+
+ public int getMessageLength()
+ {
+ return 0;
+ }
+
+
+ public void setMessageLength( int messageLength )
+ {
+ }
+
+
+ public Control getControl( String oid )
+ {
+ return null;
+ }
+
+
+ public void setMessageId( int messageId )
+ {
+ }
+ };
+
+ org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.DeleteRequestImpl( 5 );
+ assertTrue( req1.equals( req0 ) );
+ }
+}
Added: directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedRequestImplTest.java?rev=1056057&view=auto
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedRequestImplTest.java (added)
+++ directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedRequestImplTest.java Thu Jan 6 20:24:41 2011
@@ -0,0 +1,319 @@
+/*
+ * 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.shared.ldap.codec.message;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.ExtendedResponse;
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.ldap.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.message.MessageException;
+import org.apache.directory.shared.ldap.message.MessageTypeEnum;
+import org.apache.directory.shared.ldap.message.ResultResponse;
+import org.apache.directory.shared.ldap.message.control.Control;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * TestCase for the ExtendedRequestImpl class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class ExtendedRequestImplTest
+{
+ private static final Map<String, Control> EMPTY_CONTROL_MAP = new HashMap<String, Control>();
+
+
+ /**
+ * Tests the same object reference for equality.
+ */
+ @Test
+ public void testEqualsSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ assertTrue( req.equals( req ) );
+ }
+
+
+ /**
+ * Tests for equality using exact copies.
+ */
+ @Test
+ public void testEqualsExactCopy()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ req0.setRequestName( "1.1.1.1" );
+ req0.setRequestValue( "Hello World!".getBytes() );
+
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ req1.setRequestName( "1.1.1.1" );
+ req1.setRequestValue( "Hello World!".getBytes() );
+
+ assertTrue( req0.equals( req1 ) );
+ assertTrue( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Tests the same object reference for equal hashCode.
+ */
+ @Test
+ public void testHashCodeSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ assertTrue( req.hashCode() == req.hashCode() );
+ }
+
+
+ /**
+ * Tests for equal hashCode using exact copies.
+ */
+ @Test
+ public void testHashCodeExactCopy()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ req0.setRequestName( "1.1.1.1" );
+ req0.setRequestValue( "Hello World!".getBytes() );
+
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ req1.setRequestName( "1.1.1.1" );
+ req1.setRequestValue( "Hello World!".getBytes() );
+
+ assertTrue( req0.hashCode() == req1.hashCode() );
+ }
+
+
+ /**
+ * Test for inequality when only the IDs are different.
+ */
+ @Test
+ public void testNotEqualDiffId()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 7 );
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+
+ assertFalse( req0.equals( req1 ) );
+ assertFalse( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the OID is different.
+ */
+ @Test
+ public void testNotEqualDiffOID()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ req0.setRequestName( "1.1.1.1" );
+ req0.setRequestValue( "Hello World!".getBytes() );
+
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ req0.setRequestName( "1.2.2.1" );
+ req0.setRequestValue( "Hello World!".getBytes() );
+
+ assertFalse( req0.equals( req1 ) );
+ assertFalse( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Test for inequality when only the Assertion values are different.
+ */
+ @Test
+ public void testNotEqualDiffValue()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req0 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ req0.setRequestName( "1.1.1.1" );
+ req0.setRequestValue( "Hello ".getBytes() );
+
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ req0.setRequestName( "1.1.1.1" );
+ req0.setRequestValue( "World!".getBytes() );
+
+ assertFalse( req0.equals( req1 ) );
+ assertFalse( req1.equals( req0 ) );
+ }
+
+
+ /**
+ * Tests for equality even when another ExtendedRequest implementation is
+ * used.
+ */
+ @Test
+ public void testEqualsDiffImpl()
+ {
+ ExtendedRequest req0 = new ExtendedRequest()
+ {
+ private static final long serialVersionUID = 1L;
+
+
+ public void setRequestName( String oid )
+ {
+ }
+
+
+ public byte[] getRequestValue()
+ {
+ return null;
+ }
+
+
+ public void setRequestValue( byte[] payload )
+ {
+ }
+
+
+ public MessageTypeEnum getResponseType()
+ {
+ return MessageTypeEnum.EXTENDED_RESPONSE;
+ }
+
+
+ public boolean hasResponse()
+ {
+ return true;
+ }
+
+
+ public MessageTypeEnum getType()
+ {
+ return MessageTypeEnum.EXTENDED_REQUEST;
+ }
+
+
+ public Map<String, Control> getControls()
+ {
+ return EMPTY_CONTROL_MAP;
+ }
+
+
+ public void addControl( Control control ) throws MessageException
+ {
+ }
+
+
+ public void removeControl( Control control ) throws MessageException
+ {
+ }
+
+
+ public int getMessageId()
+ {
+ return 5;
+ }
+
+
+ public Object get( Object key )
+ {
+ return null;
+ }
+
+
+ public Object put( Object key, Object value )
+ {
+ return null;
+ }
+
+
+ public ResultResponse getResultResponse()
+ {
+ return null;
+ }
+
+
+ public String getRequestName()
+ {
+ return null;
+ }
+
+
+ public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length )
+ throws NamingException
+ {
+ return null;
+ }
+
+
+ public void addAllControls( Control[] controls ) throws MessageException
+ {
+ }
+
+
+ public boolean hasControl( String oid )
+ {
+ return false;
+ }
+
+
+ public Control getCurrentControl()
+ {
+ return null;
+ }
+
+
+ public int getControlsLength()
+ {
+ return 0;
+ }
+
+
+ public void setControlsLength( int controlsLength )
+ {
+ }
+
+
+ public int getMessageLength()
+ {
+ return 0;
+ }
+
+
+ public void setMessageLength( int messageLength )
+ {
+ }
+
+
+ public Control getControl( String oid )
+ {
+ return null;
+ }
+
+
+ public void setMessageId( int messageId )
+ {
+ }
+ };
+
+ org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl req1 = new org.apache.directory.shared.ldap.codec.message.ExtendedRequestImpl( 5 );
+ assertTrue( req1.equals( req0 ) );
+ assertFalse( req0.equals( req1 ) );
+ }
+}
Added: directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedResponseImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedResponseImplTest.java?rev=1056057&view=auto
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedResponseImplTest.java (added)
+++ directory/shared/branches/alex_refactoring/ldap/src/test/java/org/apache/directory/shared/ldap/codec/message/ExtendedResponseImplTest.java Thu Jan 6 20:24:41 2011
@@ -0,0 +1,341 @@
+/*
+ * 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.shared.ldap.codec.message;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl;
+import org.apache.directory.shared.ldap.codec.message.ReferralImpl;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.*;
+import org.apache.directory.shared.ldap.message.control.Control;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * TestCase for the ExtendedResponseImpl class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class ExtendedResponseImplTest
+{
+ private static final Map<String, Control> EMPTY_CONTROL_MAP = new HashMap<String, Control>();
+
+
+ /**
+ * Creates and populates a ExtendedResponseImpl stub for testing purposes.
+ *
+ * @return a populated ExtendedResponseImpl stub
+ */
+ private org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl createStub()
+ {
+ // Construct the Search response to test with results and referrals
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl response = new org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl( 45 );
+ response.setResponseValue( "Hello World!".getBytes() );
+ response.setResponseName( "1.1.1.1" );
+ LdapResult result = response.getLdapResult();
+
+ try
+ {
+ result.setMatchedDn( new DN( "dc=example,dc=com" ) );
+ }
+ catch ( LdapException ine )
+ {
+ // Do nothing
+ }
+
+ result.setResultCode( ResultCodeEnum.SUCCESS );
+ org.apache.directory.shared.ldap.codec.message.ReferralImpl refs = new ReferralImpl();
+ refs.addLdapUrl( "ldap://someserver.com" );
+ refs.addLdapUrl( "ldap://apache.org" );
+ refs.addLdapUrl( "ldap://another.net" );
+ result.setReferral( refs );
+ return response;
+ }
+
+
+ /**
+ * Tests for equality using the same object.
+ */
+ @Test
+ public void testEqualsSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp = createStub();
+ assertTrue( resp.equals( resp ) );
+ }
+
+
+ /**
+ * Tests for equality using an exact copy.
+ */
+ @Test
+ public void testEqualsExactCopy()
+ {
+ ExtendedResponseImpl resp0 = createStub();
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp1 = createStub();
+ assertTrue( resp0.equals( resp1 ) );
+ assertTrue( resp1.equals( resp0 ) );
+ }
+
+
+ /**
+ * Tests for equality using different stub implementations.
+ */
+ @Test
+ public void testEqualsDiffImpl()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp0 = createStub();
+ ExtendedResponse resp1 = new ExtendedResponse()
+ {
+ private static final long serialVersionUID = 5297000474419901408L;
+
+
+ public String getID()
+ {
+ return "1.1.1.1";
+ }
+
+
+ public String getResponseName()
+ {
+ return "1.1.1.1";
+ }
+
+
+ public void setResponseName( String oid )
+ {
+ }
+
+
+ public byte[] getEncodedValue()
+ {
+ return "Hello World!".getBytes();
+ }
+
+
+ public byte[] getResponseValue()
+ {
+ return "Hello World!".getBytes();
+ }
+
+
+ public void setResponseValue( byte[] value )
+ {
+ }
+
+
+ public LdapResult getLdapResult()
+ {
+ org.apache.directory.shared.ldap.codec.message.LdapResultImpl result = new org.apache.directory.shared.ldap.codec.message.LdapResultImpl();
+
+ try
+ {
+ result.setMatchedDn( new DN( "dc=example,dc=com" ) );
+ }
+ catch ( LdapException ine )
+ {
+ // do nothing
+ }
+
+ result.setResultCode( ResultCodeEnum.SUCCESS );
+ org.apache.directory.shared.ldap.codec.message.ReferralImpl refs = new org.apache.directory.shared.ldap.codec.message.ReferralImpl();
+ refs.addLdapUrl( "ldap://someserver.com" );
+ refs.addLdapUrl( "ldap://apache.org" );
+ refs.addLdapUrl( "ldap://another.net" );
+ result.setReferral( refs );
+
+ return result;
+ }
+
+
+ public MessageTypeEnum getType()
+ {
+ return MessageTypeEnum.EXTENDED_RESPONSE;
+ }
+
+
+ public Map<String, Control> getControls()
+ {
+ return EMPTY_CONTROL_MAP;
+ }
+
+
+ public void addControl( Control a_control ) throws MessageException
+ {
+ }
+
+
+ public void removeControl( Control a_control ) throws MessageException
+ {
+ }
+
+
+ public int getMessageId()
+ {
+ return 45;
+ }
+
+
+ public Object get( Object a_key )
+ {
+ return null;
+ }
+
+
+ public Object put( Object a_key, Object a_value )
+ {
+ return null;
+ }
+
+
+ public void addAllControls( Control[] controls ) throws MessageException
+ {
+ }
+
+
+ public boolean hasControl( String oid )
+ {
+ return false;
+ }
+
+
+ public Control getCurrentControl()
+ {
+ return null;
+ }
+
+
+ public int getControlsLength()
+ {
+ return 0;
+ }
+
+
+ public void setControlsLength( int controlsLength )
+ {
+ }
+
+
+ public int getMessageLength()
+ {
+ return 0;
+ }
+
+
+ public void setMessageLength( int messageLength )
+ {
+ }
+
+
+ public Control getControl( String oid )
+ {
+ return null;
+ }
+
+
+ public void setMessageId( int messageId )
+ {
+ }
+ };
+
+ assertTrue( resp0.equals( resp1 ) );
+ assertFalse( resp1.equals( resp0 ) );
+ }
+
+
+ /**
+ * Tests for equal hashCode using the same object.
+ */
+ @Test
+ public void testHashCodeSameObj()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp = createStub();
+ assertTrue( resp.hashCode() == resp.hashCode() );
+ }
+
+
+ /**
+ * Tests for equal hashCode using an exact copy.
+ */
+ @Test
+ public void testHashCodeExactCopy()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp0 = createStub();
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp1 = createStub();
+ assertTrue( resp0.hashCode() == resp1.hashCode() );
+ }
+
+
+ /**
+ * Tests inequality when messageIds are different.
+ */
+ @Test
+ public void testNotEqualsDiffIds()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp0 = new org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl( 3 );
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp1 = new org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl( 4 );
+
+ assertFalse( resp0.equals( resp1 ) );
+ assertFalse( resp1.equals( resp0 ) );
+ }
+
+
+ /**
+ * Tests inequality when responseNames are different.
+ */
+ @Test
+ public void testNotEqualsDiffNames()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp0 = createStub();
+ resp0.setResponseName( "1.2.3.4" );
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp1 = createStub();
+ resp1.setResponseName( "1.2.3.4.5" );
+
+ assertFalse( resp0.equals( resp1 ) );
+ assertFalse( resp1.equals( resp0 ) );
+ }
+
+
+ /**
+ * Tests inequality when responses are different.
+ */
+ @Test
+ public void testNotEqualsDiffResponses()
+ {
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp0 = createStub();
+ resp0.setResponseValue( "abc".getBytes() );
+ org.apache.directory.shared.ldap.codec.message.ExtendedResponseImpl resp1 = createStub();
+ resp1.setResponseValue( "123".getBytes() );
+
+ assertFalse( resp0.equals( resp1 ) );
+ assertFalse( resp1.equals( resp0 ) );
+ }
+}