| | |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.opends.server.workflowelement.externalchangelog.ECLSearchOperation; |
| | | import org.opends.server.workflowelement.externalchangelog.ECLWorkflowElement; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendModifyDNOperation; |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.AfterClass; |
| | |
| | | @Test(enabled=true) |
| | | public void ECLReplicationServerTest() |
| | | { |
| | | // No RSDomain created yet => RS only case => ECL is not a supported |
| | | ECLIsNotASupportedSuffix(); |
| | | |
| | | // Following test does not create RSDomain (only broker) but want to test |
| | | // ECL .. so let's enable ECl manually |
| | | // Now that we tested that ECl is not available |
| | | try |
| | | { |
| | | ECLWorkflowElement wfe = (ECLWorkflowElement) |
| | | DirectoryServer.getWorkflowElement( |
| | | ECLWorkflowElement.ECL_WORKFLOW_ELEMENT); |
| | | if (wfe!=null) |
| | | wfe.getReplicationServer().enableECL(); |
| | | } |
| | | catch(DirectoryException de) |
| | | { |
| | | fail("Ending test " + " with exception:" |
| | | + stackTraceToSingleLineString(de)); |
| | | } |
| | | |
| | | // Test all types of ops. |
| | | ECLAllOps(); // Do not clean the db for the next test |
| | | |
| | | // First and last should be ok whenever a request has been done or not |
| | | // in compat mode. |
| | | ECLCompatTestLimits(1,4);replicationServer.clearDb(); |
| | | ECLCompatTestLimits(1,4,true);replicationServer.clearDb(); |
| | | |
| | | // Test with a mix of domains, a mix of DSes |
| | | ECLTwoDomains(); replicationServer.clearDb(); |
| | |
| | | |
| | | // First and last should be ok whenever a request has been done or not |
| | | // in compat mode. |
| | | ECLCompatTestLimits(1,4);replicationServer.clearDb(); |
| | | ECLCompatTestLimits(1,4, true);replicationServer.clearDb(); |
| | | |
| | | // Test remote API (ECL through replication protocol) with NON empty ECL |
| | | ECLRemoteNonEmpty();replicationServer.clearDb(); |
| | |
| | | ECLCompatReadFromTo(5,7); |
| | | |
| | | // Test first and last draft changenumber |
| | | ECLCompatTestLimits(1,8); |
| | | ECLCompatTestLimits(1,8, true); |
| | | |
| | | // Test first and last draft changenumber, a dd a new change, do not |
| | | // search again the ECL, but search fro first and last |
| | |
| | | ECLPurgeDraftCNDbAfterChangelogClear(); |
| | | |
| | | // Test first and last are updated |
| | | ECLCompatTestLimits(0,0); |
| | | ECLCompatTestLimits(0,0, true); |
| | | |
| | | // Persistent search in changesOnly mode |
| | | ECLPsearch(true, true);replicationServer.clearDb(); |
| | |
| | | |
| | | } |
| | | |
| | | private void ECLIsNotASupportedSuffix() |
| | | { |
| | | ECLCompatTestLimits(0,0, false); |
| | | } |
| | | |
| | | //======================================================= |
| | | // Objectives |
| | | // - Test that everything id ok with no changes |
| | |
| | | |
| | | try |
| | | { |
| | | // Root DSE |
| | | InternalSearchOperation searchOp = |
| | | connection.processSearch( |
| | | ByteString.valueOf(""), |
| | |
| | | debugInfo(tn, "Ending test with success"); |
| | | } |
| | | |
| | | private void ECLCompatTestLimits(int expectedFirst, int expectedLast) |
| | | private void ECLCompatTestLimits(int expectedFirst, int expectedLast, |
| | | boolean eclEnabled) |
| | | { |
| | | String tn = "ECLCompatTestLimits"; |
| | | debugInfo(tn, "Starting test\n\n"); |
| | |
| | | i++; |
| | | debugInfo(tn, "Result entry returned:" + resultEntry.toLDIFString()); |
| | | ldifWriter.writeEntry(resultEntry); |
| | | checkValue(resultEntry,"firstchangenumber", |
| | | if (eclEnabled) |
| | | { |
| | | checkValue(resultEntry,"firstchangenumber", |
| | | String.valueOf(expectedFirst)); |
| | | checkValue(resultEntry,"lastchangenumber", |
| | | checkValue(resultEntry,"lastchangenumber", |
| | | String.valueOf(expectedLast)); |
| | | checkValue(resultEntry,"changelog", |
| | | checkValue(resultEntry,"changelog", |
| | | String.valueOf("cn=changelog")); |
| | | } |
| | | else |
| | | { |
| | | assertEquals(getAttributeValue(resultEntry, "firstchangenumber"), |
| | | null); |
| | | assertEquals(getAttributeValue(resultEntry, "lastchangenumber"), |
| | | null); |
| | | assertEquals(getAttributeValue(resultEntry, "changelog"), |
| | | null); |
| | | assertEquals(getAttributeValue(resultEntry, "lastExternalChangelogCookie"), |
| | | null); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | debugInfo(tn, "Starting test\n\n"); |
| | | try |
| | | { |
| | | ECLCompatTestLimits(expectedFirst, expectedLast); |
| | | ECLCompatTestLimits(expectedFirst, expectedLast, true); |
| | | |
| | | // Creates broker on o=test |
| | | ReplicationBroker server01 = openReplicationSession( |
| | |
| | | sleep(500); |
| | | server01.stop(); |
| | | |
| | | ECLCompatTestLimits(expectedFirst, expectedLast+1); |
| | | ECLCompatTestLimits(expectedFirst, expectedLast+1, true); |
| | | |
| | | } |
| | | catch(Exception e) |