Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
Fix nightly (hopefully)

See merge request jaguililla/hexagonal_spring!15
  • Loading branch information
jaguililla committed Sep 23, 2024
2 parents 3e35111 + 383ebed commit bd1d426
Show file tree
Hide file tree
Showing 10 changed files with 929 additions and 6 deletions.
17 changes: 15 additions & 2 deletions .mvn/parent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.3</version>
<version>3.3.4</version>
<relativePath/>
</parent>

Expand All @@ -34,7 +34,6 @@
<client.package>${openapi.package}.client</client.package>
<image.name>${project.groupId}/${project.artifactId}</image.name>
<image.registry>docker.io</image.registry>
<release.goal>verify</release.goal> <!-- verify | deploy -->
<spring.server>undertow</spring.server> <!-- undertow | jetty -->
<openapi.integration>ui</openapi.integration> <!-- ui | api -->

Expand All @@ -44,6 +43,8 @@

<jacoco.version>0.8.12</jacoco.version>
<archunit.version>1.3.0</archunit.version>
<gatling.version>3.12.0</gatling.version>
<gatling.maven.version>4.9.6</gatling.maven.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -103,6 +104,12 @@
<artifactId>kafka</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>${gatling.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -237,6 +244,12 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling.maven.version}</version>
</plugin>
</plugins>
</build>

Expand Down
3 changes: 3 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## Third Party Libraries Licenses
For the list of dependencies' licenses, check the Maven dependencies report.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
- "15432:5432"

kafka:
image: docker.io/apache/kafka:3.7.0
image: docker.io/apache/kafka-native:3.8.0
environment:
CLUSTER_ID: 4L6g3nShT-eMCtK--X86sw
KAFKA_NODE_ID: 1
Expand Down
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</parent>

<artifactId>appointments</artifactId>
<version>0.3.7</version>
<version>0.3.8</version>

<name>Appointments</name>
<description>Application to create appointments (REST API)</description>
Expand All @@ -28,7 +28,9 @@
<client.package>${openapi.package}.client</client.package>
<spring.server>undertow</spring.server>
<openapi.integration>ui</openapi.integration>
<release.goal>deploy</release.goal>
<gatling.simulationClass>
com.github.jaguililla.appointments.GatlingSimulation
</gatling.simulationClass>
</properties>

<distributionManagement>
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ management.endpoints.jmx.exposure.exclude: "*"

spring:
threads.virtual.enabled: true

datasource:
url: ${JDBC_URL:jdbc:postgresql://localhost:15432/local}
username: ${JDBC_USERNAME:root}
Expand Down
57 changes: 57 additions & 0 deletions src/main/resources/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>

<head>
<meta lang="en">
<meta charset="UTF-8">

<title>Appointments</title>

<link rel="stylesheet" href="simple.css">
<style>
:root {
--body-font-size: 1rem;
--body-line-height: 1.2;
}
</style>
</head>

<header>
<h1>Appointments</h1>
<p>Example task application</p>

<nav>
<a href="/" class="current">Appointments</a>
<a href="/">Users</a>
</nav>
</header>

<h3>Open</h3>
<table>
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Order</th>
</tr>
</thead>
<tbody id="appointments"></tbody>
</table>

<h3>New</h3>
<form>
<label for="title">Title</label>
<input id="title" type="text">
<label for="order">Order</label>
<input id="order" type="number">
</form>
<button onclick="add()">Add</button>

<template id="appointmentRow">
<tr>
<td>title</td>
<td>0</td>
<td><input type="checkbox" checked></td>
</tr>
</template>

<script src="main.js"></script>
62 changes: 62 additions & 0 deletions src/main/resources/static/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

const http = new XMLHttpRequest();

const tbody = document.querySelector("tbody#appointments");
const template = document.querySelector("#appointmentRow");
const titleInput = document.querySelector("#title");
const orderInput = document.querySelector("#order");

function httpSend(method, url, body, callback) {
http.open(method, url);
http.setRequestHeader('Content-type', 'application/json');
http.send(JSON.stringify(body));
http.onload = callback;
}

function httpGet(url, body, callback) {
httpSend('GET', url, body, callback);
}

function httpPost(url, body, callback) {
httpSend('POST', url, body, callback);
}

function addTask(task) {
const clone = template.content.cloneNode(true);
const td = clone.querySelectorAll("td");
const input = clone.querySelectorAll("input");
td[0].textContent = task.title;
td[1].textContent = task.order;
input.checked = task.completed;
tbody.appendChild(clone);
}

function add() {
const body = {
title: titleInput.value,
order: orderInput.valueAsNumber
};

httpPost('/appointments', body, () => {
titleInput.value = "";
orderInput.value = 0;

addTask(JSON.parse(http.responseText));
});
}

function main() {

httpGet('/appointments', null, () => {
for (const tr of tbody.children)
tr.remove();

const response = JSON.parse(http.responseText);
for (const task of response)
addTask(task);

console.log(http.responseText);
});
}

document.body.onload = main;
Loading

0 comments on commit bd1d426

Please sign in to comment.