use of org.apache.directory.api.dsmlv2.response.ErrorResponse in project directory-ldap-api by apache.
the class ErrorResponseTest method testResponseWithTypeNotAttempted.
/**
* Test parsing of a response with type == notAttempted
*/
@Test
public void testResponseWithTypeNotAttempted() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(ErrorResponseTest.class.getResource("response_with_type_notAttempted.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
ErrorResponse errorResponse = (ErrorResponse) parser.getBatchResponse().getCurrentResponse();
assertEquals(ErrorResponseType.NOT_ATTEMPTED, errorResponse.getErrorType());
}
use of org.apache.directory.api.dsmlv2.response.ErrorResponse in project directory-ldap-api by apache.
the class ErrorResponseTest method testResponseWithMessage.
/**
* Test parsing of a response with Message
*/
@Test
public void testResponseWithMessage() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(ErrorResponseTest.class.getResource("response_with_message.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
ErrorResponse errorResponse = (ErrorResponse) parser.getBatchResponse().getCurrentResponse();
assertEquals("Connection refused", errorResponse.getMessage());
}
use of org.apache.directory.api.dsmlv2.response.ErrorResponse in project directory-ldap-api by apache.
the class ErrorResponseTest method testResponseWithTypeAuthenticationFailed.
/**
* Test parsing of a response with type == authenticationFailed
*/
@Test
public void testResponseWithTypeAuthenticationFailed() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(ErrorResponseTest.class.getResource("response_with_type_authenticationFailed.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
ErrorResponse errorResponse = (ErrorResponse) parser.getBatchResponse().getCurrentResponse();
assertEquals(ErrorResponseType.AUTHENTICATION_FAILED, errorResponse.getErrorType());
}
use of org.apache.directory.api.dsmlv2.response.ErrorResponse in project directory-ldap-api by apache.
the class ErrorResponseTest method testResponseWithTypeConnectionClosed.
/**
* Test parsing of a response with type == connectionClosed
*/
@Test
public void testResponseWithTypeConnectionClosed() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(ErrorResponseTest.class.getResource("response_with_type_connectionClosed.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
ErrorResponse errorResponse = (ErrorResponse) parser.getBatchResponse().getCurrentResponse();
assertEquals(ErrorResponseType.CONNECTION_CLOSED, errorResponse.getErrorType());
}
Aggregations