java - Spring Boot Soap 集成测试失败

标签 java maven spring-boot soap junit

我有一个 Spring Boot 项目,有两个应用程序,一个在 src/test 中,一个在 src/main 中。我有两个应用程序,一个用于与 SOAP 端点连接的中介器,另一个充当模拟服务器来测试我的单元测试和集成测试。

我想在我的 Spring Boot 应用程序中创建一个集成测试来测试 getVersion 的 SOAPUI 调用。我想在 Spring Boot 中模拟 SOAPUI 调用并测试它是否命中,并且我必须以这种方式启动两个应用程序(我的模拟服务器用于运行集成测试,我的主应用程序用于连接到 SOAP Web 服务)

我拥有的一些东西是我必须点击的 URI:

https://127.0.0.1:28433/dave/ws/billingtool

这是我的 SOAPUI getVersion(信封请求输入)的左侧

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.billing.nulogix.com">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:getVersion/>
   </soapenv:Body>
</soapenv:Envelope>

我在我的 main/resources 中定义了一个 WSDL,以及一个请求 StudyDetailsS​​chema.xjb 和 .xsd 以及一个 response.xsd

到目前为止我将此作为测试

@Autowired
    private String studyDetailDemo;
    @Test
    public void soapTest() throws ClientProtocolException, IOException {
        String result = Request.Post("https://127.0.0.1:28433")
                .connectTimeout(2000)
                .socketTimeout(2000)
                .bodyString(studyDetailDemo, ContentType.TEXT_PLAIN)
                .execute().returnContent().asString();

    }

虽然这个测试失败了,但我不知道为什么。我将其配置为在端口 9119 上启动我的 src/test/app,在端口 28433 上启动我的 src/main/app。在预集成中,它启动我的主应用程序,然后使用我的 MockServerApp 运行测试。它们都首先关闭mockServerApp,然后关闭集成后的应用程序。

这是我的 POM

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.nulogix</groupId>
    <artifactId>billing_mediator</artifactId>
    <version>${nulogix-release-number}-${git.version.number}</version>
    <packaging>jar</packaging>

    <name>billing</name>
    <url>http://maven.apache.org</url>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven-jaxb2-plugin.version>0.14.0</maven-jaxb2-plugin.version>
        <jaxb2-specVersion>2.2</jaxb2-specVersion>
        <git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version>
        <nulogix-release-number>0.9.6_M2</nulogix-release-number>
        <git.version.number>${git.commit.time}.${git.commit.id.describe-short}</git.version.number>
        <nulogix-billing-response-schema>nulogixBillingResponse_1.1.xsd</nulogix-billing-response-schema>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformats-text</artifactId>
            <version>2.10.0.pr1</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web-services</artifactId>
        </dependency>           
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-test</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>fluent-hc</artifactId>
            </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.2.11</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>



            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>${maven-jaxb2-plugin.version}</version>
                <executions>
                    <execution>
                        <id>id1-generate-service-end-point-from-wsdl</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <specVersion>${jaxb2-specVersion}</specVersion>
                            <schemaDirectory>${project.basedir}/src/main/resources/wsdl</schemaDirectory>
                            <schemaIncludes>
                                <include>*.wsdl</include>
                            </schemaIncludes>
                            <generateDirectory>${project.basedir}/target/generated-sources/xjc/billing_endpoint</generateDirectory>
                            <generatePackage>com.nulogix.billing.service</generatePackage>
                        </configuration>
                    </execution>
                    <execution>
                        <id>id2-generate-pojo-from-request-xsd</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <specVersion>${jaxb2-specVersion}</specVersion>
                            <schemaDirectory>${project.basedir}/src/main/resources/xsd/request</schemaDirectory>
                            <schemaIncludes>
                                <include>StudyDetailsSchema_3.17.6.12.xsd</include>
                            </schemaIncludes>
                            <bindingDirectory>${project.basedir}/src/main/resources/xsd/request</bindingDirectory>
                            <bindingIncludes>
                                <include>StudyDetailsSchema_3.17.6.12.xjb</include>
                            </bindingIncludes>
                            <generateDirectory>${project.basedir}/target/generated-sources/xjc/request_model</generateDirectory>
                            <generatePackage>com.nulogix.billing.model.request</generatePackage>                            
                        </configuration>                
                    </execution>
                    <execution>
                        <id>id3-generate-pojo-from-response-xsd</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <specVersion>${jaxb2-specVersion}</specVersion>
                            <schemaDirectory>${project.basedir}/src/main/resources/xsd/response</schemaDirectory>
                            <schemaIncludes>
                                <include>${nulogix-billing-response-schema}</include>
                            </schemaIncludes>
                            <generateDirectory>${project.basedir}/target/generated-sources/xjc/response_model</generateDirectory>                           
                            <generatePackage>com.nulogix.billing.model.response</generatePackage>                   
                        </configuration>                
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <dateFormat>yyyyMMdd-HHmmss</dateFormat><!--  human-readable part of the version id -->
                    <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile><!-- somehow necessary. otherwise the variables are not available in the pom -->
                </configuration>
            </plugin>
            <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-jar-plugin</artifactId>
                  <configuration>
                    <archive>
                      <manifestEntries>
                        <Implementation-Version>${nulogix-release-number}-${git.version.number}</Implementation-Version>
                        <Git-Version-Number>${git.version.number}</Git-Version-Number>
                      </manifestEntries>
                    </archive>
                  </configuration>
            </plugin>

    <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
            <mainClass>com.nulogix.billing.App</mainClass> 
        </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>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.18.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M3</version>
    <configuration>
        <skipTests>true</skipTests>
    </configuration>
