Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Jaxrs/Basic/pom.xml
#	Jaxrs/BasicJLink/pom.xml
#	Jaxrs/OAuth/pom.xml
  • Loading branch information
GedMarc committed Feb 4, 2024
2 parents b74537a + 03041f5 commit 89fa9ae
Show file tree
Hide file tree
Showing 27 changed files with 362 additions and 113 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Maven Package
on:
workflow_dispatch:
push:
jobs:
JaxRS-Basic:
uses: GuicedEE/Workflows/.github/workflows/projects.yml@master
with:
baseDir: 'Jaxrs/Basic/'
name: 'JAXRS Basic'
secrets:
USERNAME: ${{secrets.USERNAME}}
USER_TOKEN: ${{secrets.USER_TOKEN}}
SONA_USERNAME: ${{secrets.SONA_USERNAME}}
SONA_PASSWORD: ${{secrets.SONA_PASSWORD}}
JaxRS-BasicJLink:
uses: GuicedEE/Workflows/.github/workflows/projects.yml@master
needs:
- JaxRS-Basic
with:
baseDir: 'Jaxrs/BasicJLink/'
name: 'JAXRS Basic JLink'
secrets:
USERNAME: ${{secrets.USERNAME}}
USER_TOKEN: ${{secrets.USER_TOKEN}}
SONA_USERNAME: ${{secrets.SONA_USERNAME}}
SONA_PASSWORD: ${{secrets.SONA_PASSWORD}}
JaxRS-Bindings:
uses: GuicedEE/Workflows/.github/workflows/projects.yml@master
with:
baseDir: 'Jaxrs/Binding/'
name: 'JAXRS Bindings'
secrets:
USERNAME: ${{secrets.USERNAME}}
USER_TOKEN: ${{secrets.USER_TOKEN}}
SONA_USERNAME: ${{secrets.SONA_USERNAME}}
SONA_PASSWORD: ${{secrets.SONA_PASSWORD}}
55 changes: 50 additions & 5 deletions Jaxrs/Basic/pom.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,58 @@
<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>com.guicedee.examples.jaxrs</groupId>
<artifactId>examples-jaxrs-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<packaging>jar</packaging>

<groupId>com.guicedee.examples</groupId>
<artifactId>jaxrs-basic-example</artifactId>
<version>2.0.0-SNAPSHOT</version>

<properties>
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.guicedee.servlets</groupId>
<artifactId>guiced-rest-services</artifactId>
</dependency>
<dependency>
<groupId>com.guicedee.servlets</groupId>
<artifactId>guiced-undertow</artifactId>
</dependency>


