Skip to content

Commit

Permalink
Merge pull request #7 from i-Cell-Mobilsoft-Open-Source/feature/4-qua…
Browse files Browse the repository at this point in the history
…rkus-3-samples

Feature/4 quarkus 3 samples
  • Loading branch information
speter555 authored Feb 12, 2024
2 parents 380b12e + 84aa8df commit 61afa27
Show file tree
Hide file tree
Showing 35 changed files with 870 additions and 135 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/compile_maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:
- 'dependabot/**'

jobs:
compile-on-os-with-jdk:
compile-on-linux-with-jdk:
strategy:
matrix:
os: [ 'ubuntu-latest', 'windows-latest' ]
os: [ 'ubuntu-latest']
java: [ '17', '21' ]
runs-on: ${{ matrix.os }}
name: Compile on ${{ matrix.os }} with JDK ${{ matrix.java }}
Expand All @@ -34,3 +34,28 @@ jobs:
# Maven script [ package ]
- name: Build with Maven
run: mvn -B package --file pom.xml


compile-on-windows-with-jdk:
strategy:
matrix:
os: [ 'windows-latest' ]
java: [ '17', '21' ]
runs-on: ${{ matrix.os }}
name: Compile on ${{ matrix.os }} with JDK ${{ matrix.java }}
steps:

# https://github.com/actions/checkout
- uses: actions/checkout@v4

# https://github.com/actions/setup-java
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'

# Maven script [ package ] without Test (testcoiners is not working on windows host)
- name: Build with Maven
run: mvn -B package --file pom.xml -DskipTests=true
7 changes: 7 additions & 0 deletions docs/configs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ Fontosabb elemek, melyek alapból már definiálva vannak a projekttel:
| quarkus.log.handler.gelf.additional-field."moduleId".value | Gelf log - *moduleId* additional-field value | SAMPLER_LOGSTASH_MODULE_ID | unknown
| quarkus.log.handler.gelf.additional-field."K8S_NAMESPACE".value | Gelf log - *K8S_NAMESPACE* additional-field value | SAMPLER_LOGSTASH_K8S_NAMESPACE | unknown
| quarkus.handler.gelf.include-full-mdc | Gelf log - Whether to include all fields from the MDC. | SAMPLER_LOGSTASH_K8S_NAMESPACE | false

| quarkus.handler.gelf.enabled | Gelf log - Enable it | SAMPLER_LOGSTASH_ENABLED | false
| quarkus.handler.gelf.host | Gelf log - tcp host link of logstasth | SAMPLER_LOGSTASTH_HOST | tcp:localhost
| quarkus.handler.gelf.port | Gelf log - port of logstasth | SAMPLER_LOGSTASTH_PORT | 12201
| quarkus.handler.gelf.version | Gelf log - version of logstasth's communication | SAMPLER_LOGSTASTH_VERSION | 1.1


| quarkus.log.level | Quarkus log level: https://quarkus.io/version/3.2/guides/all-config#quarkus-core_quarkus.log.level[Link] | SAMPLER_LOG_LEVEL | INFO
| quarkus.log.min-level | Quarkus min log level: https://quarkus.io/version/3.2/guides/all-config#quarkus-core_quarkus.log.min-level[Link] | SAMPLER_LOG_MIN_LEVEL | ALL

Expand Down
38 changes: 38 additions & 0 deletions etc/docker-compose/docker-compose.local.etcd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# futtatas:
# docker compose -f <PROJECT_PATH>/etc/docker-compose/docker-compose.local.etcd.yml up
#
# belemaszas:
# docker exec -it qs-etcd /bin/bash
version: "3.8"

