| File was renamed from opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaSynchronizationTest.java |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.LDAPModification; |
| | | import org.opends.server.replication.common.ChangeNumberGenerator; |
| | | import org.opends.server.replication.plugin.ChangelogBroker; |
| | | import org.opends.server.replication.protocol.ModifyMsg; |
| | | import org.opends.server.replication.protocol.SynchronizationMessage; |
| | | import org.opends.server.replication.protocol.ReplicationMessage; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.AttributeValue; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * Test for the schema synchronization. |
| | | * Test for the schema replication. |
| | | */ |
| | | public class SchemaSynchronizationTest extends SynchronizationTestCase |
| | | public class SchemaReplicationTest extends ReplicationTestCase |
| | | { |
| | | |
| | | private ArrayList<Modification> rcvdMods = null; |
| | |
| | | |
| | | /** |
| | | * Set up the environment for performing the tests in this Class. |
| | | * synchronization |
| | | * |
| | | * @throws Exception |
| | | * If the environment could not be set up. |
| | |
| | | + "ds-cfg-directory-server-id: 1\n"; |
| | | synchroServerEntry = TestCaseUtils.entryFromLdifString(synchroServerLdif); |
| | | |
| | | configureSynchronization(); |
| | | configureReplication(); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | logError(ErrorLogCategory.SYNCHRONIZATION, |
| | | ErrorLogSeverity.NOTICE, |
| | | "Starting synchronization test : pushSchemaChange ", 1); |
| | | "Starting replication test : pushSchemaChange ", 1); |
| | | |
| | | final DN baseDn = DN.decode("cn=schema"); |
| | | |
| | |
| | | "The original operation failed"); |
| | | |
| | | // See if the client has received the msg |
| | | SynchronizationMessage msg = broker.receive(); |
| | | ReplicationMessage msg = broker.receive(); |
| | | |
| | | assertTrue(msg instanceof ModifyMsg, |
| | | "The received synchronization message is not a MODIFY msg"); |
| | | "The received replication message is not a MODIFY msg"); |
| | | ModifyMsg modMsg = (ModifyMsg) msg; |
| | | |
| | | Operation receivedOp = modMsg.createOperation(connection); |
| | |
| | | "The received message is not for cn=schema"); |
| | | |
| | | assertTrue(receivedOp instanceof ModifyOperation, |
| | | "The received synchronization message is not a MODIFY msg"); |
| | | "The received replication message is not a MODIFY msg"); |
| | | ModifyOperation receivedModifyOperation = (ModifyOperation) receivedOp; |
| | | |
| | | List<RawModification> rcvdRawMods = |
| | |
| | | |
| | | /** |
| | | * Checks that changes to the schema pushed to the changelog |
| | | * are received and correctly replayed by synchronization plugin. |
| | | * are received and correctly replayed by replication plugin. |
| | | */ |
| | | @Test(dependsOnMethods = { "pushSchemaChange" }) |
| | | public void replaySchemaChange() throws Exception |
| | | { |
| | | logError(ErrorLogCategory.SYNCHRONIZATION, |
| | | ErrorLogSeverity.NOTICE, |
| | | "Starting synchronization test : pushSchemaChange ", 1); |
| | | "Starting replication test : pushSchemaChange ", 1); |
| | | |
| | | final DN baseDn = DN.decode("cn=schema"); |
| | | |
| | |
| | | { |
| | | logError(ErrorLogCategory.SYNCHRONIZATION, |
| | | ErrorLogSeverity.NOTICE, |
| | | "Starting synchronization test : pushSchemaFilesChange ", 1); |
| | | "Starting replication test : pushSchemaFilesChange ", 1); |
| | | |
| | | final DN baseDn = DN.decode("cn=schema"); |
| | | |
| | |
| | | } |
| | | |
| | | // receive the message on the broker side. |
| | | SynchronizationMessage msg = broker.receive(); |
| | | ReplicationMessage msg = broker.receive(); |
| | | |
| | | assertTrue(msg instanceof ModifyMsg, |
| | | "The received synchronization message is not a MODIFY msg"); |
| | | "The received replication message is not a MODIFY msg"); |
| | | ModifyMsg modMsg = (ModifyMsg) msg; |
| | | |
| | | Operation receivedOp = modMsg.createOperation(connection); |
| | |
| | | "The received message is not for cn=schema"); |
| | | |
| | | assertTrue(receivedOp instanceof ModifyOperation, |
| | | "The received synchronization message is not a MODIFY msg"); |
| | | "The received replication message is not a MODIFY msg"); |
| | | ModifyOperation receivedModifyOperation = (ModifyOperation) receivedOp; |
| | | |
| | | List<RawModification> rcvdRawMods = |