Tidy up unit-tests so that not all backends are always enabled, and replication related databases are deleted after tests.
| | |
| | | shutdown(); |
| | | } |
| | | |
| | | /** |
| | | * Get the replication server DB directory. |
| | | * This is useful for tests to be able to do some cleanup. Might even be |
| | | * useful for the server some day. |
| | | * |
| | | * @return the Database directory name |
| | | */ |
| | | public String getDbDirName() |
| | | { |
| | | return dbDirname; |
| | | } |
| | | |
| | | } |
| | |
| | | objectClass: top |
| | | objectClass: ds-cfg-backend |
| | | objectClass: ds-cfg-local-db-backend |
| | | ds-cfg-enabled: true |
| | | ds-cfg-enabled: false |
| | | ds-cfg-java-class: org.opends.server.backends.jeb.BackendImpl |
| | | ds-cfg-backend-id: unindexedRoot |
| | | ds-cfg-writability-mode: enabled |
| | |
| | | ds-cfg-preload-time-limit: 0 seconds |
| | | ds-cfg-entries-compressed: false |
| | | ds-cfg-db-cache-percent: 2 |
| | | ds-cfg-db-run-cleaner: false |
| | | |
| | | dn: ds-cfg-attribute=oncRpcNumber,cn=Index,ds-cfg-backend-id=userRoot,cn=Backends,cn=config |
| | | changetype: add |
| | |
| | | objectClass: top |
| | | objectClass: ds-cfg-backend |
| | | objectClass: ds-cfg-local-db-backend |
| | | ds-cfg-enabled: true |
| | | ds-cfg-enabled: false |
| | | ds-cfg-java-class: org.opends.server.backends.jeb.BackendImpl |
| | | ds-cfg-backend-id: rebuildRoot |
| | | ds-cfg-writability-mode: enabled |
| | |
| | | ds-cfg-preload-time-limit: 0 seconds |
| | | ds-cfg-entries-compressed: false |
| | | ds-cfg-db-cache-percent: 2 |
| | | ds-cfg-db-run-cleaner: false |
| | | |
| | | dn: cn=VLV Index,ds-cfg-backend-id=rebuildRoot,cn=Backends,cn=config |
| | | changetype: add |
| | |
| | | objectClass: top |
| | | objectClass: ds-cfg-backend |
| | | objectClass: ds-cfg-local-db-backend |
| | | ds-cfg-enabled: true |
| | | ds-cfg-enabled: false |
| | | ds-cfg-java-class: org.opends.server.backends.jeb.BackendImpl |
| | | ds-cfg-backend-id: importRoot |
| | | ds-cfg-writability-mode: enabled |
| | |
| | | ds-cfg-preload-time-limit: 0 seconds |
| | | ds-cfg-entries-compressed: false |
| | | ds-cfg-db-cache-percent: 2 |
| | | ds-cfg-db-run-cleaner: false |
| | | |
| | | dn: cn=VLV Index,ds-cfg-backend-id=importRoot,cn=Backends,cn=config |
| | | changetype: add |
| | |
| | | objectClass: top |
| | | objectClass: ds-cfg-backend |
| | | objectClass: ds-cfg-local-db-backend |
| | | ds-cfg-enabled: true |
| | | ds-cfg-enabled: false |
| | | ds-cfg-java-class: org.opends.server.backends.jeb.BackendImpl |
| | | ds-cfg-backend-id: verifyRoot |
| | | ds-cfg-writability-mode: enabled |
| | |
| | | ds-cfg-preload-time-limit: 0 seconds |
| | | ds-cfg-entries-compressed: false |
| | | ds-cfg-db-cache-percent: 2 |
| | | ds-cfg-db-run-cleaner: false |
| | | |
| | | dn: cn=VLV Index,ds-cfg-backend-id=verifyRoot,cn=Backends,cn=config |
| | | changetype: add |
| | |
| | | objectClass: top |
| | | objectClass: ds-cfg-backend |
| | | objectClass: ds-cfg-local-db-backend |
| | | ds-cfg-enabled: true |
| | | ds-cfg-enabled: false |
| | | ds-cfg-java-class: org.opends.server.backends.jeb.BackendImpl |
| | | ds-cfg-backend-id: indexRoot |
| | | ds-cfg-writability-mode: enabled |
| | |
| | | ds-cfg-preload-time-limit: 0 seconds |
| | | ds-cfg-entries-compressed: false |
| | | ds-cfg-db-cache-percent: 2 |
| | | ds-cfg-db-run-cleaner: false |
| | | |
| | | dn: cn=VLV Index,ds-cfg-backend-id=indexRoot,cn=Backends,cn=config |
| | | changetype: add |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server; |
| | | |
| | |
| | | |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | public static void enableBackend(String backendID) |
| | | { |
| | | dsconfig("set-backend-prop", "--backend-name", backendID, |
| | | "--set", "enabled:true"); |
| | | } |
| | | |
| | | public static void disableBackend(String backendID) |
| | | { |
| | | dsconfig("set-backend-prop", "--backend-name", backendID, |
| | | "--set", "enabled:false"); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | // This test suite depends on having the schema available, so we'll make |
| | | // sure the server is started. |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.enableBackend("indexRoot"); |
| | | |
| | | homeDirName = "db_index_test"; |
| | | |
| | |
| | | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | TestCaseUtils.disableBackend("importRoot"); |
| | | } |
| | | |
| | | @Test(expectedExceptions = DirectoryException.class) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | // This test suite depends on having the schema available, so we'll make |
| | | // sure the server is started. |
| | | TestCaseUtils.startServer(); |
| | | // Enable the backend |
| | | TestCaseUtils.enableBackend(beID); |
| | | |
| | | tempDir = TestCaseUtils.createTemporaryDirectory("jebimporttest"); |
| | | homeDirName = tempDir.getAbsolutePath(); |
| | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception |
| | | { |
| | | TestCaseUtils.disableBackend(beID); |
| | | TestCaseUtils.deleteDirectory(tempDir); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | @BeforeClass |
| | | public void setup() throws Exception { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.enableBackend(beID); |
| | | baseDNs = new DN[] { |
| | | DN.decode(suffix) |
| | | }; |
| | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, suffix); |
| | | TestCaseUtils.disableBackend(beID); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | @BeforeClass |
| | | public void setUp() throws Exception { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.enableBackend(beID); |
| | | |
| | | SortKey[] sortKeys = new SortKey[3]; |
| | | sortKeys[0] = new SortKey(DirectoryServer.getAttributeType("givenname"), true); |
| | |
| | | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | TestCaseUtils.disableBackend(beID); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | @BeforeClass |
| | | public void setup() throws Exception { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.enableBackend(beID); |
| | | baseDNs = new DN[] { |
| | | DN.decode(suffix) |
| | | }; |
| | |
| | | @AfterClass |
| | | public void cleanUp() throws Exception { |
| | | TestCaseUtils.clearJEBackend(false, beID, suffix); |
| | | TestCaseUtils.disableBackend(beID); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | ",dc=example,dc=com"), 0 }, |
| | | // new Object[] { DN.decode("cn=monitor"), |
| | | // DirectoryServer.getMonitorProviders().size() }, |
| | | new Object[] { DN.decode("cn=Backends,cn=config"), |
| | | DirectoryServer.getBackends().size() }, |
| | | // Disable test on # of backends. Some might be disabled, falsing count. |
| | | // new Object[] { DN.decode("cn=Backends,cn=config"), |
| | | // DirectoryServer.getBackends().size() }, |
| | | new Object[] { DN.decode("cn=Work Queue,cn=config"), 0 }, |
| | | new Object[] { DN.decode("cn=tasks"), 2 }, |
| | | new Object[] { DN.decode("cn=Recurring Tasks,cn=tasks"), 0 }, |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | |
| | | { |
| | | super.setUp(); |
| | | |
| | | |
| | | TestCaseUtils.enableBackend("unindexedRoot"); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.addEntries( |
| | | "dn: cn=Unprivileged Root,cn=Root DNs,cn=config", |
| | |
| | | connections[i].finalize(); |
| | | connections[i] = null; |
| | | } |
| | | TestCaseUtils.disableBackend("unindexedRoot"); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.SearchScope; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | |
| | | { |
| | | replServer1.clearDb(); |
| | | replServer1.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer1.getDbDirName())); |
| | | replServer1 = null; |
| | | } |
| | | if (replServer2 != null) |
| | | { |
| | | replServer2.clearDb(); |
| | | replServer2.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer2.getDbDirName())); |
| | | replServer2 = null; |
| | | } |
| | | if (replServer3 != null) |
| | | { |
| | | replServer3.clearDb(); |
| | | replServer3.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer3.getDbDirName())); |
| | | replServer3 = null; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | | import java.io.File; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_COMPLETION_TIME; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_INITIALIZE_DONE; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_INITIALIZE_LEFT; |
| | |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.SearchScope; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | |
| | | { |
| | | changelog1.clearDb(); |
| | | changelog1.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | changelog1.getDbDirName())); |
| | | changelog1 = null; |
| | | } |
| | | |
| | |
| | | { |
| | | changelog2.clearDb(); |
| | | changelog2.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | changelog2.getDbDirName())); |
| | | changelog2 = null; |
| | | } |
| | | |
| | |
| | | { |
| | | changelog3.clearDb(); |
| | | changelog3.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | changelog3.getDbDirName())); |
| | | changelog3 = null; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.SearchScope; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | |
| | | // Clean RS databases |
| | | cleanUpReplicationServersDB(); |
| | | |
| | | removeReplicationServerDB(); |
| | | |
| | | cleanConfigEntries(); |
| | | configEntryList = new LinkedList<DN>(); |
| | | |
| | |
| | | // (in case our test created some emtries in it) |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | // Clean the default DB dir for replication server |
| | | String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT); |
| | | String rsDbDirPath = buildRoot + File.separator + "build" + |
| | | File.separator + "unit-tests" + File.separator + |
| | | "package-instance"+ File.separator + "changelogDb"; |
| | | |
| | | File rsDbDir = new File(rsDbDirPath); |
| | | if (rsDbDir != null) |
| | | { |
| | | File[] dbFiles = rsDbDir.listFiles(); |
| | | if (dbFiles != null) |
| | | { |
| | | for (File dbFile : dbFiles) |
| | | { |
| | | if (dbFile != null) |
| | | TRACER.debugInfo("ReplicationTestCase: classCleanUp: deleting " + dbFile); |
| | | dbFile.delete(); |
| | | } |
| | | } |
| | | TRACER.debugInfo("ReplicationTestCase: classCleanUp: deleting " + rsDbDir); |
| | | rsDbDir.delete(); |
| | | } |
| | | |
| | | // Check for unexpected replication config/objects left |
| | | if (callParanoiaCheck) |
| | | paranoiaCheck(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Remove trailing directories and databases of the currently instantiated |
| | | * replication servers. |
| | | */ |
| | | protected void removeReplicationServerDB() { |
| | | for (ReplicationServer rs : ReplicationServer.getAllInstances()) { |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs.getDbDirName())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Performs a search on the config backend with the specified filter. |
| | | * Fails if a config entry is found. |
| | | * @param filter The filter to apply for the search |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import org.opends.server.util.StaticUtils; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | |
| | | { |
| | | replicationServer.clearDb(); |
| | | replicationServer.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replicationServer.getDbDirName())); |
| | | replicationServer = null; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.net.ServerSocket; |
| | | import java.util.SortedSet; |
| | |
| | | { |
| | | rs1.clearDb(); |
| | | rs1.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs1.getDbDirName())); |
| | | rs1 = null; |
| | | } |
| | | |
| | |
| | | { |
| | | rs2.clearDb(); |
| | | rs2.remove(); |
| | | rs2 = null; |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs2.getDbDirName())); |
| | | rs2 = null; |
| | | } |
| | | if (rs3 != null) |
| | | { |
| | | rs3.clearDb(); |
| | | rs3.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs3.getDbDirName())); |
| | | rs3 = null; |
| | | } |
| | | rs1Port = -1; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import java.io.File; |
| | | import static org.opends.server.TestCaseUtils.TEST_ROOT_DN_STRING; |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.testng.annotations.Test; |
| | | |
| | |
| | | { |
| | | MultimasterReplication.deleteDomain(baseDn); |
| | | rs.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs.getDbDirName())); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.util.StaticUtils; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | |
| | | { |
| | | rs1.clearDb(); |
| | | rs1.remove(); |
| | | StaticUtils.recursiveDelete |
| | | (new File(DirectoryServer.getInstanceRoot(), |
| | | rs1.getDbDirName())); |
| | | rs1 = null; |
| | | } |
| | | |
| | |
| | | { |
| | | rs2.clearDb(); |
| | | rs2.remove(); |
| | | StaticUtils.recursiveDelete |
| | | (new File(DirectoryServer.getInstanceRoot(), |
| | | rs2.getDbDirName())); |
| | | rs2 = null; |
| | | } |
| | | rs1Port = -1; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import java.io.File; |
| | | import org.opends.server.util.StaticUtils; |
| | | import java.io.IOException; |
| | | import java.net.ServerSocket; |
| | | import java.util.Iterator; |
| | |
| | | import org.opends.messages.Severity; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | |
| | | { |
| | | rs[i].clearDb(); |
| | | rs[i].remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs[i].getDbDirName())); |
| | | rs[i] = null; |
| | | } |
| | | rsPort[i] = -1; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import org.opends.server.util.StaticUtils; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.net.ServerSocket; |
| | | import java.net.SocketException; |
| | |
| | | { |
| | | rs1.clearDb(); |
| | | rs1.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs1.getDbDirName())); |
| | | rs1 = null; |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.InetSocketAddress; |
| | |
| | | { |
| | | rs1.clearDb(); |
| | | rs1.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs1.getDbDirName())); |
| | | rs1 = null; |
| | | } |
| | | |
| | |
| | | { |
| | | rs2.clearDb(); |
| | | rs2.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs2.getDbDirName())); |
| | | rs2 = null; |
| | | } |
| | | if (rs3 != null) |
| | | { |
| | | rs3.clearDb(); |
| | | rs3.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs3.getDbDirName())); |
| | | rs3 = null; |
| | | } |
| | | if (rs4 != null) |
| | | { |
| | | rs4.clearDb(); |
| | | rs4.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | rs4.getDbDirName())); |
| | | rs4 = null; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | | import org.opends.server.util.StaticUtils; |
| | | import java.io.File; |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.getTracer; |
| | |
| | | { |
| | | replServer1.clearDb(); |
| | | replServer1.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer1.getDbDirName())); |
| | | replServer1 = null; |
| | | } |
| | | if (replServer2 != null) |
| | | { |
| | | replServer2.clearDb(); |
| | | replServer2.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer2.getDbDirName())); |
| | | replServer2 = null; |
| | | } |
| | | if (replServer3 != null) |
| | | { |
| | | replServer3.clearDb(); |
| | | replServer3.remove(); |
| | | replServer3 = null; |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer3.getDbDirName())); |
| | | replServer3 = null; |
| | | } |
| | | |
| | | super.cleanRealEntries(); |
| | |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | | import org.opends.server.util.StaticUtils; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.getTracer; |
| | | import static org.opends.server.replication.protocol.OperationContext.SYNCHROCONTEXT; |
| | |
| | | |
| | | private ChangeNumber unknownChangeNumberServer1; |
| | | |
| | | |
| | | private static final String exportLDIFAllFile = "exportLDIF.ldif"; |
| | | private String exportLDIFDomainFile = null; |
| | | /** |
| | | * Set up the environment for performing the tests in this Class. |
| | | * Replication |
| | |
| | | finally |
| | | { |
| | | if (changelogs[0] != null) |
| | | { |
| | | changelogs[0].remove(); |
| | | StaticUtils.recursiveDelete |
| | | (new File(DirectoryServer.getInstanceRoot(), |
| | | changelogs[0].getDbDirName())); |
| | | } |
| | | if (changelogs[1] != null) |
| | | { |
| | | changelogs[1].remove(); |
| | | StaticUtils.recursiveDelete |
| | | (new File(DirectoryServer.getInstanceRoot(), |
| | | changelogs[1].getDbDirName())); |
| | | } |
| | | if (broker1 != null) |
| | | broker1.stop(); |
| | | if (broker2 != null) |
| | |
| | | { |
| | | callParanoiaCheck = false; |
| | | super.classCleanUp(); |
| | | |
| | | String dirName = replicationServer.getDbDirName(); |
| | | |
| | | shutdown(); |
| | | |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | dirName)); |
| | | |
| | | paranoiaCheck(); |
| | | } |
| | | |
| | |
| | | Entry exportTask = createExportAllTask(); |
| | | addTask(exportTask, ResultCode.SUCCESS, null); |
| | | waitTaskState(exportTask, TaskState.COMPLETED_SUCCESSFULLY, null); |
| | | |
| | | // Not doing anything with the export file, let's delete it |
| | | File f = new File(DirectoryServer.getInstanceRoot(),exportLDIFAllFile); |
| | | f.delete(); |
| | | |
| | | debugInfo("Export domain"); |
| | | exportTask = createExportDomainTask("dc=domain2,dc=com"); |
| | | addTask(exportTask, ResultCode.SUCCESS, null); |
| | | waitTaskState(exportTask, TaskState.COMPLETED_SUCCESSFULLY, null); |
| | | // Not doing anything with the export file, let's delete it |
| | | if (exportLDIFDomainFile != null) |
| | | { |
| | | File aFile = new File(DirectoryServer.getInstanceRoot(), |
| | | exportLDIFDomainFile); |
| | | aFile.delete(); |
| | | } |
| | | } finally { |
| | | if (server1 != null) |
| | | server1.stop(); |
| | |
| | | private Entry createExportAllTask() |
| | | throws Exception |
| | | { |
| | | String path = "exportLDIF.ldif"; |
| | | return TestCaseUtils.makeEntry( |
| | | "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | | "objectclass: ds-task-export", |
| | | "ds-task-class-name: org.opends.server.tasks.ExportTask", |
| | | "ds-task-export-ldif-file: " + path, |
| | | "ds-task-export-ldif-file: " + exportLDIFAllFile, |
| | | "ds-task-export-backend-id: replicationChanges", |
| | | "ds-task-export-include-branch: dc=replicationChanges"); |
| | | } |
| | |
| | | throws Exception |
| | | { |
| | | String root = suffix.substring(suffix.indexOf('=')+1, suffix.indexOf(',')); |
| | | String path = "exportLDIF" + root +".ldif"; |
| | | exportLDIFDomainFile = "exportLDIF" + root +".ldif"; |
| | | return TestCaseUtils.makeEntry( |
| | | "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | | "objectclass: ds-task-export", |
| | | "ds-task-class-name: org.opends.server.tasks.ExportTask", |
| | | "ds-task-export-ldif-file: " + path, |
| | | "ds-task-export-ldif-file: " + exportLDIFDomainFile, |
| | | "ds-task-export-backend-id: replicationChanges", |
| | | "ds-task-export-include-branch: "+suffix+",dc=replicationChanges"); |
| | | } |
| | |
| | | finally |
| | | { |
| | | if (changelogs[0] != null) |
| | | { |
| | | changelogs[0].remove(); |
| | | StaticUtils.recursiveDelete |
| | | (new File(DirectoryServer.getInstanceRoot(), |
| | | changelogs[0].getDbDirName())); |
| | | } |
| | | if (changelogs[1] != null) |
| | | { |
| | | changelogs[1].remove(); |
| | | StaticUtils.recursiveDelete |
| | | (new File(DirectoryServer.getInstanceRoot(), |
| | | changelogs[1].getDbDirName())); |
| | | } |
| | | if (broker1 != null) |
| | | broker1.stop(); |
| | | if (broker2 != null) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.service; |
| | | |
| | | import java.io.File; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.List; |
| | |
| | | import java.util.concurrent.BlockingQueue; |
| | | import java.util.concurrent.TimeUnit; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.common.DSInfo; |
| | | import org.opends.server.replication.common.RSInfo; |
| | |
| | | import org.opends.server.replication.protocol.UpdateMsg; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | |
| | | domain2.stopDomain(); |
| | | |
| | | if (replServer1 != null) |
| | | { |
| | | replServer1.remove(); |
| | | |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer1.getDbDirName())); |
| | | } |
| | | if (replServer2 != null) |
| | | { |
| | | replServer2.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer2.getDbDirName())); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | domain1.disableService(); |
| | | |
| | | if (replServer1 != null) |
| | | { |
| | | replServer1.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer1.getDbDirName())); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | domain2.disableService(); |
| | | |
| | | if (replServer != null) |
| | | { |
| | | replServer.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer.getDbDirName())); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | domain2.disableService(); |
| | | |
| | | if (replServer1 != null) |
| | | { |
| | | replServer1.remove(); |
| | | |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer1.getDbDirName())); |
| | | } |
| | | if (replServer2 != null) |
| | | { |
| | | replServer2.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer2.getDbDirName())); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | domain1.disableService(); |
| | | |
| | | if (replServer != null) |
| | | { |
| | | replServer.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer.getDbDirName())); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | domain1.disableService(); |
| | | |
| | | if (replServer != null) |
| | | { |
| | | replServer.remove(); |
| | | StaticUtils.recursiveDelete(new File(DirectoryServer.getInstanceRoot(), |
| | | replServer.getDbDirName())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | TestCaseUtils.enableBackend("unindexedRoot"); |
| | | |
| | | TestCaseUtils.dsconfig( |
| | | "set-sasl-mechanism-handler-prop", |
| | | "--handler-name", "DIGEST-MD5", |
| | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("dc=unindexed,dc=jeb")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | TestCaseUtils.disableBackend("unindexedRoot"); |
| | | |
| | | } |
| | | |
| | | |