LDAP-142: Added a couple utility methods for working with SingleContextSource. Also cleaned up OpenLdap integration tests.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user