Fixed test errors related to HostPort not able to parse "Not connected"
Removed code duplication and removed unused parameters
| | |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | |
| | | import org.forgerock.opendj.ldap.requests.Requests; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.server.config.server.ReplicationDomainCfg; |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | import org.opends.server.replication.service.ReplicationBroker; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.HostPort; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.util.TestTimer; |
| | |
| | | protected Entry synchroServerEntry; |
| | | protected Entry replServerEntry; |
| | | |
| | | private static final String REPLICATION_DB_IMPL_PROPERTY = "org.opends.test.replicationDbImpl"; |
| | | |
| | | /** Replication monitor stats. */ |
| | | private DN monitorDN; |
| | | private String monitorAttr; |
| | |
| | | int serverId, int windowSize, int port, int timeout, |
| | | long generationId) throws Exception |
| | | { |
| | | DomainFakeCfg config = newFakeCfg(baseDN, serverId, port); |
| | | final DomainFakeCfg config = newFakeCfg(baseDN, serverId, port); |
| | | config.setWindowSize(windowSize); |
| | | return openReplicationSession(config, port, timeout, generationId); |
| | | } |
| | | |
| | | protected ReplicationBroker openReplicationSession(ReplicationDomainCfg config, |
| | | int port, int timeout, long generationId) throws Exception |
| | | { |
| | | final ReplicationBroker broker = new ReplicationBroker( |
| | | new DummyReplicationDomain(generationId), new ServerState(), |
| | | config, getReplSessionSecurity()); |
| | | connect(broker, port, timeout); |
| | | connect(broker, timeout); |
| | | return broker; |
| | | } |
| | | |
| | |
| | | return fakeCfg; |
| | | } |
| | | |
| | | protected void connect(ReplicationBroker broker, int port, int timeout) throws Exception |
| | | protected void connect(ReplicationBroker broker, int timeout) throws Exception |
| | | { |
| | | broker.start(); |
| | | // give some time to the broker to connect to the replicationServer. |
| | | checkConnection(30, broker, port); |
| | | checkConnection(30, broker); |
| | | |
| | | if (timeout != 0) |
| | | { |
| | |
| | | * Check connection of the provided ds to the replication server. Waits for connection to be ok up |
| | | * to secTimeout seconds before failing. |
| | | */ |
| | | protected void checkConnection(int secTimeout, final ReplicationBroker rb, int rsPort) throws Exception |
| | | protected void checkConnection(int secTimeout, final ReplicationBroker rb) throws Exception |
| | | { |
| | | TestTimer timer = new TestTimer.Builder() |
| | | .maxSleep(secTimeout, SECONDS) |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | protected void waitConnected(int dsId, int rsId, int rsPort, LDAPReplicationDomain rd, String msg) throws InterruptedException |
| | | { |
| | | final int secTimeout = 30; |
| | | int nSec = 0; |
| | | |
| | | // Go out of the loop only if connection is verified or if timeout occurs |
| | | while (true) |
| | | { |
| | | boolean connected = rd.isConnected(); |
| | | int rdPort = -1; |
| | | boolean rightPort = false; |
| | | if (connected) |
| | | { |
| | | String rsUrl = rd.getReplicationServer(); |
| | | try { |
| | | rdPort = HostPort.valueOf(rsUrl).getPort(); |
| | | rightPort = rdPort == rsPort; |
| | | } |
| | | catch (IllegalArgumentException notConnectedYet) |
| | | { |
| | | // wait a bit more |
| | | } |
| | | } |
| | | if (connected && rightPort) |
| | | { |
| | | // Connection verified |
| | | String s = "checkConnection: connection from domain " + dsId |
| | | + " to replication server " + rsId + " obtained after " + nSec + " seconds."; |
| | | logger.error(LocalizableMessage.raw(s)); |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("*** TEST *** " + s); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | Thread.sleep(1000); |
| | | nSec++; |
| | | |
| | | if (nSec > secTimeout) |
| | | { |
| | | // Timeout reached, end with error |
| | | fail("checkConnection: could not verify connection from domain " + dsId |
| | | + " to replication server " + rsId + " after " + secTimeout + " seconds." |
| | | + " Domain connected: " + connected + ", connection port: " + rdPort |
| | | + " (should be: " + rsPort + "). [" + msg + "]"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.HostPort; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | |
| | | * replication server. Waits for connection to be ok up to secTimeout seconds |
| | | * before failing. |
| | | */ |
| | | private void checkConnection(int secTimeout, int dsId, int rsId, String msg) |
| | | throws Exception |
| | | private void checkConnection(int dsId, int rsId, String msg) throws Exception |
| | | { |
| | | |
| | | int rsPort = -1; |
| | |
| | | fail("Unknown replication server id."); |
| | | } |
| | | |
| | | int nSec = 0; |
| | | |
| | | // Go out of the loop only if connection is verified or if timeout occurs |
| | | while (true) |
| | | { |
| | | // Test connection |
| | | boolean connected = rd.isConnected(); |
| | | int rdPort = -1; |
| | | boolean rightPort = false; |
| | | if (connected) |
| | | { |
| | | String serverStr = rd.getReplicationServer(); |
| | | rdPort = HostPort.valueOf(serverStr).getPort(); |
| | | if (rdPort == rsPort) |
| | | { |
| | | rightPort = true; |
| | | } |
| | | } |
| | | if (connected && rightPort) |
| | | { |
| | | // Connection verified |
| | | debugInfo("checkConnection: connection from domain " + dsId + " to" + |
| | | " replication server " + rsId + " obtained after " |
| | | + nSec + " seconds."); |
| | | return; |
| | | } |
| | | |
| | | // Sleep 1 second |
| | | Thread.sleep(1000); |
| | | nSec++; |
| | | |
| | | if (nSec > secTimeout) |
| | | { |
| | | // Timeout reached, end with error |
| | | fail("checkConnection: could not verify connection from domain " + dsId |
| | | + " to replication server " + rsId + " after " + secTimeout + " seconds." |
| | | + " Domain connected: " + connected + ", connection port: " + rdPort |
| | | + " (should be: " + rsPort + "). [" + msg + "]"); |
| | | } |
| | | } |
| | | waitConnected(dsId, rsId, rsPort, rd, msg); |
| | | } |
| | | |
| | | /** |
| | | * Find needed free TCP ports. |
| | | */ |
| | | /** Find needed free TCP ports. */ |
| | | private void findFreePorts() throws IOException |
| | | { |
| | | int[] ports = TestCaseUtils.findFreePorts(3); |
| | |
| | | |
| | | try |
| | | { |
| | | |
| | | /** |
| | | * Start RS1 with GID=1 and RS2 with GID=2 |
| | | */ |
| | |
| | | */ |
| | | // Start DS1 |
| | | rd1 = createReplicationDomain(DS1_ID, 2, testCase); |
| | | checkConnection(30, DS1_ID, RS2_ID, |
| | | "Start DS1 with GID=2, should connect to RS2 with GID=2"); |
| | | checkConnection(DS1_ID, RS2_ID, "Start DS1 with GID=2, should connect to RS2 with GID=2"); |
| | | |
| | | /** |
| | | * Start DS2 with GID=3, should connect to either RS1 or RS2 (no GID=3 |
| | |
| | | rs3 = createReplicationServer(RS3_ID, 3, testCase); |
| | | // Sleep to insure start is done and DS2 has time to detect to server |
| | | // arrival and reconnect |
| | | checkConnection(30, DS2_ID, RS3_ID, |
| | | "Start RS3 with GID=3, DS2 with GID=3 should detect server with his GID and connect to RS3"); |
| | | checkConnection(DS2_ID, RS3_ID, |
| | | "Start RS3 with GID=3, DS2 with GID=3 should detect server with his GID and connect to RS3"); |
| | | |
| | | |
| | | /** |
| | |
| | | // Simulate RS3 failure |
| | | rs3.remove(); |
| | | // Sleep to insure shutdowns are ok and DS1 and DS2 reconnect to RS1 |
| | | checkConnection(30, DS1_ID, RS1_ID, |
| | | "Stop RS2 and RS3, DS1 should failover to RS1 with GID=1"); |
| | | checkConnection(30, DS2_ID, RS1_ID, |
| | | "Stop RS2 and RS3, DS2 should failover to RS1 with GID=1"); |
| | | checkConnection(DS1_ID, RS1_ID, "Stop RS2 and RS3, DS1 should failover to RS1 with GID=1"); |
| | | checkConnection(DS2_ID, RS1_ID, "Stop RS2 and RS3, DS2 should failover to RS1 with GID=1"); |
| | | |
| | | /** |
| | | * Restart RS2 and RS3, DS1 should reconnect to RS2 (with GID=2, his GID) |
| | |
| | | rs3 = createReplicationServer(RS3_ID, 3, testCase); |
| | | // Sleep to insure restarts are ok and DS1 and DS2 reconnect to the RS with |
| | | // their group id |
| | | checkConnection(30, DS1_ID, RS2_ID, |
| | | "Restart RS2 and RS3, DS1 should reconnect to RS2 (with GID=2, his GID)"); |
| | | checkConnection(30, DS2_ID, RS3_ID, |
| | | "Restart RS2 and RS3, DS2 should reconnect to RS3 (with GID=3, his GID)"); |
| | | checkConnection(DS1_ID, RS2_ID, "Restart RS2 and RS3, DS1 should reconnect to RS2 (with GID=2, his GID)"); |
| | | checkConnection(DS2_ID, RS3_ID, "Restart RS2 and RS3, DS2 should reconnect to RS3 (with GID=3, his GID)"); |
| | | |
| | | // |
| | | // ENTERING CHANGE CONFIG TEST PART |
| | |
| | | rd1.applyConfigurationChange(domainConfWithNewGid); |
| | | domainConfWithNewGid = new DomainFakeCfg(baseDn, DS2_ID, replServers, 1); |
| | | rd2.applyConfigurationChange(domainConfWithNewGid); |
| | | checkConnection(30, DS1_ID, RS1_ID, |
| | | "Change GID of DS1 to 1, it should reconnect to RS1 with GID=1"); |
| | | checkConnection(30, DS2_ID, RS1_ID, |
| | | "Change GID of DS2 to 1, it should reconnect to RS1 with GID=1"); |
| | | checkConnection(DS1_ID, RS1_ID, "Change GID of DS1 to 1, it should reconnect to RS1 with GID=1"); |
| | | checkConnection(DS2_ID, RS1_ID, "Change GID of DS2 to 1, it should reconnect to RS1 with GID=1"); |
| | | |
| | | /** |
| | | * Change group id of RS3 to 1 |
| | |
| | | rsConfWithNewGid = |
| | | new ReplServerFakeConfiguration(rs1Port, dir, 0, RS1_ID, 0, 100, otherReplServers, 3, 1000, 5000); |
| | | rs1.applyConfigurationChange(rsConfWithNewGid); |
| | | checkConnection(30, DS1_ID, RS3_ID, |
| | | "Change GID of RS3 to 1 and RS1 to 3, DS1 should reconnect to RS3 with GID=1"); |
| | | checkConnection(30, DS2_ID, RS3_ID, |
| | | "Change GID of RS3 to 1 and RS1 to 3, DS2 should reconnect to RS3 with GID=1"); |
| | | checkConnection(DS1_ID, RS3_ID, "Change GID of RS3 to 1 and RS1 to 3, DS1 should reconnect to RS3 with GID=1"); |
| | | checkConnection(DS2_ID, RS3_ID, "Change GID of RS3 to 1 and RS1 to 3, DS2 should reconnect to RS3 with GID=1"); |
| | | |
| | | /** |
| | | * Change group id of DS1 and DS2 to 3 : they should reconnect to RS1 |
| | |
| | | rd1.applyConfigurationChange(domainConfWithNewGid); |
| | | domainConfWithNewGid = new DomainFakeCfg(baseDn, DS2_ID, replServers, 3); |
| | | rd2.applyConfigurationChange(domainConfWithNewGid); |
| | | checkConnection(30, DS1_ID, RS1_ID, |
| | | "Change GID of DS1 to 3, it should reconnect to RS1 with GID=3"); |
| | | checkConnection(30, DS2_ID, RS1_ID, |
| | | "Change GID of DS2 to 3, it should reconnect to RS1 with GID=3"); |
| | | |
| | | } finally |
| | | checkConnection(DS1_ID, RS1_ID, "Change GID of DS1 to 3, it should reconnect to RS1 with GID=3"); |
| | | checkConnection(DS2_ID, RS1_ID, "Change GID of DS2 to 3, it should reconnect to RS1 with GID=3"); |
| | | } |
| | | finally |
| | | { |
| | | endTest(); |
| | | } |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.HostPort; |
| | | import org.testng.annotations.Test; |
| | | |
| | |
| | | // Let time for failover to happen |
| | | // DS1 connected to RS2 ? |
| | | msg = "After " + RS1_ID + " failure"; |
| | | checkConnection(30, DS1_ID, RS2_ID, msg); |
| | | checkConnection(DS1_ID, RS2_ID, msg); |
| | | } |
| | | else if (rsPort == rs2Port) |
| | | { // Simulate RS2 failure |
| | |
| | | rs2.remove(); |
| | | // DS1 connected to RS1 ? |
| | | msg = "After " + RS2_ID + " failure"; |
| | | checkConnection(30, DS1_ID, RS1_ID, msg); |
| | | checkConnection(DS1_ID, RS1_ID, msg); |
| | | } |
| | | else { |
| | | fail("DS1 is not connected to a RS"); |
| | |
| | | |
| | | // DS1 connected to RS2 ? |
| | | String msg = "After " + RS1_ID + " failure"; |
| | | checkConnection(30, DS1_ID, RS2_ID, msg); |
| | | checkConnection(DS1_ID, RS2_ID, msg); |
| | | // DS2 connected to RS2 ? |
| | | checkConnection(30, DS2_ID, RS2_ID, msg); |
| | | checkConnection(DS2_ID, RS2_ID, msg); |
| | | |
| | | // Restart RS1 |
| | | rs1 = createReplicationServer(RS1_ID, testCase); |
| | | |
| | | // DS1 connected to RS2 ? |
| | | msg = "Before " + RS2_ID + " failure"; |
| | | checkConnection(30, DS1_ID, RS2_ID, msg); |
| | | checkConnection(DS1_ID, RS2_ID, msg); |
| | | // DS2 connected to RS2 ? |
| | | checkConnection(30, DS2_ID, RS2_ID, msg); |
| | | checkConnection(DS2_ID, RS2_ID, msg); |
| | | |
| | | // Simulate RS2 failure |
| | | rs2.remove(); |
| | | |
| | | // DS1 connected to RS1 ? |
| | | msg = "After " + RS2_ID + " failure"; |
| | | checkConnection(30, DS1_ID, RS1_ID, msg); |
| | | checkConnection(DS1_ID, RS1_ID, msg); |
| | | // DS2 connected to RS1 ? |
| | | checkConnection(30, DS2_ID, RS1_ID, msg); |
| | | checkConnection(DS2_ID, RS1_ID, msg); |
| | | |
| | | // Restart RS2 |
| | | rs2 = createReplicationServer(RS2_ID, testCase); |
| | | |
| | | // DS1 connected to RS1 ? |
| | | msg = "After " + RS2_ID + " restart"; |
| | | checkConnection(30, DS1_ID, RS1_ID, msg); |
| | | checkConnection(DS1_ID, RS1_ID, msg); |
| | | // DS2 connected to RS1 ? |
| | | checkConnection(30, DS2_ID, RS1_ID, msg); |
| | | checkConnection(DS2_ID, RS1_ID, msg); |
| | | |
| | | debugInfo(testCase + " successfully ended."); |
| | | } finally |
| | |
| | | * replication server. Waits for connection to be ok up to secTimeout seconds |
| | | * before failing. |
| | | */ |
| | | private void checkConnection(int secTimeout, int dsId, int rsId, String msg) |
| | | private void checkConnection(int dsId, int rsId, String msg) |
| | | throws Exception |
| | | { |
| | | LDAPReplicationDomain rd = null; |
| | |
| | | fail("Unknown replication server id."); |
| | | } |
| | | |
| | | int nSec = 0; |
| | | |
| | | // Go out of the loop only if connection is verified or if timeout occurs |
| | | while (true) |
| | | { |
| | | // Test connection |
| | | boolean connected = rd.isConnected(); |
| | | int rdPort = -1; |
| | | boolean rightPort = false; |
| | | if (connected) |
| | | { |
| | | String serverStr = rd.getReplicationServer(); |
| | | rdPort = HostPort.valueOf(serverStr).getPort(); |
| | | if (rdPort == rsPort) |
| | | { |
| | | rightPort = true; |
| | | } |
| | | } |
| | | if (connected && rightPort) |
| | | { |
| | | // Connection verified |
| | | debugInfo("checkConnection: connection from domain " + dsId + " to" + |
| | | " replication server " + rsId + " obtained after " |
| | | + nSec + " seconds."); |
| | | return; |
| | | } |
| | | |
| | | // Sleep 1 second |
| | | Thread.sleep(1000); |
| | | nSec++; |
| | | |
| | | if (nSec > secTimeout) |
| | | { |
| | | // Timeout reached, end with error |
| | | fail("checkConnection: could not verify connection from domain " + dsId |
| | | + " to replication server " + rsId + " after " + secTimeout + " seconds." |
| | | + " Domain connected: " + connected + ", connection port: " + rdPort |
| | | + " (should be: " + rsPort + "). [" + msg + "]"); |
| | | } |
| | | } |
| | | waitConnected(dsId, rsId, rsPort, rd, msg); |
| | | } |
| | | |
| | | /** |
| | | * Find needed free TCP ports. |
| | | */ |
| | | /** Find needed free TCP ports. */ |
| | | private void findFreePorts() throws IOException |
| | | { |
| | | int[] ports = TestCaseUtils.findFreePorts(2); |
| | |
| | | ReplicationBroker broker = new ReplicationBroker( |
| | | new DummyReplicationDomain(generationId), state, fakeCfg, security); |
| | | broker.start(); |
| | | checkConnection(30, broker, rs1Port); |
| | | checkConnection(30, broker); |
| | | return broker; |
| | | } |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.meta.ReplicationDomainCfgDefn.AssuredType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.common.AssuredMode; |
| | | import org.opends.server.replication.common.DSInfo; |
| | |
| | | import org.opends.server.replication.protocol.ProtocolVersion; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.HostPort; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | |
| | | * replication server. Waits for connection to be ok up to secTimeout seconds |
| | | * before failing. |
| | | */ |
| | | private void checkConnection(int secTimeout, int dsId, int rsId) |
| | | throws Exception |
| | | private void checkConnection(int dsId, int rsId) throws Exception |
| | | { |
| | | int rsPort = -1; |
| | | LDAPReplicationDomain rd = null; |
| | |
| | | fail("Unknown replication server id."); |
| | | } |
| | | |
| | | int nSec = 0; |
| | | |
| | | // Go out of the loop only if connection is verified or if timeout occurs |
| | | while (true) |
| | | { |
| | | // Test connection |
| | | boolean connected = rd.isConnected(); |
| | | int rdPort = -1; |
| | | boolean rightPort = false; |
| | | if (connected) |
| | | { |
| | | String serverStr = rd.getReplicationServer(); |
| | | rdPort = HostPort.valueOf(serverStr).getPort(); |
| | | if (rdPort == rsPort) |
| | | { |
| | | rightPort = true; |
| | | } |
| | | } |
| | | if (connected && rightPort) |
| | | { |
| | | // Connection verified |
| | | debugInfo("checkConnection: connection from domain " + dsId + " to" + |
| | | " replication server " + rsId + " obtained after " |
| | | + nSec + " seconds."); |
| | | return; |
| | | } |
| | | |
| | | // Sleep 1 second |
| | | Thread.sleep(1000); |
| | | nSec++; |
| | | |
| | | if (nSec > secTimeout) |
| | | { |
| | | // Timeout reached, end with error |
| | | fail("checkConnection: could not verify connection from domain " + dsId |
| | | + " to replication server " + rsId + " after " + secTimeout + " seconds." |
| | | + " Domain connected: " + connected + ", connection port: " + rdPort |
| | | + " (should be: " + rsPort + ")"); |
| | | } |
| | | } |
| | | waitConnected(dsId, rsId, rsPort, rd, ""); |
| | | } |
| | | |
| | | /** |
| | | * Find needed free TCP ports. |
| | | */ |
| | | /** Find needed free TCP ports. */ |
| | | private void findFreePorts() throws Exception |
| | | { |
| | | int[] ports = TestCaseUtils.findFreePorts(3); |
| | |
| | | */ |
| | | debugInfo("*** STEP 1 ***"); |
| | | rd1 = createReplicationDomain(DS1_ID); |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_1); |
| | | checkTopoView(new int[] {DS1_ID}, theoricalTopoView); |
| | | |
| | |
| | | debugInfo("*** STEP 2 ***"); |
| | | rd2 = createReplicationDomain(DS2_ID); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_2); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID}, theoricalTopoView); |
| | | |
| | |
| | | debugInfo("*** STEP 3 ***"); |
| | | rs2 = createReplicationServer(RS2_ID, testCase); |
| | | Thread.sleep(1000); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_3); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID}, theoricalTopoView); |
| | | |
| | |
| | | debugInfo("*** STEP 4 ***"); |
| | | rd3 = createReplicationDomain(DS3_ID); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_4); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID}, theoricalTopoView); |
| | | |
| | |
| | | debugInfo("*** STEP 5 ***"); |
| | | rd4 = createReplicationDomain(DS4_ID); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(30, DS4_ID, RS2_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | checkConnection(DS4_ID, RS2_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_5); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID, DS4_ID}, |
| | | theoricalTopoView); |
| | |
| | | debugInfo("*** STEP 6 ***"); |
| | | rd5 = createReplicationDomain(DS5_ID); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(30, DS4_ID, RS2_ID); |
| | | checkConnection(30, DS5_ID, RS2_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | checkConnection(DS4_ID, RS2_ID); |
| | | checkConnection(DS5_ID, RS2_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_6); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID, DS4_ID, DS5_ID}, |
| | | theoricalTopoView); |
| | |
| | | debugInfo("*** STEP 7 ***"); |
| | | rs3 = createReplicationServer(RS3_ID, testCase); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(30, DS4_ID, RS2_ID); |
| | | checkConnection(30, DS5_ID, RS3_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | checkConnection(DS4_ID, RS2_ID); |
| | | checkConnection(DS5_ID, RS3_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_7); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID, DS4_ID, DS5_ID}, |
| | | theoricalTopoView); |
| | |
| | | debugInfo("*** STEP 8 ***"); |
| | | rd6 = createReplicationDomain(DS6_ID); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(30, DS4_ID, RS2_ID); |
| | | checkConnection(30, DS5_ID, RS3_ID); |
| | | checkConnection(30, DS6_ID, RS3_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | checkConnection(DS4_ID, RS2_ID); |
| | | checkConnection(DS5_ID, RS3_ID); |
| | | checkConnection(DS6_ID, RS3_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_8); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID, DS4_ID, DS5_ID, DS6_ID}, |
| | | theoricalTopoView); |
| | |
| | | debugInfo("*** STEP 9 ***"); |
| | | rd6.disable(); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(30, DS4_ID, RS2_ID); |
| | | checkConnection(30, DS5_ID, RS3_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | checkConnection(DS4_ID, RS2_ID); |
| | | checkConnection(DS5_ID, RS3_ID); |
| | | assertFalse(rd6.isConnected()); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_9); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID, DS4_ID, DS5_ID}, |
| | |
| | | debugInfo("*** STEP 10 ***"); |
| | | rd6.enable(); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(30, DS4_ID, RS2_ID); |
| | | checkConnection(30, DS5_ID, RS3_ID); |
| | | checkConnection(30, DS6_ID, RS3_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | checkConnection(DS4_ID, RS2_ID); |
| | | checkConnection(DS5_ID, RS3_ID); |
| | | checkConnection(DS6_ID, RS3_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_10); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID, DS4_ID, DS5_ID, DS6_ID}, |
| | | theoricalTopoView); |
| | |
| | | debugInfo("*** STEP 11 ***"); |
| | | rs3.remove(); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(30, DS4_ID, RS2_ID); |
| | | checkConnection(30, DS5_ID, RS2_ID); |
| | | checkConnection(30, DS6_ID, RS2_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | checkConnection(DS4_ID, RS2_ID); |
| | | checkConnection(DS5_ID, RS2_ID); |
| | | checkConnection(DS6_ID, RS2_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_11); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID, DS4_ID, DS5_ID, DS6_ID}, |
| | | theoricalTopoView); |
| | |
| | | debugInfo("*** STEP 12 ***"); |
| | | rs3 = createReplicationServer(RS3_ID, testCase); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS3_ID, RS2_ID); |
| | | checkConnection(30, DS4_ID, RS2_ID); |
| | | checkConnection(30, DS5_ID, RS3_ID); |
| | | checkConnection(30, DS6_ID, RS3_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS3_ID, RS2_ID); |
| | | checkConnection(DS4_ID, RS2_ID); |
| | | checkConnection(DS5_ID, RS3_ID); |
| | | checkConnection(DS6_ID, RS3_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_12); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS3_ID, DS4_ID, DS5_ID, DS6_ID}, |
| | | theoricalTopoView); |
| | |
| | | debugInfo("*** STEP 13 ***"); |
| | | rs2.remove(); |
| | | Thread.sleep(500); // Let time to topo msgs being propagated through the network |
| | | checkConnection(30, DS1_ID, RS1_ID); |
| | | checkConnection(30, DS2_ID, RS1_ID); |
| | | checkConnection(30, DS5_ID, RS3_ID); |
| | | checkConnection(30, DS6_ID, RS3_ID); |
| | | checkConnection(DS1_ID, RS1_ID); |
| | | checkConnection(DS2_ID, RS1_ID); |
| | | checkConnection(DS5_ID, RS3_ID); |
| | | checkConnection(DS6_ID, RS3_ID); |
| | | theoricalTopoView = createTheoreticalTopoViewForStep(STEP_13); |
| | | checkTopoView(new int[] {DS1_ID, DS2_ID, DS5_ID, DS6_ID}, |
| | | theoricalTopoView); |
| | |
| | | import org.assertj.core.api.Assertions; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.SynchronizationProvider; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.replication.service.ReplicationBroker; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryConfig; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.HostPort; |
| | | import org.opends.server.types.Modification; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendModifyDNOperation; |
| | | import org.testng.annotations.AfterClass; |
| | |
| | | broker = new ReplicationBroker(new DummyReplicationDomain(generationId), |
| | | state, newFakeCfg(TEST_ROOT_DN, 3, replicationServerPort), |
| | | getReplSessionSecurity()); |
| | | connect(broker, replicationServerPort, 5000); |
| | | connect(broker, 5000); |
| | | |
| | | ReplicationMsg receivedMsg = broker.receive(); |
| | | broker.updateWindowAfterReplay(); |