services:
qs-etcd:
container_name: qs-etcd
image: 'bitnami/etcd:3'
ports:
- '2379:2379'
environment:
- ALLOW_NONE_AUTHENTICATION=yes
deploy:
resources:
limits:
memory: 128M
cpus: '.5'
reservations:
memory: 32M
cpus: '.5'
healthcheck:
test: etcdctl endpoint health
interval: 1s
timeout: 3s
retries: 5
etcdsetup:
image: 'bitnami/etcd:3'
depends_on:
qs-etcd:
condition: service_healthy
command: ["sh", "-c", "etcdctl --endpoints=http://qs-etcd:2379 put hello world"]
networks:
default:
external:
name: quarkus-sampler-local-network
6 changes: 6 additions & 0 deletions etc/docker-compose/docker-compose.local.qs-rest-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ services:
environment:
# With this config, service use application-dev.yml!
- MP_CONFIG_PROFILE=dev
#- SAMPLER_LOGSTASH_MODULE_VERSION=1.0.0-SNAPSHOT
#- SAMPLER_LOGSTASH_MODULE_ID=qs-rest-service-dev
#- SAMPLER_LOGSTASH_K8S_NAMESPACE=test
#- SAMPLER_LOGSTASH_ENABLED=true
#- SAMPLER_LOGSTASTH_HOST=tcp:graylog
#- SAMPLER_LOGSTASTH_PORT=12201
ports:
- '8081:8080' # REST
- '5006:5005' # Debug
Expand Down
108 changes: 85 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,34 @@
</includes>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<maven.home>${maven.home}</maven.home>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
<!-- some dev tools tests need the following properties -->
<project.version>${project.version}</project.version>
<project.groupId>${project.groupId}</project.groupId>
</systemPropertyVariables>
<!-- set tmpdir as early as possible because failsafe sets it too late for JDK16 -->
<argLine>-Djava.io.tmpdir="${project.build.directory}"</argLine>
<excludedEnvironmentVariables>MAVEN_OPTS</excludedEnvironmentVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<systemPropertyVariables>
<systemPropertyVariables combine.self="override">
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
<!-- some dev tools tests need the following properties -->
<project.version>${project.version}</project.version>
<project.groupId>${project.groupId}</project.groupId>
</systemPropertyVariables>
<argLine>-Xmx1500m -XX:MaxMetaspaceSize=1500m -Djava.io.tmpdir="${project.build.directory}"</argLine>
<excludedEnvironmentVariables>MAVEN_OPTS</excludedEnvironmentVariables>
</configuration>
</plugin>
<plugin>
Expand All @@ -143,12 +159,58 @@
<goals>
<goal>jandex</goal>
</goals>
<!-- phase is 'process-classes by default' -->
<configuration>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
</plugin>

<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
native2ascii-maven-plugin
</artifactId>
<versionRange>
[2.1.0,)
</versionRange>
<goals>
<goal>native2ascii</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>

</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
Expand Down Expand Up @@ -229,7 +291,7 @@
<profile>
<id>check-javadoc</id>
<activation>
<activeByDefault>true</activeByDefault>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
Expand All @@ -253,26 +315,26 @@
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-gpg-plugin</artifactId>-->
<!-- <version>3.1.0</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>sign-artifacts</id>-->
<!-- <phase>verify</phase>-->
<!-- <goals>-->
<!-- <goal>sign</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- <gpgArguments>-->
<!-- <arg>&#45;&#45;pinentry-mode</arg>-->
<!-- <arg>loopback</arg>-->
<!-- </gpgArguments>-->
<!-- </configuration>-->
<!-- </plugin>-->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
package hu.icellmobilsoft.quarkus.sampler.api.jakarta.dto.exception.enums;

import hu.icellmobilsoft.coffee.dto.error.IFaultType;
import hu.icellmobilsoft.coffee.cdi.annotation.FaultTypeCode;

