如何在测试之前启动activemq并转移到测试

时间:2017-10-24 02:49:22

标签: maven automation activemq

我正在尝试测试我的应用程序,它将消息发送到队列(Activemq)。

我有一个maven测试项目,它可以从javax.jms.MessageConsumer使用者那里消费。

如果我要在maven构建中启动activemq,我就是在回答here。但是,它会在启动activemq时停止,并且不会将构建移动到测试执行。

我的构建xml部分如下所示,

        <plugin>
            <groupId>org.apache.activemq.tooling</groupId>
            <artifactId>maven-activemq-plugin</artifactId>
            <version>5.7.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <phase>process-test-classes</phase> 
                </execution>
            </executions>
        </plugin>

我正在寻找一种让maven在activemq启动后进入下一阶段的方法。

我还尝试了新版本的插件,即 activemq-maven-plugin ;

        <plugin>
            <groupId>org.apache.activemq.tooling</groupId>
            <artifactId>activemq-maven-plugin</artifactId>
            <version>5.15.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <phase>process-test-classes</phase>
                </execution>
            </executions>
        </plugin>

无论哪种情况,我的maven构建都停在......

[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ my-automation ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to C:\Users\xyz\my-automation\target\test-classes
[INFO] 
[INFO] --- maven-activemq-plugin:5.7.0:run (default) @ my-automation ---
[INFO] Loading broker configUri: broker:(tcp://localhost:61616)?useJmx=false&persistent=false
[INFO] Using Persistence Adapter: MemoryPersistenceAdapter
[INFO] Apache ActiveMQ 5.7.0 (localhost, ID:XYZ-0001:1) is starting
[INFO] Listening for connections at: tcp://127.0.0.1:61616
[INFO] Connector tcp://127.0.0.1:61616 Started
[INFO] Apache ActiveMQ 5.7.0 (localhost, ID:XYZ-0001:1) started
[INFO] For help or more information please see: http://activemq.apache.org

activemq已启动的位置。

我如何从这一点开始?

1 个答案:

答案 0 :(得分:0)

将以下内容添加到插件声明中:

Main: in thread <_MainThread(MainThread, started 140737137116096)>
Main: in process 80462
Task: in thread <_MainThread(MainThread, started 140737137116096)>
Task: in process 80463
Callback: in thread <Thread(Thread-1, started daemon 123145465724928)>
Callback: in process 80462