| | |
| | | * - testSingleRS : test generation ID setting with different servers and one |
| | | * Replication server. |
| | | * |
| | | * - testMultiRS : tests generation ID propagatoion with more than one |
| | | * - testMultiRS : tests generation ID propagatoion with more than one |
| | | * Replication server. |
| | | * |
| | | */ |
| | |
| | | |
| | | private static final String baseDnStr = "dc=example,dc=com"; |
| | | private static final String baseSnStr = "genidcom"; |
| | | |
| | | |
| | | private static final int WINDOW_SIZE = 10; |
| | | private static final int CHANGELOG_QUEUE_SIZE = 100; |
| | | private static final short server1ID = 1; |
| | |
| | | /** |
| | | * Creates a new replicationServer. |
| | | * @param changelogId The serverID of the replicationServer to create. |
| | | * @param all Specifies whether to coonect the created replication |
| | | * @param all Specifies whether to coonect the created replication |
| | | * server to the other replication servers in the test. |
| | | * @return The new created replication server. |
| | | */ |
| | | private ReplicationServer createReplicationServer(short changelogId, |
| | | private ReplicationServer createReplicationServer(short changelogId, |
| | | boolean all, String suffix) |
| | | { |
| | | SortedSet<String> servers = null; |
| | |
| | | try |
| | | { |
| | | // suffix synchronized |
| | | String synchroServerStringDN = "cn=" + baseSnStr + ", cn=domains," + |
| | | String synchroServerStringDN = "cn=" + baseSnStr + ", cn=domains," + |
| | | synchroPluginStringDN; |
| | | if (synchroServerEntry != null) |
| | | { |
| | |
| | | catch(Exception e) |
| | | { |
| | | fail("Exception raised in readGenId", e); |
| | | } |
| | | } |
| | | return genId; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * SingleRS tests basic features of generationID |
| | | * SingleRS tests basic features of generationID |
| | | * with one single Replication Server. |
| | | * |
| | | * @throws Exception |
| | |
| | | assertEquals(genId,-1); |
| | | |
| | | debugInfo(testCase + " Expect genId to be set in memory on the replication " + |
| | | " server side even if not wrote on disk/db since no change occured."); |
| | | " server side even if not wrote on disk/db since no change occurred."); |
| | | rgenId = replServer1.getGenerationId(baseDn); |
| | | assertEquals(rgenId, 3211313L); |
| | | |
| | |
| | | this.addTestEntriesToDB(updatedEntries); |
| | | connectToReplServer(changelog1ID); |
| | | |
| | | // Test that the generationId is written in the DB in the |
| | | // Test that the generationId is written in the DB in the |
| | | // root entry on the replica side |
| | | genId = readGenId(); |
| | | assertTrue(genId != -1); |
| | |
| | | try |
| | | { |
| | | broker2 = openReplicationSession(baseDn, |
| | | server2ID, 100, getChangelogPort(changelog1ID), |
| | | server2ID, 100, getChangelogPort(changelog1ID), |
| | | 1000, !emptyOldChanges, genId+1); |
| | | } |
| | | catch(SocketException se) |
| | |
| | | * Test : generationID persistence in Replication server |
| | | * Shutdown/Restart Replication Server and redo connections |
| | | * with valid and invalid generationId |
| | | * Check : same expected connections results |
| | | * Check : same expected connections results |
| | | */ |
| | | |
| | | // The changes from broker2 should be ignored |
| | |
| | | catch(SocketException se) |
| | | { |
| | | fail("Broker connection is expected to be accepted."); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | * |
| | | * |
| | | * FIXME Should clearJEBackend() regenerate generationId and do a start |
| | | * against ReplicationServer ? |
| | | */ |
| | |
| | | assertTrue(genId != -1, "DS is expected to have a new genID computed " + |
| | | " after on-line import but genId=" + genId); |
| | | |
| | | rgenId = replServer1.getGenerationId(baseDn); |
| | | rgenId = replServer1.getGenerationId(baseDn); |
| | | assertEquals(genId, rgenId, "DS and replServer are expected to have same genId."); |
| | | |
| | | assertTrue(!replServer1.getReplicationCache(baseDn, false). |
| | |
| | | fail("No update message is supposed to be received by degraded broker3"+ msg); |
| | | } catch(SocketTimeoutException e) { /* expected */ } |
| | | |
| | | debugInfo("broker2 is publishing a change, " + |
| | | debugInfo("broker2 is publishing a change, " + |
| | | "replServer1 expected to ignore this change."); |
| | | broker2.publish(createAddMsg()); |
| | | try |
| | |
| | | ReplicationMessage msg = broker3.receive(); |
| | | fail("No update message is supposed to be received by degraded broker3"+ msg); |
| | | } catch(SocketTimeoutException e) { /* expected */ } |
| | | |
| | | |
| | | // In S1 launch the total update to initialize S2 |
| | | addTask(taskInitRemoteS2, ResultCode.SUCCESS, null); |
| | | |
| | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | fail(testCase + " Exception:"+ e.getMessage() + " " + |
| | | fail(testCase + " Exception:"+ e.getMessage() + " " + |
| | | stackTraceToSingleLineString(e)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * SingleRS tests basic features of generationID |
| | | * SingleRS tests basic features of generationID |
| | | * with more than one Replication Server. |
| | | * The following test focus on: |
| | | * - genId checking accross multiple starting RS (replication servers) |
| | |
| | | Thread.sleep(1000); |
| | | |
| | | debugInfo("Expect genId to be unset(-1) in all servers since no server is " + |
| | | " connected and no change ever occured"); |
| | | " connected and no change ever occurred"); |
| | | assertEquals(replServer1.getGenerationId(baseDn), -1, " in replServer1"); |
| | | assertEquals(replServer2.getGenerationId(baseDn), -1, " in replServer2"); |
| | | assertEquals(replServer3.getGenerationId(baseDn), -1, " in replServer3"); |
| | |
| | | |
| | | debugInfo("Expect genIds to be set in all servers based on the added entries."); |
| | | genId = readGenId(); |
| | | assertTrue(genId != -1); |
| | | assertTrue(genId != -1); |
| | | assertEquals(replServer1.getGenerationId(baseDn), genId); |
| | | assertEquals(replServer2.getGenerationId(baseDn), genId); |
| | | assertEquals(replServer3.getGenerationId(baseDn), genId); |
| | |
| | | try |
| | | { |
| | | broker2 = openReplicationSession(baseDn, |
| | | server2ID, 100, getChangelogPort(changelog3ID), |
| | | server2ID, 100, getChangelogPort(changelog3ID), |
| | | 1000, !emptyOldChanges, genId); |
| | | Thread.sleep(1000); |
| | | } |
| | |
| | | { |
| | | long badgenId=1; |
| | | broker3 = openReplicationSession(baseDn, |
| | | server3ID, 100, getChangelogPort(changelog1ID), |
| | | server3ID, 100, getChangelogPort(changelog1ID), |
| | | 1000, !emptyOldChanges, badgenId); |
| | | Thread.sleep(1000); |
| | | } |
| | |
| | | addTask(taskReset, ResultCode.SUCCESS, null); |
| | | waitTaskState(taskReset, TaskState.COMPLETED_SUCCESSFULLY, null); |
| | | Thread.sleep(500); |
| | | |
| | | |
| | | debugInfo("Verifying that all replservers genIds have been reset."); |
| | | genId = readGenId(); |
| | | assertEquals(replServer2.getGenerationId(baseDn), genId); |