This is mostly a heads-up for anyone trying to run Repository unit tests on the latest version of the alfresco-repository from Github. TL;DR the defaults now assume you have the message bus stuff running and available, the readme doesn't, and you need to set messaging.subsystem.autoStart=false to get your tests to not hang
Last week, I thought I'd found a bug in the Repo. (Spoiler - I did, reported and suggested fix as Mail action executor better html detection by Gagravarr · Pull Request #364 · Alfresco/alfresco-repository · GitHub ). So, the first thing I did was checkout the latest code from Github. My plan was to add a failing unit test, fix it, see the unit test pass, then contribute back. But before that, I needed to run the existing unit test just to ensure I had everything setup.
I followed the instructions in the README, and (with a tweak to set the test name and db name) ran:
mvn clean test -Dtest=org.alfresco.repo.action.executer.MlActionExecuterTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco_test -Ddb.url=jdbc:postgresql:alfresco_test -Ddb.username=alfresco -Ddb.password=alfresco
And... It just hung, the last log line was
INFO [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] [main] Starting 'Messaging' subsystem, ID: [Messaging, default]
It turns out that the repo by default now needs the ActiveMQ message broker stuff that was talked about at devcon. No mention in the readme, but without it, it'll hang. Poking around, I discovered that the magic property to disable it (since the functionality I needed to test didn't use it) is
With that set, the unit test ran! I was able to add the extra checks, fix the bug, and contribute back. My working maven command was then
mvn clean test -Dtest=org.alfresco.repo.action.executer.MailActionExecuterTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco_test -Ddb.url=jdbc:postgresql:alfresco_test -Ddb.username=alfresco -Ddb.password=alfresco -Dmessaging.subsystem.autoStart=false
Hope that helps anyone else trying to run the repo unit tests!