| | |
| | | |
| | | // Test with a mix of domains, a mix of DSes |
| | | ECLTwoDomains(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, dependsOnMethods = { "ECLReplicationServerTest"}) |
| | |
| | | |
| | | // Test ECL after changelog triming |
| | | ECLAfterChangelogTrim(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, dependsOnMethods = { "ECLReplicationServerTest"}) |
| | |
| | | public void ECLReplicationServerTest4() |
| | | { |
| | | ECLIncludeAttributes(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, dependsOnMethods = { "ECLReplicationServerTest"}) |
| | |
| | | { |
| | | |
| | | ChangeTimeHeartbeatTest(); |
| | | replicationServer.clearDb(); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | // Test that private backend is excluded from ECL |
| | | ECLOnPrivateBackend(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, groups="slow", dependsOnMethods = { "ECLReplicationServerTest"}) |
| | |
| | | { |
| | | // Test remote API (ECL through replication protocol) with empty ECL |
| | | ECLRemoteEmpty(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, groups="slow", dependsOnMethods = { "ECLReplicationServerTest"}) |
| | |
| | | { |
| | | // Test with empty changelog |
| | | ECLEmpty(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, groups="slow", dependsOnMethods = { "ECLReplicationServerTest"}) |
| | |
| | | { |
| | | // Test remote API (ECL through replication protocol) with NON empty ECL |
| | | ECLRemoteNonEmpty(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, groups="slow", dependsOnMethods = { "ECLReplicationServerTest"}) |
| | | public void ECLReplicationServerFullTest5() |
| | | { |
| | | // Test with a mix of domains, a mix of DSes |
| | | ECLTwoDomains(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, groups="slow", dependsOnMethods = { "ECLReplicationServerTest"}) |
| | | public void ECLReplicationServerFullTest6() |
| | | { |
| | | // Test ECL after changelog triming |
| | | ECLAfterChangelogTrim(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, groups="slow", dependsOnMethods = { "ECLReplicationServerTest"}) |
| | | public void ECLReplicationServerFullTest7() |
| | |
| | | { |
| | | // Simultaneous psearches |
| | | ECLSimultaneousPsearches(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, groups="slow", dependsOnMethods = { "ECLReplicationServerTest"}) |
| | |
| | | // Test directly from the java obect that the changeTimeHeartbeatState |
| | | // stored are ok. |
| | | ChangeTimeHeartbeatTest(); |
| | | replicationServer.clearDb(); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | // Test Filter on replication csn |
| | | // TODO: test with optimization when code done. |
| | | ECLFilterOnReplicationCsn();replicationServer.clearDb(); |
| | | ECLFilterOnReplicationCsn(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | |
| | | @Test(enabled=true, groups="slow", dependsOnMethods = { "ECLReplicationServerTest"}) |
| | | public void ECLReplicationServerFullTest17() |
| | | { |
| | | // Test simultaneous persistent searches in draft compat mode. |
| | | ECLSimultaneousPsearches();replicationServer.clearDb(); |
| | | |
| | | } |
| | | |
| | | private void ECLIsNotASupportedSuffix() |
| | | { |
| | |
| | | assertTrue(msg instanceof DoneMsg, |
| | | "Ending " + tn + " with incorrect message type :" + |
| | | msg.getClass().getCanonicalName()); |
| | | |
| | | server1.stop(); |
| | | server2.stop(); |
| | | server3.stop(); |
| | | debugInfo(tn, "Ending test successfully\n\n"); |
| | | } |
| | | catch(Exception e) |
| | |
| | | fail("Ending test " + tn + " with exception:" |
| | | + stackTraceToSingleLineString(e)); |
| | | } |
| | | finally |
| | | { |
| | | if (server1 != null) |
| | | server1.stop(); |
| | | if (server2 != null) |
| | | server2.stop(); |
| | | if (server3 != null) |
| | | server3.stop(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | } |
| | | |
| | | //======================================================= |
| | |
| | | debugInfo(tn, "RESULT:" + msg); |
| | | assertTrue(msg instanceof DoneMsg, "RESULT:" + msg); |
| | | |
| | | // clean |
| | | serverECL.stop(); |
| | | server01.stop(); |
| | | server02.stop(); |
| | | debugInfo(tn, "Ending test successfully"); |
| | | } |
| | | catch(Exception e) |
| | |
| | | fail("Ending test " + tn + " with exception:" |
| | | + stackTraceToSingleLineString(e)); |
| | | } |
| | | finally |
| | | { |
| | | // clean |
| | | if (serverECL != null) |
| | | serverECL.stop(); |
| | | if (server01 != null) |
| | | server01.stop(); |
| | | if (server02 != null) |
| | | server02.stop(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | String tn = "ECLEmpty"; |
| | | debugInfo(tn, "Starting test\n\n"); |
| | | |
| | | replicationServer.clearDb(); |
| | | |
| | | try |
| | | { |
| | | // search on 'cn=changelog' |
| | |
| | | ExternalChangelogRequestControl control = |
| | | new ExternalChangelogRequestControl(true, |
| | | new MultiDomainServerState(cookie)); |
| | | ArrayList<Control> controls = new ArrayList<Control>(0); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | controls.add(control); |
| | | return controls; |
| | | } |
| | |
| | | { |
| | | String tn = "ECLOnPrivateBackend"; |
| | | debugInfo(tn, "Starting test"); |
| | | |
| | | replicationServer.clearDb(); |
| | | |
| | | ReplicationBroker server01 = null; |
| | | LDAPReplicationDomain domain2 = null; |
| | | Backend backend2 = null; |
| | | DN baseDn2 = null; |
| | | try |
| | | { |
| | | ReplicationBroker server01 = openReplicationSession( |
| | | baseDn2 = DN.decode(TEST_ROOT_DN_STRING2); |
| | | |
| | | server01 = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING), 1201, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true); |
| | |
| | | // Initialize a second test backend o=test2, in addtion to o=test |
| | | // Configure replication on this backend |
| | | // Add the root entry in the backend |
| | | Backend backend2 = initializeTestBackend(false, TEST_ROOT_DN_STRING2, |
| | | backend2 = initializeTestBackend(false, TEST_ROOT_DN_STRING2, |
| | | TEST_BACKEND_ID2); |
| | | backend2.setPrivateBackend(true); |
| | | DN baseDn2 = DN.decode(TEST_ROOT_DN_STRING2); |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | replServers.add("localhost:"+replicationServerPort); |
| | | |
| | |
| | | ExternalChangelogDomainFakeCfg eclCfg = |
| | | new ExternalChangelogDomainFakeCfg(true, null, null); |
| | | domainConf.setExternalChangelogDomain(eclCfg); |
| | | LDAPReplicationDomain domain2 = |
| | | MultimasterReplication.createNewDomain(domainConf); |
| | | |
| | | domain2 = MultimasterReplication.createNewDomain(domainConf); |
| | | domain2.start(); |
| | | |
| | | sleep(1000); |
| | |
| | | " Expected last cookie attribute value:" + expectedLastCookie + |
| | | " Read from server: " + lastCookie + " are equal :"); |
| | | |
| | | // Cleaning |
| | | if (domain2 != null) |
| | | MultimasterReplication.deleteDomain(baseDn2); |
| | | removeTestBackend2(backend2); |
| | | |
| | | server01.stop(); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | fail("Ending test " + tn + " with exception:" |
| | | + stackTraceToSingleLineString(e)); |
| | | } |
| | | finally |
| | | { |
| | | // Cleaning |
| | | if (domain2 != null && baseDn2 != null) |
| | | MultimasterReplication.deleteDomain(baseDn2); |
| | | if (backend2 != null) |
| | | removeTestBackend2(backend2); |
| | | |
| | | if (server01 != null) |
| | | server01.stop(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | debugInfo(tn, "Ending test successfully"); |
| | | } |
| | | |
| | |
| | | String tn = "ECLTwoDomains"; |
| | | debugInfo(tn, "Starting test"); |
| | | |
| | | ReplicationBroker s1test = null; |
| | | ReplicationBroker s1test2 = null; |
| | | ReplicationBroker s2test = null; |
| | | ReplicationBroker s2test2 = null; |
| | | |
| | | try |
| | | { |
| | | // Initialize a second test backend |
| | |
| | | LDIFWriter ldifWriter = getLDIFWriter(); |
| | | |
| | | // -- |
| | | ReplicationBroker s1test = openReplicationSession( |
| | | s1test = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING), 1201, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true); |
| | | |
| | | ReplicationBroker s2test2 = openReplicationSession( |
| | | s2test2 = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING2), 1202, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true, EMPTY_DN_GENID); |
| | |
| | | // Test startState ("first cookie") of the ECL |
| | | // |
| | | // -- |
| | | ReplicationBroker s1test2 = openReplicationSession( |
| | | s1test2 = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING2), 1203, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true, EMPTY_DN_GENID); |
| | | |
| | | ReplicationBroker s2test = openReplicationSession( |
| | | s2test = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING), 1204, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true); |
| | |
| | | assertTrue(searchOp.getErrorMessage().toString().equalsIgnoreCase(expectedError), |
| | | "Expected: " + expectedError + "Server output:" + |
| | | searchOp.getErrorMessage().toString()); |
| | | s1test.stop(); |
| | | s1test2.stop(); |
| | | s2test.stop(); |
| | | s2test2.stop(); |
| | | sleep(500); |
| | | |
| | | // removeTestBackend2(backend2); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | fail("Ending test " + tn + "with exception:\n" |
| | | + stackTraceToSingleLineString(e)); |
| | | } |
| | | finally |
| | | { |
| | | if (s1test != null) |
| | | s1test.stop(); |
| | | if (s1test2 != null) |
| | | s1test2.stop(); |
| | | if (s2test != null) |
| | | s2test.stop(); |
| | | if (s2test2 != null) |
| | | s2test2.stop(); |
| | | replicationServer.clearDb(); |
| | | } |
| | | debugInfo(tn, "Ending test successfully"); |
| | | } |
| | | |
| | |
| | | String tn = "ECLAfterChangelogTrim"; |
| | | debugInfo(tn, "Starting test"); |
| | | |
| | | ReplicationBroker server01 = null; |
| | | ReplicationServerDomain d1 = null; |
| | | ReplicationServerDomain d2 = null; |
| | | |
| | | try |
| | | { |
| | | // --- |
| | | // 1. Populate the changelog and read the cookie |
| | | |
| | | // Creates broker on o=test |
| | | ReplicationBroker server01 = openReplicationSession( |
| | | server01 = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING), 1201, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true); |
| | |
| | | // --- |
| | | // 2. Now set up a very short purge delay on the replication changelogs |
| | | // so that this test can play with a trimmed changelog. |
| | | ReplicationServerDomain d1 = replicationServer.getReplicationServerDomain("o=test", false); |
| | | ReplicationServerDomain d2 = replicationServer.getReplicationServerDomain("o=test2", false); |
| | | d1 = replicationServer.getReplicationServerDomain("o=test", false); |
| | | d2 = replicationServer.getReplicationServerDomain("o=test2", false); |
| | | d1.setPurgeDelay(1); |
| | | d2.setPurgeDelay(1); |
| | | |
| | |
| | | .toString()), |
| | | searchOp.getErrorMessage().toString()); |
| | | |
| | | // Clean |
| | | server01.stop(); |
| | | |
| | | // And reset changelog purge delay for the other tests. |
| | | d1.setPurgeDelay(15 * 1000); |
| | | d2.setPurgeDelay(15 * 1000); |
| | | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | fail("Ending test " + tn + "with exception:\n" |
| | | + stackTraceToSingleLineString(e)); |
| | | } |
| | | finally |
| | | { |
| | | if (server01 != null) |
| | | server01.stop(); |
| | | // And reset changelog purge delay for the other tests. |
| | | if (d1 != null) |
| | | d1.setPurgeDelay(15 * 1000); |
| | | if (d2 != null) |
| | | d2.setPurgeDelay(15 * 1000); |
| | | |
| | | replicationServer.clearDb(); |
| | | } |
| | | debugInfo(tn, "Ending test successfully"); |
| | | } |
| | | |
| | |
| | | { |
| | | String tn = "ECLSimultaneousPsearches"; |
| | | debugInfo(tn, "Starting test \n\n"); |
| | | Socket s1, s2, s3 = null; |
| | | Socket s1 = null, s2 = null, s3 = null; |
| | | ReplicationBroker server01 = null; |
| | | ReplicationBroker server02 = null; |
| | | boolean compatMode = false; |
| | | boolean changesOnly = false; |
| | | |
| | |
| | | try |
| | | { |
| | | // Create broker on o=test |
| | | ReplicationBroker server01 = openReplicationSession( |
| | | server01 = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING), 1201, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true); |
| | |
| | | int ts = 1; |
| | | |
| | | // Create broker on o=test2 |
| | | ReplicationBroker server02 = openReplicationSession( |
| | | server02 = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING2), 1202, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true, EMPTY_DN_GENID); |
| | |
| | | } |
| | | } |
| | | debugInfo(tn, "Search 3 successfully receives additional changes"); |
| | | |
| | | server01.stop(); |
| | | server02.stop(); |
| | | |
| | | try { s1.close(); } catch (Exception e) {}; |
| | | try { s2.close(); } catch (Exception e) {}; |
| | | try { s3.close(); } catch (Exception e) {}; |
| | | |
| | | while (!s1.isClosed()) sleep(100); |
| | | while (!s2.isClosed()) sleep(100); |
| | | while (!s3.isClosed()) sleep(100); |
| | | } |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | fail("Test " + tn + " fails with " + stackTraceToSingleLineString(e)); |
| | | } |
| | | finally |
| | | { |
| | | if (server01 != null) |
| | | server01.stop(); |
| | | if (server02 != null) |
| | | server02.stop(); |
| | | |
| | | if (s1 != null) |
| | | { |
| | | try { s1.close(); } catch (Exception ignored) {}; |
| | | while (!s1.isClosed()) sleep(100); |
| | | } |
| | | if (s2 != null) |
| | | { |
| | | try { s2.close(); } catch (Exception e) {}; |
| | | while (!s2.isClosed()) sleep(100); |
| | | } |
| | | if (s3 != null) |
| | | { |
| | | try { s3.close(); } catch (Exception e) {}; |
| | | while (!s3.isClosed()) sleep(100); |
| | | } |
| | | replicationServer.clearDb(); |
| | | } |
| | | debugInfo(tn, "Ends test successfully"); |
| | | } |
| | | |
| | |
| | | { |
| | | String tn = "ChangeTimeHeartbeatTest"; |
| | | debugInfo(tn, "Starting test"); |
| | | ReplicationBroker s1test = null; |
| | | ReplicationBroker s2test = null; |
| | | ReplicationBroker s1test2 = null; |
| | | ReplicationBroker s2test2 = null; |
| | | |
| | | // Initialize a second test backend |
| | | Backend backend2 = null; |
| | | |
| | | try |
| | | { |
| | | // Initialize a second test backend |
| | | Backend backend2 = initializeTestBackend(true, TEST_ROOT_DN_STRING2, |
| | | backend2 = initializeTestBackend(true, TEST_ROOT_DN_STRING2, |
| | | TEST_BACKEND_ID2); |
| | | |
| | | |
| | | // -- |
| | | ReplicationBroker s1test = openReplicationSession( |
| | | s1test = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING), 1201, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true); |
| | | |
| | | ReplicationBroker s2test2 = openReplicationSession( |
| | | s2test2 = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING2), 1202, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true, EMPTY_DN_GENID); |
| | |
| | | sleep(500); |
| | | |
| | | // -- |
| | | ReplicationBroker s1test2 = openReplicationSession( |
| | | s1test2 = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING2), 1203, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true, EMPTY_DN_GENID); |
| | | |
| | | ReplicationBroker s2test = openReplicationSession( |
| | | s2test = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING), 1204, |
| | | 100, replicationServerPort, |
| | | brokerSessionTimeout, true); |
| | |
| | | + " eligibleCN=" + rsd2.getEligibleCN() |
| | | + " rs eligibleCN=" + replicationServer.getEligibleCN()); |
| | | // FIXME:ECL Enable this test by adding an assert on the right value |
| | | |
| | | s1test2.stop(); |
| | | s2test2.stop(); |
| | | removeTestBackend2(backend2); |
| | | |
| | | Thread.sleep(1000); |
| | | |
| | | rsd2.getChangeTimeHeartbeatState(); |
| | | debugInfo(tn, rsd2.getBaseDn() |
| | | + " DbServerState=" + rsd2.getDbServerState() |
| | | + " ChangeTimeHeartBeatState=" + rsd2.getChangeTimeHeartbeatState() |
| | | + " eligibleCN=" + rsd2.getEligibleCN() |
| | | + " rs eligibleCN=" + replicationServer.getEligibleCN()); |
| | | |
| | | s1test.stop(); |
| | | s2test.stop(); |
| | | |
| | | Thread.sleep(1000); |
| | | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | fail("Ending test " + tn + " with exception:" |
| | | + stackTraceToSingleLineString(e)); |
| | | } |
| | | finally |
| | | { |
| | | if (s1test2 != null) |
| | | s1test2.stop(); |
| | | if (s2test2 != null) |
| | | s2test2.stop(); |
| | | if (backend2 != null) |
| | | removeTestBackend2(backend2); |
| | | if (s1test != null) |
| | | s1test.stop(); |
| | | if (s2test != null) |
| | | s2test.stop(); |
| | | |
| | | replicationServer.clearDb(); |
| | | } |
| | | debugInfo(tn, "Ending test successfully"); |
| | | } |
| | | |
| | |
| | | fail("Ending test "+tn+" with exception in test cleanup:\n" + |
| | | stackTraceToSingleLineString(e)); |
| | | } |
| | | finally |
| | | { |
| | | replicationServer.clearDb(); |
| | | } |
| | | } |
| | | debugInfo(tn, "Ending test with success"); |
| | | } |