- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一组通过Spring Boot实现的微服务,它们通过HTTP REST进行通信。我正在尝试使用Citrus框架设置集成测试。我已经为某些服务成功编写并执行了集成测试,但是正在为更复杂的用例而苦苦挣扎。
场景如下:
我有一个概念性的“任务计划”应用程序,涉及3个服务:任务计划器,路线生成器和路线评估器。任务计划者要求2条路线服务执行计划任务所需的一些工作。路由服务不进行REST调用。
我已经设置了我的maven POM文件,以便在执行Maven验证步骤时运行集成测试。故障安全和Spring Boot maven插件已配置为执行此操作。
路线服务的集成测试按预期工作,但任务计划程序的测试不起作用。我怀疑一个可能的原因是路由服务尚未启动。因此,在进行了一些研究之后,我在集成测试逻辑中插入了调用,以在进行测试工作之前启动这两个服务,并随后停止它们。
我不确定100%是否已采取正确的步骤正确启动服务。我也很好奇是否有办法知道他们是否真的成功启动了。我找不到解决此问题的任何文档。
无论如何,要么它们没有被启动,要么它们的配置有问题,或者还有其他引起问题的原因。当我运行测试时,它失败,并指示任务计划程序无法连接到路由生成器(首先称为路由生成器)。
以下是网络详细信息:
目前一切都在localhost上运行。
当前不涉及SSL / TLS。
路由生成器将在端口9110上侦听。
路由评估器将在端口9120上侦听。
任务计划程序配置为使用上述端口访问路线服务。
我的工作场所确实使用HTTP代理-这会影响本地主机通信吗?
任务计划者
EndpointConfig.java:
@Configuration
public class EndpointConfig {
@Bean
public HttpClient missionPlannerHTTPClient() {
return CitrusEndpoints.http().client().requestUrl("http://localhost:9100").build();
}
@Bean
public Server routeGeneratorServer() {
return CitrusEndpoints.http().server().port(9110).timeout(10000).build();
}
@Bean
public Server routeAssessorServer() {
return CitrusEndpoints.http().server().port(9120).timeout(10000).build();
}
}
http().server("helloHttpServer")
.receive()
.post("/test")
.payload("<testRequestMessage>" +
"<text<Hello HttpServer</text>" +
"</testRequestMessage>")
.contentType("application/xml")
.accept("application/xml, */*")
.header("X-CustomHeaderId", "${custom_header_id}")
.header("Authorization", "Basic c29tZVVzZXJuYW1lOnNvbWVQYXNzd29yZA==")
.extractFromHeader("X-MessageId", "message_id");
http().server("helloHttpServer")
.send()
.response(HttpStatus.OK)
.payload("<testResponseMessage>" +
"<text<Hello Citrus</text>" +
"</testResponseMessage>")
.version("HTTP/1.1")
.contentType("application/xml")
.header("X-CustomHeaderId", "${custom_header_id}")
.header("X-MessageId", "${message_id}");
public class MissionPlannerIT extends JUnit4CitrusTest {
@Qualifier("routeGeneratorServer")
private HttpServer routeGeneratorServer;
@Qualifier("routeAssessorServer")
private HttpServer routeAssessorServer;
@Autowired
private HttpClient missionPlannerHTTPClient;
@Test
@CitrusTest
// @formatter:off
public void testPlanMission(@CitrusResource TestRunner runner) {
runner.description("Test mission planning 'plan mission' REST endpoint");
// Start route generator and route assessor.
runner.start(routeGeneratorServer);
runner.start(routeAssessorServer);
// Call mission planner to plan a mission.
// Note: There is no request body (payload).
runner.http(builder -> builder
.client(missionPlannerHTTPClient)
.send()
.post("/v1/missionServices/missionPlanning/planMission"));
// Expect a success response.
runner.http(builder -> builder
.client(missionPlannerHTTPClient)
.receive()
.response(HttpStatus.OK)
.messageType(MessageType.JSON)
.payload(new ClassPathResource("templates/plan-mission-response.json")));
// Shut down route services.
runner.stop(routeGeneratorServer);
runner.stop(routeAssessorServer);
}
// @formatter:on
}
@Qualifier
而不是
@Autowired
进行注释。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemProperties>
<system.under.test.mode>${system.under.test.mode}</system.under.test.mode>
</systemProperties>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>edu.mit.ll.mission_services.service.mission_planner.ApplicationMain</mainClass>
<useTestClasspath>false</useTestClasspath>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
$ mvn verify
...
[INFO] --- spring-boot-maven-plugin:2.1.6.RELEASE:start (pre-integration-test) @ mission-planner ---
...
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:integration-test (default) @ mission-planner ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running edu.mit.ll.mission_services.service.mission_planner.MissionPlannerIT
[WARNING]
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:9110/v1/missionServices/missionPlanning/generateRoute": Connect to localhost:9110 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:9110 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
at org.springframework.web.client.RestTemplate.doExecute (RestTemplate.java:744)
at org.springframework.web.client.RestTemplate.execute (RestTemplate.java:670)
at org.springframework.web.client.RestTemplate.postForEntity (RestTemplate.java:445)
at edu.mit.ll.mission_services.service.mission_planner.service.MissionPlanner.postGenerateRoute (MissionPlanner.java:210)
at edu.mit.ll.mission_services.service.mission_planner.service.MissionPlanner.planMission (MissionPlanner.java:143)
at edu.mit.ll.mission_services.service.mission_planner.controller.MissionPlannerController$Runner.executeTask (MissionPlannerController.java:51)
at edu.mit.ll.mission_services.common.util.ITask.run (ITask.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:9110 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect (DefaultHttpClientConnectionOperator.java:156)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect (PoolingHttpClientConnectionManager.java:374)
at org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:56)
at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal (HttpComponentsClientHttpRequest.java:87)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal (AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute (AbstractClientHttpRequest.java:53)
at org.springframework.web.client.RestTemplate.doExecute (RestTemplate.java:735)
at org.springframework.web.client.RestTemplate.execute (RestTemplate.java:670)
at org.springframework.web.client.RestTemplate.postForEntity (RestTemplate.java:445)
at edu.mit.ll.mission_services.service.mission_planner.service.MissionPlanner.postGenerateRoute (MissionPlanner.java:210)
at edu.mit.ll.mission_services.service.mission_planner.service.MissionPlanner.planMission (MissionPlanner.java:143)
at edu.mit.ll.mission_services.service.mission_planner.controller.MissionPlannerController$Runner.executeTask (MissionPlannerController.java:51)
at edu.mit.ll.mission_services.common.util.ITask.run (ITask.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect (Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect (DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect (PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:392)
at java.net.Socket.connect (Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket (PlainConnectionSocketFactory.java:75)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect (DefaultHttpClientConnectionOperator.java:142)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect (PoolingHttpClientConnectionManager.java:374)
at org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:56)
at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal (HttpComponentsClientHttpRequest.java:87)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal (AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute (AbstractClientHttpRequest.java:53)
at org.springframework.web.client.RestTemplate.doExecute (RestTemplate.java:735)
at org.springframework.web.client.RestTemplate.execute (RestTemplate.java:670)
at org.springframework.web.client.RestTemplate.postForEntity (RestTemplate.java:445)
at edu.mit.ll.mission_services.service.mission_planner.service.MissionPlanner.postGenerateRoute (MissionPlanner.java:210)
at edu.mit.ll.mission_services.service.mission_planner.service.MissionPlanner.planMission (MissionPlanner.java:143)
at edu.mit.ll.mission_services.service.mission_planner.controller.MissionPlannerController$Runner.executeTask (MissionPlannerController.java:51)
at edu.mit.ll.mission_services.common.util.ITask.run (ITask.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
09:00:46.576 [main] ERROR com.consol.citrus.report.LoggingReporter - TEST FAILED MissionPlannerIT.testPlanMission <edu.mit.ll.mission_services.service.mission_planner> Nested exception is:
com.consol.citrus.exceptions.TestCaseFailedException: Failed to validate JSON text:
{"timestamp":"2020-02-06T14:00:46.436+0000","status":503,"error":"Service Unavailable","message":"Service Unavailable","path":"/v1/missionServices/missionPlanning/planMission"} Number of JSON entries not equal for element: '$.', expected '1' but was '5'
at com.consol.citrus.TestCase.executeAction(TestCase.java:227) [citrus-core-2.8.0.jar:?]
at com.consol.citrus.dsl.runner.DefaultTestRunner.run(DefaultTestRunner.java:188) ~[citrus-java-dsl-2.8.0.jar:?]
at com.consol.citrus.dsl.runner.DefaultTestRunner.http(DefaultTestRunner.java:540) [citrus-java-dsl-2.8.0.jar:?]
at edu.mit.ll.mission_services.service.mission_planner.MissionPlannerIT.testPlanMission(MissionPlannerIT.java:44) ~[test-classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at com.consol.citrus.dsl.junit.JUnit4CitrusTest.invokeTestMethod(JUnit4CitrusTest.java:99) [citrus-java-dsl-2.8.0.jar:?]
at com.consol.citrus.dsl.junit.JUnit4CitrusTest.run(JUnit4CitrusTest.java:70) [citrus-java-dsl-2.8.0.jar:?]
at com.consol.citrus.junit.CitrusJUnit4Runner$InvokeRunMethod.evaluate(CitrusJUnit4Runner.java:217) [citrus-core-2.8.0.jar:?]
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) [surefire-booter-2.22.2.jar:2.22.2]
Caused by: com.consol.citrus.exceptions.ValidationException: Failed to validate JSON text:
{"timestamp":"2020-02-06T14:00:46.436+0000","status":503,"error":"Service Unavailable","message":"Service Unavailable","path":"/v1/missionServices/missionPlanning/planMission"} Number of JSON entries not equal for element: '$.', expected '1' but was '5'
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessage(JsonTextMessageValidator.java:127) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessage(JsonTextMessageValidator.java:62) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:46) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:231) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:128) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.dsl.actions.DelegatingTestAction.doExecute(DelegatingTestAction.java:54) ~[citrus-java-dsl-2.8.0.jar:?]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.TestCase.executeAction(TestCase.java:220) ~[citrus-core-2.8.0.jar:?]
... 36 more
Caused by: java.lang.IllegalArgumentException: Number of JSON entries not equal for element: '$.', expected '1' but was '5'
at org.springframework.util.Assert.isTrue(Assert.java:118) ~[spring-core-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateJson(JsonTextMessageValidator.java:170) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessage(JsonTextMessageValidator.java:115) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessage(JsonTextMessageValidator.java:62) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:46) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:231) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:128) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.dsl.actions.DelegatingTestAction.doExecute(DelegatingTestAction.java:54) ~[citrus-java-dsl-2.8.0.jar:?]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.8.0.jar:?]
at com.consol.citrus.TestCase.executeAction(TestCase.java:220) ~[citrus-core-2.8.0.jar:?]
... 36 more
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 13.907 s <<< FAILURE! - in edu.mit.ll.mission_services.service.mission_planner.MissionPlannerIT
[ERROR] testPlanMission(edu.mit.ll.mission_services.service.mission_planner.MissionPlannerIT) Time elapsed: 9.88 s <<< ERROR!
com.consol.citrus.exceptions.TestCaseFailedException:
Failed to validate JSON text:
{"timestamp":"2020-02-06T14:00:46.436+0000","status":503,"error":"Service Unavailable","message":"Service Unavailable","path":"/v1/missionServices/missionPlanning/planMission"} Number of JSON entries not equal for element: '$.', expected '1' but was '5'
at edu.mit.ll.mission_services.service.mission_planner.MissionPlannerIT.testPlanMission(MissionPlannerIT.java:44)
Caused by: com.consol.citrus.exceptions.ValidationException:
Failed to validate JSON text:
{"timestamp":"2020-02-06T14:00:46.436+0000","status":503,"error":"Service Unavailable","message":"Service Unavailable","path":"/v1/missionServices/missionPlanning/planMission"} Number of JSON entries not equal for element: '$.', expected '1' but was '5'
at edu.mit.ll.mission_services.service.mission_planner.MissionPlannerIT.testPlanMission(MissionPlannerIT.java:44)
Caused by: java.lang.IllegalArgumentException: Number of JSON entries not equal for element: '$.', expected '1' but was '5'
at edu.mit.ll.mission_services.service.mission_planner.MissionPlannerIT.testPlanMission(MissionPlannerIT.java:44)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] MissionPlannerIT>JUnit4CitrusTest.run:70->JUnit4CitrusTest.invokeTestMethod:102 » TestCaseFailed
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:integration-test (integration-tests) @ mission-planner ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.6.RELEASE:stop (post-integration-test) @ mission-planner ---
[INFO] Stopping application...
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:verify (default) @ mission-planner ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Mission Services - REST 0.0.1-SNAPSHOT:
[INFO]
[INFO] Mission Services - REST ............................ SUCCESS [ 2.475 s]
[INFO] Common Utilities ................................... SUCCESS [ 3.778 s]
[INFO] Mission Services Message Types ..................... SUCCESS [ 1.823 s]
[INFO] Security ........................................... SUCCESS [ 1.262 s]
[INFO] Mission Planner Client ............................. SUCCESS [ 4.679 s]
[INFO] Mission Planner Service ............................ FAILURE [ 48.212 s]
[INFO] Route Generator Service ............................ SKIPPED
[INFO] Route Assessor Service ............................. SKIPPED
[INFO] UAV Service ........................................ SKIPPED
[INFO] Correlator Service ................................. SKIPPED
[INFO] Correlator Client .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:03 min
[INFO] Finished at: 2020-02-06T09:00:50-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.22.2:verify (default) on project mission-planner: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\JO24447\workspace\REST_RST_Service\mission-services\mission-planner\target\failsafe-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :mission-planner
@Autowired
@Qualifier("networkBackendHttpServer")
private HttpServer networkHttpServer;
@Autowired
批注。那就是我的代码所缺少的。记住,我对上面的事情很感兴趣。如果只有我知道
@Qualifer
注释做了什么和没有做什么。
最佳答案
解决方案很简单。我需要用@Autowired
注释我的“服务器”对象。
public class MissionPlannerIT extends JUnit4CitrusTest {
@Autowired
@Qualifier("routeGeneratorServer")
private HttpServer rgServer;
@Autowired
@Qualifier("routeAssessorServer")
private HttpServer raServer;
@Qualifier
注释也会自动连接这些对象。嘿,不。
关于java - Citrus Framework-SUT与其他服务进行通信时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60097222/
关闭。这个问题是off-topic .它目前不接受答案。 想要改进这个问题? Update the question所以它是on-topic用于堆栈溢出。 关闭 12 年前。 Improve thi
我有一个动态网格,其中的数据功能需要正常工作,这样我才能逐步复制网格中的数据。假设在第 5 行中,我输入 10,则从第 6 行开始的后续行应从 11 开始读取,依此类推。 如果我转到空白的第一行并输入
我有一个关于我的按钮消失的问题 我已经把一个图像作为我的按钮 用这个函数动画 function example_animate(px) { $('#cont
我有一个具有 Facebook 连接和经典用户名/密码登录的网站。目前,如果用户单击 facebook_connect 按钮,系统即可运行。但是,我想将现有帐户链接到 facebook,因为用户可以选
我有一个正在为 iOS 开发的应用程序,该应用程序执行以下操作 加载和设置注释并启动核心定位和缩放到位置。 map 上有很多注释,从数据加载不会花很长时间,但将它们实际渲染到 map 上需要一段时间。
我被推荐使用 Heroku for Ruby on Rails 托管,到目前为止,我认为我真的会喜欢它。只是想知道是否有人可以帮助我找出问题所在。 我按照那里的说明在该网站上创建应用程序,创建并提交
我看过很多关于 SSL 错误的帖子和信息,我自己也偶然发现了一个。 我正在尝试使用 GlobalSign CA BE 证书通过 Android WebView 访问网页,但出现了不可信错误。 对于大多
我想开始使用 OpenGL 3+ 和 4,但我在使用 Glew 时遇到了问题。我试图将 glew32.lib 包含在附加依赖项中,并且我已将库和 .dll 移动到主文件夹中,因此不应该有任何路径问题。
我已经盯着这两个下载页面的源代码看了一段时间,但我似乎找不到问题。 我有两个下载页面,一个 javascript 可以工作,一个没有。 工作:http://justupload.it/v/lfd7不是
我一直在使用 jQuery,只是尝试在单击链接时替换文本字段以及隐藏/显示内容项。它似乎在 IE 中工作得很好,但我似乎无法让它在 FF 中工作。 我的 jQuery: $(function() {
我正在尝试为 NDK 编译套接字库,但出现以下两个错误: error: 'close' was not declared in this scope 和 error: 'min' is not a m
我正在使用 Selenium 浏览器自动化框架测试网站。在测试过程中,我切换到特定的框架,我们将其称为“frame_1”。后来,我在 Select 类中使用了 deselectAll() 方法。不久之
我正在尝试通过 Python 创建到 Heroku PostgreSQL 数据库的连接。我将 Windows10 与 Python 3.6.8 和 PostgreSQL 9.6 一起使用。 我从“ht
我有一个包含 2 列的数据框,我想根据两列之间的比较创建第三列。 所以逻辑是:第 1 列 val = 3,第 2 列 val = 4,因此新列值什么都没有 第 1 列 val = 3,第 2 列 va
我想知道如何调试 iphone 5 中的 css 问题。 我尝试使用 firelite 插件。但是从纵向旋转到横向时,火石占据了整个屏幕。 有没有其他方法可以调试 iphone 5 中的 css 问题
所以我有点难以理解为什么这不起作用。我正在尝试替换我正在处理的示例站点上的类别复选框。我试图让它做以下事情:未选中时以一种方式出现,悬停时以另一种方式出现(选中或未选中)选中时以第三种方式出现(而不是
Javascript CSS 问题: 我正在使用一个文本框来写入一个 div。我使用以下 javascript 获取文本框来执行此操作: function process_input(){
你好,我很难理解 P、NP 和多项式时间缩减的主题。我试过在网上搜索它并问过我的一些 friend ,但我没有得到任何好的答案。 我想问一个关于这个话题的一般性问题: 设 A,B 为 P 中的语言(或
你好,我一直在研究 https://leetcode.com/problems/2-keys-keyboard/并想到了这个动态规划问题。 您从空白页上的“A”开始,完成后得到一个数字 n,页面上应该
我正在使用 Cocoapods 和 KIF 在 Xcode 服务器上运行持续集成。我已经成功地为一个项目设置了它来报告每次提交。我现在正在使用第二个项目并收到错误: Bot Issue: warnin
我是一名优秀的程序员,十分优秀!