09 Oct, 2013

1 commit

  • Changes after review from Matthew Swift.
    
    ChangeNumberIndexDB.java:
    In addRecord(), added a precision to the javadoc.
    
    ReplicationDomainDB.java
    In getDomainLatestTrimDate(), added a precision to the javadoc.
    Added replicaHeartbeat() and replicaOffline().
    
    JEChangelogDB.java:
    Added empty implementation for replicaHeartbeat() and replicaOffline().
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9689 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     

08 Oct, 2013

12 commits

  • …uesting transport implementations
    
    As a consequence of fix of issue with StaticUtils#getProvider, reverted change in tests: there is no need for a specific class loader.
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9688 41b1ffd8-f28e-4786-ab96-9950f0a78031
    nicolas.capponi@forgerock.com
     
  • …uesting transport implementations
    
    As a consequence of fix of issue with StaticUtils#getProvider, reverted change in tests: there is no need for a specific class loader.
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9687 41b1ffd8-f28e-4786-ab96-9950f0a78031
    nicolas.capponi@forgerock.com
     
  • …uesting transport implementations
    
    Fixed an issue in StaticUtils#getProvider : passing a null class loader to ServiceLoader#load(Class<T>, ClassLoader) has unexpected effect, 
    ie it is not throwing a NPE and has not the same behavior that ServiceLoader#load(Class<T>).
    
    Now code explicitely checks for null class loader and use the appropriate load method.
    
    As a consequence :
    * Reverted in all tests of opendj-ldap-sdk the use of a specific LDAPOption to provide a specific class loader, as it is not necessary any more with the fix.
    * Removed utility methods in TestCaseUtils class to ease the use of custom class loader, they're not needed anymore
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9686 41b1ffd8-f28e-4786-ab96-9950f0a78031
    nicolas.capponi@forgerock.com
     
  • 
    Changes after review from Matthew Swift.
    Hid ChangeNumberIndexDB.nextChangeNumber() from client code.
    
    
    ChangeNumberIndexDB.java, JEChangeNumberIndexDB.java:
    Removed nextChangeNumber().
    Changed addRecord() to return the assigned changeNumber.
    
    ECLServerHandler.java, CNIndexRecord.java:
    Consequence of the change above.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9685 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • Big code cleanup to remove as much useless variables and useless code as possible to only leave the important parts of the tests.
    There's more to do but I am tired now, I'll see later for the rest.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9684 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • … requesting transport implementations
    This a a part of OPENDJ-175 - Decouple OpenDJ LDAP SDK from Grizzly 
    CR-2440
    
    * LDAPConnectionFactory/LDAPListener load its implementation via java.util.ServiceLoader, the JDK loader facility. 
       An implementation is given by a transport provider.
       
       Common code to load a provider is implemented in StaticUtils#getProvider
    
    * New package org.forgerock.opendj.ldap.spi that contains interfaces for providers and implementations.
      TransportProvider interface which provides:
      - LDAPConnectionFactoryImpl, implementation for LDAPConnectionFactory
      - LDAPListenerImpl, implementation for LDAPListener
    
    * There is one transport provider based on Grizzly: GrizzlyTransportProvider class which provides the two implementation classes
      - GrizzlyLDAPConnectionFactory
      - GrizzlyLDAPListener
    In order to locate transport provider to use, the file 'org.forgerock.opendj.ldap.spi.TransportProvider'
    must be available in the classpath in META-INF/services directory.
    
    That file is included with the value "com.forgerock.opendj.ldap.GrizzlyTransportProvider" to have Grizzly as the default provider
    
    * LDAPOptions and LDAPListenerOptions:
      - have no more TCPNIOTransport option,
      - have two new options transportProvider and providerClassLoader to tune loading of providers.
        - transportProvider allow to require a given provider (eg, "Grizzly"), otherwise the first provider found will be used.
        - providerClassLoader allow to provide a class loader to use when several class loaders are used by an application. 
          ServiceLoader needs to load both provider-configuration file and provider class from the same class loader, 
          so there are case where you must provide the correct class loader to find the provider class.
    
    * Fixed all the tests in opendj-ldap-sdk, because they suffer from the class loader problem if not providing the right class loader
     - Systematically provide the class loader used by test class when creating LDAPConnectionFactory or LDAPListener
     - Added utility methods in TestCaseUtils class to ease the use of custom class loader
    
    * Fixed tests in modules: opendj-ldap-toolkit and opendj-server2x-adapter
     - Same fix than for opendj-ldap-sdk
     - Added new TestCaseUtils.java class in both modules to hold utility methods
    
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9683 41b1ffd8-f28e-4786-ab96-9950f0a78031
    nicolas.capponi@forgerock.com
     
  • 
    Leveraged the ReplicaDBCursor interface to hide iterations cross replica DBs from client code.
    Net benefit: more coherent code + reduced coupling between changelogDB and ECL code.
    There is an added benefit: searching on cn=changelog now returns changes in order.
    
    The change was implemented by moving code from MessageHandler to JEChangelogDB.
    
    
    MessageHandler.java:
    Removed nextOldestUpdateMsg(), addCursorIfNotEmpty() and collectAllCursorsWithChanges().
    Extracted method isLateQueueBelowThreshold().
    
    ReplicationServerDomain.java
    Removed getServerIds() and getCursorFrom(int, CSN)
    Added getCursorFrom(CSN) and getCursorFrom(ServerState).
    
    ReplicationDomainDB.java:
    Removed getDomainServerIds() and getCursorFrom(DN, int, CSN)
    Added getCursorFrom(DN, CSN) and getCursorFrom(DN, ServerState).
    
    JEChangelogDB.java
    Added inenr class CrossReplicaDBCursor + moved getCursorFrom(DN, int, CSN) here from enclosing type.
    Removed getDomainServerIds().
    Added getCursorFrom(DN, CSN) and getCursorFrom(DN, ServerState).
    
    ReplicationBackend.java:
    In writeChangesAfterCSN(), removed loop on the serverIds + renamed "rsd" to "rsDomain".
    
    JEReplicaDB.java, JEReplicaDBCursor.java:
    Implemented toString().
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9682 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • git-svn-id: https://svn.forgerock.org/opendj/trunk@9681 41b1ffd8-f28e-4786-ab96-9950f0a78031
    ludo
     
  • MultiDomainServerState.java
    In update() removed the call to ServerState.duplicate() and let client code decide whether it needs to call it.
    In toString(), use dSTringBuilder.
    Code cleanup, removed use of "this" and useless parentheses.
    
    ReplicationServer.java:
    In getLastECLCookie(), made the code more efficient: called ReplicationServerDomain.getLatestServerState() only if the baseDN is not excluded.
    
    ECLServerHandler.java:
    In buildDomainContexts(), Call ServerState.duplicate() before calling MultiDomainServerState.update().
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9680 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • Extracted methods isMsgQueueAboveThreshold() and isMsgQueueBelowThreshold().
    Extracted MsgQueue.consumeUpTo(UpdateMsg).
    Updated javadocs.
    
    MsgQueue.java:
    Added method consumeUpTo(UpdateMsg).
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9679 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • 
    Tightening up the interfaces after review from Matthew Swift
    
    CNIndexRecord.java:
    Now final, removed a useless call to super().
    
    ChangeNumberIndexDB.java, JEChangeNumberIndexDB.java:
    Removed methods from the interface that ought not to be exposed to clients but remain internal to the implementation.
    Moved javadocs to the implementation.
    
    JEChangelogDB.java:
    Reference JEChangeNumberIndexDB instead of ChangeNumberIndexDB due to the change above.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9678 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • ECLServerHandler.java:
    Renamed clDomCtxtsToString() to domaimCtxtsToString().
    In waitAndProcessStartSessionECLFromRemoteServer(), removed the many declared exceptions.
    Extracted method buildDomainContexts().
    Renamed findOldestChangeFromDomainCtxts() to findDomainCtxtWithOldestChange().
    Removed useless comments
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9677 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     

