I am writing a unit test for my code and for testing purpose I am using unboundsId's IN memory LDAP server. I created and conntected to inmemory server and after That i want to perform a sync request but server is saying "InMemory LDAP server do not support contentSyncRequestControl". I looked in to server API docs there are number of controlls. I tried to print OIDs of controls which are supported and The OID for contentSyncRequestControl is not present. so My Question is how to enable or add controlls to inMemory LDAP Server?? Look the following code for ref.
public class InMemoryLDAPServer {
private Logger logger = LoggerFactory.getLogger(InMemoryLDAPServer.class);
private InMemoryDirectoryServer mServer;
final String DEFAULT_INMEMORY_HOST = "localhost";
final int DEFAULT_INMEMORY_PORT = 5389;
final String LDAP_LISTENER_NAME = "LDAP_TEST_SERVER";
final String INMEMORY_BASE = "dc=Contoso,dc=net";
final String INMEMORY_DOMAIN = "Contoso.net";
final String INMEMORY_USER = "uid=TestAdmin";
final String INMEMORY_PASS = "password";
public void start(int port) {
try {
InMemoryDirectoryServerConfig config =
new InMemoryDirectoryServerConfig(INMEMORY_BASE);
config.setGenerateOperationalAttributes(true);
config.addAdditionalBindCredentials(INMEMORY_USER, INMEMORY_PASS);
config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig(LDAP_LISTENER_NAME, port));
mServer = new InMemoryDirectoryServer(config);
URI ldifFixture= InMemoryLDAPServer.class.getResource("/Contoso_rootdse_open.ldif").toURI();
mServer.importFromLDIF(true, new LDIFReader(new File(ldifFixture)));
mServer.startListening(LDAP_LISTENER_NAME);
// I tried here to check which controlls are supported
//The OID (1.3.6.1.4.1.4203.1.9.1.1) for the sync request control.
LDAPConnection con = mServer.getConnection();
RootDSE rootDSE = con.getRootDSE();
String[] oids = rootDSE.getSupportedControlOIDs();
for(int i=0; i<oids.length; i++){
System.out.println(oids[i]);
}
con.close();
} catch(Exception exception) {
logger.error("Failed to start in memory ldap server", exception);
}
}
public void start() {
start(DEFAULT_INMEMORY_PORT);
}
public void stop() {
try {
mServer.shutDown(LDAP_LISTENER_NAME, true);
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
result
here are the supported OIDs by default.
1.2.840.113556.1.4.1413
1.2.840.113556.1.4.319
1.2.840.113556.1.4.473
1.2.840.113556.1.4.805
1.3.6.1.1.12
1.3.6.1.1.13.1
1.3.6.1.1.13.2
1.3.6.1.1.21.2
1.3.6.1.1.22
1.3.6.1.4.1.7628.5.101.1
2.16.840.1.113730.3.4.12
2.16.840.1.113730.3.4.16
2.16.840.1.113730.3.4.18
2.16.840.1.113730.3.4.2
2.16.840.1.113730.3.4.9
Ref to API doc: http://ift.tt/16chUqt
Kindly Help me to proper configuration please.
Aucun commentaire:
Enregistrer un commentaire