use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class BindResponseImplTest method testHashCodeSameObj.
/**
* Tests to make sure the same object has the same hashCode.
*/
@Test
public void testHashCodeSameObj() {
BindResponseImpl resp = new BindResponseImpl(1);
assertTrue(resp.hashCode() == resp.hashCode());
}
use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class BindResponseImplTest method testEqualsWithTheWorks.
/**
* Tests for equality of two fully loaded identical BindResponse PDUs.
*/
@Test
public void testEqualsWithTheWorks() throws LdapException {
LdapResultImpl r0 = new LdapResultImpl();
LdapResultImpl r1 = new LdapResultImpl();
r0.setDiagnosticMessage("blah blah blah");
r1.setDiagnosticMessage("blah blah blah");
r0.setMatchedDn(new Dn("dc=example,dc=com"));
r1.setMatchedDn(new Dn("dc=example,dc=com"));
r0.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
r1.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
Referral refs0 = new ReferralImpl();
refs0.addLdapUrl("ldap://someserver.com");
refs0.addLdapUrl("ldap://anotherserver.org");
Referral refs1 = new ReferralImpl();
refs1.addLdapUrl("ldap://someserver.com");
refs1.addLdapUrl("ldap://anotherserver.org");
BindResponseImpl resp0 = new BindResponseImpl(1);
BindResponseImpl resp1 = new BindResponseImpl(1);
resp0.setServerSaslCreds(PASSWORD);
resp1.setServerSaslCreds(PASSWORD);
assertTrue("loaded carbon copies should be equal", resp0.equals(resp1));
assertTrue("loaded carbon copies should be equal", resp1.equals(resp0));
}
use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class BindResponseImplTest method testEqualsNewWithSameId.
/**
* Tests to make sure newly created objects with same id are equal.
*/
@Test
public void testEqualsNewWithSameId() {
BindResponseImpl resp0 = new BindResponseImpl(1);
BindResponseImpl resp1 = new BindResponseImpl(1);
assertTrue("default copy with same id should be equal", resp0.equals(resp1));
assertTrue("default copy with same id should be equal", resp1.equals(resp0));
}
use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class InitBindResponse method action.
/**
* {@inheritDoc}
*/
public void action(LdapMessageContainer<BindResponseDecorator> container) {
// Now, we can allocate the BindResponse Object
BindResponseDecorator bindResponse = new BindResponseDecorator(container.getLdapCodecService(), new BindResponseImpl(container.getMessageId()));
container.setMessage(bindResponse);
}
use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class InitSaslBind method action.
/**
* {@inheritDoc}
*/
public void action(LdapMessageContainer<BindRequestDecorator> container) throws DecoderException {
BindRequest bindRequestMessage = container.getMessage();
TLV tlv = container.getCurrentTLV();
// We will check that the sasl is not null
if (tlv.getLength() == 0) {
String msg = I18n.err(I18n.ERR_04079);
LOG.error(msg);
BindResponseImpl response = new BindResponseImpl(bindRequestMessage.getMessageId());
throw new ResponseCarryingException(msg, response, ResultCodeEnum.INVALID_CREDENTIALS, bindRequestMessage.getDn(), null);
}
bindRequestMessage.setSimple(false);
if (IS_DEBUG) {
LOG.debug("The SaslCredential has been created");
}
}
Aggregations