mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
15.41.2010 66588dabcb904716d6465a0f51a0c001249e586b
Fix potential corruption of search result entries in unit tests.
1 files modified
17 ■■■■ changed files
opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/LDAPServer.java 17 ●●●● patch | view | raw | blame | history
opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/LDAPServer.java
@@ -133,7 +133,7 @@
  // The mapping between entry DNs and the corresponding entries.
  private final ConcurrentHashMap<DN, SearchResultEntry> entryMap = new ConcurrentHashMap<DN, SearchResultEntry>();
  private final ConcurrentHashMap<DN, Entry> entryMap = new ConcurrentHashMap<DN, Entry>();
  // The grizzly transport.
  private final TCPNIOTransport transport = TransportFactory.getInstance()
@@ -157,7 +157,7 @@
  private LDAPServer()
  {
    // Add the root dse first.
    entryMap.put(DN.rootDN(), Responses.newSearchResultEntry(DN.rootDN()));
    entryMap.put(DN.rootDN(), Types.unmodifiableEntry(new LinkedHashMapEntry()));
    for (int i = 0; i < 1000; i++)
    {
      final String dn = String.format("uid=user.%d,ou=people,o=test", i);
@@ -166,10 +166,10 @@
      final String uid = String.format("uid: user.%d", i);
      final DN d = DN.valueOf(dn);
      final SearchResultEntry e = Responses.newSearchResultEntry("dn: " + dn,
      final Entry e = new LinkedHashMapEntry("dn: " + dn,
          "objectclass: person", "objectclass: inetorgperson",
          "objectclass: top", cn, sn, uid);
      entryMap.put(d, e);
      entryMap.put(d, Types.unmodifiableEntry(e));
    }
  }
@@ -342,7 +342,7 @@
    }
    // Get the entry.
    final SearchResultEntry entry = entryMap.get(dn);
    final Entry entry = entryMap.get(dn);
    final AttributeDescription attrDesc = request.getAttributeDescription();
    for (final Attribute attr : entry.getAllAttributes(attrDesc))
    {
@@ -519,7 +519,8 @@
      return;
    }
    final SearchResultEntry e = entryMap.get(dn);
    final SearchResultEntry e = Responses.newSearchResultEntry(
        new LinkedHashMapEntry(entryMap.get(dn)));
    // Check we have had any controls in the request.
    for (final Control control : request.getControls())
    {
@@ -543,7 +544,7 @@
   * @param port
   * @exception IOException
   */
  public void start(final int port) throws IOException
  public synchronized void start(final int port) throws IOException
  {
    if (isRunning)
    {
@@ -562,7 +563,7 @@
  /**
   * Stops the server.
   */
  public void stop()
  public synchronized void stop()
  {
    if (!isRunning)
    {