Code cleanup
TestCaseUtils.java:
Split clearJEBackend(boolean, String backendID, String dn) in two:
- clearJEBackend(String backendID, String dn) to clear the backend and recreate the base entry
- clearJEBackend(String backendID) to clear the backend without recreating the base entry
| | |
| | | |
| | | import com.forgerock.opendj.util.OperatingSystem; |
| | | |
| | | import static org.opends.server.loggers.TextAccessLogPublisher.*; |
| | | import static org.opends.server.loggers.TextErrorLogPublisher.*; |
| | | import static org.opends.server.loggers.TextHTTPAccessLogPublisher.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | */ |
| | | public static final String TEST_ROOT_DN_STRING = "o=test"; |
| | | |
| | | /** |
| | | * The backend if for the test backend |
| | | */ |
| | | /** The backend if for the test backend. */ |
| | | public static final String TEST_BACKEND_ID = "test"; |
| | | |
| | | /** |
| | | * The string representation of the OpenDMK jar file location |
| | | * that will be used as base to determine if snmp is included or not |
| | | * that will be used as base to determine if snmp is included or not. |
| | | */ |
| | | public static final String PROPERTY_OPENDMK_LOCATION = |
| | | "org.opends.server.snmp.opendmk"; |
| | | |
| | | /** The test text writer for the Debug Logger */ |
| | | /** The test text writer for the Debug Logger. */ |
| | | public static TestTextWriter DEBUG_TEXT_WRITER = new TestTextWriter(); |
| | | |
| | | /** The test text writer for the Error Logger */ |
| | | /** The test text writer for the Error Logger. */ |
| | | public static TestTextWriter ERROR_TEXT_WRITER = new TestTextWriter(); |
| | | |
| | | /** The test text writer for the Access Logger */ |
| | | /** The test text writer for the Access Logger. */ |
| | | public static TestTextWriter ACCESS_TEXT_WRITER = new TestTextWriter(); |
| | | |
| | | /** The test text writer for the HTTP Access Logger */ |
| | | /** The test text writer for the HTTP Access Logger. */ |
| | | public static TestTextWriter HTTP_ACCESS_TEXT_WRITER = new TestTextWriter(); |
| | | |
| | | /** |
| | |
| | | * constant must not be altered by anything outside the |
| | | * <CODE>startServer</CODE> method. |
| | | */ |
| | | public static boolean SERVER_STARTED = false; |
| | | public static boolean SERVER_STARTED; |
| | | |
| | | /** |
| | | * This is used to store the schema as it was before starting the fake server |
| | |
| | | /** |
| | | * Incremented by one each time the server has restarted. |
| | | */ |
| | | private static int serverRestarts = 0; |
| | | private static int serverRestarts; |
| | | |
| | | /** |
| | | * The config directory in the test environment. |
| | |
| | | File testSrcRoot = new File(buildRoot + File.separator + "tests" + |
| | | File.separator + "unit-tests-testng"); |
| | | |
| | | String cleanupRequiredString = |
| | | System.getProperty(PROPERTY_CLEANUP_REQUIRED, "true"); |
| | | boolean cleanupRequired = |
| | | !cleanupRequiredString.equalsIgnoreCase("false"); |
| | | String cleanupRequiredString = System.getProperty(PROPERTY_CLEANUP_REQUIRED, "true"); |
| | | boolean cleanupRequired = !"false".equalsIgnoreCase(cleanupRequiredString); |
| | | |
| | | if (cleanupRequired) { |
| | | deleteDirectory(testInstallRoot); |
| | |
| | | testInstanceRoot.getAbsolutePath()); |
| | | |
| | | AccessLogger.getInstance().addLogPublisher( |
| | | (AccessLogPublisher) TextAccessLogPublisher |
| | | .getStartupTextAccessPublisher(ACCESS_TEXT_WRITER, false)); |
| | | (AccessLogPublisher) getStartupTextAccessPublisher(ACCESS_TEXT_WRITER, false)); |
| | | |
| | | HTTPAccessLogger.getInstance().addLogPublisher( |
| | | (HTTPAccessLogPublisher) TextHTTPAccessLogPublisher |
| | | .getStartupTextHTTPAccessPublisher(HTTP_ACCESS_TEXT_WRITER)); |
| | | (HTTPAccessLogPublisher) getStartupTextHTTPAccessPublisher(HTTP_ACCESS_TEXT_WRITER)); |
| | | |
| | | // Enable more verbose error logger. |
| | | ErrorLogger.getInstance().addLogPublisher( |
| | | (ErrorLogPublisher) TextErrorLogPublisher.getToolStartupTextErrorPublisher(ERROR_TEXT_WRITER)); |
| | | (ErrorLogPublisher) getToolStartupTextErrorPublisher(ERROR_TEXT_WRITER)); |
| | | |
| | | DebugLogger.getInstance().addPublisherIfRequired(DEBUG_TEXT_WRITER); |
| | | |
| | |
| | | |
| | | private static void clearJEBackends() throws Exception |
| | | { |
| | | for (Backend backend: DirectoryServer.getBackends().values()) { |
| | | for (Backend<?> backend : DirectoryServer.getBackends().values()) { |
| | | if (backend instanceof BackendImpl) { |
| | | TestCaseUtils.clearJEBackend(false, backend.getBackendID(), null); |
| | | clearJEBackend(backend.getBackendID()); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (testConfigDir == null) { |
| | | throw new RuntimeException("The testConfigDir variable is not set yet!"); |
| | | } |
| | | |
| | | return (testConfigDir); |
| | | return testConfigDir; |
| | | } |
| | | |
| | | public static File getBuildRoot() |
| | |
| | | */ |
| | | public static void clearMemoryBackend(String backendID) throws Exception |
| | | { |
| | | MemoryBackend memoryBackend = |
| | | (MemoryBackend) DirectoryServer.getBackend(backendID); |
| | | MemoryBackend memoryBackend = (MemoryBackend) DirectoryServer.getBackend(backendID); |
| | | // FIXME JNR I suspect we could call finalizeBackend() here (but also in other |
| | | // places in this class), because finalizeBackend() calls clearMemoryBackend(). |
| | | if (memoryBackend != null) |
| | | { |
| | | memoryBackend.clearMemoryBackend(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Clears all the entries from the JE backend determined by the |
| | | * be id passed into the method. |
| | | * Clears all the entries from the JE backend determined by the backend id passed into the method. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | public static void clearJEBackend(String backendId) throws Exception |
| | | { |
| | | clearJEBackend(backendId, null); |
| | | } |
| | | |
| | | * @param createBaseEntry Indicate whether to automatically create the base |
| | | * entry and add it to the backend. |
| | | /** |
| | | * Clears all the entries from the JE backend determined by the backend id passed into the method. |
| | | * |
| | | * @param beID The be id to clear. |
| | | * |
| | | * @param dn The suffix of the backend to create if the the createBaseEntry |
| | | * boolean is true. |
| | | * |
| | | * @param backendId The backend id to clear |
| | | * @param baseDN If not null, the suffix of the backend to create |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | public static void clearJEBackend(boolean createBaseEntry, String beID, String dn) |
| | | throws Exception |
| | | public static void clearJEBackend(String backendId, String baseDN) throws Exception |
| | | { |
| | | BackendImpl backend = (BackendImpl)DirectoryServer.getBackend(beID); |
| | | RootContainer rootContainer = backend.getRootContainer(); |
| | | if (rootContainer != null) { |
| | | final BackendImpl backend = (BackendImpl)DirectoryServer.getBackend(backendId); |
| | | final RootContainer rootContainer = backend.getRootContainer(); |
| | | if (rootContainer != null) |
| | | { |
| | | for (EntryContainer ec : rootContainer.getEntryContainers()) |
| | | { |
| | | ec.clear(); |
| | |
| | | } |
| | | rootContainer.resetNextEntryID(); |
| | | |
| | | if (createBaseEntry) |
| | | if (baseDN != null) |
| | | { |
| | | DN baseDN = DN.valueOf(dn); |
| | | Entry e = createEntry(baseDN); |
| | | backend = (BackendImpl)DirectoryServer.getBackend(beID); |
| | | backend.addEntry(e, null); |
| | | Entry e = createEntry(DN.valueOf(baseDN)); |
| | | DirectoryServer.getBackend(backendId).addEntry(e, null); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (dbContainer instanceof Index) { |
| | | Index index = (Index)dbContainer; |
| | | if (!index.isTrusted()) { |
| | | originalSystemErr.println("ERROR: The index " + index.toString() + " is no longer trusted."); |
| | | originalSystemErr.println("ERROR: The index " + index + " is no longer trusted."); |
| | | } |
| | | } |
| | | } |
| | |
| | | // --------------------------------------------------------------------------- |
| | | |
| | | /** The set of loggers for which the console logger has been disabled. */ |
| | | private final static Map<Logger, Handler> disabledLogHandlers = new HashMap<Logger,Handler>(); |
| | | private static final Map<Logger, Handler> disabledLogHandlers = new HashMap<Logger,Handler>(); |
| | | |
| | | /** The original System.err print stream. Use this if you absolutely |
| | | * must write something to System.err. */ |
| | | public final static PrintStream originalSystemErr = System.err; |
| | | public static final PrintStream originalSystemErr = System.err; |
| | | |
| | | /** The original System.out print stream. Use this if you absolutely |
| | | * must write something to System.out. */ |
| | | public final static PrintStream originalSystemOut = System.out; |
| | | public static final PrintStream originalSystemOut = System.out; |
| | | |
| | | /** System.err is redirected to here so that we can only print it out |
| | | * if a test fails. */ |
| | | private final static ByteArrayOutputStream redirectedSystemErr = new ByteArrayOutputStream(); |
| | | private static final ByteArrayOutputStream redirectedSystemErr = new ByteArrayOutputStream(); |
| | | |
| | | /** System.out is redirected to here so that we can only print it out |
| | | * if a test fails. */ |
| | | private final static ByteArrayOutputStream redirectedSystemOut = new ByteArrayOutputStream(); |
| | | private static final ByteArrayOutputStream redirectedSystemOut = new ByteArrayOutputStream(); |
| | | |
| | | public synchronized static void suppressOutput() { |
| | | public static synchronized void suppressOutput() { |
| | | String suppressStr = System.getProperty("org.opends.test.suppressOutput"); |
| | | if ((suppressStr != null) && suppressStr.equalsIgnoreCase("true")) |
| | | if ("true".equalsIgnoreCase(suppressStr)) |
| | | { |
| | | System.setOut(new PrintStream(redirectedSystemOut)); |
| | | System.setErr(new PrintStream(redirectedSystemErr)); |
| | |
| | | * @return everything written to System.out since the last time |
| | | * clearSystemOutContents was called. |
| | | */ |
| | | public synchronized static String getSystemOutContents() { |
| | | public static synchronized String getSystemOutContents() { |
| | | return redirectedSystemOut.toString(); |
| | | } |
| | | |
| | |
| | | * @return everything written to System.err since the last time |
| | | * clearSystemErrContents was called. |
| | | */ |
| | | public synchronized static String getSystemErrContents() { |
| | | public static synchronized String getSystemErrContents() { |
| | | return redirectedSystemErr.toString(); |
| | | } |
| | | |
| | | /** |
| | | * clear everything written to System.out since the last time |
| | | * Clear everything written to System.out since the last time |
| | | * clearSystemOutContents was called. |
| | | */ |
| | | public synchronized static void clearSystemOutContents() { |
| | | public static synchronized void clearSystemOutContents() { |
| | | redirectedSystemOut.reset(); |
| | | } |
| | | |
| | | /** |
| | | * clear everything written to System.err since the last time |
| | | * Clear everything written to System.err since the last time |
| | | * clearSystemErrContents was called. |
| | | */ |
| | | public synchronized static void clearSystemErrContents() { |
| | | public static synchronized void clearSystemErrContents() { |
| | | redirectedSystemErr.reset(); |
| | | } |
| | | |
| | | /** |
| | | * clear everything written to the Access, Error, or Debug loggers |
| | | * Clear everything written to the Access, Error, or Debug loggers. |
| | | */ |
| | | public synchronized static void clearLoggersContents() { |
| | | public static synchronized void clearLoggersContents() { |
| | | ACCESS_TEXT_WRITER.clear(); |
| | | ERROR_TEXT_WRITER.clear(); |
| | | DEBUG_TEXT_WRITER.clear(); |
| | |
| | | } |
| | | } |
| | | |
| | | public synchronized static void unsupressOutput() { |
| | | public static synchronized void unsupressOutput() { |
| | | System.setOut(originalSystemOut); |
| | | System.setErr(originalSystemErr); |
| | | |
| | |
| | | /** |
| | | * Read the contents of a file and return it as a String. |
| | | */ |
| | | public static String readFile(String name) |
| | | throws IOException { |
| | | public static String readFile(String name) throws IOException { |
| | | return readFile(new File(name)); |
| | | } |
| | | |
| | | /** |
| | | * Read the contents of a file and return it as a String. |
| | | */ |
| | | public static String readFile(File file) |
| | | throws IOException { |
| | | public static String readFile(File file) throws IOException { |
| | | byte[] bytes = readFileBytes(file); |
| | | return new String(bytes); |
| | | } |
| | |
| | | import javax.naming.directory.ModificationItem; |
| | | |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.config.ConfigConstants; |
| | |
| | | import org.opends.server.tools.LDAPPasswordModify; |
| | | import org.opends.server.tools.LDAPSearch; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.testng.Assert; |
| | | import org.testng.Reporter; |
| | | import org.testng.annotations.AfterClass; |
| | |
| | | Reporter.log("Running aciTestCaseSetup"); |
| | | |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | // Save Global ACI. |
| | |
| | | { |
| | | Reporter.log("Running aciTestCaseTearDown"); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", null); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | // Restore Global ACI. |
| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import static org.testng.AssertJUnit.assertTrue; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.DN; |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.testng.AssertJUnit.*; |
| | | |
| | | /** |
| | | * EntryContainer tester. |
| | | */ |
| | | public class TestEntryContainer extends JebTestCase { |
| | | private String beID="userRoot"; |
| | | private static final String backendID = "userRoot"; |
| | | private BackendImpl be; |
| | | |
| | | private static final String ldifString = "dn: dc=example,dc=com\n" |
| | |
| | | */ |
| | | @AfterClass |
| | | public void tearDown() throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend(backendID); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Test() |
| | | public void test1() throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, null); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | TestCaseUtils.clearJEBackend(backendID); |
| | | be = (BackendImpl) DirectoryServer.getBackend(backendID); |
| | | RootContainer rootContainer = be.getRootContainer(); |
| | | EntryContainer entryContainer = |
| | | rootContainer.getEntryContainer(DN.valueOf("dc=example,dc=com")); |
| | |
| | | @Test(enabled = true) |
| | | public void testImportAll() throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, beID, null); |
| | | TestCaseUtils.clearJEBackend(beID); |
| | | ArrayList<String> fileList = new ArrayList<String>(); |
| | | fileList.add(homeDirName + File.separator + "top.ldif"); |
| | | fileList.add(homeDirName + File.separator + "entries1.ldif"); |
| | |
| | | @Test(dependsOnMethods = "testImportReplaceExisting") |
| | | public void testImportAppend() throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, beID, null); |
| | | TestCaseUtils.clearJEBackend(beID); |
| | | |
| | | LDIFImportConfig importConfig = new LDIFImportConfig(homeDirName |
| | | + File.separator + "top.ldif"); |
| | |
| | | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, suffix); |
| | | TestCaseUtils.clearJEBackend(beID); |
| | | TestCaseUtils.disableBackend(beID); |
| | | } |
| | | |
| | |
| | | * @throws Exception if the entries are not loaded or created. |
| | | */ |
| | | private void cleanAndLoad(int numEntries) throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, suffix); |
| | | TestCaseUtils.clearJEBackend(beID); |
| | | template[2]=numUsersLine; |
| | | template[2]= |
| | | template[2].replaceAll("#numEntries#", String.valueOf(numEntries)); |
| | |
| | | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, "dc=vlvtest,dc=com"); |
| | | TestCaseUtils.clearJEBackend(beID); |
| | | TestCaseUtils.disableBackend(beID); |
| | | } |
| | | |
| | |
| | | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, suffix); |
| | | TestCaseUtils.clearJEBackend(beID); |
| | | TestCaseUtils.disableBackend(beID); |
| | | } |
| | | |
| | | /** |
| | | * Performs a ncomplete verify against a backend using the |
| | | * entries loaded in the setup initializer. |
| | | * Performs a complete verify against a backend using the entries loaded in |
| | | * the setup initializer. |
| | | * |
| | | * @throws Exception if error count is not equal to 0. |
| | | * @throws Exception |
| | | * if error count is not equal to 0. |
| | | */ |
| | | |
| | | @Test() |
| | | public void testCompleteVerifyJob() throws Exception { |
| | | cleanAndLoad(9); |
| | |
| | | * @throws Exception if the entries are not loaded or created. |
| | | */ |
| | | private void cleanAndLoad(int numEntries) throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, suffix); |
| | | TestCaseUtils.clearJEBackend(beID); |
| | | template[2]=numUsersLine; |
| | | template[2]= |
| | | template[2].replaceAll("#numEntries#", String.valueOf(numEntries)); |
| | |
| | | */ |
| | | private long getStatEntryCount(Entry e, String type) |
| | | throws NumberFormatException { |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(type); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(type); |
| | | if (attrType == null) |
| | | { |
| | | attrType = DirectoryServer.getDefaultAttributeType(type); |
| | | } |
| | | List<Attribute> attrList = e.getAttribute(attrType, null); |
| | | ByteString v = attrList.get(0).iterator().next(); |
| | | return Long.parseLong(v.toString()); |
| | |
| | | */ |
| | | private void populateDB() throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | private void populateDB() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * A set of test cases for bind operations |
| | | * A set of test cases for bind operations. |
| | | */ |
| | | public class BindOperationTestCase |
| | | extends OperationTestCase |
| | |
| | | return array; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Operation[] createTestOperations() |
| | | throws Exception |
| | | { |
| | |
| | | * Tests the <CODE>getUserEntryDN</CODE> method for a completed bind operation |
| | | * using simple authentication in which this value will be set. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetUserEntryDNSimpleNonNull() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * Tests the <CODE>getUserEntryDN</CODE> method for a completed bind operation |
| | | * using SASL authentication in which this value will be set. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetUserEntryDNSASLNonNull() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * <CODE>getProcessingStopTime</CODE>, and <CODE>getProcessingTime()</CODE> |
| | | * methods for a completed bind operation using simple authentication. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetProcessingStartAndStopTimesSimple() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * <CODE>getProcessingStopTime</CODE>, and <CODE>getProcessingTime()</CODE> |
| | | * methods for a completed bind operation using SASL authentication. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetProcessingStartAndStopTimesSASL() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * Tests a simple bind operation to ensure that all plugin types are invoked |
| | | * as expected. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testAllPluginsCalledSimple() |
| | | { |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | |
| | | * Tests a SASL bind operation to ensure that all plugin types are invoked |
| | | * as expected. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testAllPluginsCalledSASL() |
| | | { |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | |
| | | message = r.readMessage(); |
| | | while (message != null) |
| | | { |
| | | assertTrue((message.getProtocolOpType() == OP_TYPE_BIND_RESPONSE) || |
| | | (message.getProtocolOpType() == OP_TYPE_EXTENDED_RESPONSE)); |
| | | assertThat(message.getProtocolOpType()).isIn(OP_TYPE_BIND_RESPONSE, OP_TYPE_EXTENDED_RESPONSE); |
| | | message = r.readMessage(); |
| | | } |
| | | |
| | |
| | | message = r.readMessage(); |
| | | while (message != null) |
| | | { |
| | | assertTrue((message.getProtocolOpType() == OP_TYPE_BIND_RESPONSE) || |
| | | (message.getProtocolOpType() == OP_TYPE_EXTENDED_RESPONSE)); |
| | | assertThat(message.getProtocolOpType()).isIn(OP_TYPE_BIND_RESPONSE, OP_TYPE_EXTENDED_RESPONSE); |
| | | message = r.readMessage(); |
| | | } |
| | | |
| | |
| | | message = r.readMessage(); |
| | | while (message != null) |
| | | { |
| | | assertTrue((message.getProtocolOpType() == OP_TYPE_BIND_RESPONSE) || |
| | | (message.getProtocolOpType() == OP_TYPE_EXTENDED_RESPONSE)); |
| | | assertThat(message.getProtocolOpType()).isIn(OP_TYPE_BIND_RESPONSE, OP_TYPE_EXTENDED_RESPONSE); |
| | | message = r.readMessage(); |
| | | } |
| | | |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testBindShortCircuitInPreParseSimpleAnonymous() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testBindShortCircuitInPreOperationSimpleAnonymous() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testBindShortCircuitInPreParseSimpleAuthenticated() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testBindShortCircuitInPreOperationSimpleAuthenticated() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testBindShortCircuitInPreParseSASL() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testBindShortCircuitInPreOperationSASL() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests performing a simple bind operation with an invalid user DN. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleBindInvalidDN() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | /** |
| | | * Tests performing a SASL bind operation with an invalid user DN. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSASLBindInvalidDN() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * Tests performing a simple bind operation with an unsupported control that |
| | | * is marked critical. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleBindUnsupportedCriticalControl() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * Tests performing a SASL bind operation with an unsupported control that is |
| | | * marked critical. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSASLBindUnsupportedCriticalControl() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * Tests performing a simple bind operation with an unsupported control that |
| | | * is not marked critical. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleBindUnsupportedNonCriticalControl() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * Tests performing a SASL bind operation with an unsupported control that is |
| | | * is not marked critical. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSASLBindUnsupportedNonCriticalControl() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleBindNoSuchUser() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleBindWithDNNoPasswordDisallowed() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleBindWithDNNoPasswordAllowed() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleBindNoUserPassword() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testSimpleBindReferral() |
| | | throws Exception |
| | | @Test |
| | | public void testSimpleBindReferral() throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=people,dc=example,dc=com", |
| | |
| | | * Tests performing a simple bind operation with a valid DN but incorrect |
| | | * password. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleBindWrongPassword() |
| | | { |
| | | InternalClientConnection conn = |
| | |
| | | /** |
| | | * Tests the behavior of the returnBindErrorMessage configuration option. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testReturnBindErrorMessage() |
| | | { |
| | | // Make sure that the default behavior is to not include the error message. |
| | |
| | | conn.processSimpleBind(ByteString.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("wrongpassword")); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS); |
| | | assertTrue(((bindOperation.getErrorMessage() == null) || |
| | | (bindOperation.getErrorMessage().length() == 0)), |
| | | bindOperation.getErrorMessage().toString()); |
| | | assertThat(bindOperation.getErrorMessage()).isEmpty(); |
| | | |
| | | |
| | | // Change the server configuration so that error messages should be |
| | |
| | | conn.processSimpleBind(ByteString.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("wrongpassword")); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS); |
| | | assertTrue(((bindOperation.getErrorMessage() == null) || |
| | | (bindOperation.getErrorMessage().length() == 0)), |
| | | bindOperation.getErrorMessage().toString()); |
| | | assertThat(bindOperation.getErrorMessage()).isEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testRebindClearsAuthInfo() |
| | | throws Exception |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.restartServer(); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.addEntries( |
| | | "dn: ou=people,dc=example,dc=com", |
| | | "objectClass: organizationalUnit", |
| | |
| | | s.close(); |
| | | |
| | | // Cleanup. |
| | | TestCaseUtils.clearJEBackend(false, |
| | | "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.restartServer(); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.addEntries( |
| | | "dn: ou=people,dc=example,dc=com", |
| | | "objectClass: organizationalUnit", |
| | |
| | | s.close(); |
| | | |
| | | // Cleanup. |
| | | TestCaseUtils.clearJEBackend(false, |
| | | "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testIgnoreStateUpdateFailurePolicy() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testReactiveStateUpdateFailurePolicy() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testProactiveStateUpdateFailurePolicy() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @BeforeClass() |
| | | @BeforeClass |
| | | public void startServer() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | } |
| | | |
| | | @AfterClass() |
| | | @AfterClass |
| | | public void cleanUp() { |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetGroupImplementations() |
| | | throws Exception |
| | | { |
| | |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | |
| | | @Test() |
| | | @Test |
| | | public void testStaticGroupCircularNested() throws Exception { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testStaticGroupDynamicNested() throws Exception { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testStaticGroupInstanceChange() throws Exception { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testStaticGroupInstanceInvalid() throws Exception { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testStaticGroupNestedAPI() throws Exception { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGenericStaticGroupAPI() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testValidPopulatedGroupOfNames() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testValidEmptyGroupOfNames() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testValidPopulatedGroupOfUniqueNames() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testValidEmptyGroupOfUniqueNames() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testValidPopulatedGroupOfEntries() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testValidEmptyGroupOfEntries() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testRenameStaticGroup() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testStaticClientConnectionMembership() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testStaticMemberList() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGenericDynamicGroupAPI() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testDynamicGroupMalformedURL() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetMembersSimple() |
| | | throws Exception |
| | | { |
| | |
| | | { |
| | | DN memberDN = memberList.nextMemberDN(); |
| | | assertTrue(memberSet.remove(memberDN), |
| | | "Returned unexpected member " + memberDN.toString()); |
| | | "Returned unexpected member " + memberDN); |
| | | } |
| | | memberList.close(); |
| | | assertTrue(memberSet.isEmpty(), |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetMembersComplex() |
| | | throws Exception |
| | | { |
| | |
| | | { |
| | | DN memberDN = memberList.nextMemberDN(); |
| | | assertTrue(memberSet.remove(memberDN), |
| | | "Returned unexpected member " + memberDN.toString()); |
| | | "Returned unexpected member " + memberDN); |
| | | } |
| | | memberList.close(); |
| | | assertTrue(memberSet.isEmpty(), |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetMembersMultipleDistinctURLs() |
| | | throws Exception |
| | | { |
| | |
| | | { |
| | | DN memberDN = memberList.nextMemberDN(); |
| | | assertTrue(memberSet.remove(memberDN), |
| | | "Returned unexpected member " + memberDN.toString()); |
| | | "Returned unexpected member " + memberDN); |
| | | } |
| | | memberList.close(); |
| | | assertTrue(memberSet.isEmpty(), |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testGetMembersMultipleOverlappingURLs() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | |
| | | { |
| | | DN memberDN = memberList.nextMemberDN(); |
| | | assertTrue(memberSet.remove(memberDN), |
| | | "Returned unexpected member " + memberDN.toString()); |
| | | "Returned unexpected member " + memberDN); |
| | | } |
| | | memberList.close(); |
| | | assertTrue(memberSet.isEmpty(), |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSubtreeDelete() throws Exception { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | | addSubtreeGroupTestEntries(); |
| | |
| | | assertNull(group3); |
| | | |
| | | // Cleanup. |
| | | TestCaseUtils.clearJEBackend(false, |
| | | "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSubtreeModify() throws Exception { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | | addSubtreeGroupTestEntries(); |
| | |
| | | assertTrue(conn.isMemberOf(newGroup3, null)); |
| | | |
| | | // Cleanup. |
| | | TestCaseUtils.clearJEBackend(false, |
| | | "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | |
| | | /** |
| | |
| | | public void testCompressedSchemaRefresh() throws Exception |
| | | { |
| | | String baseDN = "dc=example,dc=com"; |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", baseDN); |
| | | TestCaseUtils.clearJEBackend("userRoot", baseDN); |
| | | TestCaseUtils.addEntry("dn: cn=Test User," + baseDN, |
| | | "objectClass: top", "objectClass: person", |
| | | "objectClass: organizationalPerson", "sn: User", "cn: Test User"); |
| | |
| | | public void setUp() throws Exception |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.clearJEBackend(true,"userRoot","dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot","dc=example,dc=com"); |
| | | |
| | | DN suffixDN = DN.valueOf(SUFFIX); |
| | | if (!DirectoryServer.entryExists(suffixDN)) |
| | |
| | | public void setUp() throws Exception |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", SUFFIX); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | addTestEntries(); |
| | | } |
| | | |
| | |
| | | subentryList = manager.getCollectiveSubentries(testEntry.getName()); |
| | | assertThat(subentryList).isEmpty(); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", SUFFIX); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | |
| | | @BeforeMethod |
| | |
| | | public void setUp() throws Exception |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", SUFFIX); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | // Add suffix entry. |
| | | DN suffixDN = DN.valueOf(SUFFIX); |
| | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", SUFFIX); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | // Add the example.com entry |
| | | TestCaseUtils.addEntry( |
| | |
| | | try |
| | | { |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: ou=People,dc=example,dc=com", |
| | |
| | | try |
| | | { |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: ou=Org 1,dc=example,dc=com", |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn", false); |
| | | assertNotNull(entryDNType); |
| | |
| | | String uuidString = |
| | | UUID.nameUUIDFromBytes(getBytes("dc=example,dc=com")).toString(); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | Entry e = TestCaseUtils.addEntry( |
| | | "dn: dc=example,dc=com", |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | governingStructureRuleType = |
| | | DirectoryServer.getAttributeType("governingstructurerule", false); |
| | |
| | | "postalAddress: Aarika Atpco$59208 Elm Street$Youngstown, HI 57377", |
| | | "description: This is the description for Aarika Atpco."); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | TestCaseUtils.addEntries(entries); |
| | | } |
| | |
| | | "postalAddress: Aarika Atpco$59208 Elm Street$Youngstown, HI 57377", |
| | | "description: This is the description for Aarika Atpco."); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | TestCaseUtils.addEntries(entries); |
| | | } |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | structuralObjectClassType = |
| | | DirectoryServer.getAttributeType("structuralobjectclass", false); |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | subschemaSubentryType = |
| | | DirectoryServer.getAttributeType("subschemasubentry", false); |
| | |
| | | replaceAttrEntry(configDN, dsConfigUpdateInterval,"0 seconds"); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | addTestEntries("o=test"); |
| | | TestCaseUtils.clearJEBackend(true,"userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | addTestEntries("dc=example,dc=com"); |
| | | } |
| | | |
| | |
| | | //unit tests. |
| | | replaceAttrEntry(configDN, dsConfigAttrType,"seeAlso"); |
| | | replaceAttrEntry(configDN, dsConfigUpdateInterval,"0 seconds"); |
| | | TestCaseUtils.clearJEBackend(false,"userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | //Add entries to two backends to test public naming context. |
| | | addTestEntries("o=test", 't'); |
| | | TestCaseUtils.clearJEBackend(true,"userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | addTestEntries("dc=example,dc=com", 'x'); |
| | | uidConfigDN=DN.valueOf("cn=UID Unique Attribute ,cn=Plugins,cn=config"); |
| | | testConfigDN=DN.valueOf("cn=Test Unique Attribute,cn=Plugins,cn=config"); |
| | |
| | | @AfterClass |
| | | public void tearDown() throws Exception { |
| | | clearConfigEntries(); |
| | | TestCaseUtils.clearJEBackend(false,"userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | clearAcis("o=test"); |
| | | TestCaseUtils.clearMemoryBackend(TestCaseUtils.TEST_BACKEND_ID); |
| | | } |
| | |
| | | // (like the test backend we use in every tests): backend is disabled then |
| | | // re-enabled and this clears the backend reference and thus the underlying |
| | | // data. So for this particular test, we use a classical backend. |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | // For most tests, a limited number of entries is enough |
| | | updatedEntries = newLDIFEntries(2); |
| | |
| | | + "ds-cfg-receive-status: true\n" |
| | | + "ds-cfg-window-size: " + WINDOW_SIZE; |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | addSynchroServerEntry(synchroServerLdif); |
| | | |
| | |
| | | callParanoiaCheck = false; |
| | | super.classCleanUp(); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | paranoiaCheck(); |
| | | } |
| | |
| | | // re-enabled and this clears the backend reference and thus the underlying |
| | | // data. So for this particular test, we use a classical backend. Let's |
| | | // clear it and create the root entry |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | addEntry("dn: dc=example,dc=com\n" + "objectClass: top\n" |
| | | + "objectClass: domain\n"); |
| | | |
| | |
| | | entriesToCleanup.remove(DN.valueOf(EXAMPLE_DN)); |
| | | super.classCleanUp(); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | TestCaseUtils.deleteDirectory(reSyncTempDir); |
| | | |
| | | paranoiaCheck(); |
| | |
| | | // We need a backend with a real configuration in cn=config as at import time |
| | | // the real domain will check for backend existence in cn=config. So we use |
| | | // dc=example,dc=com for this particular test. |
| | | clearJEBackend(false, "userRoot", TEST2_ROOT_DN_STRING); |
| | | clearJEBackend("userRoot"); |
| | | |
| | | try |
| | | { |
| | |
| | | // We need a backend with a real configuration in cn=config as at import time |
| | | // the real domain will check for backend existence in cn=config. So we use |
| | | // dc=example,dc=com for this particular test. |
| | | clearJEBackend(false, "userRoot", TEST2_ROOT_DN_STRING); |
| | | clearJEBackend("userRoot"); |
| | | |
| | | try |
| | | { |
| | |
| | | // going into degraded status, we need to send a lot of updates. This makes |
| | | // the memory test backend crash with OutOfMemoryError. So we prefer here |
| | | // a backend backed up with a file |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | |
| | | /** |
| | |
| | | callParanoiaCheck = false; |
| | | super.classCleanUp(); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | |
| | | paranoiaCheck(); |
| | | } |
| | |
| | | } |
| | | finally |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | private void populateEntriesForControl() throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.addEntries( |
| | | "dn: cn=user1,dc=example,dc=com", |
| | | "objectclass: inetorgperson", |
| | |
| | | /** Adds an entry for test. */ |
| | | private void addEntry() throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.addEntries( |
| | | "dn: cn=Jos\u00E9,dc=example, dc=com", |
| | | "objectClass: person", |
| | |
| | | } |
| | | finally |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot"); |
| | | } |
| | | } |
| | | |
| | |
| | | // calendar may fail if the time thread using a stale time. |
| | | long currentTime = TimeThread.getTime(); |
| | | |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.addEntries( |
| | | "dn: cn=user1,dc=example,dc=com", |
| | | "objectclass: person", |
| | |
| | | public class LDAPSearchTestCase |
| | | extends ToolsTestCase |
| | | { |
| | | // The path to a file containing an invalid bind password. |
| | | /** The path to a file containing an invalid bind password. */ |
| | | private String invalidPasswordFile; |
| | | |
| | | // The path to a file containing a valid bind password. |
| | | /** The path to a file containing a valid bind password. */ |
| | | private String validPasswordFile; |
| | | |
| | | |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @BeforeClass() |
| | | public void startServerAndCreatePasswordFiles() |
| | | throws Exception |
| | | @BeforeClass |
| | | public void startServerAndCreatePasswordFiles() throws Exception |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | |
| | | |
| | | @AfterClass |
| | | public void tearDown() throws Exception { |
| | | |
| | | TestCaseUtils.dsconfig( |
| | | "set-sasl-mechanism-handler-prop", |
| | | "--handler-name", "DIGEST-MD5", |
| | |
| | | /** |
| | | * Tests a simple LDAPv2 search. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleLDAPv2Search() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests a simple LDAPv3 search. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleLDAPv3Search() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests a simple search with verbose output. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleVerboseSearch() |
| | | { |
| | | String[] args = |
| | |
| | | * Tests a simple invocation using the "--dry-run" option with a valid argument |
| | | * set. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testNoOpSearchValidArguments() |
| | | { |
| | | String[] args = |
| | |
| | | * Tests a simple invocation using the "--dry-run" option with an invalid |
| | | * argument set. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testNoOpSearchInvalidArguments() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests a simple LDAP search over SSL using blind trust. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleSearchSSLBlindTrust() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests a simple LDAP search over SSL using a trust store. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleSearchSSLTrustStore() |
| | | { |
| | | String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | |
| | | /** |
| | | * Tests a simple LDAP search using StartTLS with blind trust. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleSearchStartTLSBlindTrust() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests a simple LDAP search using StartTLS with a trust store. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleSearchStartTLSTrustStore() |
| | | { |
| | | String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleSearchSSLTrustStoreSASLExternal() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleSearchSSLTrustStoreSASLExternalValidClientCert() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleSearchSSLTrustStoreSASLExternalInvalidClientCert() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimpleSearchStartTLSTrustStoreSASLExternal() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testCRAMMD5() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testDigestMD5() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testPLAIN() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests a search with a malformed bind DN. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testMalformedBindDN() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests a search with a nonexistent bind DN. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testNonExistentBindDN() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests a search with an invalid password. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testInvalidBindPassword() |
| | | { |
| | | String[] args = |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testValidPasswordFromFile() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testInvalidPasswordFromFile() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests a search with a malformed base DN. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testMalformedBaseDN() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests a search with a nonexistent base DN. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testNonExistentBaseDN() |
| | | { |
| | | String[] args = |
| | |
| | | /** |
| | | * Tests with the typesOnly option. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testTypesOnly() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests with the reportAuthzID option for an unauthenticated search. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testReportAuthzIDUnauthenticated() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests with the reportAuthzID option for an authenticated search. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testReportAuthzIDAuthenticated() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests with the usePasswordPolicyControl option for an authenticated search. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testUsePasswordPolicyControl() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests with the account usability control for an authenticated search. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testAccountUsabilityControl() |
| | | throws Exception |
| | | { |
| | |
| | | * Tests with the account usability control with an alternate name for an |
| | | * authenticated search. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testAccountUsabilityControlAltName() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests with the LDAP assertion control in which the assertion is true. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testLDAPAssertionControlTrue() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests with the LDAP assertion control in which the assertion is false. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testLDAPAssertionControlFalse() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests with the LDAP matched values control. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testMatchedValuesControl() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSubentriesControl() |
| | | throws Exception |
| | | { |
| | |
| | | * Tests the inclusion of multiple arbitrary controls in the request to the |
| | | * server. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testMultipleRequestControls() |
| | | throws Exception |
| | | { |
| | |
| | | /** |
| | | * Tests the use of the simple paged results control. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSimplePagedResults() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: cn=device 1,dc=example,dc=com", |
| | |
| | | * Tests the use of both the server-side sort control and the simple paged |
| | | * results control. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortWithPagedResults() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | /** |
| | | * Tests the use of the server-side sort control with valid sort criteria. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortValidGivenNameAscending() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | /** |
| | | * Tests the use of the server-side sort control with valid sort criteria. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortValidGivenNameDescending() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | /** |
| | | * Tests the use of the server-side sort control with valid sort criteria. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortValidGivenNameAscendingCaseExactOrderingMatch() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | /** |
| | | * Tests the use of the server-side sort control with valid sort criteria. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortValidSnAscendingGivenNameAscending() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | /** |
| | | * Tests the use of the server-side sort control with valid sort criteria. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortValidSnAscendingGivenNameDescending() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | /** |
| | | * Tests the use of the server-side sort control with an empty sort order. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortEmptySortOrder() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | * Tests the use of the server-side sort control with a sort order containing |
| | | * a key with no attribute type. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortSortOrderMissingType() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | * Tests the use of the server-side sort control with a sort order containing |
| | | * a key with a colon but no matching rule. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortSortOrderMissingMatchingRule() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | /** |
| | | * Tests the use of the server-side sort control with an undefined attribute. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortUndefinedAttribute() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | * Tests the use of the server-side sort control with an undefined ordering |
| | | * rule. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortUndefinedOrderingRule() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testControlNoValue() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testVLVWithoutSort() |
| | | throws Exception |
| | | { |
| | | // Test is supposed to fail in parsing arguments. But we do not |
| | | // want it to fail because there no backend to search in. |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | * Tests the use of the server-side sort control with both the simple paged |
| | | * results and virtual list view controls. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortWithVLVAndPagedResults() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testVLVInvalidDescriptorNoColons() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testVLVInvalidDescriptorTwoColons() |
| | | throws Exception |
| | | { |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testVLVInvalidDescriptorThreeColons() |
| | | throws Exception |
| | | { |
| | |
| | | * Tests the use of both the server-side sort control and the virtual list |
| | | * view control. |
| | | * |
| | | * @throws Exception If an unexpectd problem occurs. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testSortWithVLV() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com"); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | TestCaseUtils.addEntries( |
| | | "dn: uid=albert.zimmerman,dc=example,dc=com", |
| | |
| | | /** |
| | | * Tests the LDAPSearch tool with the "--help" option. |
| | | */ |
| | | @Test() |
| | | @Test |
| | | public void testHelp() |
| | | { |
| | | String[] args = { "--help" }; |
| | |
| | | String backendBaseDNName = "ds-cfg-base-dn"; |
| | | |
| | | // Initialize a backend with a base entry. |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", suffix); |
| | | TestCaseUtils.clearJEBackend("userRoot", suffix); |
| | | |
| | | // Check that suffix is accessible while suffix2 is not. |
| | | searchEntry(suffix, ResultCode.SUCCESS); |
| | |
| | | try |
| | | { |
| | | TestCaseUtils.clearDataBackends(); |
| | | |
| | | |
| | | // At this point, the list of subordinate naming context is not defined |
| | | // yet (null): any public backend should be visible. Create a backend |
| | | // with a base entry and check that the test naming context is visible. |
| | | TestCaseUtils.initializeMemoryBackend(backendID1, backend1, true); |
| | | searchPublicNamingContexts(ResultCode.SUCCESS, 1); |
| | | |
| | | |
| | | // Create another test backend and check that the new backend is visible |
| | | TestCaseUtils.initializeMemoryBackend(backendID2, backend2, true); |
| | | searchPublicNamingContexts(ResultCode.SUCCESS, 2); |
| | | |
| | | |
| | | // Now put in the list of subordinate naming context the backend1 naming context. |
| | | // This white list will prevent the backend2 to be visible. |
| | | TestCaseUtils.dsconfig( |
| | | "set-root-dse-backend-prop", |
| | | "--set", "subordinate-base-dn:" + backend1); |
| | | searchPublicNamingContexts(ResultCode.SUCCESS, 1); |
| | | |
| | | |
| | | // === Cleaning |
| | | |
| | | |
| | | // Reset the subordinate naming context list. |
| | | // Both naming context should be visible again. |
| | | TestCaseUtils.dsconfig( |