Skip to content

Commit

Permalink
Merge branch refactor/period:
Browse files Browse the repository at this point in the history
- refactor measurement handling to properly implement and fix issues related heterogenous periods within a single push
- always ignore timestamp duplicates within station/datatype/period,
  even if within the same push (previously only if the value was a
duplicate, too)
- fix old unit tests and enable them again
- make unit tests use an internal postgres container instead of relying
  on a live DB outside of ci/cd
- add unit tests for new period handling
- only unit test client and dto modules on client release
- update postgres version to 16 to reflect recent migration due to 12
  EOL
- eliminate obsolete persistence configurations
  • Loading branch information
clezag committed Jan 20, 2025
1 parent 0b9e107 commit fe75c80
Show file tree
Hide file tree
Showing 19 changed files with 561 additions and 492 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
uses: actions/checkout@v2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1

- name: Test code
uses: noi-techpark/github-actions/maven-test@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: noi-techpark/github-actions/maven-test@v2
with:
java-version: ${{ env.JAVA_VERSION }}
test-command: 'mvn -B test'
test-command: 'mvn -pl dto,client -B test'

# Release Test Snapshot SDK
release-sdk-snapshot:
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ services:
# stop the containers and execute 'docker-compose rm -fv db' to get rid
# of cached databases...
db:
image: postgis/postgis:12-3.2-alpine
image: postgis/postgis:16-3.5-alpine
environment:
POSTGRES_DB: bdp
POSTGRES_USER: bdp
POSTGRES_PASSWORD: password
# Uncomment this lines, if you want to keep Postgres data on your local machine
#volumes:
# - ./tmp/postgres/data:/var/lib/postgresql/data
ports:
- "5555:5432"
# uncomment to use local data persistence
# volumes:
# - ./tmp/postgres/data:/var/lib/postgresql/data

# To start a local ninja instance along with the core, use `docker compose --profile full up`.
# It's then accessible on port 8991
Expand Down
72 changes: 43 additions & 29 deletions writer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ SPDX-FileCopyrightText: NOI Techpark <[email protected]>
SPDX-License-Identifier: CC0-1.0
-->
<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">
<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.opendatahub.timeseries.bdp</groupId>
<artifactId>core</artifactId>
<groupId>com.opendatahub.timeseries.bdp</groupId>
<artifactId>core</artifactId>
<version>9.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<relativePath>../pom.xml</relativePath>
</parent>

<packaging>jar</packaging> <!-- jar packaging needed by infrastructure/utils/schema-generator -->
<groupId>com.opendatahub.timeseries.bdp</groupId>
Expand All @@ -22,7 +24,7 @@ SPDX-License-Identifier: CC0-1.0
<properties>
<finalName>writer</finalName>
<geotools.version>30.0</geotools.version>
<hibernate.version>6.3.1.Final</hibernate.version>
<hibernate.version>6.6.4.Final</hibernate.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -57,10 +59,10 @@ SPDX-License-Identifier: CC0-1.0
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand All @@ -70,18 +72,18 @@ SPDX-License-Identifier: CC0-1.0
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<!-- Keycloak UMA To request Resource level authorization -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<version>26.0.6</version>
</dependency>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-authz-client</artifactId>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-authz-client</artifactId>
<version>26.0.3</version>
</dependency>
</dependency>

<!-- To create JSON schema descriptions out of classes -->
<dependency>
Expand All @@ -98,10 +100,10 @@ SPDX-License-Identifier: CC0-1.0
</dependency>

<!-- DB migration - Flyway -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>

<!-- Hibernate: ORM with spatial entity support (Postgis, Geometry, ...) -->
<dependency>
Expand All @@ -114,13 +116,13 @@ SPDX-License-Identifier: CC0-1.0
<artifactId>hibernate-spatial</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
</dependency>

<!--
Second level cache, to store entities that never change as
for example provenance records.
Expand Down Expand Up @@ -183,6 +185,18 @@ SPDX-License-Identifier: CC0-1.0
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
</dependency>
<!-- Container support for testing -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.20.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
Expand Down Expand Up @@ -215,4 +229,4 @@ SPDX-License-Identifier: CC0-1.0
<id>generator</id>
</profile>
</profiles>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public abstract class MeasurementAbstract implements Serializable {
public abstract MeasurementAbstract findLatestEntry(EntityManager em, Station station, DataType type, Integer period);
public abstract Date getDateOfLastRecord(EntityManager em, Station station, DataType type, Integer period);
public abstract void setValue(Object value);
public abstract Object getValue();

protected MeasurementAbstract() {
this.created_on = new Date();
Expand Down
Loading

0 comments on commit fe75c80

Please sign in to comment.