前言:我已经尝试了好几天自己解决这个问题,然后打扰你们中的任何一个好人。提前道歉。
我的问题:我的自定义源模块以及spring-xd-samples项目rss-feed-source的测试挂起。
我在Java 1.7 OSX 10.9.5上运行spring-xd 1.1.1.RELEASE,并在终端和Spring Tool Suite中看到与mvn相同的结果。值得一提的是,运行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] ------------------------------------------------------------------------
答案 0 :(得分:0)
目前还不清楚你在问什么...
Running com.acme.FeedSourceModuleIntegrationTest
...
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.026 sec - in com.acme.FeedSourceModuleIntegrationTest
表示测试运行正常(没有错误或失败)。
当我在STS中运行它时,是的,启动期间有一个延迟(启动单个节点需要一段时间)但测试运行成功完成,给我一个绿色条。