07 Oct, 2013

7 commits

  • Renamed "rsd" variable and field to "domain" and "rsDomain".
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9675 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • ECLServerHandler.java:
    In getNextMessage(), forgot to revert one condition.
    Changed domainCtxts from DomainContext[] to Set<DomainContext>.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9674 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • ECLServerHandler.java:
    Moved fields to the top of the file.
    Extracted method asDate(), toString(CSN), isEligible(), debugInfo(), getNextMessage(), newECLUpdateMsg().
    Renamed getNextEligibleMessageForDomain() to computeNextEligibleMessageForDomain().
    Renamed initializeCLSearchFromGenState() to initializeCLSearchFromCookie().
    In initializeChangelogDomainCtxts(), used foreach + extracted local variable "latestServerState" (no need to duplicate it) + collapsed one if statement.
    Removed commented out code.
    
    ECLServerWriter.java:
    Minor code cleanup:
    - Removed useless parentheses
    - Collapsed if statements
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9673 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • * rename CSN comparison methods to make them easier to understand.
    
    
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9672 41b1ffd8-f28e-4786-ab96-9950f0a78031
    matthew
     
  • 
    Slayered walking dead code.
    Walking dead code is code that looks it is alive, tastes just like if it was alive, but there is funny smell about it, and actually... it turns out this code is dead.
    ReplicationServerDomain.getEligibleState() is walking dead code because:
    - JEChangelogDB.getCSNAfter() always returns null: the API of ReplicaDBCursor mandates to call call next() before calling getChange(), however getCSNAfter() fails to do so, hence getChange() always returns null, which means getCSNAfter() always returns null.
    - the "result" local variable is a duplicate of "latestState", which means it starts of with the exact same state. The code iterates through "latestState" to get its CSNs, calling update() on "result" with these CSNs. But... since "result" duplicates "latestState", it has the exact same CSNs, which means calling update() will have no effect on "result", leaving it on the same state as it was before the iterations.
    
    
    ECLServerHandler.java, ReplicationServer.java:
    Replaced ReplicationServerDomain.getEligibleState() with ReplicationServerDomain.getLatestServerState().duplicate() where applicable.
    
    ReplicationServerDomain.java:
    Removed getEligibleState() which does literally nothing, but in a very inneficient way.
    
    ReplicationDomainDB.java, JEChangelogDB.java:
    Removed getCSNAfter(), now become unused.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9671 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • * remove serverId parameter from ReplicationDomainDB#publishUpdateMsg().
    
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9670 41b1ffd8-f28e-4786-ab96-9950f0a78031
    matthew
     
  • Fixing this test: the main problem was in classCleanUp() that was trying to remove non leaves entries, which ended up in a failure.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9669 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     

