Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Java checkstyle and and polish maven dep references #112

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
release.properties
/*/.cache/
/*/*/.cache/
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Quarkus - Hivemq Client
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

## Introduction
Expand Down Expand Up @@ -32,6 +32,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center"><a href="https://github.com/masini"><img src="https://avatars.githubusercontent.com/u/2060870?v=4?s=100" width="100px;" alt=""/><br /><sub><b>masini</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-hivemq-client/commits?author=masini" title="Code">💻</a> <a href="#maintenance-masini" title="Maintenance">🚧</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/pjgg"><img src="https://avatars.githubusercontent.com/u/3541131?v=4" width="100px;" alt=""/><br /><sub><b>pjgg</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-hivemq-client/commits?author=pjgg" title="Code">💻</a> <a href="#maintenance-pjgg" title="Maintenance">🚧</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
Expand Down
14 changes: 14 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<property name="severity" value="error"/>
<module name="TreeWalker">
<!-- Checks for imports -->
<!-- See https://checkstyle.org/config_imports.html -->
<module name="AvoidStarImport"/>
<module name="RedundantImport"/>
<module name="RequireThis">
<property name="validateOnlyOverlapping" value="true"/>
</module>
</module>
</module>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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;

import javax.enterprise.context.ApplicationScoped;

/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
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;

import javax.enterprise.context.ApplicationScoped;

/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package io.quarkiverse.hivemqclient.test.smallrye;

import org.eclipse.microprofile.reactive.messaging.Channel;

import io.smallrye.mutiny.Multi;

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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
import java.net.URI;
import java.util.concurrent.atomic.AtomicInteger;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.sse.SseEventSource;

import org.jboss.logging.Logger;
import org.junit.jupiter.api.Test;

import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.sse.SseEventSource;

@TestProfile(HivemqDefaultProfile.class)
@QuarkusTest
public class PriceResourceTest {
Expand Down
39 changes: 8 additions & 31 deletions integration-tests/kitchensink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,13 @@
<version>1.0.1-SNAPSHOT</version>
</parent>
<artifactId>quarkus-hivemq-client-kitchensink</artifactId>
<name>Quarkus - HiveMQ Client - Kitchen Sink</name>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus-plugin.version>2.16.1.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.16.1.Final</quarkus.platform.version>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
<lombok.version>1.18.30</lombok.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<name>Quarkus - HiveMQ Client - Integration Tests Kitchen Sink</name>
<properties>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
<lombok.version>1.18.30</lombok.version>
</properties>
<dependencies>

<dependency><!-- Lombok deve essere in cima alle dipendenze perchè il suo generatore deve essere processato per primo -->
<dependency><!-- Lombok must be at the top of the dependencies because its generator must be processed first -->
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
Expand All @@ -46,7 +23,7 @@
<dependency>
<groupId>io.quarkiverse.hivemqclient</groupId>
<artifactId>quarkus-hivemq-client</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down Expand Up @@ -76,7 +53,7 @@
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus-plugin.version}</version>
<version>${quarkus.version}</version>
<extensions>true</extensions>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package io.quarkiverse.hivemqclient;

import javax.inject.Inject;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

import org.eclipse.microprofile.reactive.messaging.Channel;
import org.eclipse.microprofile.reactive.messaging.Emitter;
import org.eclipse.microprofile.reactive.messaging.Incoming;
import org.eclipse.microprofile.reactive.messaging.OnOverflow;

import io.smallrye.reactive.messaging.mqtt.MqttMessage;

import javax.inject.Inject;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

