opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/ProtocolWindowTest.java
@@ -99,7 +99,7 @@ final DN baseDn = DN.decode("ou=People,dc=example,dc=com"); ChangelogBroker broker = openChangelogSession(baseDn, (short) 13, WINDOW_SIZE); WINDOW_SIZE, 8989, 1000); try { opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java
@@ -111,7 +111,8 @@ final int TOTAL_MESSAGES = 1000; cleanEntries(); ChangelogBroker broker = openChangelogSession(baseDn, (short) 18, 100); ChangelogBroker broker = openChangelogSession(baseDn, (short) 18, 100, 8989, 5000); Monitor monitor = new Monitor("stress test monitor"); DirectoryServer.registerMonitorProvider(monitor); opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/SynchronizationTestCase.java
@@ -107,11 +107,10 @@ /** * Open a changelog session to the local Changelog server. * @param window_size * */ protected ChangelogBroker openChangelogSession( final DN baseDn, short serverId, int window_size) final DN baseDn, short serverId, int window_size, int port, int timeout) throws Exception, SocketException { PersistentServerState state = new PersistentServerState(baseDn); @@ -119,9 +118,10 @@ ChangelogBroker broker = new ChangelogBroker( state, baseDn, serverId, 0, 0, 0, 0, window_size); ArrayList<String> servers = new ArrayList<String>(1); servers.add("localhost:8989"); servers.add("localhost:" + port); broker.start(servers); broker.setSoTimeout(1000); if (timeout != 0) broker.setSoTimeout(timeout); /* * loop receiving update until there is nothing left * to make sure that message from previous tests have been consumed. opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java
@@ -248,7 +248,8 @@ * Open a session to the changelog server using the Changelog broker API. * This must use a serverId different from the LDAP server ID */ ChangelogBroker broker = openChangelogSession(baseDn, (short) 2, 100); ChangelogBroker broker = openChangelogSession(baseDn, (short) 2, 100, 8989, 1000); /* * Create a Change number generator to generate new changenumbers @@ -560,7 +561,8 @@ cleanEntries(); ChangelogBroker broker = openChangelogSession(baseDn, (short) 27, 100); ChangelogBroker broker = openChangelogSession(baseDn, (short) 27, 100, 8989, 1000); try { ChangeNumberGenerator gen = new ChangeNumberGenerator((short) 27, 0); @@ -956,7 +958,8 @@ final DN baseDn = DN.decode("ou=People,dc=example,dc=com"); Thread.sleep(2000); ChangelogBroker broker = openChangelogSession(baseDn, (short) 11, 100); ChangelogBroker broker = openChangelogSession(baseDn, (short) 11, 100, 8989, 1000); try { ChangeNumberGenerator gen = new ChangeNumberGenerator((short) 11, 0); opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/changelog/ChangeLogTestCase.java
File was deleted opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/changelog/ChangelogTest.java
New file @@ -0,0 +1,103 @@ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at * trunk/opends/resource/legal-notices/OpenDS.LICENSE * or https://OpenDS.dev.java.net/OpenDS.LICENSE. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, * add the following below this CDDL HEADER, with the fields enclosed * by brackets "[]" replaced with your own identifying * information: * Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END * * * Portions Copyright 2006 Sun Microsystems, Inc. */ package org.opends.server.synchronization.changelog; import java.net.ServerSocket; import org.opends.server.TestCaseUtils; import org.opends.server.config.ConfigEntry; import org.opends.server.synchronization.SynchronizationTestCase; import org.opends.server.synchronization.common.ChangeNumber; import org.opends.server.synchronization.plugin.ChangelogBroker; import org.opends.server.synchronization.protocol.DeleteMsg; import org.opends.server.synchronization.protocol.SynchronizationMessage; import org.opends.server.types.DN; import org.opends.server.types.Entry; import org.testng.annotations.Test; import static org.testng.Assert.*; /** * Tests for the chngelog service code. */ public class ChangelogTest extends SynchronizationTestCase { /** * Basic test of the changelog code. * Create a changelog server, connect 2 clients and exchange * messages between the clients. */ @Test() public void changelogBasic() throws Exception { // find a free port ServerSocket socket = TestCaseUtils.bindFreePort(); int changelogPort = socket.getLocalPort(); socket.close(); String changelogLdif = "dn: cn=Changelog Server\n" + "objectClass: top\n" + "objectClass: ds-cfg-synchronization-changelog-server-config\n" + "cn: Changelog Server\n" + "ds-cfg-changelog-port: "+ changelogPort + "\n" + "ds-cfg-changelog-server-id: 1\n"; Entry tmp = TestCaseUtils.entryFromLdifString(changelogLdif); ConfigEntry changelogConfig = new ConfigEntry(tmp, null); Changelog changelog = new Changelog(changelogConfig); ChangelogBroker broker1 = null; ChangelogBroker broker2 = null; try { broker1 = openChangelogSession( DN.decode("dc=example,dc=com"), (short) 1, 100, changelogPort, 1000); broker2 = openChangelogSession( DN.decode("dc=example,dc=com"), (short) 2, 100, changelogPort, 1000); ChangeNumber cn = new ChangeNumber((long) 1, 1, (short)1); DeleteMsg msg = new DeleteMsg("o=test,dc=example,dc=com", cn, "uid"); broker1.publish(msg); SynchronizationMessage msg2 = broker2.receive(); if (msg2 instanceof DeleteMsg) { DeleteMsg del = (DeleteMsg) msg2; assertTrue(del.toString().equals(msg2.toString())); } else fail("Changelog transmission failed"); } finally { changelog.shutdown(); if (broker1 != null) broker1.stop(); if (broker2 != null) broker2.stop(); } } } opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/changelog/UpdateComparatorTest.java
@@ -35,6 +35,7 @@ import org.opends.server.core.DeleteOperation; import org.opends.server.protocols.internal.InternalClientConnection; import org.opends.server.synchronization.SynchronizationTestCase; import org.opends.server.synchronization.changelog.UpdateComparator; import org.opends.server.synchronization.common.ChangeNumber; import org.opends.server.synchronization.protocol.DeleteContext; @@ -49,7 +50,7 @@ /** * Test ChangeNumber and ChangeNumberGenerator */ public class UpdateComparatorTest extends ChangeLogTestCase public class UpdateComparatorTest extends SynchronizationTestCase { /**