use of com.unboundid.ldap.sdk.examples.LDAPSearch in project ldapsdk by pingidentity.
the class LDAPCommandLineToolTestCase method testSASLInvalidMechanism.
/**
* Provides a test with an invalid SASL mechanism.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testSASLInvalidMechanism() throws Exception {
LDAPSearch ldapSearch = new LDAPSearch(null, null);
ResultCode rc = ldapSearch.runTool("-h", getTestHost(), "-p", String.valueOf(getTestPort()), "-o", "mech=UNSUPPORTED", "-w", getTestBindPassword(), "-b", "", "-s", "base", "(objectClass=*)");
assertFalse(rc == ResultCode.SUCCESS);
}
use of com.unboundid.ldap.sdk.examples.LDAPSearch in project ldapsdk by pingidentity.
the class LDAPCommandLineToolTestCase method testGeneratePropertiesFileWithoutArguments.
/**
* Tests the behavior when trying to generate a properties file when no other
* arguments are provided.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testGeneratePropertiesFileWithoutArguments() throws Exception {
final LDAPSearch ldapSearch = new LDAPSearch(null, null);
final File propertiesFile = createTempFile();
assertTrue(propertiesFile.exists());
assertTrue(propertiesFile.delete());
assertFalse(propertiesFile.exists());
final ResultCode rc = ldapSearch.runTool("--generatePropertiesFile", propertiesFile.getAbsolutePath());
assertEquals(rc, ResultCode.SUCCESS);
assertTrue(propertiesFile.exists());
assertTrue(propertiesFile.length() > 0);
assertFileHasLine(propertiesFile, "# ldapsearch.hostname={host}");
assertFileHasLine(propertiesFile, "# ldapsearch.port={port}");
assertFileHasLine(propertiesFile, "# ldapsearch.bindDN={dn}");
assertFileHasLine(propertiesFile, "# ldapsearch.bindPassword={password}");
assertFalse(ldapSearch.anyLDAPArgumentsProvided());
}
use of com.unboundid.ldap.sdk.examples.LDAPSearch in project ldapsdk by pingidentity.
the class LDAPCommandLineToolTestCase method testSASLInvalidOption.
/**
* Provides a test with an invalid SASL option.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testSASLInvalidOption() throws Exception {
LDAPSearch ldapSearch = new LDAPSearch(null, null);
ResultCode rc = ldapSearch.runTool("-h", getTestHost(), "-p", String.valueOf(getTestPort()), "-o", "mech=PLAIN", "-o", "invalid=foo", "-o", "authID=dn:" + getTestBindDN(), "-w", getTestBindPassword(), "-b", "", "-s", "base", "(objectClass=*)");
assertFalse(rc == ResultCode.SUCCESS);
}
use of com.unboundid.ldap.sdk.examples.LDAPSearch in project ldapsdk by pingidentity.
the class LDAPCommandLineToolTestCase method testSASLNoMechanism.
/**
* Provides a test with SASL option but no mechanism.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testSASLNoMechanism() throws Exception {
LDAPSearch ldapSearch = new LDAPSearch(null, null);
ResultCode rc = ldapSearch.runTool("-h", getTestHost(), "-p", String.valueOf(getTestPort()), "-o", "authID=dn:" + getTestBindDN(), "-w", getTestBindPassword(), "-b", "", "-s", "base", "(objectClass=*)");
assertFalse(rc == ResultCode.SUCCESS);
}
use of com.unboundid.ldap.sdk.examples.LDAPSearch in project ldapsdk by pingidentity.
the class LDAPCommandLineToolTestCase method testPropertiesFileMissing.
/**
* Tests the behavior with a properties file that is missing.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testPropertiesFileMissing() throws Exception {
final File propertiesFile = createTempFile();
assertTrue(propertiesFile.delete());
final LDAPSearch ldapSearch = new LDAPSearch(null, null);
final ResultCode rc = ldapSearch.runTool("--propertiesFilePath", propertiesFile.getAbsolutePath(), "--baseDN", "", "(objectClass=*)");
assertFalse(rc == ResultCode.SUCCESS);
}
Aggregations