From 7a0569d8a0d4b4996ead363a19b1c7c20f15ccfe Mon Sep 17 00:00:00 2001 From: Mattias Arthursson Date: Fri, 7 Sep 2007 13:13:25 +0000 Subject: [PATCH] Now using AbstractContextMapper in itests. --- .../ldap/PersonContextMapper.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/spring-ldap/src/itest/java/org/springframework/ldap/PersonContextMapper.java b/spring-ldap/src/itest/java/org/springframework/ldap/PersonContextMapper.java index dd0a0b56..1539979d 100644 --- a/spring-ldap/src/itest/java/org/springframework/ldap/PersonContextMapper.java +++ b/spring-ldap/src/itest/java/org/springframework/ldap/PersonContextMapper.java @@ -16,8 +16,8 @@ package org.springframework.ldap; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; +import org.springframework.ldap.core.DirContextOperations; +import org.springframework.ldap.core.support.AbstractContextMapper; /** * Dummy implemention of ContextMapper for use in the integration tests and for @@ -25,18 +25,15 @@ import org.springframework.ldap.core.DirContextAdapter; * * @author Mattias Arthursson */ -public class PersonContextMapper implements ContextMapper { +public class PersonContextMapper extends AbstractContextMapper { - /* (non-Javadoc) - * @see org.springframework.ldap.core.ContextMapper#mapFromContext(java.lang.Object) - */ - public Object mapFromContext(Object ctx) { - DirContextAdapter adapter = (DirContextAdapter) ctx; + protected Object doMapFromContext(DirContextOperations operations) { Person person = new Person(); - person.setFullname(adapter.getStringAttribute("cn")); - person.setLastname(adapter.getStringAttribute("sn")); - person.setPhone(adapter.getStringAttribute("telephoneNumber")); - person.setDescription(adapter.getStringAttribute("description")); + person.setFullname(operations.getStringAttribute("cn")); + person.setLastname(operations.getStringAttribute("sn")); + person.setPhone(operations.getStringAttribute("telephoneNumber")); + person.setDescription(operations.getStringAttribute("description")); + return person; } }