</plugin>
    </plugins>
</build>

</project>

当我运行 mvn verify 仅运行集成测试时,它说它在 28433 和 9119 上打开端口

[INFO] --- spring-boot-maven-plugin:2.1.0.RELEASE:start (pre-integration-test) @ billing_mediator ---

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.0.RELEASE)

2019-08-19 23:43:10.175  INFO 50954 --- [ling.App.main()] com.nulogix.billing.App                  : Starting App on Alexs-MacBook-Pro.local with PID 50954 (/Users/asluborski/Documents/billing/billing_mediator/target/classes started by asluborski in /Users/asluborski/Documents/billing/billing_mediator)
2019-08-19 23:43:10.177 DEBUG 50954 --- [ling.App.main()] com.nulogix.billing.App                  : Running with Spring Boot v2.1.0.RELEASE, Spring v5.1.2.RELEASE
2019-08-19 23:43:10.179  INFO 50954 --- [ling.App.main()] com.nulogix.billing.App                  : No active profile set, falling back to default profiles: default
2019-08-19 23:43:10.807  INFO 50954 --- [ling.App.main()] trationDelegate$BeanPostProcessorChecker : Bean 'webServiceConfig' of type [com.nulogix.billing.ws.endpoint.WebServiceConfig$$EnhancerBySpringCGLIB$$8e6919d9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-08-19 23:43:10.809  INFO 50954 --- [ling.App.main()] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$47c57f47] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-08-19 23:43:10.837  INFO 50954 --- [ling.App.main()] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2019-08-19 23:43:11.183  INFO 50954 --- [ling.App.main()] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 28443 (https)
2019-08-19 23:43:11.202  INFO 50954 --- [ling.App.main()] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-08-19 23:43:11.202  INFO 50954 --- [ling.App.main()] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.12
2019-08-19 23:43:11.211  INFO 50954 --- [ling.App.main()] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/asluborski/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2019-08-19 23:43:11.279  INFO 50954 --- [ling.App.main()] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-08-19 23:43:11.280  INFO 50954 --- [ling.App.main()] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1072 ms
2019-08-19 23:43:11.306  INFO 50954 --- [ling.App.main()] o.s.b.w.servlet.ServletRegistrationBean  : Servlet messageDispatcherServlet mapped to [/nulogix/ws/*]
2019-08-19 23:43:11.307  INFO 50954 --- [ling.App.main()] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2019-08-19 23:43:11.310  INFO 50954 --- [ling.App.main()] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-08-19 23:43:11.310  INFO 50954 --- [ling.App.main()] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-08-19 23:43:11.310  INFO 50954 --- [ling.App.main()] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'formContentFilter' to: [/*]
2019-08-19 23:43:11.310  INFO 50954 --- [ling.App.main()] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-08-19 23:43:11.339 DEBUG 50954 --- [ling.App.main()] c.n.b.service.PredictionEngineService    : billing.engine.address=127.0.0.1
2019-08-19 23:43:11.339 DEBUG 50954 --- [ling.App.main()] c.n.b.service.PredictionEngineService    : billing.engine.port=9119
2019-08-19 23:43:11.339 DEBUG 50954 --- [ling.App.main()] c.n.b.service.PredictionEngineService    : Using http://127.0.0.1:9119
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/Users/asluborski/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.11/jaxb-impl-2.2.11.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-08-19 23:43:11.638 DEBUG 50954 --- [ling.App.main()] c.n.billing.ws.endpoint.AnalyzeEndPoint  : billing.engine.api.version=0.97
2019-08-19 23:43:11.638 DEBUG 50954 --- [ling.App.main()] c.n.billing.ws.endpoint.AnalyzeEndPoint  : billing.engine.core.version=0.97
2019-08-19 23:43:11.638 DEBUG 50954 --- [ling.App.main()] c.n.billing.ws.endpoint.AnalyzeEndPoint  : billing.engine.core.name=Nulogix_Patient_Responsibility
2019-08-19 23:43:11.640 DEBUG 50954 --- [ling.App.main()] c.n.b.ws.endpoint.GetVersionEndPoint     : billing.engine.api.version=0.97
2019-08-19 23:43:11.778  INFO 50954 --- [ling.App.main()] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-08-19 23:43:12.301  INFO 50954 --- [ling.App.main()] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 28443 (https) with context path ''
2019-08-19 23:43:12.304  INFO 50954 --- [ling.App.main()] com.nulogix.billing.App                  : Started App in 2.474 seconds (JVM running for 10.674)
[INFO] 
[INFO] --- maven-failsafe-plugin:2.18.1:integration-test (default) @ billing_mediator ---
[INFO] Failsafe report directory: /Users/asluborski/Documents/billing/billing_mediator/target/failsafe-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------



  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.0.RELEASE)

2019-08-19 23:43:18.744  INFO 50977 --- [           main] c.n.b.ws.endpoint.BillingMediatorIT      : Starting BillingMediatorIT on Alexs-MacBook-Pro.local with PID 50977 (started by asluborski in /Users/asluborski/Documents/billing/billing_mediator)
2019-08-19 23:43:18.745 DEBUG 50977 --- [           main] c.n.b.ws.endpoint.BillingMediatorIT      : Running with Spring Boot v2.1.0.RELEASE, Spring v5.1.2.RELEASE
2019-08-19 23:43:18.747  INFO 50977 --- [           main] c.n.b.ws.endpoint.BillingMediatorIT      : No active profile set, falling back to default profiles: default
2019-08-19 23:43:19.410  INFO 50977 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$4eacc45] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-08-19 23:43:19.443  INFO 50977 --- [           main] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2019-08-19 23:43:19.803  INFO 50977 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9119 (http)
2019-08-19 23:43:19.820  INFO 50977 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-08-19 23:43:19.821  INFO 50977 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.12
2019-08-19 23:43:19.829  INFO 50977 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/asluborski/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2019-08-19 23:43:19.914  INFO 50977 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-08-19 23:43:19.914  INFO 50977 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1141 ms
2019-08-19 23:43:19.999  INFO 50977 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2019-08-19 23:43:20.000  INFO 50977 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Servlet messageDispatcherServlet mapped to [/services/*]
2019-08-19 23:43:20.006  INFO 50977 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-08-19 23:43:20.007  INFO 50977 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-08-19 23:43:20.007  INFO 50977 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'formContentFilter' to: [/*]
2019-08-19 23:43:20.007  INFO 50977 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-08-19 23:43:20.007  INFO 50977 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationRequestSizeLimitFilter' to: [/*]
2019-08-19 23:43:20.021 DEBUG 50977 --- [           main] .n.b.m.ApplicationRequestSizeLimitFilter : Filter 'applicationRequestSizeLimitFilter' configured for use
2019-08-19 23:43:20.073 DEBUG 50977 --- [           main] c.n.b.ws.endpoint.GetVersionEndPoint     : billing.engine.api.version=0.97
WARNING: An illegal reflective access operation has occurred
SUREFIRE-859: WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/Users/asluborski/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.11/jaxb-impl-2.2.11.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-08-19 23:43:20.430 DEBUG 50977 --- [           main] c.n.b.service.PredictionEngineService    : billing.engine.address=127.0.0.1
2019-08-19 23:43:20.430 DEBUG 50977 --- [           main] c.n.b.service.PredictionEngineService    : billing.engine.port=9119
2019-08-19 23:43:20.430 DEBUG 50977 --- [           main] c.n.b.service.PredictionEngineService    : Using http://127.0.0.1:9119
2019-08-19 23:43:20.431 DEBUG 50977 --- [           main] c.n.billing.ws.endpoint.AnalyzeEndPoint  : billing.engine.api.version=0.97
2019-08-19 23:43:20.431 DEBUG 50977 --- [           main] c.n.billing.ws.endpoint.AnalyzeEndPoint  : billing.engine.core.version=0.97
2019-08-19 23:43:20.431 DEBUG 50977 --- [           main] c.n.billing.ws.endpoint.AnalyzeEndPoint  : billing.engine.core.name=Nulogix_Patient_Responsibility
2019-08-19 23:43:20.657  INFO 50977 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-08-19 23:43:21.125  INFO 50977 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9119 (http) with context path ''
2019-08-19 23:43:21.130  INFO 50977 --- [           main] c.n.b.ws.endpoint.BillingMediatorIT      : Started BillingMediatorIT in 7.641 seconds (JVM running for 8.125)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.912 sec <<< FAILURE! - in com.nulogix.billing.ws.endpoint.BillingMediatorIT
soapTest(com.nulogix.billing.ws.endpoint.BillingMediatorIT)  Time elapsed: 0.239 sec  <<< ERROR!
org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:28433 [/127.0.0.1] failed: Connection refused (Connection refused)
    at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
    at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
    at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
    at java.base/java.net.Socket.connect(Socket.java:591)
    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:373)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:394)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    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.apache.http.client.fluent.Request.internalExecute(Request.java:173)
    at org.apache.http.client.fluent.Request.execute(Request.java:177)
    at com.nulogix.billing.ws.endpoint.BillingMediatorIT.soapTest(BillingMediatorIT.java:30)

2019-08-19 23:43:21.377  INFO 50977 --- [       Thread-2] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

Results :

Tests in error: 
  BillingMediatorIT.soapTest:30 » HttpHostConnect Connect to 127.0.0.1:28433 [/1...

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

[INFO] 
[INFO] --- spring-boot-maven-plugin:2.1.0.RELEASE:stop (post-integration-test) @ billing_mediator ---
[INFO] Stopping application...
2019-08-19 23:43:21.498  INFO 50954 --- [           main] inMXBeanRegistrar$SpringApplicationAdmin : Application shutdown requested.
2019-08-19 23:43:21.501  INFO 50954 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
[INFO] 
[INFO] --- maven-failsafe-plugin:2.18.1:verify (default) @ billing_mediator ---
[INFO] Failsafe report directory: /Users/asluborski/Documents/billing/billing_mediator/target/failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  19.197 s
[INFO] Finished at: 2019-08-19T23:43:21-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify (default) on project billing_mediator: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/asluborski/Documents/billing/billing_mediator/target/failsafe-reports for the individual test results.
[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

我的 POM 设置有问题吗?

最佳答案

您确定要连接到端口 28433 吗?正如您所正确指出的,您的本地 tomcat 在端口 9119 上启动,当您想要测试本地运行的应用程序时,该端口通常是您想要连接的端口。

关于java - Spring Boot Soap 集成测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57580360/

相关文章:

spring-boot - 将 Spring Boot 升级到 2.4.2 时 org.springframework.test.context.TestContextAnnotationUtils 上的 ClassNotFoundException

Java 使用 Web 服务

java - graphql-java-tools:空参数与不存在参数

java - 防止从 Git 存储库 pull 时需要 "add external jars"

java - Cobertura 在 Jenkins 上重复测试运行

java - Spring Cloud Gateway 使用谓词检查头授权

spring - SimpleMessageListenerContainer Amazon SQS 轮询间隔

java - 在 Android Studio 中的 Java 和 Android 程序之间共享一个 OpenCV 类

java - eclipse 在断点处停止,但没有可用的调试功能

java - Spring 工具套件 : Changes to static resources triggers redeploy