use of org.apache.directory.api.ldap.model.message.BindRequestImpl in project directory-ldap-api by apache.
the class BindRequestPerfTest method testEncodeBindRequestPerf.
/**
* Test the decoding of a BindRequest with Simple authentication and no
* controls
*/
@Test
@Ignore
public void testEncodeBindRequestPerf() throws Exception {
Dn dn = new Dn("uid=akarasulu,dc=example,dc=com");
int nbLoops = 1000000;
long t0 = System.currentTimeMillis();
for (int i = 0; i < nbLoops; i++) {
// Check the decoded BindRequest
BindRequest bindRequest = new BindRequestImpl();
bindRequest.setMessageId(1);
bindRequest.setSimple(true);
bindRequest.setDn(dn);
bindRequest.setCredentials(Strings.getBytesUtf8("password"));
Control control = new OpaqueControl("2.16.840.1.113730.3.4.2");
bindRequest.addControl(control);
// Check the encoding
try {
encoder.encodeMessage(bindRequest);
} catch (EncoderException ee) {
ee.printStackTrace();
fail(ee.getMessage());
}
}
long t1 = System.currentTimeMillis();
System.out.println("BindRequest testEncodeBindRequestPerf, " + nbLoops + " loops, Delta = " + (t1 - t0));
}
Aggregations