- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
整个下午,我一直在努力解决有关错误的神秘问题:
[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 9.783 s <<< FAILURE! - in api.rest.AdRestServiceTest
[ERROR] testGet Time elapsed: 4.351 s <<< ERROR!
java.net.ConnectException: Connection refused: connect
at api.rest.AdRestServiceTest.testGet(AdRestServiceTest.java:32)
[ERROR] testCount Time elapsed: 2.013 s <<< ERROR!
java.net.ConnectException: Connection refused: connect
at api.rest.AdRestServiceTest.testCount(AdRestServiceTest.java:27)
[ERROR] testGetAll Time elapsed: 2.022 s <<< ERROR!
java.net.ConnectException: Connection refused: connect
at api.rest.AdRestServiceTest.testGetAll(AdRestServiceTest.java:21)
mvn clean install
成功运行一个工作项目(
https://github.com/hostettler/microservices/tree/integration_tests)。
Thorntail is ready
。
2019-05-21 16:29:26,235 INFO [org.wildfly.swarm] (main) THORN99999: Thorntail is Ready
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.2:prepare-agent (integration-tests-preaparation) @ counterparty-service ---
[INFO] argLineForIntegration set to -javaagent:C:\\Users\\Admin\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.2\\org.jacoco.agent-0.8.2-runtime.jar=destfile=C:\\Users\\Admin\\Desktop\\ProjetINFO\\microservices\\counterparty-service\\target\\jacoco-it.exec
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.1:integration-test (default) @ counterparty-service ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running api.CounterpartyRestServiceIT
2019-05-21 16:29:34,220 INFO [stdout] (default task-1) Hibernate: ...
<?xml version="1.0" encoding="UTF-8"?>
<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>ch.unige</groupId>
<artifactId>PInfo2</artifactId>
<version>0.2.0-SNAPSHOT</version>
<name>Parent Pom of the PInfo2</name>
<packaging>pom</packaging>
<!--<scm>
<url>https://github.com/hostettler/microservices</url>
<connection>scm:git:git@github.com/hostettler/microservices.git</connection>
<developerConnection>scm:git:git@github.com/hostettler/microservices</developerConnection>
</scm> -->
<properties>
<version.thorntail>2.3.0.Final</version.thorntail>
<version.h2>1.4.197</version.h2>
<failOnMissingWebXml>false</failOnMissingWebXml>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<skip-docker-build>true</skip-docker-build>
<skip-docker-compose>false</skip-docker-compose>
<dockerHost>tcp://localhost:2375</dockerHost>
</properties>
<modules>
<module>image-service</module>
<module>stats-service</module>
<module>chat-service</module>
<module>ad-service</module>
<module>category-service</module>
<module>user-service</module>
<module>search-service</module>
<module>api-gateway</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>bom</artifactId>
<version>${version.thorntail}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<!--<dependency>
<groupId>org.aerogear.kafka</groupId>
<artifactId>kafka-cdi-extension</artifactId>
<version>0.1.0</version>
</dependency> -->
<dependency>
<groupId>com.github.dadrus.jpa-unit</groupId>
<artifactId>jpa-unit-bom</artifactId>
<version>0.5.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${version.h2}</version>
</dependency>
<dependency>
<groupId>org.aerogear.kafka</groupId>
<artifactId>kafka-cdi-extension</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>swagger</artifactId>
<version>2.2.1.Final</version>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.3.2</version>
<scope>test</scope>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>2.23.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>@{project.version}</tagNameFormat>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M6</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
</plugin>
<plugin>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-maven-plugin</artifactId>
<version>${version.thorntail}</version>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>4.0.0-M2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>unit-tests</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>integration-tests-preaparation</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>argLineForIntegration</propertyName>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
</configuration>
</execution>
<execution>
<id>merge</id>
<phase>post-integration-test</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
</fileSets>
<destFile>${project.build.directory}/jacoco-merged.exec</destFile>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-merged.exec</dataFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>activate_windows</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<dockerHost>tcp://localhost:2375</dockerHost>
</properties>
</profile>
<profile>
<id>activation_unix</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<dockerHost>unix:///var/run/docker.sock</dockerHost>
</properties>
</profile>
<profile>
<id>package-docker-image</id>
<activation>
<property>
<name>docker-build</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<skip>${skip-docker-build}</skip>
<useColor>true</useColor>
<dockerHost>${dockerHost}</dockerHost>
<images>
<image>
<name>%g/%a:%l</name>
<run>
<ports>
<port>8080:8080</port>
</ports>
</run>
<build>
<from>java:openjdk-8-jdk</from>
<ports>
<port>8080</port>
</ports>
<assembly>
<basedir>/</basedir>
<inline>
<files>
<file>
<source>${project.build.directory}/${project.build.finalName}-thorntail.jar</source>
<outputDirectory>/opt</outputDirectory>
</file>
</files>
</inline>
</assembly>
<entryPoint>
<shell>java -Djava.net.preferIPv4Stack=true -jar \
/opt/${project.build.finalName}-thorntail.jar</shell>
</entryPoint>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<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>
<parent>
<groupId>ch.unige</groupId>
<artifactId>PInfo2</artifactId>
<version>0.2.0-SNAPSHOT</version>
</parent>
<artifactId>ad-service</artifactId>
<name>Ad Service</name>
<packaging>war</packaging>
<properties>
<skip-docker-build>false</skip-docker-build>
</properties>
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jpa</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>swagger</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>cdi</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>transactions</artifactId>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>datasources</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>logging</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.10.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aerogear.kafka</groupId>
<artifactId>kafka-cdi-extension</artifactId>
</dependency>
<dependency>
<groupId>com.github.dadrus.jpa-unit</groupId>
<artifactId>jpa-unit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.dadrus.jpa-unit</groupId>
<artifactId>jpa-unit-rdbms</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>unit-tests-1</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>jacoco.exec</destFile>
</configuration>
</execution>
<execution>
<id>unit-tests-2</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<append>false</append>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-maven-plugin</artifactId>
<configuration>
<!--PLACEHOLDER:configuration -->
</configuration>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<jvmArguments>${}</jvmArguments>
<properties>
<thorntail.port.offset>20000</thorntail.port.offset>
</properties>
</configuration>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package api.rest;
import static io.restassured.RestAssured.when;
import static org.hamcrest.Matchers.containsString;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import io.restassured.RestAssured;
public class AdRestServiceTest {
@BeforeAll
public static void setup() {
RestAssured.baseURI = "http://localhost:28080/ad";
RestAssured.port = 8080;
}
@Test
public void testGetAll() {
when().get("/").then().body(containsString("984500C2EEUEB4A0C629"));
}
@Test
public void testCount() {
when().get("/count").then().body(containsString("5"));
}
@Test
public void testGet() {
when().get("/984500C2EEUEB4A0C629").then().body(containsString("984500C2EEUEB4A0C629"));
}
}
最佳答案
默认情况下,Maven Surefire插件(负责在test
阶段运行单元测试)可识别称为*Test
的类。 Maven Failsafe插件(负责在integration-test
阶段运行集成测试)可识别称为*IT
的类。
您的测试类称为AdRestServiceTest
,它将在test
阶段执行。您希望它在integration-test
阶段中执行,因为integration-test
阶段被pre-integration-test
和post-integration-test
阶段所包围。
因此,您需要将AdRestServiceTest
重命名为AdRestServiceIT
。 (另一种选择是重新配置Surefire和Failsafe插件。)
关于maven - Thorntail没有运行以进行集成测试,但是我有一个正在运行的项目相同的pom.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56244941/
我还在学习,这是我第一次写后端。有一个限制,我必须使用Thorntail。我对此了解不多。 Thorntail Project Generator有一个可用依赖项的列表,但我看到的教程使用 Maven
我的 Maven 项目遇到问题。我正在尝试使用命令“mvn clean install”,但没有成功。我已经在 Eclipse IDE 中更新并清理了 Maven 项目。我还删除了“.m2”目录中的文
我正在 Thorntail 中编写一个计划任务,该任务将运行很长时间(大约 30 分钟)。然而,Thorntail 似乎将执行时间限制为 30 秒。 我的代码如下所示(我删除了我认为不相关的代码):
我使用 Thorntail Project Generator 创建了一个新项目。我想提供少量静态文件,例如 html、图像等 我该怎么做? 最佳答案 假设您使用 Maven 构建项目,您需要: 确保
我需要将 Wildfly-Thorntail 从 2.2 升级到 2.3,以解决与 Maven 3.6 的兼容性问题。在 Maven 3.5 和 2.2 下,该项目可以完美构建和运行,但在 3.6 下
尝试打包 thorntail-examples project 时在 github 上,构建在几个示例中失败,指出与此类似的 API 不兼容错误... [ERROR] Failed to execut
您能否提供Quarkus之间更详细的区别?和 Thorntail ? 这有助于在构建新的“Java 云原生应用”时在这两者之间进行考虑。 最佳答案 Quarkus 对 Thorntail 的看法: 能
我刚刚开始使用 Thorntail,并尝试做最简单的测试。我编写了一个仅返回成功状态的 HealthCheck 实现。就这样。然而,当我运行 mvn thorntail:run 时,我收到一条错误消息
这个问题是关于以可移植的方式读取 REST 服务中的配置的正确方法,例如应在 Thorntail 2.4.0 和 Wildfly 15 上运行。 这是 Thorntail 建议的原始实现 @Injec
我正在启动一个 Thorntail 空心 jar 并传入 --properties=environment.properties。该文件包含一个带有 ${...} 表达式的属性,该表达式并不供 Tho
我的 JavaEE 应用程序有问题,我尝试创建将自动部署的应用程序,所以我选择了 Thorntail,但在使用 mvn thorntail:run 启动它后,我'我收到了这个错误信息 Exceptio
我有几个使用 Thorntail 框架开发的微服务项目。我正在使用 Eclipse 编写代码。过去,我使用 Wildfly 应用程序服务器完成了所有开发工作,而 Eclipse 使调试这些应用程序变得
我正在创建一个简单的 Thorntail 服务,它将向远程 ActiveMQ 队列写入一条文本消息,并让 MDB 使用该消息。为了对此进行测试,我在本地 Docker 容器中运行了 ActiveMQ。
我有一个关于在 Thorntail 上配置 JMS 的小问题。在我的开发项目中,我使用 Wildfly,但对于远程服务器,我们使用(我的团队)IBM Portal。我将本地服务器从 Wildfly 升
如何使用项目默认 yaml 配置消息传递 activemq - thorntail 或 swarm 我目前遇到以下异常 资源“/subsystem=messaging-activemq/connect
我们目前将项目中的 Thorntail 版本从 2.5.0.Final 更新到 2.6.0.Final。 Caused by: org.eclipse.aether.transfer.Artifact
我在 docker 容器中运行 Spring Boot 和 Keycloak 时遇到问题。 我开始使用 Keycloak,mysql 作为 db 在 docker 中运行。 services: m
我开始使用thorntail V4 (www.thorntail.io)(以前称为wildfly swarm)来创建微服务。是的,我知道该网站将其称为“概念证明”。 Thorntail 附带 Unde
我正在尝试使用 @ConfigurationValue ,它应该从 project-defaults.yml 读取值,但是,我遇到了奇怪的行为,请参阅下面的代码。 我的 Controller : @A
我在通过从 Keycloak 收到的不记名 token 授权用户时遇到问题。 任务是将来自 Angular 应用程序的用户请求授权给我的后端 Thorntail 2.5.0.Final 微服务。我已经
我是一名优秀的程序员,十分优秀!