-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/maven/surefire-plugin.version-3.1.2
- Loading branch information
Showing
36 changed files
with
474 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: "Pull Request CI" | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
paths-ignore: | ||
- '.gitignore' | ||
- 'CODEOWNERS' | ||
- 'LICENSE' | ||
- '*.md' | ||
- '*.adoc' | ||
- '*.txt' | ||
- '.all-contributorsrc' | ||
pull_request: | ||
paths-ignore: | ||
- '.gitignore' | ||
- 'CODEOWNERS' | ||
- 'LICENSE' | ||
- '*.md' | ||
- '*.adoc' | ||
- '*.txt' | ||
- '.all-contributorsrc' | ||
|
||
jobs: | ||
validate-format: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: [ 11 ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ matrix.java }} | ||
check-latest: true | ||
- name: format | ||
run: mvn -V -B formatter:validate verify -DskipTests -DskipITs | ||
- name: Tar Maven Repo | ||
shell: bash | ||
run: tar -I 'pigz -9' -cf maven-repo.tgz -C ~ .m2/repository | ||
- name: Persist Maven Repo | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: maven-repo | ||
path: maven-repo.tgz | ||
linux-build-jvm: | ||
name: PR - Linux - JVM build - Latest Version | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
needs: validate-format | ||
strategy: | ||
matrix: | ||
java: [ 11 ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install JDK {{ matrix.java }} | ||
# Uses sha for added security since tags can be updated | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ matrix.java }} | ||
check-latest: true | ||
cache: 'maven' | ||
- name: Download Maven Repo | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: maven-repo | ||
path: . | ||
- name: Extract Maven Repo | ||
shell: bash | ||
run: tar -xzf maven-repo.tgz -C ~ | ||
- name: Build with Maven | ||
run: mvn -V -B -am clean verify | ||
# TODO there is an error under investigation on Native mode | ||
# linux-build-native: | ||
# name: PR - Linux - Native build - Latest Version | ||
# runs-on: ubuntu-latest | ||
# timeout-minutes: 60 | ||
# needs: validate-format | ||
# strategy: | ||
# matrix: | ||
# java: [ 11 ] | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Install JDK {{ matrix.java }} | ||
# # Uses sha for added security since tags can be updated | ||
# uses: actions/setup-java@v3 | ||
# with: | ||
# distribution: 'temurin' | ||
# java-version: ${{ matrix.java }} | ||
# check-latest: true | ||
# cache: 'maven' | ||
# - name: Download Maven Repo | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# name: maven-repo | ||
# path: . | ||
# - name: Extract Maven Repo | ||
# shell: bash | ||
# run: tar -xzf maven-repo.tgz -C ~ | ||
# - name: Build with Maven | ||
# run: mvn -V -B -am clean verify -Dnative | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkiverse.hivemqclient</groupId> | ||
<artifactId>quarkus-hivemq-client-integration-tests</artifactId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-hivemq-client-integration-tests-smallrye</artifactId> | ||
<name>Quarkus - Hivemq Client - Integration Tests smallrye</name> | ||
|
||
<properties> | ||
<hive.testcontainers.version>1.17.6</hive.testcontainers.version> | ||
<exclude.quarkus.native.tests>**/*Native*IT.java</exclude.quarkus.native.tests> | ||
<include.tests>**/*Test.java</include.tests> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-reactive</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-smallrye-reactive-messaging-mqtt</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.hivemqclient</groupId> | ||
<artifactId>quarkus-hivemq-client</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.resteasy</groupId> | ||
<artifactId>resteasy-client</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>hivemq</artifactId> | ||
<version>${hive.testcontainers.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>${quarkus.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${failsafe-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<excludes> | ||
<exclude>${exclude.quarkus.native.tests}</exclude> | ||
</excludes> | ||
<includes> | ||
<include>${include.tests}</include> | ||
</includes> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
30 changes: 30 additions & 0 deletions
30
...ient-smallrye/src/main/java/io/quarkiverse/hivemqclient/test/smallrye/PriceConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.quarkiverse.hivemqclient.test.smallrye; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Incoming; | ||
import org.eclipse.microprofile.reactive.messaging.Outgoing; | ||
import org.jboss.logging.Logger; | ||
|
||
import io.smallrye.reactive.messaging.annotations.Broadcast; | ||
|
||
/** | ||
* A bean consuming data from the "prices" MQTT topic and applying some conversion. | ||
* The result is pushed to the "my-data-stream" stream which is an in-memory stream. | ||
*/ | ||
@ApplicationScoped | ||
public class PriceConverter { | ||
|
||
private static final Logger LOG = Logger.getLogger(PriceConverter.class); | ||
private static final double CONVERSION_RATE = 0.88; | ||
|
||
@Incoming("prices") | ||
@Outgoing("my-data-stream") | ||
@Broadcast | ||
public double process(byte[] priceRaw) { | ||
int priceInUsd = Integer.parseInt(new String(priceRaw)); | ||
LOG.infof("Receiving price: %d ", priceInUsd); | ||
return priceInUsd * CONVERSION_RATE; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
...ient-smallrye/src/main/java/io/quarkiverse/hivemqclient/test/smallrye/PriceGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.quarkiverse.hivemqclient.test.smallrye; | ||
|
||
import java.time.Duration; | ||
import java.util.Random; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Outgoing; | ||
import org.jboss.logging.Logger; | ||
|
||
import io.smallrye.mutiny.Multi; | ||
|
||
/** | ||
* A bean producing random prices every second. | ||
* The prices are written to a MQTT topic (prices). The MQTT configuration is specified in the application configuration. | ||
*/ | ||
@ApplicationScoped | ||
public class PriceGenerator { | ||
|
||
private static final Logger LOG = Logger.getLogger(PriceGenerator.class); | ||
|
||
private Random random = new Random(); | ||
|
||
@Outgoing("topic-price") | ||
public Multi<Integer> generate() { | ||
return Multi.createFrom().ticks().every(Duration.ofSeconds(1)) | ||
.onOverflow().drop() | ||
.map(tick -> { | ||
int price = random.nextInt(100); | ||
LOG.infof("Sending price: %d", price); | ||
return price; | ||
}); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
...lient-smallrye/src/main/java/io/quarkiverse/hivemqclient/test/smallrye/PriceResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.quarkiverse.hivemqclient.test.smallrye; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Channel; | ||
|
||
import io.smallrye.mutiny.Multi; | ||
|
||
/** | ||
* A simple resource retrieving the "in-memory" "my-data-stream" and sending the items to a server sent event. | ||
*/ | ||
@Path("/prices") | ||
public class PriceResource { | ||
|
||
@Inject | ||
@Channel("my-data-stream") | ||
Multi<Double> prices; | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "hello"; | ||
} | ||
|
||
@GET | ||
@Path("/stream") | ||
@Produces(MediaType.SERVER_SENT_EVENTS) | ||
public Multi<Double> stream() { | ||
return prices; | ||
} | ||
} |
Oops, something went wrong.