Skip to content

Commit

Permalink
[cache-invalidation] Use Quarkus instead of WildFly
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Sep 27, 2024
1 parent 5539e37 commit 944b5b9
Show file tree
Hide file tree
Showing 43 changed files with 1,491 additions and 434 deletions.
211 changes: 211 additions & 0 deletions cache-invalidation-2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
<?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>
<groupId>org.acme</groupId>
<artifactId>code-with-quarkus</artifactId>
<version>1.0.0-SNAPSHOT</version>

<properties>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.15.1</quarkus.platform.version>
<skipITs>true</skipITs>
<surefire-plugin.version>3.3.1</surefire-plugin.version>
<infinispan.version>15.0.8.Final</infinispan.version>
<version.debezium>2.7.3.Final</version.debezium>
</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>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-embedded</artifactId>
<version>${version.debezium}</version>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-connector-postgres</artifactId>
<version>${version.debezium}</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<version>15.0.8.Final</version>
<scope>provided</scope>
</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.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
<goal>native-image-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<parameters>true</parameters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.43.4</version>
<configuration>
<watchInterval>500</watchInterval>
<logDate>default</logDate>
<verbose>true</verbose>
<images>
<image>
<!-- A Docker image using the Postgres Server with the DBZ decoderbufs plugin -->
<name>debezium/postgres-server-test-database</name>
<run>
<namingStrategy>none</namingStrategy>
<env>
<POSTGRES_USER>postgresuser</POSTGRES_USER>
<POSTGRES_PASSWORD>postgrespw</POSTGRES_PASSWORD>
<POSTGRES_DB>inventory</POSTGRES_DB>
<POSTGRES_INITDB_ARGS>-E UTF8</POSTGRES_INITDB_ARGS>
<LANG>en_US.utf8</LANG>
</env>
<ports>
<port>5432:5432</port>
</ports>
<log>
<prefix>postgres</prefix>
<enabled>true</enabled>
<color>green</color>
</log>
<wait>
<time>30000</time>
<log>(?s)PostgreSQL init process complete.*database system is ready to accept connections</log>
</wait>
</run>
<build>
<from>quay.io/debezium/example-postgres:latest</from>
<runCmds>
<run>ln -fs /usr/share/zoneinfo/US/Samoa /etc/localtime &amp;&amp; echo timezone=US/Samoa &gt;&gt; /usr/share/postgresql/postgresql.conf.sample</run>
</runCmds>
</build>
<external>
<type>properties</type>
<mode>override</mode>
</external>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
</properties>
</profile>
</profiles>
</project>
5 changes: 5 additions & 0 deletions cache-invalidation-2/resources/data/create-order-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"customer" : "Billy-Bob",
"itemId" : 10003,
"quantity" : 2
}
4 changes: 4 additions & 0 deletions cache-invalidation-2/resources/data/update-item-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"description" : "North by Northwest - Director's Cut",
"price" : 17.99
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.examples.cacheinvalidation.model;

import java.math.BigDecimal;

import jakarta.persistence.Cacheable;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;

@Entity
@Cacheable
public class Item {

@Id
private long id;
private String description;
private BigDecimal price;

public Item() {
}

public Item(long id, String description, BigDecimal price) {
this.id = id;
this.description = description;
this.price = price;
}

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public BigDecimal getPrice() {
return price;
}

public void setPrice(BigDecimal price) {
this.price = price;
}

@Override
public String toString() {
return "Item [id=" + id + ", description=" + description + ", price=" + price + "]";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.examples.cacheinvalidation.model;

import java.math.BigDecimal;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.SequenceGenerator;

@Entity
public class PurchaseOrder {

@Id
@GeneratedValue(generator = "sequence")
@SequenceGenerator(
name = "sequence",
sequenceName = "seq_po",
initialValue = 1001,
allocationSize = 50
)
private long id;

private String customer;

@ManyToOne
private Item item;

private int quantity;

private BigDecimal totalPrice;

public PurchaseOrder() {
}

public PurchaseOrder(String customer, Item item, int quantity, BigDecimal totalPrice) {
this.customer = customer;
this.item = item;
this.quantity = quantity;
this.totalPrice = totalPrice;
}

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public String getCustomer() {
return customer;
}

public void setCustomer(String customer) {
this.customer = customer;
}

public Item getItem() {
return item;
}

public void setItem(Item item) {
this.item = item;
}

public int getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
this.quantity = quantity;
}

public BigDecimal getTotalPrice() {
return totalPrice;
}

public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
}
Loading

0 comments on commit 944b5b9

Please sign in to comment.