use of org.apache.directory.api.ldap.model.message.LdapResult in project directory-ldap-api by apache.
the class AddResponseTest method testResponseWith2Referrals.
/**
* Test parsing of a response with 2 Referral elements
*/
@Test
public void testResponseWith2Referrals() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(AddResponseTest.class.getResource("response_with_2_referrals.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
AddResponse addResponse = (AddResponse) parser.getBatchResponse().getCurrentResponse();
LdapResult ldapResult = addResponse.getLdapResult();
Collection<String> referrals = ldapResult.getReferral().getLdapUrls();
assertEquals(2, referrals.size());
assertTrue(referrals.contains("ldap://www.apache.org/"));
assertTrue(referrals.contains("ldap://www.apple.com/"));
}
Aggregations