Expand Down
90 changes: 90 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<smallrye-reactive-messaging-mqtt.version>4.10.1</smallrye-reactive-messaging-mqtt.version>
<microprofile-reactive-streams.version>3.0</microprofile-reactive-streams.version>
<microprofile-metrics-api.version>5.0.1</microprofile-metrics-api.version>
<impsort-maven-plugin.version>1.8.0</impsort-maven-plugin.version>
<formatter-maven-plugin.version>2.21.0</formatter-maven-plugin.version>
<maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version>
<src.format.goal>format</src.format.goal>
<src.sort.goal>sort</src.sort.goal>
<mutiny-rxjava.version>1.9.0</mutiny-rxjava.version>
<hivemq.client.version>1.3.3</hivemq.client.version>
<checkstyle.version>10.10.0</checkstyle.version>
<quarkus.version>2.16.10.Final</quarkus.version>
<failsafe-plugin.version>2.22.2</failsafe-plugin.version>
</properties>
Expand Down Expand Up @@ -58,6 +68,73 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<version>${impsort-maven-plugin.version}</version>
<configuration>
<!-- store outside of target to speed up formatting when mvn clean is used -->
<cachedir>.cache</cachedir>
<groups>java.,jakarta.,org.,com.,io.</groups>
<staticGroups>*</staticGroups>
<removeUnused>true</removeUnused>
</configuration>
<executions>
<execution>
<goals>
<goal>${src.sort.goal}</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>${formatter-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>${src.format.goal}</goal>
</goals>
</execution>
</executions>
<configuration>
<configFile>eclipse-format.xml</configFile>
<lineEnding>LF</lineEnding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<!-- To exclude autogenerated sources -->
<sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>true</linkXRef>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
Expand All @@ -72,5 +149,18 @@
<module>integration-tests</module>
</modules>
</profile>
<profile>
<id>validate-format</id>
<activation>
<property>
<name>validate-format</name>
</property>
</activation>
<properties>
<src.format.goal>validate</src.format.goal>
<src.sort.goal>check</src.sort.goal>
<xml.format.goal>xml-check</xml.format.goal>
</properties>
</profile>
</profiles>
</project>
20 changes: 4 additions & 16 deletions runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@
</parent>
<artifactId>quarkus-hivemq-client</artifactId>
<name>Quarkus - HiveMQ Client - Runtime</name>
<properties>
<microprofile-reactive-streams.version>3.0</microprofile-reactive-streams.version>
<mutiny.version>1.10.0</mutiny.version>
</properties>

<dependencies>
<dependency>
<groupId>com.hivemq</groupId>
<artifactId>hivemq-mqtt-client</artifactId>
<version>1.3.3</version>
<version>${hivemq.client.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
Expand All @@ -26,12 +23,11 @@
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>mutiny</artifactId>
<version>${mutiny.version}</version>
<version>${mutiny-rxjava.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>mutiny-rxjava</artifactId>
<version>${mutiny.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.reactive-streams-operators</groupId>
Expand All @@ -41,7 +37,7 @@
<dependency>
<groupId>org.eclipse.microprofile.metrics</groupId>
<artifactId>microprofile-metrics-api</artifactId>
<version>5.0.1</version>
<version>${microprofile-metrics-api.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down Expand Up @@ -107,14 +103,6 @@
<version>3.0.3</version>
</path>
</annotationProcessorPaths>
<!--annotationProcessors>
<annotationProcessor>
io.smallrye.reactive.messaging.connector.ConnectorAttributeProcessor
</annotationProcessor>
<annotationProcessor>
org.jboss.logging.processor.apt.LoggingToolsProcessor
</annotationProcessor>
</annotationProcessors-->
</configuration>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

import javax.net.ssl.TrustManagerFactory;

import com.hivemq.client.mqtt.MqttClientSslConfigBuilder;
import com.hivemq.client.mqtt.mqtt3.Mqtt3BlockingClient;
import com.hivemq.client.mqtt.mqtt3.Mqtt3Client;
Expand All @@ -29,6 +27,8 @@
import io.smallrye.mutiny.converters.uni.UniRxConverters;
import io.smallrye.reactive.messaging.health.HealthReport;

import javax.net.ssl.TrustManagerFactory;

public class HiveMQClients {

private static final Map<String, ClientHolder> clients = new ConcurrentHashMap<>();
Expand Down
Loading