无法 运行 测试 spring-xd-samples (rss-feed-source)

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

前言: 在打扰你们任何好人之前,我已经尝试了好几天自己解决这个问题。提前致歉。

我的问题: 我的自定义源模块以及 spring-xd-samples 项目的测试挂起 rss-feed-source.

我是 运行 spring-xd 1.1.1.RELEASE 在 Java 1.7 OSX 10.9.5 上看到与 mvn 相同的结果终端以及 Spring 工具套件。可能值得一提的是,我没有问题 运行 spring 的 xd-amdin、xd-container、xd-singlenode 或 xd-shell 可执行文件。

FeedSourceModuleIntegrationTest 是几秒钟挂起的地方。

/**
 * 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 工作正常!

这是终端输出:

(可能需要滚动)

$ 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] ------------------------------------------------------------------------

不清楚你在问什么...

Running com.acme.FeedSourceModuleIntegrationTest

...

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

表示测试运行 ok(没有错误或失败)。

当我在 STS 中 运行 时,是的,在启动过程中有延迟(启动单个节点需要一段时间)但是测试 运行s 成功完成,给了我一个绿条。