Skip to content

Commit

Permalink
replaced thorntail with quarkus latest version (#40)
Browse files Browse the repository at this point in the history
* replaced thorntail with quarkus
  • Loading branch information
HoodElliot authored and JChrist committed Apr 22, 2019
1 parent ebf4280 commit 4a0a81c
Show file tree
Hide file tree
Showing 32 changed files with 428 additions and 474 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN cd /app && mvn clean package -DskipTests=true

FROM openjdk:11-jre
RUN mkdir /reminder
COPY --from=builder /app/target/reminder-thorntail.jar /reminder/reminder.jar
COPY --from=builder /app/target/chatreminderbot.jar /reminder/reminder.jar
ENV JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true"
EXPOSE 8080
CMD java $JAVA_OPTS -jar /reminder/reminder.jar
293 changes: 103 additions & 190 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,236 +1,92 @@
<?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/maven-v4_0_0.xsd">
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>gr.cytech</groupId>
<artifactId>chatreminderbot</artifactId>
<name>Chat Reminder Bot</name>
<version>1.10.1</version>
<packaging>war</packaging>

<version>1.11.0</version>
<properties>
<version.thorntail>2.4.0.Final</version.thorntail>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<surefire-plugin.version>3.0.0-M3</surefire-plugin.version>

<quarkus.version>0.13.3</quarkus.version>
<prettytime.version>4.0.2.Final</prettytime.version>
<google.api.client.version>1.27.0</google.api.client.version>
<guava.version>27.1-jre</guava.version>

<junit.version>5.3.2</junit.version>
<assertj.version>3.11.1</assertj.version>
<mockito.version>2.24.0</mockito.version>
</properties>

<dependencyManagement>
<dependencies>

<dependency>
<groupId>io.thorntail</groupId>
<artifactId>bom-all</artifactId>
<version>${version.thorntail}</version>
<scope>import</scope>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<finalName>reminder</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.17</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</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-M3</version>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-maven-plugin</artifactId>
<version>${version.thorntail}</version>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>ejb</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>cdi-config</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>microprofile-config</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-multipart</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-validator</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>cdi</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jpa</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>elytron</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>datasources</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>
<!-- Hibernate ORM specific dependencies -->
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-runner</artifactId>
<version>${version.thorntail}</version>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>flyway</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>

<!-- JDBC driver dependencies -->
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>microprofile-restclient</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>

<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jsonb</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId>
</dependency>

<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-jsonb</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-rest-client</artifactId>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime-nlp</artifactId>
<version>${prettytime.version}</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.27.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
<version>${google.api.client.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
<version>${guava.version}</version>
</dependency>


<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>


<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<!--testing libraries-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime-nlp</artifactId>
<version>4.0.2.Final</version>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>

<!--testing libraries-->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -256,5 +112,62 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>chatreminderbot</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.17</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<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>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/*IT.java</include>
<include>**/*Test.java</include>
</includes>
<systemProperties>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</project>

13 changes: 6 additions & 7 deletions src/main/java/gr/cytech/chatreminderbot/rest/BotResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
@Path("/services")
public class BotResource {
private static final Logger logger = LoggerFactory.getLogger(BotResource.class);
private String spaceId;
private String message;

@Inject
private Control control;
Control control;

/*
* Handles requests from google chat which are assign to this path
Expand All @@ -35,15 +34,15 @@ public class BotResource {
@Produces(MediaType.APPLICATION_JSON)
public String handleReq(Request req) {
control.setRequest(req);
spaceId = req.getMessage().getThread().getSpaceId();
String spaceId = req.getMessage().getThread().getSpaceId();
String message;
try {
message = control.controlResponse();
return responseBuild();
} catch (Exception e) {
logger.warn("Error from message:{}", req.getMessage().getText(), e);
message = "Not even a clue what you just said";
return responseBuild();
}
return responseBuild(spaceId, message);
}

@GET
Expand Down Expand Up @@ -82,7 +81,7 @@ public String onButtonClick(@Context HttpServletRequest request) {
+ "</html>";
}

private String responseBuild() {
private String responseBuild(String spaceId, String message) {
return new CardResponseBuilder()
.thread("spaces/" + spaceId)
.textParagraph(message)
Expand Down
Loading

0 comments on commit 4a0a81c

Please sign in to comment.