use of org.apache.directory.api.ldap.model.message.AbandonRequest in project directory-ldap-api by apache.
the class AbandonRequestTest method testRequestWithRequestId.
/**
* Test parsing of a request with the (optional) requestID attribute
*/
@Test
public void testRequestWithRequestId() {
Dsmlv2Parser parser = null;
try {
parser = newParser();
parser.setInput(AbandonRequestTest.class.getResource("request_with_requestID_attribute.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
AbandonRequest abandonRequest = (AbandonRequest) parser.getBatchRequest().getCurrentRequest();
assertEquals(456, abandonRequest.getMessageId());
}
use of org.apache.directory.api.ldap.model.message.AbandonRequest in project directory-ldap-api by apache.
the class AbandonRequestTest method testRequestWith2Controls.
/**
* Test parsing of a request with 2 (optional) Control elements
*/
@Test
public void testRequestWith2Controls() {
Dsmlv2Parser parser = null;
try {
parser = newParser();
parser.setInput(AbandonRequestTest.class.getResource("request_with_2_controls.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
AbandonRequest abandonRequest = (AbandonRequest) parser.getBatchRequest().getCurrentRequest();
Map<String, Control> controls = abandonRequest.getControls();
assertEquals(2, abandonRequest.getControls().size());
Control control = controls.get("1.2.840.113556.1.4.789");
assertNotNull(control);
assertFalse(control.isCritical());
assertEquals("1.2.840.113556.1.4.789", control.getOid());
assertEquals("Some other text", Strings.utf8ToString(((DsmlControl<?>) control).getValue()));
}
Aggregations