use of org.apache.directory.api.dsmlv2.response.SearchResponse in project directory-ldap-api by apache.
the class SearchResponseTest method testResponseWith2SRE2SRR1SRD.
/**
* Test parsing of a Response with 2 Search Result Entry, 2 Search Result Reference and a Search Result Done
*/
@Test
public void testResponseWith2SRE2SRR1SRD() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(SearchResponseTest.class.getResource("response_with_2_SRE_2_SRR_1_SRD.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
SearchResponse searchResponse = (SearchResponse) parser.getBatchResponse().getCurrentResponse().getDecorated();
assertEquals(2, searchResponse.getSearchResultEntryList().size());
assertEquals(2, searchResponse.getSearchResultReferenceList().size());
assertNotNull(searchResponse.getSearchResultDone());
}
use of org.apache.directory.api.dsmlv2.response.SearchResponse in project directory-ldap-api by apache.
the class SearchResponseTest method testResponseWith1SRR1SRD.
/**
* Test parsing of a Response with 1 Search Result Reference and a Search Result Done
*/
@Test
public void testResponseWith1SRR1SRD() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(SearchResponseTest.class.getResource("response_with_1_SRR_1_SRD.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
SearchResponse searchResponse = (SearchResponse) parser.getBatchResponse().getCurrentResponse().getDecorated();
assertEquals(1, searchResponse.getSearchResultReferenceList().size());
assertNotNull(searchResponse.getSearchResultDone());
}
use of org.apache.directory.api.dsmlv2.response.SearchResponse in project directory-ldap-api by apache.
the class SearchResponseTest method testResponseWith2SRR1SRD.
/**
* Test parsing of a Response with 2 Search Result Reference and a Search Result Done
*/
@Test
public void testResponseWith2SRR1SRD() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(SearchResponseTest.class.getResource("response_with_2_SRR_1_SRD.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
SearchResponse searchResponse = (SearchResponse) parser.getBatchResponse().getCurrentResponse().getDecorated();
assertEquals(2, searchResponse.getSearchResultReferenceList().size());
assertNotNull(searchResponse.getSearchResultDone());
}
use of org.apache.directory.api.dsmlv2.response.SearchResponse in project directory-ldap-api by apache.
the class SearchResponseTest method testResponseWith2SRE1SRD.
/**
* Test parsing of a Response with 2 Search Result Entry and a Search Result Done
*/
@Test
public void testResponseWith2SRE1SRD() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(SearchResponseTest.class.getResource("response_with_2_SRE_1_SRD.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
SearchResponse searchResponse = (SearchResponse) parser.getBatchResponse().getCurrentResponse().getDecorated();
assertEquals(2, searchResponse.getSearchResultEntryList().size());
assertNotNull(searchResponse.getSearchResultDone());
}
use of org.apache.directory.api.dsmlv2.response.SearchResponse in project directory-ldap-api by apache.
the class SearchResultDoneTest method testResponseWithMatchedDNAttribute.
/**
* Test parsing of a response with MatchedDN attribute
*/
@Test
public void testResponseWithMatchedDNAttribute() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(SearchResultDoneTest.class.getResource("response_with_matchedDN_attribute.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
SearchResultDone searchResultDone = ((SearchResponse) parser.getBatchResponse().getCurrentResponse().getDecorated()).getSearchResultDone();
LdapResult ldapResult = searchResultDone.getLdapResult();
assertTrue(ldapResult.getMatchedDn().equals("cn=Bob Rush,ou=Dev,dc=Example,dc=COM"));
}
Aggregations