Search code examples
spring-xd

Unable to run test for spring-xd-samples (rss-feed-source)


Preface: I have tried for several days to solve this problem on my own before bothering any of you nice people. Apologies in advance.

My problem: Tests hang for my custom source module as well as the spring-xd-samples project rss-feed-source.

I am running spring-xd 1.1.1.RELEASE on Java 1.7 OSX 10.9.5 and see the same result with mvn in the terminal as well as in Spring Tool Suite. It may be worth mentioning that I have no issue running spring's xd-amdin, xd-container, xd-singlenode, or xd-shell executables.

FeedSourceModuleIntegrationTest is where the several second hang occurs.

/**
 * Start the single node container, binding random unused ports, etc. to not conflict with any other instances
 * running on this host. Configure the ModuleRegistry to include the project module.
 */
@BeforeClass
public static void setUp() {
    RandomConfigurationSupport randomConfigSupport = new RandomConfigurationSupport();
    application = new SingleNodeApplication().run(); // Hang occurs here!
    SingleNodeIntegrationTestSupport singleNodeIntegrationTestSupport = new SingleNodeIntegrationTestSupport(application);
    singleNodeIntegrationTestSupport.addModuleRegistry(new  SingletonModuleRegistry(ModuleType.source, "feed"));
}

FeedConfigurationTest Works just fine!

Here is the terminal output:

(may need to scroll)

$ cd rss-feed-source
$ mvn test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building rss-feed-source 1.0.0.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rss-feed-source ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rss-feed-source ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/food_meister/Documents/spring-xd-samples/rss-feed-source/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rss-feed-source ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ rss-feed-source ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/food_mesiter/Documents/spring-xd-samples/rss-feed-source/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.18:test (default-test) @ rss-feed-source ---
[INFO] Surefire report directory: /Users/food_meister/Documents/spring-xd-samples/rss-feed-source/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.acme.FeedConfigurationTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.749 sec - in com.acme.FeedConfigurationTest
Running com.acme.FeedSourceModuleIntegrationTest

 _____                           __   _______
/  ___|          (-)             \ \ / /  _  \
\ `--. _ __  _ __ _ _ __   __ _   \ V /| | | |
 `--. \ '_ \| '__| | '_ \ / _` |  / ^ \| | | |
/\__/ / |_) | |  | | | | | (_| | / / \ \ |/ /
\____/| .__/|_|  |_|_| |_|\__, | \/   \/___/
      | |                  __/ |
      |_|                 |___/
1.1.1.RELEASE                    eXtreme Data


Started : SingleNodeApplication
Documentation: https://github.com/spring-projects/spring-xd/wiki

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.026 sec - in com.acme.FeedSourceModuleIntegrationTest
[2015-04-11 23:14:01,577] WARN Failed to unregister MBean InMemoryDataTree (org.apache.zookeeper.jmx.MBeanRegistry:117)
[2015-04-11 23:14:01,578] WARN Error during unregister (org.apache.zookeeper.jmx.MBeanRegistry:134)
javax.management.InstanceNotFoundException: org.apache.ZooKeeperService:name0=StandaloneServer_port-1,name1=InMemoryDataTree
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(DefaultMBeanServerInterceptor.java:427)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(DefaultMBeanServerInterceptor.java:415)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanServer.java:546)
    at org.apache.zookeeper.jmx.MBeanRegistry.unregister(MBeanRegistry.java:115)
    at org.apache.zookeeper.jmx.MBeanRegistry.unregister(MBeanRegistry.java:132)
    at org.apache.zookeeper.server.ZooKeeperServer.unregisterJMX(ZooKeeperServer.java:465)
    at org.apache.zookeeper.server.ZooKeeperServer.shutdown(ZooKeeperServer.java:458)
    at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:116)
    at org.springframework.xd.dirt.zookeeper.EmbeddedZooKeeper$ServerRunnable.run(EmbeddedZooKeeper.java:240)
    at java.lang.Thread.run(Thread.java:745)

Results :




Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.890 s
[INFO] Finished at: 2015-04-11T23:14:01-07:00
[INFO] Final Memory: 35M/455M
[INFO] ------------------------------------------------------------------------

Solution

  • It's not clear what you are asking...

    Running com.acme.FeedSourceModuleIntegrationTest
    
    ...
    
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.026 sec - in com.acme.FeedSourceModuleIntegrationTest
    

    Indicates the test ran ok (no errors or failures).

    When I run it in STS, yes there's a delay during the startup (it takes a while to start the single node) but the test runs to successful completion, giving me a green bar.