05 Oct, 2013

3 commits

  • Fixing this test: the main problem was in afterTest() that was trying to remove non leaves entries, which ended up in a failure.
    Renamed all the "changelog" to "replServer".
    Extracted a few methods.
    Removed useless parameters from other methods.
    Removed useless methods.
    Removed unneeded try / catch / log.
    Made better use of assertions and assertj.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9668 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • I think it was invalid to think that we might want to call getCount() for a given serverId (hence replicaDB) by using the serverId from one of the CSNs. We can very well call getCount() with from and to CSNs that are not present on the targeted replicaDB.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9667 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • Fixed problem introduced in tests at r9648.
    
    HeartBeatMsg.java:
    Added toString().
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9666 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     

04 Oct, 2013

10 commits

  • … it helps with CI that runs on single CPU machine.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9665 41b1ffd8-f28e-4786-ab96-9950f0a78031
    ludo
     
  • Note that these tests may still fail some time to time, since they expect the JMX connection handler to start in less than 1 second, which might be low on a single cpu VM.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9664 41b1ffd8-f28e-4786-ab96-9950f0a78031
    ludo
     
  • * fix minor behavior change introduced in r9660.
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9663 41b1ffd8-f28e-4786-ab96-9950f0a78031
    matthew
     
  • Renamed some classes in package src.server.org.opends.server.replication.server.changelog.je:
    - DbHandler.java         => JEReplicaDB.java (and tests)
    - DraftCNDbHandler.java  => JEChangeNumberIndexDB.java (and tests)
    - DraftCNDbIterator.java => JEChangeNumberIndexDBCursor.java
    
    *.java:
    Consequence of the renames.
    Changed methods/variables/parameter names and comments to reflect the new names. In particular, bye bye to DraftCNDb, DbHandler and welcome to CNIndexDB and ReplicaDB.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9662 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • * remove serverId parameter from ReplicationDomainDB.getCount(DN, int, CSN, CSN)
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9661 41b1ffd8-f28e-4786-ab96-9950f0a78031
    matthew
     
  • * convert ServerState to implement Iterable<CSN> instead of Iterable<Integer>
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9660 41b1ffd8-f28e-4786-ab96-9950f0a78031
    matthew
     
  • 
    Changes after review from Matthew Swift.
    
    
    ReplicationServerDomain.java
    Renamed changelogDB field to domainDB + changed type.
    
    ChangelogDB.java, JEChangelogDB.java:
    Extracted interface ReplicationDomainDB from this interface.
    Added getReplicationDomainDB().
    
    ReplicationDomainDB.java: ADDED
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9659 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • Changes after review from Matthew Swift.
    
    
    ChangelogDB.java, JEChangelogDB.java:
    Removed getDBDirectoryName(), not needed anymore.
    In getDomainServerIds(), now return an unmodifiable set.
    In getDomainOldestCSNs() and getDomainNewestCSNs(), now return a ServerState object.
    
    ReplicationServerDomain.java:
    Consequence of the change to ChangelogDB.
    
    ReplicationServer.java
    Consequence of the change to ChangelogDB.
    Added config instance field + removed all the instance field that are duplicating its info + added getConfiguredRSAddresses() to replace toHostPorts() + adapted the code + moved some javadocs.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9658 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • 
    LDAPReplicationDomain.replay() may lose error messages after too many replay attempts if "op" gets overwritten.
    
    
    LDAPReplicationDomain.java:
    In replay():
    - Added the "nextOp" local variable so the code can keep error messages in the "op" local variable until the next loop iteration starts.
    - Reduced as much as possible the scope of local variables to avoid the need to reinitialize them.
    - Renamed "newOp" local variables to "castOp"
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9657 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • Over the shoulder review by Nicolas Capponi
    
    Removed unnecessary if guards before calling logging: rely on SLF4J to lazily call toString() when needed.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9656 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     

