| | |
| | | |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_COMPLETION_TIME; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_STATE; |
| | | import org.opends.server.config.ConfigException; |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.testng.Assert.assertEquals; |
| | | import static org.testng.Assert.assertNotNull; |
| | | import static org.testng.Assert.assertTrue; |
| | | import static org.testng.Assert.fail; |
| | | |
| | | import java.net.SocketException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.LinkedList; |
| | |
| | | import org.opends.server.replication.common.ServerState; |
| | | import org.opends.server.replication.plugin.PersistentServerState; |
| | | import org.opends.server.replication.plugin.ReplicationBroker; |
| | | import org.opends.server.replication.protocol.ReplSessionSecurity; |
| | | import org.opends.server.schema.DirectoryStringSyntax; |
| | | import org.opends.server.schema.IntegerSyntax; |
| | | import org.opends.server.types.Attribute; |
| | |
| | | private DN monitorDn; |
| | | private String monitorAttr; |
| | | private long lastCount; |
| | | |
| | | |
| | | /** |
| | | * schema check flag |
| | | */ |
| | |
| | | protected ReplicationBroker openReplicationSession( |
| | | final DN baseDn, short serverId, int window_size, |
| | | int port, int timeout, boolean emptyOldChanges) |
| | | throws Exception, SocketException |
| | | throws Exception |
| | | { |
| | | ServerState state; |
| | | if (emptyOldChanges) |
| | |
| | | state = new ServerState(); |
| | | |
| | | ReplicationBroker broker = new ReplicationBroker( |
| | | state, baseDn, serverId, 0, 0, 0, 0, window_size, 0); |
| | | state, baseDn, serverId, 0, 0, 0, 0, window_size, 0, |
| | | getReplSessionSecurity()); |
| | | ArrayList<String> servers = new ArrayList<String>(1); |
| | | servers.add("localhost:" + port); |
| | | broker.start(servers); |
| | |
| | | protected ReplicationBroker openReplicationSession( |
| | | final DN baseDn, short serverId, int window_size, |
| | | int port, int timeout, ServerState state) |
| | | throws Exception, SocketException |
| | | throws Exception |
| | | { |
| | | ReplicationBroker broker = new ReplicationBroker( |
| | | state, baseDn, serverId, 0, 0, 0, 0, window_size, 0); |
| | | state, baseDn, serverId, 0, 0, 0, 0, window_size, 0, |
| | | getReplSessionSecurity()); |
| | | ArrayList<String> servers = new ArrayList<String>(1); |
| | | servers.add("localhost:" + port); |
| | | broker.start(servers); |
| | |
| | | final DN baseDn, short serverId, int window_size, |
| | | int port, int timeout, int maxSendQueue, int maxRcvQueue, |
| | | boolean emptyOldChanges) |
| | | throws Exception, SocketException |
| | | throws Exception |
| | | { |
| | | ServerState state; |
| | | if (emptyOldChanges) |
| | |
| | | |
| | | ReplicationBroker broker = new ReplicationBroker( |
| | | state, baseDn, serverId, maxRcvQueue, 0, |
| | | maxSendQueue, 0, window_size, 0); |
| | | maxSendQueue, 0, window_size, 0, |
| | | getReplSessionSecurity()); |
| | | ArrayList<String> servers = new ArrayList<String>(1); |
| | | servers.add("localhost:" + port); |
| | | broker.start(servers); |
| | |
| | | while (op.getSearchEntries().isEmpty() && (count<100)); |
| | | if (op.getSearchEntries().isEmpty()) |
| | | throw new Exception("Could not read monitoring information"); |
| | | |
| | | |
| | | SearchResultEntry entry = op.getSearchEntries().getFirst(); |
| | | AttributeType attrType = |
| | | DirectoryServer.getDefaultAttributeType(attr); |
| | |
| | | LockManager.unlock(dn, lock); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Update the monitor count for the specified monitor attribute. |
| | | */ |
| | |
| | | assertTrue(false); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get the delta between the current / last monitor counts. |
| | | * @return The delta between the current and last monitor count. |
| | |
| | | mods.add(mod); |
| | | return mods; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Utility method to create, run a task and check its result. |
| | | */ |
| | |
| | | "The task completed in an unexpected state"); |
| | | } |
| | | |
| | | /** |
| | | * Create a new replication session security object that can be used in |
| | | * unit tests. |
| | | * |
| | | * @return A new replication session security object. |
| | | * @throws ConfigException If an error occurs. |
| | | */ |
| | | protected static ReplSessionSecurity getReplSessionSecurity() |
| | | throws ConfigException |
| | | { |
| | | return new ReplSessionSecurity(null, null, null, true); |
| | | } |
| | | |
| | | } |