Skip to content

Commit

Permalink
Feature/helidon3 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiviter authored Jan 5, 2023
1 parent 12f4756 commit 6dac23d
Show file tree
Hide file tree
Showing 43 changed files with 514 additions and 337 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
distribution: 'temurin'
java-version: 17
cache: 'maven'

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: java
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
mvn -B -ntp verify

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
83 changes: 43 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.helidon.applications</groupId>
<artifactId>helidon-mp</artifactId>
<version>2.4.2</version>
<version>3.1.0</version>
</parent>
<groupId>uk.dansiviter.scd</groupId>
<artifactId>scd-example</artifactId>
Expand All @@ -13,17 +13,16 @@
<name>${project.artifactId}</name>

<properties>
<java.version>17</java.version>
<!-- <java.version>17</java.version>
<maven.compiler.release>${java.version}</maven.compiler.release>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.target>${java.version}</maven.compiler.target> -->
<!-- <maven.compiler.showWarnings>true</maven.compiler.showWarnings>
<maven.compiler.verbose>true</maven.compiler.verbose> -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<version.lib.jandex>2.4.1.Final</version.lib.jandex>
<version.plugin.jandex>1.2.1</version.plugin.jandex>
<version.jule>0.7.0-SNAPSHOT</version.jule>
</properties>

<repositories>
Expand All @@ -35,16 +34,31 @@
</repository>
</repositories>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>uk.dansiviter.juli</groupId>
<artifactId>juli-cdi</artifactId>
<version>0.4.0</version>
<groupId>uk.dansiviter.jule</groupId>
<artifactId>jule-cdi</artifactId>
<version>${version.jule}</version>
</dependency>
<dependency>
<groupId>uk.dansiviter.juli</groupId>
<artifactId>juli-processor</artifactId>
<version>0.4.0</version>
<groupId>uk.dansiviter.jule</groupId>
<artifactId>jule-processor</artifactId>
<version>${version.jule}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -54,7 +68,7 @@
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threeten-extra</artifactId>
<version>1.7.0</version>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>uk.dansiviter.uuid</groupId>
Expand All @@ -64,7 +78,7 @@
<dependency>
<groupId>io.soabase.record-builder</groupId>
<artifactId>record-builder-processor</artifactId>
<version>29</version>
<version>34</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -78,34 +92,24 @@

<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<artifactId>jersey-media-json-binding</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<groupId>com.thoughtworks.paranamer</groupId>
<artifactId>paranamer</artifactId>
<version>2.8</version>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.8</version>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.16.2</version>
</dependency>

<dependency> <!-- Required for Java 16 -->
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.asm</artifactId>
<version>3.0.1</version>
<version>42.5.1</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -144,7 +148,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>[5.7.1,5.8)</version>
<version>[5,6)</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -158,6 +162,12 @@
<artifactId>helidon-microprofile-tests-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.17.6</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -171,14 +181,14 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- <plugin>
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>2.7.5.1</version>
<version>2.7.9.1</version>
<executions>
<execution>
<id>weave</id>
Expand All @@ -193,14 +203,7 @@
<basePackage>uk.dansiviter.scd.entity</basePackage>
</basePackages>
</configuration>
<dependencies>
<dependency> <!-- Required for Java 16 -->
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.asm</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
</plugin>
</plugin> -->
</plugins>
</build>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/uk/dansiviter/scd/Pair.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package uk.dansiviter.scd;

public record Pair<F, S> (F first, S second) {
public record Pair<F, S>(F first, S second) {
public static <F, S> Pair<F, S> pair(F first, S second) {
return new Pair<>(first, second);
}
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/uk/dansiviter/scd/ScdLog.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package uk.dansiviter.scd;

import static uk.dansiviter.juli.annotations.Message.Level.ERROR;
import static uk.dansiviter.juli.annotations.Message.Level.WARN;
import static uk.dansiviter.jule.annotations.Message.Level.ERROR;
import static uk.dansiviter.jule.annotations.Message.Level.WARN;

import java.time.OffsetDateTime;
import java.util.function.Supplier;

import org.threeten.extra.PeriodDuration;

import uk.dansiviter.juli.annotations.Log;
import uk.dansiviter.juli.annotations.Message;
import uk.dansiviter.jule.annotations.Log;
import uk.dansiviter.jule.annotations.Message;

@Log
public interface ScdLog {
@Message(value = "{0}", level = WARN)
@Message(value = "%s", level = WARN)
void clientError(Supplier<String> object);

@Message(value = "{0}", level = ERROR)
@Message(value = "%s", level = ERROR)
void serverError(Supplier<String> object, Throwable ex);

@Message("Querying window. [name={0},start={1},end={2},alignment={3}].")
@Message("Querying window. [name=%s,start=%s,end=%s,alignment=%s].")
void window(String name, OffsetDateTime start, OffsetDateTime end, PeriodDuration alignment);
}
3 changes: 1 addition & 2 deletions src/main/java/uk/dansiviter/scd/entity/BaseEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import java.util.UUID;
import java.util.function.Supplier;

import javax.persistence.PreUpdate;

import jakarta.persistence.PreUpdate;
import uk.dansiviter.uuid.UuidFactories;

public interface BaseEntity extends Serializable {
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/uk/dansiviter/scd/entity/PersonEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
import java.time.Instant;
import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Index;
import javax.persistence.NamedNativeQuery;
import javax.persistence.PrePersist;
import javax.persistence.Table;

import org.eclipse.persistence.annotations.ReturnInsert;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.Index;
import jakarta.persistence.NamedNativeQuery;
import jakarta.persistence.PrePersist;
import jakarta.persistence.Table;

@Entity
@NamedNativeQuery(
name = "Person.find",
Expand Down Expand Up @@ -76,10 +76,9 @@ public class PersonEntity implements BaseEntity {

public PersonEntity() { }

public PersonEntity(String name, int age, Instant inserted) {
public PersonEntity(String name, int age) {
this.name = name;
this.age = age;
this.inserted = inserted;
}

public String getName() {
Expand Down
38 changes: 11 additions & 27 deletions src/main/java/uk/dansiviter/scd/entity/PointEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,22 @@
import java.math.BigDecimal;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import javax.persistence.Column;
import javax.persistence.ColumnResult;
import javax.persistence.ConstructorResult;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Index;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQuery;
import javax.persistence.SqlResultSetMapping;
import javax.persistence.Table;

import org.eclipse.persistence.annotations.ReturnInsert;

import jakarta.persistence.Column;
import jakarta.persistence.ColumnResult;
import jakarta.persistence.ConstructorResult;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.Index;
import jakarta.persistence.NamedNativeQuery;
import jakarta.persistence.NamedQuery;
import jakarta.persistence.SqlResultSetMapping;
import jakarta.persistence.Table;
import uk.dansiviter.scd.rest.api.Point;
import uk.dansiviter.scd.rest.api.PointBuilder;
import uk.dansiviter.scd.rest.api.TimeSeries;

@Entity
Expand Down Expand Up @@ -126,18 +122,6 @@ public PointId toId() {
return new PointId(this);
}

public Point toRecord() {
return PointBuilder.builder()
.time(getTime())
.value(getValue())
.inserted(getInserted())
.build();
}

public static List<Point> from(List<PointEntity> entities) {
return entities.stream().map(PointEntity::toRecord).collect(Collectors.toList());
}

public static PointEntity from(TimeSeries timeSeries, Point point) {
var entity = new PointEntity();
entity.timeSeriesName = timeSeries.name();
Expand Down
Loading

0 comments on commit 6dac23d

Please sign in to comment.