LDAP-142: Added a couple utility methods for working with SingleContextSource. Also cleaned up OpenLdap integration tests.

This commit is contained in:
Mattias Hellborg Arthursson
2013-09-10 11:40:53 +02:00
parent 14bf8b48a2
commit 8b6f586fd5
19 changed files with 661 additions and 324 deletions

View File

@@ -29,7 +29,7 @@ import java.util.Arrays;
*
* @author Mattias Hellborg Arthursson
*/
public class AttributeCheckAttributesMapper implements AttributesMapper {
public class AttributeCheckAttributesMapper implements AttributesMapper<Object> {
private String[] expectedAttributes = new String[0];
private String[] expectedValues = new String[0];;
@@ -47,8 +47,8 @@ public class AttributeCheckAttributesMapper implements AttributesMapper {
Assert.assertEquals(expectedValues[i], attribute.get());
}
for (int i = 0; i < absentAttributes.length; i++) {
Assert.assertNull(attributes.get(absentAttributes[i]));
for (String absentAttribute : absentAttributes) {
Assert.assertNull(attributes.get(absentAttribute));
}
return null;

View File

@@ -28,14 +28,14 @@ import java.util.Arrays;
*
* @author Mattias Hellborg Arthursson
*/
public class AttributeCheckContextMapper implements ContextMapper {
public class AttributeCheckContextMapper implements ContextMapper<DirContextAdapter> {
private String[] expectedAttributes = new String[0];
private String[] expectedValues = new String[0];
private String[] absentAttributes = new String[0];
public Object mapFromContext(Object ctx) {
public DirContextAdapter mapFromContext(Object ctx) {
DirContextAdapter adapter = (DirContextAdapter) ctx;
Assert.assertEquals("Values and attributes need to have the same length ",
expectedAttributes.length, expectedValues.length);