diff --git a/spring-ldap/.classpath b/spring-ldap/.classpath
index 6290e470..96ad1b1d 100644
--- a/spring-ldap/.classpath
+++ b/spring-ldap/.classpath
@@ -1,51 +1,51 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-ldap/build.xml b/spring-ldap/build.xml
index febbaa6e..6ad8a44e 100644
--- a/spring-ldap/build.xml
+++ b/spring-ldap/build.xml
@@ -83,10 +83,9 @@ The HTML report is ${target.testresults.html.dir}/index.html
-
-
-
-
+
+
+
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/authentication/AcegiAuthenticationSourceTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/authentication/AcegiAuthenticationSourceTest.java
deleted file mode 100644
index abfc4daa..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/authentication/AcegiAuthenticationSourceTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.authentication;
-
-import junit.framework.TestCase;
-
-
-import org.acegisecurity.Authentication;
-import org.acegisecurity.GrantedAuthority;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.userdetails.User;
-import org.acegisecurity.userdetails.ldap.LdapUserDetails;
-import org.easymock.MockControl;
-import org.springframework.ldap.support.authentication.AcegiAuthenticationSource;
-
-public class AcegiAuthenticationSourceTest extends TestCase {
-
- private MockControl authenticationControl;
-
- private Authentication authenticationMock;
-
- private MockControl ldapUserDetailsControl;
-
- private LdapUserDetails ldapUserDetailsMock;
-
- private AcegiAuthenticationSource tested;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- authenticationControl = MockControl.createControl(Authentication.class);
- authenticationMock = (Authentication) authenticationControl.getMock();
-
- ldapUserDetailsControl = MockControl
- .createControl(LdapUserDetails.class);
- ldapUserDetailsMock = (LdapUserDetails) ldapUserDetailsControl
- .getMock();
-
- tested = new AcegiAuthenticationSource();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
-
- authenticationControl = null;
- authenticationMock = null;
-
- ldapUserDetailsControl = null;
- ldapUserDetailsMock = null;
-
- tested = null;
- }
-
- protected void replay() {
- authenticationControl.replay();
- ldapUserDetailsControl.replay();
- }
-
- protected void verify() {
- authenticationControl.verify();
- ldapUserDetailsControl.verify();
- }
-
- public void testGetPrincipalAndCredentials() {
- authenticationControl.expectAndReturn(
- authenticationMock.getPrincipal(), ldapUserDetailsMock);
- authenticationControl.expectAndReturn(authenticationMock
- .getCredentials(), "secret");
-
- ldapUserDetailsControl.expectAndDefaultReturn(ldapUserDetailsMock
- .getDn(), "cn=Manager");
-
- SecurityContextHolder.getContext()
- .setAuthentication(authenticationMock);
-
- replay();
-
- String principal = tested.getPrincipal();
- String credentials = tested.getCredentials();
-
- verify();
-
- assertEquals("secret", credentials);
- assertEquals("cn=Manager", principal);
- }
-
- public void testGetPrincipalAndCredentials_nullAuthentication() {
- SecurityContextHolder.getContext().setAuthentication(null);
-
- replay();
-
- assertEquals("", tested.getPrincipal());
- assertEquals("", tested.getCredentials());
- verify();
- }
-
- public void testGetPrincipal_InvalidPrincipal() {
- authenticationControl.expectAndReturn(
- authenticationMock.getPrincipal(), new User("dummy", "dummy",
- true, true, true, true, new GrantedAuthority[0]));
-
- SecurityContextHolder.getContext()
- .setAuthentication(authenticationMock);
-
- replay();
-
- try {
- tested.getPrincipal();
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException expected) {
- assertTrue(true);
- }
- verify();
- }
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/authentication/DefaultValuesAuthenticationSourceDecoratorTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/authentication/DefaultValuesAuthenticationSourceDecoratorTest.java
deleted file mode 100644
index 26bdd7a7..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/authentication/DefaultValuesAuthenticationSourceDecoratorTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.springframework.ldap.support.authentication;
-
-import org.easymock.MockControl;
-import org.springframework.ldap.core.AuthenticationSource;
-import org.springframework.ldap.support.authentication.DefaultValuesAuthenticationSourceDecorator;
-
-import junit.framework.TestCase;
-
-public class DefaultValuesAuthenticationSourceDecoratorTest extends TestCase {
-
- private static final String DEFAULT_PASSWORD = "defaultPassword";
-
- private static final String DEFAULT_USER = "cn=defaultUser";
-
- private DefaultValuesAuthenticationSourceDecorator tested;
-
- private MockControl authenticationSourceControl;
-
- private AuthenticationSource authenticationSourceMock;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- authenticationSourceControl = MockControl
- .createControl(AuthenticationSource.class);
- authenticationSourceMock = (AuthenticationSource) authenticationSourceControl
- .getMock();
- tested = new DefaultValuesAuthenticationSourceDecorator();
- tested.setDefaultUser(DEFAULT_USER);
- tested.setDefaultPassword(DEFAULT_PASSWORD);
- tested.setTarget(authenticationSourceMock);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
-
- tested = null;
- authenticationSourceControl = null;
- authenticationSourceMock = null;
- }
-
- public void testGetPrincipal_TargetHasPrincipal() {
- authenticationSourceControl.expectAndDefaultReturn(
- authenticationSourceMock.getPrincipal(), "cn=someUser");
- authenticationSourceControl.replay();
-
- String principal = tested.getPrincipal();
-
- authenticationSourceControl.verify();
- assertEquals("cn=someUser", principal);
- }
-
- public void testGetPrincipal_TargetHasNoPrincipal() {
- authenticationSourceControl.expectAndDefaultReturn(
- authenticationSourceMock.getPrincipal(), "");
- authenticationSourceControl.replay();
-
- String principal = tested.getPrincipal();
-
- authenticationSourceControl.verify();
- assertEquals(DEFAULT_USER, principal);
- }
-
- public void testGetCredentials_TargetHasPrincipal() {
- authenticationSourceControl.expectAndDefaultReturn(
- authenticationSourceMock.getPrincipal(), "cn=someUser");
- authenticationSourceControl.expectAndDefaultReturn(
- authenticationSourceMock.getCredentials(), "somepassword");
- authenticationSourceControl.replay();
-
- String credentials = tested.getCredentials();
-
- authenticationSourceControl.verify();
- assertEquals("somepassword", credentials);
- }
-
- public void testGetCredentials_TargetHasNoPrincipal() {
- authenticationSourceControl.expectAndDefaultReturn(
- authenticationSourceMock.getPrincipal(), "");
- authenticationSourceControl.expectAndDefaultReturn(
- authenticationSourceMock.getCredentials(), "somepassword");
- authenticationSourceControl.replay();
-
- String credentials = tested.getCredentials();
-
- authenticationSourceControl.verify();
- assertEquals(DEFAULT_PASSWORD, credentials);
- }
-
- public void testAfterPropertiesSet_noTarget() throws Exception {
- tested.setTarget(null);
- try {
- tested.afterPropertiesSet();
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException expected) {
- assertTrue(true);
- }
- }
-
- public void testAfterPropertiesSet_noDefaultUser() throws Exception {
- tested.setDefaultUser(null);
- try {
- tested.afterPropertiesSet();
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException expected) {
- assertTrue(true);
- }
- }
-
- public void testAfterPropertiesSet_noDefaultPassword() throws Exception {
- tested.setDefaultPassword(null);
- try {
- tested.afterPropertiesSet();
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException expected) {
- assertTrue(true);
- }
- }
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/control/AbstractRequestControlDirContextProcessorTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/control/AbstractRequestControlDirContextProcessorTest.java
deleted file mode 100644
index 07a904d5..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/control/AbstractRequestControlDirContextProcessorTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.control;
-
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.ldap.Control;
-import javax.naming.ldap.LdapContext;
-
-import junit.framework.TestCase;
-
-import org.easymock.MockControl;
-
-public class AbstractRequestControlDirContextProcessorTest extends TestCase {
-
- private AbstractRequestControlDirContextProcessor tested;
-
- private MockControl requestControlControl;
-
- private Control requestControlMock;
-
- private MockControl requestControl2Control;
-
- private Control requestControl2Mock;
-
- private MockControl ldapContextControl;
-
- private LdapContext ldapContextMock;
-
- private MockControl dirContextControl;
-
- private DirContext dirContextMock;
-
- protected void setUp() throws Exception {
- super.setUp();
- // Create requestControl mock
- requestControlControl = MockControl.createControl(Control.class);
- requestControlMock = (Control) requestControlControl.getMock();
-
- // Create requestControl2 mock
- requestControl2Control = MockControl.createControl(Control.class);
- requestControl2Mock = (Control) requestControl2Control.getMock();
-
- // Create ldapContext mock
- ldapContextControl = MockControl.createControl(LdapContext.class);
- ldapContextMock = (LdapContext) ldapContextControl.getMock();
-
- // Create dirContext mock
- dirContextControl = MockControl.createControl(DirContext.class);
- dirContextMock = (DirContext) dirContextControl.getMock();
-
- tested = new AbstractRequestControlDirContextProcessor() {
-
- public Control createRequestControl() {
- return requestControlMock;
- }
-
- public void postProcess(DirContext ctx) throws NamingException {
- }
-
- };
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
-
- requestControlControl = null;
- requestControlMock = null;
-
- requestControl2Control = null;
- requestControl2Mock = null;
-
- ldapContextControl = null;
- ldapContextMock = null;
-
- dirContextControl = null;
- dirContextMock = null;
-
- }
-
- protected void replay() {
- requestControlControl.replay();
- requestControl2Control.replay();
- ldapContextControl.replay();
- dirContextControl.replay();
- }
-
- protected void verify() {
- requestControlControl.verify();
- requestControl2Control.verify();
- ldapContextControl.verify();
- dirContextControl.verify();
- }
-
- public void testPreProcess() throws NamingException {
- ldapContextControl.setDefaultMatcher(MockControl.ARRAY_MATCHER);
- ldapContextControl.expectAndDefaultReturn(ldapContextMock
- .getRequestControls(), new Control[] { requestControl2Mock });
- ldapContextMock.setRequestControls(new Control[] { requestControl2Mock,
- requestControlMock });
-
- replay();
-
- tested.preProcess(ldapContextMock);
-
- verify();
- }
-
- public void testPreProcess_NoExistingControls() throws NamingException {
- ldapContextControl.setDefaultMatcher(MockControl.ARRAY_MATCHER);
- ldapContextControl.expectAndDefaultReturn(ldapContextMock
- .getRequestControls(), new Control[0]);
- ldapContextMock
- .setRequestControls(new Control[] { requestControlMock });
-
- replay();
-
- tested.preProcess(ldapContextMock);
-
- verify();
- }
-
- public void testPreProcess_NotLdapContext() throws Exception {
- try {
- tested.preProcess(dirContextMock);
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException expected) {
- assertTrue(true);
- }
- }
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultTest.java
deleted file mode 100644
index 1401b74c..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.control;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import com.gargoylesoftware.base.testing.EqualsTester;
-
-import junit.framework.TestCase;
-
-public class PagedResultTest extends TestCase {
- public void testEquals() throws Exception {
- List expectedList = new LinkedList();
- expectedList.add("dummy");
- List otherList = new LinkedList();
- otherList.add("different");
-
- PagedResult originalObject = new PagedResult(expectedList,
- new PagedResultsCookie(null));
- PagedResult identicalObject = new PagedResult(expectedList,
- new PagedResultsCookie(null));
- PagedResult differentObject = new PagedResult(otherList,
- new PagedResultsCookie(null));
- PagedResult subclassObject = new PagedResult(expectedList,
- new PagedResultsCookie(null)) {
-
- };
-
- new EqualsTester(originalObject, identicalObject, differentObject,
- subclassObject);
- }
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultsCookieTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultsCookieTest.java
deleted file mode 100644
index 39ea3c52..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultsCookieTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.control;
-
-import com.gargoylesoftware.base.testing.EqualsTester;
-
-import junit.framework.TestCase;
-
-public class PagedResultsCookieTest extends TestCase {
- public void testEquals() {
- byte[] expectedCookie = new byte[] { 1, 2 };
- byte[] differentCookie = new byte[] { 2, 3 };
-
- PagedResultsCookie originalObject = new PagedResultsCookie(
- expectedCookie);
- PagedResultsCookie identicalObject = new PagedResultsCookie(
- expectedCookie);
- PagedResultsCookie differentObject = new PagedResultsCookie(
- differentCookie);
- PagedResultsCookie subclassObject = new PagedResultsCookie(
- expectedCookie) {
-
- };
-
- new EqualsTester(originalObject, identicalObject, differentObject,
- subclassObject);
- }
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultsRequestControlTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultsRequestControlTest.java
deleted file mode 100644
index 2cf0e4dc..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/control/PagedResultsRequestControlTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.control;
-
-import java.io.IOException;
-
-import javax.naming.ldap.Control;
-import javax.naming.ldap.LdapContext;
-
-import junit.framework.TestCase;
-
-import org.easymock.MockControl;
-
-import com.sun.jndi.ldap.Ber;
-import com.sun.jndi.ldap.BerDecoder;
-import com.sun.jndi.ldap.BerEncoder;
-import com.sun.jndi.ldap.ctl.DirSyncResponseControl;
-import com.sun.jndi.ldap.ctl.PagedResultsControl;
-import com.sun.jndi.ldap.ctl.PagedResultsResponseControl;
-
-public class PagedResultsRequestControlTest extends TestCase {
-
- private MockControl ldapContextControl;
-
- private LdapContext ldapContextMock;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- // Create ldapContext mock
- ldapContextControl = MockControl.createControl(LdapContext.class);
- ldapContextMock = (LdapContext) ldapContextControl.getMock();
-
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
-
- ldapContextControl = null;
- ldapContextMock = null;
-
- }
-
- protected void replay() {
- ldapContextControl.replay();
- }
-
- protected void verify() {
- ldapContextControl.verify();
- }
-
- public void testCreateRequestControl() throws Exception {
- PagedResultsRequestControl tested = new PagedResultsRequestControl(20);
-
- PagedResultsControl control = (PagedResultsControl) tested
- .createRequestControl();
- assertNotNull(control);
- }
-
- public void testCreateRequestControl_CookieSet() throws Exception {
- PagedResultsCookie cookie = new PagedResultsCookie(new byte[0]);
- PagedResultsRequestControl tested = new PagedResultsRequestControl(20,
- cookie);
-
- PagedResultsControl control = (PagedResultsControl) tested
- .createRequestControl();
- assertNotNull(control);
- }
-
- public void testPostProcess() throws Exception {
- int resultSize = 50;
- byte pageSize = 8;
-
- byte[] value = new byte[1];
- value[0] = pageSize;
- byte[] cookie = encodeValue(resultSize, value);
- PagedResultsResponseControl control = new PagedResultsResponseControl(
- "dummy", true, cookie);
-
- ldapContextControl.expectAndDefaultReturn(ldapContextMock
- .getResponseControls(), new Control[] { control });
-
- PagedResultsRequestControl tested = new PagedResultsRequestControl(20);
-
- replay();
-
- tested.postProcess(ldapContextMock);
-
- verify();
-
- PagedResultsCookie returnedCookie = tested.getCookie();
- assertEquals(8, returnedCookie.getCookie()[0]);
- assertEquals(20, tested.getPageSize());
- assertEquals(50, tested.getResultSize());
- }
-
- public void testPostProcess_InvalidResponseControl() throws Exception {
- int resultSize = 50;
- byte pageSize = 8;
-
- byte[] value = new byte[1];
- value[0] = pageSize;
- byte[] cookie = encodeDirSyncValue(resultSize, value);
-
- // Using another response control to verify that it is ignored
- DirSyncResponseControl control = new DirSyncResponseControl(
- "dummy", true, cookie);
-
- ldapContextControl.expectAndDefaultReturn(ldapContextMock
- .getResponseControls(), new Control[] { control });
-
- PagedResultsRequestControl tested = new PagedResultsRequestControl(20);
-
- replay();
-
- tested.postProcess(ldapContextMock);
-
- verify();
-
- assertNull(tested.getCookie());
- assertEquals(20, tested.getPageSize());
- assertEquals(0, tested.getResultSize());
- }
-
- public void testBerDecoding() throws Exception {
- byte[] value = new byte[1];
- value[0] = 8;
- int pageSize = 20;
- byte[] cookie = encodeValue(pageSize, value);
-
- BerDecoder ber = new BerDecoder(cookie, 0, cookie.length);
-
- ber.parseSeq(null);
- int actualPageSize = ber.parseInt();
- byte[] actualValue = ber.parseOctetString(Ber.ASN_OCTET_STR, null);
-
- assertEquals("pageSize,", 20, actualPageSize);
- assertEquals("value length", value.length, actualValue.length);
- for (int i = 0; i < value.length; i++) {
- assertEquals("value (index " + i + "),", value[i], actualValue[i]);
- }
- }
-
- private byte[] encodeValue(int pageSize, byte[] cookie)
- throws IOException {
-
- // build the ASN.1 encoding
- BerEncoder ber = new BerEncoder(10 + cookie.length);
-
- ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
- ber.encodeInt(pageSize);
- ber.encodeOctetString(cookie, Ber.ASN_OCTET_STR);
- ber.endSeq();
-
- return ber.getTrimmedBuf();
- }
-
- /**
- * Encode a value suitable for the DirSyncResponseControl used in a test.
- */
- private byte[] encodeDirSyncValue(int pageSize, byte[] cookie)
- throws IOException {
-
- // build the ASN.1 encoding
- BerEncoder ber = new BerEncoder(10 + cookie.length);
-
- ber.beginSeq(Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
- ber.encodeInt(1); // flag
- ber.encodeInt(pageSize); // maxReturnLength
- ber.encodeOctetString(cookie, Ber.ASN_OCTET_STR);
- ber.endSeq();
-
- return ber.getTrimmedBuf();
- }
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/AbstractFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/AbstractFilterTest.java
deleted file mode 100644
index 7fad9e46..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/AbstractFilterTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.AbstractFilter;
-
-import junit.framework.TestCase;
-
-/**
- * @author Adam Skogman
- */
-public class AbstractFilterTest extends TestCase {
-
- /**
- * Constructor for AbstractFilterTest.
- *
- * @param name
- */
- public AbstractFilterTest(String name) {
- super(name);
- }
-
- /*
- * Test for String encode()
- */
- public void testEncode() {
-
- AbstractFilter af = new AbstractFilter() {
- public StringBuffer encode(StringBuffer buff) {
- return buff.append("foo");
- }
- };
-
- assertEquals("foo", af.encode());
-
- }
-
- /*
- * Test for toString()
- */
- public void testToString() {
-
- AbstractFilter af = new AbstractFilter() {
- public StringBuffer encode(StringBuffer buff) {
- return buff.append("foo");
- }
- };
-
- assertEquals("foo", af.toString());
-
- }
-
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/AndFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/AndFilterTest.java
deleted file mode 100644
index c1feccbc..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/AndFilterTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.AndFilter;
-import org.springframework.ldap.support.filter.EqualsFilter;
-
-import com.gargoylesoftware.base.testing.EqualsTester;
-
-import junit.framework.TestCase;
-
-/**
- * @author Adam Skogman
- */
-public class AndFilterTest extends TestCase {
-
- /**
- * Constructor for AndFilterTest.
- *
- * @param name
- */
- public AndFilterTest(String name) {
- super(name);
- }
-
- public void testZero() {
- AndFilter aq = new AndFilter();
-
- assertEquals("", aq.encode());
- }
-
- public void testOne() {
- AndFilter aq = new AndFilter().and(new EqualsFilter("a", "b"));
-
- assertEquals("(a=b)", aq.encode());
- }
-
- public void testTwo() {
- AndFilter aq = new AndFilter().and(new EqualsFilter("a", "b")).and(
- new EqualsFilter("c", "d"));
-
- assertEquals("(&(a=b)(c=d))", aq.encode());
- }
-
- public void testThree() {
- AndFilter aq = new AndFilter().and(new EqualsFilter("a", "b")).and(
- new EqualsFilter("c", "d")).and(new EqualsFilter("e", "f"));
-
- assertEquals("(&(a=b)(c=d)(e=f))", aq.encode());
- }
-
- public void testEquals() {
- AndFilter originalObject = new AndFilter().and(new EqualsFilter("a",
- "b"));
- AndFilter identicalObject = new AndFilter().and(new EqualsFilter("a",
- "b"));
- AndFilter differentObject = new AndFilter().and(new EqualsFilter("b",
- "b"));
- AndFilter subclassObject = new AndFilter() {
- }.and(new EqualsFilter("a", "b"));
-
- new EqualsTester(originalObject, identicalObject, differentObject,
- subclassObject);
- }
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/EqualsFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/EqualsFilterTest.java
deleted file mode 100644
index 58122f1e..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/EqualsFilterTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.EqualsFilter;
-
-import com.gargoylesoftware.base.testing.EqualsTester;
-
-import junit.framework.TestCase;
-
-/**
- * @author Adam Skogman
- */
-public class EqualsFilterTest extends TestCase {
-
- /**
- * Constructor for EqualsQueryTest.
- *
- * @param name
- */
- public EqualsFilterTest(String name) {
- super(name);
- }
-
- public void testEncode() {
-
- EqualsFilter eqq = new EqualsFilter("foo", "*bar(fie)");
-
- StringBuffer buff = new StringBuffer();
- eqq.encode(buff);
-
- assertEquals("(foo=\\2abar\\28fie\\29)", buff.toString());
-
- }
-
- public void testEncodeInt() {
-
- EqualsFilter eqq = new EqualsFilter("foo", 456);
-
- StringBuffer buff = new StringBuffer();
- eqq.encode(buff);
-
- assertEquals("(foo=456)", buff.toString());
-
- }
-
- public void testEquals() {
- EqualsFilter originalObject = new EqualsFilter("a", "b");
- EqualsFilter identicalObject = new EqualsFilter("a", "b");
- EqualsFilter differentObject = new EqualsFilter("b", "b");
- EqualsFilter subclassObject = new EqualsFilter("a", "b") {
- };
-
- new EqualsTester(originalObject, identicalObject, differentObject,
- subclassObject);
- }
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/GreaterThanOrEqualsFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/GreaterThanOrEqualsFilterTest.java
deleted file mode 100644
index 6a483973..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/GreaterThanOrEqualsFilterTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.GreaterThanOrEqualsFilter;
-
-import junit.framework.TestCase;
-
-/**
- * @author Mattias Arthursson
- */
-public class GreaterThanOrEqualsFilterTest extends TestCase {
-
- /**
- * Constructor for EqualsQueryTest.
- *
- * @param name
- */
- public GreaterThanOrEqualsFilterTest(String name) {
- super(name);
- }
-
- public void testEncode() {
-
- GreaterThanOrEqualsFilter eqq = new GreaterThanOrEqualsFilter("foo",
- "*bar(fie)");
-
- StringBuffer buff = new StringBuffer();
- eqq.encode(buff);
-
- assertEquals("(foo>=\\2abar\\28fie\\29)", buff.toString());
-
- }
-
- public void testEncodeInt() {
-
- GreaterThanOrEqualsFilter eqq = new GreaterThanOrEqualsFilter("foo",
- 456);
-
- StringBuffer buff = new StringBuffer();
- eqq.encode(buff);
-
- assertEquals("(foo>=456)", buff.toString());
-
- }
-
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/LessThanOrEqualsFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/LessThanOrEqualsFilterTest.java
deleted file mode 100644
index 3a152f45..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/LessThanOrEqualsFilterTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.LessThanOrEqualsFilter;
-
-import junit.framework.TestCase;
-
-/**
- * @author Mattias Arthursson
- */
-public class LessThanOrEqualsFilterTest extends TestCase {
-
- /**
- * Constructor for EqualsQueryTest.
- *
- * @param name
- */
- public LessThanOrEqualsFilterTest(String name) {
- super(name);
- }
-
- public void testEncode() {
-
- LessThanOrEqualsFilter eqq = new LessThanOrEqualsFilter("foo",
- "*bar(fie)");
-
- StringBuffer buff = new StringBuffer();
- eqq.encode(buff);
-
- assertEquals("(foo<=\\2abar\\28fie\\29)", buff.toString());
-
- }
-
- public void testEncodeInt() {
-
- LessThanOrEqualsFilter eqq = new LessThanOrEqualsFilter("foo", 456);
-
- StringBuffer buff = new StringBuffer();
- eqq.encode(buff);
-
- assertEquals("(foo<=456)", buff.toString());
-
- }
-
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/LikeFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/LikeFilterTest.java
deleted file mode 100644
index af3d9d1d..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/LikeFilterTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.LikeFilter;
-
-import junit.framework.TestCase;
-
-/**
- * @author Anders Henja
- */
-public class LikeFilterTest extends TestCase {
- /**
- * Constructor for LikeFilterTest.
- *
- * @param name
- */
- public LikeFilterTest(String name) {
- super(name);
- }
-
- final public void testEncodeValue_blank() {
- assertEquals("", new LikeFilter("", null).getEncodedValue());
- assertEquals(" ", new LikeFilter("", " ").getEncodedValue());
- }
-
- final public void testEncodeValue_normal() {
- assertEquals("foo", new LikeFilter("", "foo").getEncodedValue());
- assertEquals("foo*bar", new LikeFilter("", "foo*bar").getEncodedValue());
- assertEquals("*foo*bar*", new LikeFilter("", "*foo*bar*")
- .getEncodedValue());
- assertEquals("**foo**bar**", new LikeFilter("", "**foo**bar**")
- .getEncodedValue());
- }
-
- final public void testEncodeValue_escape() {
- assertEquals("*\\28*\\29*", new LikeFilter("", "*(*)*")
- .getEncodedValue());
- assertEquals("*\\5c2a*", new LikeFilter("", "*\\2a*").getEncodedValue());
- }
-
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/NotFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/NotFilterTest.java
deleted file mode 100644
index 58788e7c..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/NotFilterTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.EqualsFilter;
-import org.springframework.ldap.support.filter.NotFilter;
-
-import com.gargoylesoftware.base.testing.EqualsTester;
-
-import junit.framework.TestCase;
-
-/**
- * @author Mattias Arthursson
- */
-public class NotFilterTest extends TestCase {
-
- public void testConstructor() {
- EqualsFilter filter = new EqualsFilter("a", "b");
- NotFilter notFilter = new NotFilter(filter);
-
- assertEquals("(!(a=b))", notFilter.encode());
- }
-
- public void testEquals() {
- EqualsFilter filter = new EqualsFilter("a", "b");
- NotFilter originalObject = new NotFilter(filter);
- NotFilter identicalObject = new NotFilter(filter);
- NotFilter differentObject = new NotFilter(new EqualsFilter("a", "a"));
- NotFilter subclassObject = new NotFilter(filter) {
- };
-
- new EqualsTester(originalObject, identicalObject, differentObject,
- subclassObject);
- }
-
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/OrFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/OrFilterTest.java
deleted file mode 100644
index f5f5360d..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/OrFilterTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.EqualsFilter;
-import org.springframework.ldap.support.filter.OrFilter;
-
-import junit.framework.TestCase;
-
-/**
- * @author Adam Skogman
- */
-public class OrFilterTest extends TestCase {
-
- /**
- * Constructor for OrFilterTest.
- *
- * @param name
- */
- public OrFilterTest(String name) {
- super(name);
- }
-
- public void testZero() {
- OrFilter of = new OrFilter();
-
- assertEquals("", of.encode());
- }
-
- public void testOne() {
- OrFilter of = new OrFilter().or(new EqualsFilter("a", "b"));
-
- assertEquals("(a=b)", of.encode());
- }
-
- public void testTwo() {
- OrFilter of = new OrFilter().or(new EqualsFilter("a", "b")).or(
- new EqualsFilter("c", "d"));
-
- assertEquals("(|(a=b)(c=d))", of.encode());
- }
-
- public void testThree() {
- OrFilter of = new OrFilter().or(new EqualsFilter("a", "b")).or(
- new EqualsFilter("c", "d")).or(new EqualsFilter("e", "f"));
-
- assertEquals("(|(a=b)(c=d)(e=f))", of.encode());
- }
-
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/WhitespaceWildcardsFilterTest.java b/spring-ldap/src/test/java/org/springframework/ldap/support/filter/WhitespaceWildcardsFilterTest.java
deleted file mode 100644
index d781c281..00000000
--- a/spring-ldap/src/test/java/org/springframework/ldap/support/filter/WhitespaceWildcardsFilterTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2002-2005 the original author or authors.
- *
- * Licensed 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.springframework.ldap.support.filter;
-
-import org.springframework.ldap.support.filter.WhitespaceWildcardsFilter;
-
-import junit.framework.TestCase;
-
-/**
- * @author Adam Skogman
- */
-public class WhitespaceWildcardsFilterTest extends TestCase {
-
- /**
- * Constructor for WhitespaceWildcardsFilterTest.
- *
- * @param name
- */
- public WhitespaceWildcardsFilterTest(String name) {
- super(name);
- }
-
- final public void testEncodeValue_blank() {
-
- // blank
- assertEquals("*", new WhitespaceWildcardsFilter("", null)
- .getEncodedValue());
- assertEquals("*", new WhitespaceWildcardsFilter("", " ")
- .getEncodedValue());
- assertEquals("*", new WhitespaceWildcardsFilter("", " ")
- .getEncodedValue());
- assertEquals("*", new WhitespaceWildcardsFilter("", "\t")
- .getEncodedValue());
-
- }
-
- final public void testEncodeValue_normal() {
-
- assertEquals("*foo*", new WhitespaceWildcardsFilter("", "foo")
- .getEncodedValue());
- assertEquals("*foo*bar*", new WhitespaceWildcardsFilter("", "foo bar")
- .getEncodedValue());
- assertEquals("*foo*bar*",
- new WhitespaceWildcardsFilter("", " foo bar ")
- .getEncodedValue());
- assertEquals("*foo*bar*", new WhitespaceWildcardsFilter("",
- " \t foo \n bar \r ").getEncodedValue());
- }
-
- final public void testEncodeValue_escape() {
-
- assertEquals("*\\28\\2a\\29*", new WhitespaceWildcardsFilter("", "(*)")
- .getEncodedValue());
- assertEquals("*\\2a*", new WhitespaceWildcardsFilter("", "*")
- .getEncodedValue());
- assertEquals("*\\5c*", new WhitespaceWildcardsFilter("", " \\ ")
- .getEncodedValue());
-
- }
-
-}
diff --git a/spring-ldap/src/test/java/org/springframework/ldap/util/ListComparatorTest.java b/spring-ldap/src/test/java/org/springframework/ldap/util/ListComparatorTest.java
index ac456537..2b974e11 100644
--- a/spring-ldap/src/test/java/org/springframework/ldap/util/ListComparatorTest.java
+++ b/spring-ldap/src/test/java/org/springframework/ldap/util/ListComparatorTest.java
@@ -18,7 +18,7 @@ package org.springframework.ldap.util;
import java.util.Arrays;
import java.util.List;
-import org.springframework.ldap.util.ListComparator;
+import org.springframework.ldap.support.ListComparator;
import junit.framework.TestCase;