<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.guicedee</groupId>
<artifactId>guicedee-bom</artifactId>
<version>${project.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>


</project>
13 changes: 0 additions & 13 deletions Jaxrs/Basic/src/jre11/java/module-info.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
import com.guicedee.guicedinjection.GuiceContext;
import com.guicedee.guicedservlets.undertow.GuicedUndertow;

import io.undertow.Undertow;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.concurrent.TimeUnit;

@Path("hello")
@Produces("application/json")
public class HelloWorld {
Expand All @@ -16,8 +21,15 @@ public class HelloWorld {
public String hello(@PathParam("name") final String name) {
return "Hello! " + name;
}

public static void main(String[] args) throws Exception {
GuiceContext.instance().getConfig().setServiceLoadWithClassPath(true);
GuicedUndertow.boot("0.0.0.0", 6003);
LocalDateTime startTime = LocalDateTime.now();

//optional for class scanning optimization
GuiceContext.registerModule("com.guicedee.examples.jaxrs.basic");
Undertow boot = GuicedUndertow.boot("0.0.0.0", 6003);
LocalDateTime endTime = LocalDateTime.now();

System.out.println("Started in " + ChronoUnit.MILLIS.between(startTime, endTime) + "ms");
}
}
9 changes: 9 additions & 0 deletions Jaxrs/Basic/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module com.guicedee.examples.jaxrs.basic {
requires com.guicedee.guicedservlets.rest;
requires com.guicedee.guicedservlets.undertow;

requires java.net.http;

exports com.guicedee.examples.jaxrs.basic;
opens com.guicedee.examples.jaxrs.basic to com.google.guice, com.fasterxml.jackson.databind, org.apache.cxf;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.guicedee.examples.jaxrs.basic.tests;

import com.guicedee.examples.jaxrs.basic.HelloWorld;
import com.guicedee.guicedinjection.GuiceContext;
import com.guicedee.guicedservlets.undertow.GuicedUndertow;
import org.junit.jupiter.api.Test;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.time.temporal.ChronoUnit;

import static org.junit.jupiter.api.Assertions.*;

class HelloWorldTest
{
@Test
public void testWorld() throws Exception
{
HelloWorld.main(null);

HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.of(5, ChronoUnit.SECONDS))
.build();
HttpResponse response = client.send(HttpRequest.newBuilder()
.GET()
.uri(new URI("http://localhost:6003/rest/hello/world"))
.build(),
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
assertEquals(200, response.statusCode());

GuiceContext.destroy();
}
}
11 changes: 11 additions & 0 deletions Jaxrs/Basic/src/test/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module com.guicedee.examples.jaxrs.basic.test {
requires com.guicedee.examples.jaxrs.basic;
requires org.junit.jupiter.api;

requires java.net.http;

requires com.guicedee.guicedservlets.rest;
requires com.guicedee.guicedservlets.undertow;

opens com.guicedee.examples.jaxrs.basic.tests to com.google.guice, com.fasterxml.jackson.databind, org.apache.cxf,org.junit.platform.commons;
}
6 changes: 6 additions & 0 deletions Jaxrs/BasicJLink/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine:3.14
LABEL authors="GedMarc"

COPY target/maven-jlink/default /opt

ENTRYPOINT ["/opt/bin/example"]
18 changes: 9 additions & 9 deletions Jaxrs/BasicJLink/pom.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<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>com.guicedee.examples.jaxrs</groupId>
<artifactId>examples-jaxrs-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<groupId>com.guicedee.examples.jaxrs</groupId>
<artifactId>jaxrs-basic-jlink</artifactId>
<packaging>jlink</packaging>
<version>2.0.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<groupId>com.guicedee.examples</groupId>
<artifactId>jaxrs-basic-example</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-jlink-plugin</artifactId>
<version>3.0.0-alpha-2-SNAPSHOT</version>
<version>3.1.0</version>
<extensions>true</extensions>
<configuration>
<noHeaderFiles>true</noHeaderFiles>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<verbose>true</verbose>
<compress>2</compress>
<compress>1</compress>
<launcher>example=com.guicedee.examples.jaxrs.basic/com.guicedee.examples.jaxrs.basic.HelloWorld</launcher>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.6</version>
</dependency>
</dependencies>
</plugin>
Expand Down
57 changes: 57 additions & 0 deletions Jaxrs/Binding/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<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>

<packaging>jar</packaging>

<groupId>com.guicedee.examples</groupId>
<artifactId>jaxrs-binding-example</artifactId>
<version>2.0.0-SNAPSHOT</version>

<properties>
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.guicedee.servlets</groupId>
<artifactId>guiced-rest-services</artifactId>
</dependency>
<dependency>
<groupId>com.guicedee.servlets</groupId>
<artifactId>guiced-openapi</artifactId>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.guicedee</groupId>
<artifactId>guicedee-bom</artifactId>
<version>${project.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.guicedee.examples.jaxrs.binding;


import com.guicedee.guicedinjection.GuiceContext;
import com.guicedee.guicedservlets.undertow.GuicedUndertow;
import io.undertow.Undertow;

public class BootJaxRSBindings
{
public static void main(String... args) throws Exception
{
GuiceContext.registerModule("com.guicedee.examples.jaxrs.binding");
Undertow undertow = GuicedUndertow.boot("0.0.0.0", 6003);
}
}
Loading

0 comments on commit 89fa9ae

Please sign in to comment.