| File was renamed from opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SynchronizationTestCase.java |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | |
| | | /** |
| | | * An abstract class that all synchronization unit test should extend. |
| | | * An abstract class that all Replication unit test should extend. |
| | | */ |
| | | @Test(groups = { "precommit", "synchronization" }) |
| | | public abstract class SynchronizationTestCase extends DirectoryServerTestCase |
| | | @Test(groups = { "precommit", "replication" }) |
| | | public abstract class ReplicationTestCase extends DirectoryServerTestCase |
| | | { |
| | | |
| | | /** |
| | |
| | | protected boolean schemaCheck; |
| | | |
| | | /** |
| | | * The synchronization plugin entry |
| | | * The replication plugin entry |
| | | */ |
| | | protected String synchroPluginStringDN = |
| | | "cn=Multimaster Synchronization, cn=Synchronization Providers,cn=config"; |
| | |
| | | { |
| | | logError(ErrorLogCategory.SYNCHRONIZATION, |
| | | ErrorLogSeverity.NOTICE, |
| | | "SynchronizationTestCase/openChangelogSession" + e.getMessage(), 1); |
| | | "ReplicationTestCase/openChangelogSession" + e.getMessage(), 1); |
| | | } |
| | | } |
| | | return broker; |
| | |
| | | { |
| | | logError(ErrorLogCategory.SYNCHRONIZATION, |
| | | ErrorLogSeverity.NOTICE, |
| | | "SynchronizationTestCase/Cleaning config entries" , 1); |
| | | "ReplicationTestCase/Cleaning config entries" , 1); |
| | | |
| | | DeleteOperation op; |
| | | // Delete entries |
| | |
| | | { |
| | | logError(ErrorLogCategory.SYNCHRONIZATION, |
| | | ErrorLogSeverity.NOTICE, |
| | | "SynchronizationTestCase/Cleaning entries" , 1); |
| | | "ReplicationTestCase/Cleaning entries" , 1); |
| | | |
| | | DeleteOperation op; |
| | | // Delete entries |
| | |
| | | } |
| | | |
| | | /** |
| | | * Configure the Synchronization for this test. |
| | | * Configure the replication for this test. |
| | | */ |
| | | protected void configureSynchronization() throws Exception |
| | | protected void configureReplication() throws Exception |
| | | { |
| | | // Add the Multimaster synchronization plugin |
| | | // Add the Multimaster replication plugin |
| | | String synchroPluginLdif = "dn: " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-provider\n" |
| | | + "objectClass: ds-cfg-multimaster-synchronization-provider\n" |
| | | + "ds-cfg-synchronization-provider-enabled: true\n" |
| | | + "ds-cfg-synchronization-provider-class: " + |
| | | "org.opends.server.replication.plugin.MultimasterSynchronization\n"; |
| | | "org.opends.server.replication.plugin.MultimasterReplication\n"; |
| | | Entry synchroPluginEntry = TestCaseUtils.entryFromLdifString(synchroPluginLdif); |
| | | DirectoryServer.getConfigHandler().addEntry(synchroPluginEntry, null); |
| | | configEntryList.add(synchroPluginEntry.getDN()); |
| | | assertNotNull(DirectoryServer.getConfigEntry(DN |
| | | .decode(synchroPluginStringDN)), |
| | | "Unable to add the Multimaster synchronization plugin"); |
| | | "Unable to add the Multimaster replication plugin"); |
| | | |
| | | // domains container entry. |
| | | String domainsLdif = "dn: " |
| | |
| | | configEntryList.add(domainsEntry.getDN()); |
| | | assertNotNull(DirectoryServer.getConfigEntry( |
| | | DN.decode(synchroPluginStringDN)), |
| | | "Unable to add the Multimaster synchronization plugin"); |
| | | "Unable to add the Multimaster replication plugin"); |
| | | |
| | | |
| | | // Add the changelog server |
| | |
| | | "Unable to add the changeLog server"); |
| | | configEntryList.add(changeLogEntry.getDN()); |
| | | |
| | | // We also have a replicated suffix (synchronization domain) |
| | | // We also have a replicated suffix (replication domain) |
| | | DirectoryServer.getConfigHandler().addEntry(synchroServerEntry, null); |
| | | assertNotNull(DirectoryServer.getConfigEntry(synchroServerEntry.getDN()), |
| | | "Unable to add the synchronized server"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieve the number of replayed updates for a given synchronization |
| | | * Retrieve the number of replayed updates for a given replication |
| | | * domain from the monitor entry. |
| | | * @return The number of replayed updates. |
| | | * @throws Exception If an error occurs. |