03 Oct, 2013

7 commits

  • These changes are adding a new optional configuration parameter : rmi-port, to allow specifying a fixed port for the RMI connection underlying JMX. This is required when managing applications need to connect to OpenDJ through a firewall.
    CR-2429.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9655 41b1ffd8-f28e-4786-ab96-9950f0a78031
    ludo
     
  • git-svn-id: https://svn.forgerock.org/opendj/trunk@9654 41b1ffd8-f28e-4786-ab96-9950f0a78031
    ludo
     
  • * add slf4j-jdk14 compile dependency for the examples, toolkit, and rest2ldap servlet
    * add slf4j-jdk14 test dependency for all sub-modules.
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9653 41b1ffd8-f28e-4786-ab96-9950f0a78031
    matthew
     
  • * reduce log level of heartbeat failure message.
    
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9651 41b1ffd8-f28e-4786-ab96-9950f0a78031
    matthew
     
  • …fore proceeding. Adding a wait should solve the problem.
    
    
    ReplicationTestCase.java
    Added executeTask().
    Used simpler InternalConnection.process*() APIs.
    
    HistoricalTest.java:
    Used ReplicationTestCase.executeTask().
    Inlined local variables.
    Extracted method getEntryValue().
    Changed signature of publishModify().
    
    GenerationIdTest.java:
    Used ReplicationTestCase.executeTask().
    Renamed assertNoMessageReceivedBadGenId() to assertNoMessageReceived().
    
    ReplicationServerTest.java
    Used ReplicationTestCase.executeTask().
    
    
    TestCaseUtils.java:
    Used simpler InternalConnection.process*() APIs.
    
    UpgradeTestCase.java
    Renamed isOutputContainsExpectedMessage() to assertContainsMessage().
    
    *Test.java:
    Used assertj.
    Let the exceptions go up.
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9650 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac
     
  • git-svn-id: https://svn.forgerock.org/opendj/trunk@9649 41b1ffd8-f28e-4786-ab96-9950f0a78031
    ludo
     
  • Change entryList and configEntryList from LinkedList to Set and renamed them to entriesToCleanup and configEntriesToCleanup.
    Extracted method connect() and waitForSpecificMsg() + Changed the return type of the existing waitForSpecificMsg() methods.
    In configureReplication(), added 2 String parameters + extracted method addSynchroServerEntry() and addConfigEntry().
    Simplified code a lot.
    
    *Test[Case].java:
    Consequence of the changes to ReplicationTestCase.
    Factorized code with ReplicationTestCase.
    Various cleanups:
    - used assertj
    - used StaticUtils.close()
    - made fields private
    - used foreach
    - used assertEquals() instead of assertTrue()
    - removed try/catch/fail test anti pattern.
    - let exceptions go up the stack
    
    ProtocolWindowTest.java:
    Extracted method searchNbMonitorEntries().
    
    git-svn-id: https://svn.forgerock.org/opendj/trunk@9648 41b1ffd8-f28e-4786-ab96-9950f0a78031
    JnRouvignac