opends/src/server/org/opends/server/replication/common/package-info.java
@@ -34,8 +34,8 @@ * The main classes of this core are : * <ul> * <li> * <A HREF="ChangeNumber.html"><B>ChangeNumber</B></A> * Define Change Numbers used to identify and to order the LDAP changes * <A HREF="CSN.html"><B>CSN</B></A> * Define CSNs used to identify and to order the LDAP changes * </li> * <li> * <A HREF="ServerState.html"><B>ServerState</B></A> opends/src/server/org/opends/server/replication/plugin/FakeOperationComparator.java
@@ -31,7 +31,7 @@ /** * This Class implements a Comparator that can be used to build TreeSet * containing FakeOperations sorted by the ChangeNumber order. * containing FakeOperations sorted by the CSN order. */ public class FakeOperationComparator implements Comparator<FakeOperation> { opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -27,12 +27,6 @@ */ package org.opends.server.replication.plugin; import static org.opends.messages.ReplicationMessages.*; import static org.opends.server.loggers.ErrorLogger.*; import static org.opends.server.replication.plugin. ReplicationRepairRequestControl.*; import static org.opends.server.util.StaticUtils.*; import java.util.*; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; @@ -50,6 +44,12 @@ import org.opends.server.types.*; import org.opends.server.types.operation.*; import static org.opends.messages.ReplicationMessages.*; import static org.opends.server.loggers.ErrorLogger.*; import static org.opends.server.replication.plugin. ReplicationRepairRequestControl.*; import static org.opends.server.util.StaticUtils.*; /** * This class is used to load the Replication code inside the JVM * and to trigger initialization of the replication. @@ -119,14 +119,14 @@ return null; /* * Check if the provided operation is a repair operation and set * the synchronization flags if necessary. * The repair operations are tagged as synchronization operations * so that the core server let the operation modify the entryuuid * and ds-sync-hist attributes. * They are also tagged as dontSynchronize so that the replication * code running later do not generate ChangeNumber, solve conflicts * and forward the operation to the replication server. * Check if the provided operation is a repair operation and set the * synchronization flags if necessary. * The repair operations are tagged as synchronization operations so * that the core server let the operation modify the entryuuid and * ds-sync-hist attributes. * They are also tagged as dontSynchronize so that the replication code * running later do not generate CSN, solve conflicts and forward the * operation to the replication server. */ for (Control c : op.getRequestControls()) { @@ -135,10 +135,9 @@ op.setSynchronizationOperation(true); op.setDontSynchronize(true); /* remove this control from the list of controls since it has now been processed and the local backend will fail if it finds a control that it does not know about and that is marked as critical. remove this control from the list of controls since it has now been processed and the local backend will fail if it finds a control that it does not know about and that is marked as critical. */ List<Control> controls = op.getRequestControls(); controls.remove(c); @@ -175,19 +174,18 @@ ReplicationDomainCfg configuration) throws ConfigException { LDAPReplicationDomain domain = null; try { domain = new LDAPReplicationDomain(configuration, updateToReplayQueue); LDAPReplicationDomain domain = new LDAPReplicationDomain(configuration, updateToReplayQueue); if (domains.size() == 0) { /* * Create the threads that will process incoming update messages */ // Create the threads that will process incoming update messages createReplayThreads(); } domains.put(domain.getBaseDN(), domain); return domain; } catch (ConfigException e) { @@ -195,7 +193,7 @@ configuration.dn().toString(), e.getLocalizedMessage() + " " + stackTraceToSingleLineString(e))); } return domain; return null; } /** @@ -564,7 +562,7 @@ if (domain == null) return new SynchronizationProviderResult.ContinueProcessing(); // For LOCAL op only, generate ChangeNumber and attach Context // For LOCAL op only, generate CSN and attach Context if (!addOperation.isSynchronizationOperation()) domain.doPreOperation(addOperation); opends/src/server/org/opends/server/replication/plugin/PendingChange.java
@@ -40,7 +40,7 @@ */ public class PendingChange implements Comparable<PendingChange> { private CSN changeNumber; private CSN csn; private boolean committed; private LDAPUpdateMsg msg; private PluginOperation op; @@ -49,15 +49,13 @@ /** * Construct a new PendingChange. * @param changeNumber the ChangeNumber of use * @param csn the CSN of use * @param op the operation to use * @param msg the message to use (can be null for local operations) */ public PendingChange(CSN changeNumber, PluginOperation op, LDAPUpdateMsg msg) public PendingChange(CSN csn, PluginOperation op, LDAPUpdateMsg msg) { this.changeNumber = changeNumber; this.csn = csn; this.committed = false; this.op = op; this.msg = msg; @@ -82,12 +80,12 @@ } /** * Get the ChangeNumber associated to this PendingChange. * @return the ChangeNumber * Get the CSN associated to this PendingChange. * @return the CSN */ public CSN getCSN() { return changeNumber; return csn; } /** @@ -167,16 +165,15 @@ synchronized (this) { if (targetDN != null) return targetDN; else { try { targetDN = DN.decode(msg.getDn()); } catch (DirectoryException e) { } return targetDN; } try { targetDN = DN.decode(msg.getDn()); } catch (DirectoryException e) { } return targetDN; } @@ -188,6 +185,6 @@ @Override public int compareTo(PendingChange o) { return this.getCSN().compareTo(o.getCSN()); return getCSN().compareTo(o.getCSN()); } } opends/src/server/org/opends/server/replication/server/MessageHandler.java
@@ -428,9 +428,9 @@ } /** * Get the older Change Number for that server. * Get the older CSN for that server. * Returns null when the queue is empty. * @return The older change number. * @return The older CSN. */ public CSN getOlderUpdateCSN() { @@ -461,14 +461,14 @@ the lateQueue when it will send the next update but we are not yet there. So let's take the last change not sent directly from the db. */ result = findOldestChangeNumberFromReplicaDBs(); result = findOldestCSNFromReplicaDBs(); } } } return result; } private CSN findOldestChangeNumberFromReplicaDBs() private CSN findOldestCSNFromReplicaDBs() { SortedSet<ReplicaDBCursor> sortedCursors = null; try opends/src/server/org/opends/server/replication/server/changelog/je/DraftCNDbHandler.java
@@ -549,7 +549,7 @@ } catch(Exception e) { debugException("getChangeNumber", draftCN, e); debugException("getCSN", draftCN, e); return null; } finally opends/tests/unit-tests-testng/src/server/org/opends/server/controls/ExternalChangelogControlTest.java
@@ -26,11 +26,6 @@ */ package org.opends.server.controls; import static org.opends.server.util.ServerConstants.OID_ECL_COOKIE_EXCHANGE_CONTROL; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import org.opends.server.protocols.asn1.ASN1; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.protocols.ldap.LDAPControl; @@ -40,11 +35,11 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** * Test ChangeNumber and ChangeNumberGenerator */ public class ExternalChangelogControlTest extends ControlsTestCase import static org.opends.server.util.ServerConstants.*; import static org.testng.Assert.*; @SuppressWarnings("javadoc") public class ExternalChangelogControlTest extends ControlsTestCase { /** @@ -53,7 +48,6 @@ @DataProvider(name = "eclRequestControl") public Object[][] createECLRequestControlTest() { return new Object[][] { {true, "" }, @@ -73,7 +67,7 @@ { // Test contructor MultiDomainServerState mdss = new MultiDomainServerState(value); ExternalChangelogRequestControl eclrc ExternalChangelogRequestControl eclrc = new ExternalChangelogRequestControl(critical, mdss); assertNotNull(eclrc); assertEquals(critical, eclrc.isCritical()); opends/tests/unit-tests-testng/src/server/org/opends/server/controls/PersistentSearchControlTest.java
@@ -26,64 +26,60 @@ */ package org.opends.server.controls; import java.util.ArrayList; import static org.opends.server.util.ServerConstants.*; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.*; import org.opends.messages.Message; import org.opends.server.TestCaseUtils; import org.opends.server.core.ModifyOperation; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static org.testng.Assert.*; import org.opends.server.types.*; import org.opends.server.protocols.asn1.ASN1; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.protocols.internal.InternalClientConnection; import org.opends.server.protocols.internal.InternalSearchOperation; import org.opends.server.protocols.ldap.LDAPAttribute; import org.opends.server.protocols.ldap.LDAPReader; import org.opends.server.protocols.ldap.LDAPControl; import org.opends.server.protocols.ldap.LDAPModification; import org.opends.server.protocols.ldap.LDAPReader; import org.opends.server.tools.LDAPSearch; import org.opends.server.types.*; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** * Test ChangeNumber and ChangeNumberGenerator */ public class PersistentSearchControlTest extends ControlsTestCase import static org.assertj.core.api.Assertions.*; import static org.opends.server.controls.PersistentSearchChangeType.*; import static org.opends.server.util.ServerConstants.*; import static org.testng.Assert.*; @SuppressWarnings("javadoc") public class PersistentSearchControlTest extends ControlsTestCase { private static final String CANNOT_DECODE_CHANGE_NOTIF_CONTROL_NO_VALUE = "Cannot decode the provided entry change notification control because it " + "does not have a value"; private static final String CANNOT_DECODE_PERSISTENT_SEARCH_CONTROL_NO_VALUE = "Cannot decode the provided persistent search control because it does not have a value"; /** * Create correct values */ @DataProvider(name = "persistentSearchChangeTypeData") public Object[][] createPersistentSearchChangeTypeData() { HashMap<Integer, String> values = new HashMap<Integer, String>(); Map<Integer, String> values = new HashMap<Integer, String>(); values.put(1, "add"); values.put(2, "delete"); values.put(4, "modify"); values.put(8, "modDN"); return new Object[][] { { values } }; return new Object[][] { { values } }; } /** * Test if int value are ok */ @Test(dataProvider = "persistentSearchChangeTypeData") public void checkIntValueTest( HashMap<Integer, String> expectedValues) throws Exception public void checkIntValueTest(Map<Integer, String> expectedValues) throws Exception { for (Integer i : expectedValues.keySet()) { @@ -98,13 +94,13 @@ * Test If we have only the required values */ @Test(dataProvider = "persistentSearchChangeTypeData") public void checkRequiredValuesTest( HashMap<Integer, String> exceptedValues) throws Exception public void checkRequiredValuesTest(Map<Integer, String> exceptedValues) throws Exception { // Retrieve the values PersistentSearchChangeType[] vals = PersistentSearchChangeType.values(); // Check if we have the correct munber // Check if we have the correct number assertEquals(vals.length, exceptedValues.size()); // Check if we have the correct int value @@ -118,8 +114,8 @@ * Test invalid int values */ @Test(dataProvider = "persistentSearchChangeTypeData") public void checkInvalidIntTest( HashMap<Integer, String> exceptedValues) throws Exception public void checkInvalidIntTest(Map<Integer, String> exceptedValues) throws Exception { Set<Integer> keys = exceptedValues.keySet() ; for (int i=-10 ; i< 10 ; i++) @@ -128,11 +124,13 @@ try { PersistentSearchChangeType.valueOf(i); assertTrue(false,"the int '" + i + "' is not a set of type - exception expected"); fail(); } catch (LDAPException e) { assertTrue(true,"the int '" + i + "' is not a set of type - exception expected"); assertThat(e.getMessage()).contains( "The provided integer value " + i + " does not correspond to any persistent search change type"); } } } @@ -141,13 +139,13 @@ * Test int to type */ @Test(dataProvider = "persistentSearchChangeTypeData") public void checkIntToTypeTest( HashMap<Integer, String> exceptedValues) throws Exception public void checkIntToTypeTest(Map<Integer, String> exceptedValues) throws Exception { Set<Integer> keys = exceptedValues.keySet() ; Set<PersistentSearchChangeType> returnTypes; HashSet<PersistentSearchChangeType> expectedTypes = Set<PersistentSearchChangeType> expectedTypes = new HashSet<PersistentSearchChangeType>(4); for (int i = 1; i <= 15; i++) @@ -168,27 +166,32 @@ } } // We should have and exception // We should have an exception try { PersistentSearchChangeType.intToTypes(0); assertTrue(false,"the int '" + 0 + "' is not a set of type - exception expected"); fail(); } catch (LDAPException e) catch (LDAPException expected) { assertTrue(true,"the int is not a set of type - exception expected"); assertEquals( expected.getMessage(), "The provided integer value indicated that there were no persistent search change types, which is not allowed"); } // We should have and exception // We should have an exception int i = 16; try { int i = 16 ; PersistentSearchChangeType.intToTypes(i); assertTrue(false,"the int '" + i + "' is not a set of type - exception expected"); fail(); } catch (LDAPException e) catch (LDAPException expected) { assertTrue(true,"the int is not a set of type - exception expected"); assertEquals( expected.getMessage(), "The provided integer value " + i + " was outside the range of acceptable values for an encoded change type set"); } } @@ -196,8 +199,8 @@ * Test type to int */ @Test(dataProvider = "persistentSearchChangeTypeData", dependsOnMethods= {"checkIntToTypeTest"}) public void checkTypesToIntTest( HashMap<Integer, String> exceptedValues) throws Exception public void checkTypesToIntTest(Map<Integer, String> exceptedValues) throws Exception { Set<PersistentSearchChangeType> returnTypes; for (int i = 1; i <= 15; i++) @@ -209,8 +212,8 @@ } @Test(dataProvider = "persistentSearchChangeTypeData", dependsOnMethods= {"checkIntToTypeTest"}) public void checkChangeTypesToStringTest( HashMap<Integer, String> exceptedValues) throws Exception public void checkChangeTypesToStringTest(Map<Integer, String> exceptedValues) throws Exception { Set<PersistentSearchChangeType> returnTypes; for (int i = 1; i <= 15; i++) @@ -254,7 +257,7 @@ boolean isCritical, boolean changesOnly, boolean returnECs) throws Exception { // Test contructor // Test constructor // CheclPersistentSearchControlTest(Set<PersistentSearchChangeType> // changeTypes, // boolean changesOnly, boolean returnECs @@ -271,7 +274,7 @@ assertEquals(OID_PERSISTENT_SEARCH, psc.getOID()); } // Test contructor // Test constructor // CString oid, boolean isCritical, // Set<PersistentSearchChangeType> changeTypes, // boolean changesOnly, boolean returnECs @@ -309,10 +312,12 @@ assertEquals(returnTypes.size(), psc.getChangeTypes().size()); // Check the toString String toString = "PersistentSearchControl(changeTypes=\"" + PersistentSearchChangeType.changeTypesToString(psc.getChangeTypes()) + "\",changesOnly=" + psc.getChangesOnly() + ",returnECs=" +psc.getReturnECs() +")" ; String changeTypes = PersistentSearchChangeType.changeTypesToString(psc.getChangeTypes()); String toString = "PersistentSearchControl(changeTypes=\"" + changeTypes + "\",changesOnly=" + psc.getChangesOnly() + ",returnECs=" + psc.getReturnECs() + ")"; assertEquals(psc.toString(), toString); @@ -321,12 +326,12 @@ { control = new LDAPControl(OID_PERSISTENT_SEARCH, isCritical); psc = PersistentSearchControl.DECODER.decode(control.isCritical(), control.getValue()); assertTrue(false,"the control should have a value"); fail(); } catch (DirectoryException e) catch (DirectoryException expected) { // normal case assertTrue(true,"the control should have a value"); assertEquals(expected.getMessage(), CANNOT_DECODE_PERSISTENT_SEARCH_CONTROL_NO_VALUE); } // check invalid value for the control @@ -335,14 +340,13 @@ control = new LDAPControl(OID_PERSISTENT_SEARCH, isCritical, ByteString.valueOf("invalid value")); psc = PersistentSearchControl.DECODER.decode(control.isCritical(), control.getValue()); assertTrue(false, "the control should have a value"); fail(); } catch (DirectoryException e) catch (DirectoryException expected) { // normal case assertTrue(true, "the control should have a value"); assertThat(expected.getMessage()).contains( "Cannot decode the provided persistent search control"); } } } @@ -368,7 +372,7 @@ boolean isCritical, long changeNumber, String dnString) throws Exception { // Test contructor EntryChangeNotificationControl // Test constructor EntryChangeNotificationControl // (PersistentSearchChangeType changeType,long changeNumber) PersistentSearchChangeType[] types = PersistentSearchChangeType.values(); EntryChangeNotificationControl ecnc = null ; @@ -402,20 +406,11 @@ } catch (DirectoryException e) { if (type.compareTo(PersistentSearchChangeType.MODIFY_DN) == 0) { assertTrue(true,"could decode a control with previousDN=null " + "and type=modDN"); } else { assertTrue(false,"could decode a control with previousDN=null " + "and type=modDN"); } fail(); } } // Test contructor EntryChangeNotificationControl // Test constructor EntryChangeNotificationControl // (PersistentSearchChangeType changeType, DN previousDN, long // changeNumber) DN dn = DN.decode(dnString); @@ -446,21 +441,14 @@ } catch (DirectoryException e) { if (type.compareTo(PersistentSearchChangeType.MODIFY_DN) == 0) { assertTrue(false,"couldn't decode a control with previousDN " + "not null and type=modDN"); } else { assertTrue(true,"couldn't decode a control with previousDN " + "not null and type=modDN"); } assertFalse(type.compareTo(MODIFY_DN) == 0, "couldn't decode a control with previousDN " + "not null and type=modDN"); } } // Test contructor EntryChangeNotificationControl(boolean // Test constructor EntryChangeNotificationControl(boolean // isCritical, PersistentSearchChangeType changeType, // DN previousDN, long changeNumber) for (PersistentSearchChangeType type : types) @@ -491,16 +479,9 @@ } catch (DirectoryException e) { if (type.compareTo(PersistentSearchChangeType.MODIFY_DN) == 0) { assertTrue(false,"couldn't decode a control with previousDN " + "not null and type=modDN"); } else { assertTrue(true,"couldn't decode a control with previousDN " + "not null and type=modDN"); } assertFalse(type.compareTo(PersistentSearchChangeType.MODIFY_DN) == 0, "couldn't decode a control with previousDN " + "not null and type=modDN"); } } @@ -510,24 +491,23 @@ LDAPControl control = new LDAPControl(OID_ENTRY_CHANGE_NOTIFICATION, isCritical); newEcnc = EntryChangeNotificationControl.DECODER.decode(control.isCritical(), control.getValue()); assertTrue(false,"couldn't decode a control with null"); fail(); } catch (DirectoryException e) catch (DirectoryException expected) { assertTrue(true,"couldn't decode a control with null"); assertEquals(expected.getMessage(), CANNOT_DECODE_CHANGE_NOTIF_CONTROL_NO_VALUE); } } private void checkEntryChangeNotificationControlToString(EntryChangeNotificationControl ecnc) { String toString ="EntryChangeNotificationControl(changeType="; toString = toString + ecnc.getChangeType(); String toString = "EntryChangeNotificationControl(changeType=" + ecnc.getChangeType(); if (ecnc.getPreviousDN() != null) { toString = toString + ",previousDN=\"" + ecnc.getPreviousDN() + "\"" ; } if (ecnc.getChangeNumber() > 0) { toString = toString + ",changeNumber=" + ecnc.getChangeNumber() ; @@ -560,16 +540,12 @@ assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); //Create a persistent search request. LinkedHashSet<String> attributes = new LinkedHashSet<String>(); Set<String> attributes = new LinkedHashSet<String>(); attributes.add("cn"); List<Control> controls = new LinkedList<Control>(); // Creates psearch control HashSet<PersistentSearchChangeType> changeTypes = new HashSet<PersistentSearchChangeType>(); changeTypes.add(PersistentSearchChangeType.ADD); changeTypes.add(PersistentSearchChangeType.DELETE); changeTypes.add(PersistentSearchChangeType.MODIFY); changeTypes.add(PersistentSearchChangeType.MODIFY_DN); Set<PersistentSearchChangeType> changeTypes = EnumSet.of(ADD, DELETE, MODIFY, MODIFY_DN); PersistentSearchControl persSearchControl = new PersistentSearchControl( changeTypes, true, true); controls.add(persSearchControl); @@ -579,8 +555,9 @@ 0, // Time limit true, // Types only "(objectClass=*)", attributes, controls, null); Thread t = new Thread(new Runnable() { @Override public void run() { try { search.run(); opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DelayPreOpPlugin.java
@@ -28,25 +28,25 @@ import java.util.Set; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.io.IOException; import java.util.Set; import org.opends.messages.Message; import org.opends.server.admin.std.server.PluginCfg; import org.opends.server.api.plugin.DirectoryServerPlugin; import org.opends.server.api.plugin.PluginType; import org.opends.server.api.plugin.PluginResult; import org.opends.server.api.plugin.PluginType; import org.opends.server.config.ConfigException; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.protocols.asn1.ASN1Reader; import org.opends.server.controls.ControlDecoder; import org.opends.server.protocols.asn1.ASN1; import static org.opends.server.protocols.asn1.ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE; import org.opends.server.protocols.asn1.ASN1Reader; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.types.*; import org.opends.server.types.operation.*; import org.opends.server.controls.ControlDecoder; import org.opends.messages.Message; import static org.opends.server.protocols.asn1.ASN1Constants.*; /** * This class defines a very simple pre-operation plugin that sleeps for up to @@ -80,6 +80,7 @@ /** * {@inheritDoc} */ @Override public DelayRequestControl decode(boolean isCritical, ByteString value) throws DirectoryException { @@ -98,6 +99,7 @@ } } @Override public String getOID() { return OID_DELAY_REQUEST; @@ -115,11 +117,13 @@ private long delayDuration; /** * Constructs a new change number control. * Constructs a new control of this class. * * @param isCritical Indicates whether support for this control should be * considered a critical part of the server processing. * @param delayDuration The requested delay duration. * @param isCritical * Indicates whether support for this control should be considered * a critical part of the server processing. * @param delayDuration * The requested delay duration. */ public DelayRequestControl(boolean isCritical, long delayDuration) { opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DisconnectClientPlugin.java
@@ -28,20 +28,22 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.io.IOException; import org.opends.messages.Message; import org.opends.server.admin.std.server.PluginCfg; import org.opends.server.api.plugin.*; import org.opends.server.api.plugin.DirectoryServerPlugin; import org.opends.server.api.plugin.PluginResult; import org.opends.server.api.plugin.PluginType; import org.opends.server.config.ConfigException; import org.opends.server.controls.ControlDecoder; import org.opends.server.loggers.ErrorLogger; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.types.*; import org.opends.server.types.operation.*; import org.opends.server.controls.ControlDecoder; import org.opends.server.loggers.ErrorLogger; import org.opends.messages.Message; /** @@ -84,6 +86,7 @@ /** * {@inheritDoc} */ @Override public DisconnectClientControl decode(boolean isCritical, ByteString value) throws DirectoryException @@ -91,6 +94,7 @@ return new DisconnectClientControl(isCritical, value.toString()); } @Override public String getOID() { return OID_DISCONNECT_REQUEST; @@ -108,11 +112,13 @@ private String section; /** * Constructs a new change number control. * Constructs a new control of this class. * * @param isCritical Indicates whether support for this control should be * considered a critical part of the server processing. * @param section The section to use for the disconnect. * @param isCritical * Indicates whether support for this control should be considered * a critical part of the server processing. * @param section * The section to use for the disconnect. */ public DisconnectClientControl(boolean isCritical, String section) { opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/ShortCircuitPlugin.java
@@ -28,30 +28,27 @@ import java.util.Set; import java.util.Map; import java.util.List; import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.opends.server.admin.std.server.PluginCfg; import org.opends.server.api.plugin.*; import org.opends.server.config.ConfigException; import org.opends.server.protocols.asn1.ASN1; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.protocols.asn1.ASN1Reader; import org.opends.server.types.ByteString; import org.opends.server.types.Control; import org.opends.server.types.DirectoryException; import org.opends.server.types.ResultCode; import org.opends.server.types.OperationType; import org.opends.server.types.operation.*; import org.opends.server.controls.ControlDecoder; import org.opends.messages.Message; import org.opends.server.admin.std.server.PluginCfg; import org.opends.server.api.plugin.DirectoryServerPlugin; import org.opends.server.api.plugin.PluginResult; import org.opends.server.api.plugin.PluginType; import org.opends.server.config.ConfigException; import org.opends.server.controls.ControlDecoder; import org.opends.server.protocols.asn1.ASN1; import org.opends.server.protocols.asn1.ASN1Reader; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.types.*; import org.opends.server.types.operation.*; import static org.opends.server.protocols.asn1.ASN1Constants. UNIVERSAL_OCTET_STRING_TYPE; import static org.opends.server.protocols.asn1.ASN1Constants.*; /** @@ -85,6 +82,7 @@ /** * {@inheritDoc} */ @Override public ShortCircuitRequestControl decode(boolean isCritical, ByteString value) throws DirectoryException @@ -108,6 +106,7 @@ } } @Override public String getOID() { return OID_SHORT_CIRCUIT_REQUEST; @@ -126,12 +125,15 @@ private String section; /** * Constructs a new change number control. * Constructs a new control of this class. * * @param isCritical Indicates whether support for this control should be * considered a critical part of the server processing. * @param resultCode The result code to return to the client. * @param section The section to use to determine when to short circuit. * @param isCritical * Indicates whether support for this control should be considered * a critical part of the server processing. * @param resultCode * The result code to return to the client. * @param section * The section to use to determine when to short circuit. */ public ShortCircuitRequestControl(boolean isCritical, int resultCode, String section) @@ -647,7 +649,6 @@ { ShortCircuitRequestControl control = operation.getRequestControl(ShortCircuitRequestControl.DECODER); if (control != null && section.equalsIgnoreCase(control.getSection())) { return control.resultCode; opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/SynchronizationMsgTest.java
@@ -607,8 +607,8 @@ { AckMsg msg1, msg2 ; // Constructor test (with ChangeNumber) // Check that retrieved CN is OK // Constructor test (with CSN) // Check that retrieved CSN is OK msg1 = new AckMsg(csn); assertEquals(msg1.getCSN().compareTo(csn), 0); @@ -666,7 +666,7 @@ CSN csn = new CSN(TimeThread.getTime(), 123, 45); op.setAttachment(SYNCHROCONTEXT, new DeleteContext(csn, "uniqueid")); DeleteMsg delmsg = new DeleteMsg(op); int draftcn = 21; int draftCN = 21; String baseDN = "dc=example,dc=com"; @@ -677,10 +677,10 @@ "o=test2:000001210b6f21e904b100000002 000001210b6f21e904b200000002;"); // Constructor test ECLUpdateMsg msg1 = new ECLUpdateMsg(delmsg, cookie, baseDN, draftcn); ECLUpdateMsg msg1 = new ECLUpdateMsg(delmsg, cookie, baseDN, draftCN); assertTrue(msg1.getCookie().equalsTo(cookie)); assertTrue(msg1.getBaseDN().equalsIgnoreCase(baseDN)); assertEquals(msg1.getDraftChangeNumber(), draftcn); assertEquals(msg1.getDraftChangeNumber(), draftCN); DeleteMsg delmsg2 = (DeleteMsg)msg1.getUpdateMsg(); assertEquals(delmsg.compareTo(delmsg2), 0); @@ -691,7 +691,7 @@ assertTrue(msg2.getBaseDN().equalsIgnoreCase(msg1.getBaseDN())); assertTrue(msg2.getBaseDN().equalsIgnoreCase(baseDN)); assertEquals(msg2.getDraftChangeNumber(), msg1.getDraftChangeNumber()); assertEquals(msg2.getDraftChangeNumber(), draftcn); assertEquals(msg2.getDraftChangeNumber(), draftCN); DeleteMsg delmsg1 = (DeleteMsg)msg1.getUpdateMsg(); delmsg2 = (DeleteMsg)msg2.getUpdateMsg(); opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/changelog/je/DbHandlerTest.java
@@ -204,8 +204,8 @@ assertEquals(csn, csns[i]); } assertFalse(cursor.next()); assertNull(cursor.getChange(), "Actual change number=" + cursor.getChange() + ", Expected null"); assertNull(cursor.getChange(), "Actual change=" + cursor.getChange() + ", Expected null"); } finally { opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java
@@ -55,9 +55,6 @@ @SuppressWarnings("javadoc") public class ReplicationDomainTest extends ReplicationTestCase { /** * Create ChangeNumber Data */ @DataProvider(name = "publishAndReceiveData") public Object[][] createpublishAndReceiveData() {