/**
* Project specific faults
Expand All @@ -28,7 +28,8 @@
* @since 0.1.0
*
*/
public enum FaultType implements IFaultType<FaultType> {
@FaultTypeCode
public enum FaultType {

/**
* HTTP 400 Response.Status.BAD_REQUEST<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
Expand All @@ -31,9 +32,12 @@
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
import org.eclipse.microprofile.openapi.annotations.tags.Tag;

import hu.icellmobilsoft.coffee.cdi.annotation.xml.ValidateXML;
import hu.icellmobilsoft.coffee.dto.common.commonservice.BaseRequest;
import hu.icellmobilsoft.coffee.dto.exception.BaseException;
import hu.icellmobilsoft.coffee.rest.validation.xml.annotation.ValidateXML;
import hu.icellmobilsoft.coffee.rest.log.annotation.LogSpecifier;
import hu.icellmobilsoft.coffee.rest.log.annotation.LogSpecifiers;
import hu.icellmobilsoft.coffee.rest.log.annotation.enumeration.LogSpecifierTarget;
import hu.icellmobilsoft.quarkus.sampler.api.jakarta.path.QuarkusSamplerPath;
import hu.icellmobilsoft.quarkus.sampler.api.schema.XsdConstants;
import hu.icellmobilsoft.quarkus.sampler.dto.test.post.SampleResponse;
Expand Down Expand Up @@ -78,6 +82,10 @@ public interface ITestQuarkusSamplerServiceRest {
description = "Dummy operation for testing Sampler service")
@Tag(ref = ITestQuarkusSamplerServiceRest.TAG)
@GET
@LogSpecifiers(value = {
@LogSpecifier(target = { LogSpecifierTarget.CLIENT_REQUEST }, maxEntityLogSize = 10000),
@LogSpecifier(target = { LogSpecifierTarget.CLIENT_RESPONSE }, maxEntityLogSize = 1000)
})
@Produces(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML, MediaType.APPLICATION_XML })
TestResponse getTest(
@QueryParam(QuarkusSamplerPath.PARAM_TEST_STRING) @Parameter(name = QuarkusSamplerPath.PARAM_TEST_STRING,
Expand Down Expand Up @@ -111,6 +119,8 @@ TestResponse getTest(
description = "Dummy operation for testing Sampler service")
@Tag(ref = ITestQuarkusSamplerServiceRest.TAG)
@POST
@LogSpecifier(target = { LogSpecifierTarget.CLIENT_REQUEST }, maxEntityLogSize = 20)
@LogSpecifier(target = { LogSpecifierTarget.CLIENT_RESPONSE }, noLog = true)
@Consumes(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML, MediaType.APPLICATION_XML })
@Produces(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML, MediaType.APPLICATION_XML })
SampleResponse postTest(@ValidateXML(xsdPath = XsdConstants.SUPER_XSD_PATH) BaseRequest baseRequest,
Expand All @@ -123,4 +133,40 @@ SampleResponse postTest(@ValidateXML(xsdPath = XsdConstants.SUPER_XSD_PATH) Base
@QueryParam(QuarkusSamplerPath.PARAM_TEST_BOOLEAN) @Parameter(name = QuarkusSamplerPath.PARAM_TEST_BOOLEAN,
description = TEST_DESCRIPTION) Boolean testBoolean)
throws BaseException;

/**
* Test POST operation
*
* @param baseRequest
* base request from body
* @param testString
* {@link String} test value
* @param testInteger
* {@link Integer} test value
* @param testLong
* {@link Long} test value
* @param testBoolean
* {@link Boolean} test value
* @return {@link SampleResponse} response
* @throws BaseException
* if any error occurs
*/
@Operation(summary = "Test POST operation", //
description = "Dummy operation for testing Sampler service")
@Tag(ref = ITestQuarkusSamplerServiceRest.TAG)
@PUT
@Consumes(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML, MediaType.APPLICATION_XML })
@Produces(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML, MediaType.APPLICATION_XML })
@LogSpecifier(target = LogSpecifierTarget.REQUEST, maxEntityLogSize = 10)
@LogSpecifier(target = LogSpecifierTarget.RESPONSE, maxEntityLogSize = 5000)
SampleResponse putTest(@ValidateXML(xsdPath = XsdConstants.SUPER_XSD_PATH) BaseRequest baseRequest,
@QueryParam(QuarkusSamplerPath.PARAM_TEST_STRING) @Parameter(name = QuarkusSamplerPath.PARAM_TEST_STRING,
description = TEST_DESCRIPTION) String testString,
@QueryParam(QuarkusSamplerPath.PARAM_TEST_INTEGER) @Parameter(name = QuarkusSamplerPath.PARAM_TEST_INTEGER,
description = TEST_DESCRIPTION) Integer testInteger,
@QueryParam(QuarkusSamplerPath.PARAM_TEST_LONG) @Parameter(name = QuarkusSamplerPath.PARAM_TEST_LONG,
description = TEST_DESCRIPTION) Long testLong,
@QueryParam(QuarkusSamplerPath.PARAM_TEST_BOOLEAN) @Parameter(name = QuarkusSamplerPath.PARAM_TEST_BOOLEAN,
description = TEST_DESCRIPTION) Boolean testBoolean)
throws BaseException;
}
11 changes: 8 additions & 3 deletions qs-bom/qs-bom-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<packaging>pom</packaging>

<properties>
<version.coffee>2.4.0</version.coffee>
<version.coffee>2.6.0-SNAPSHOT</version.coffee>
<version.commons-collections4>4.4</version.commons-collections4>
<version.commons-collections>3.2.2</version.commons-collections>
<version.apache.commons-csv>1.5</version.apache.commons-csv>
</properties>

Expand Down Expand Up @@ -45,11 +46,16 @@
</dependency>
<dependency>
<groupId>hu.icellmobilsoft.coffee</groupId>
<artifactId>coffee-bom</artifactId>
<artifactId>coffee-bom-project</artifactId>
<version>${version.coffee}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${version.commons-collections}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
Expand All @@ -71,7 +77,6 @@
<artifactId>commons-csv</artifactId>
<version>${version.apache.commons-csv}</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down
Loading

0 comments on commit 61afa27

Please sign in to comment.