Skip to content

Commit

Permalink
feature/sabi-157 (#161)
Browse files Browse the repository at this point in the history
* fixes #sabi-113 (#152)

fixes sabi-113 HTTP.500 after login (returned users)

* fixes sabi-68 (#154)

Adding Spanish resource bundles
Patch-Management on Server Module
Added French, Italian as well
Added flags to the selection dialog
DisplayLanguage is set in it's own Locale.

* Added same more locales to captcha, too.
Some PatcheManagement

* Fixes i18n Bundle - broken key issue
Tuned logging

* Enhanced i18n sabi-17 (#158)

* sabi-17 i18n of measurement, unit, parameters name and description
- plagues
- parameters
- unit

* sabi-157 Test case classification and use of test containers for integration tests
- Added Testcontainer configuration and a Sample Testclass, as blueprint for the required annotations.

* sabi-157 Test case classification and use of test containers for integration tests
- Refactored UserRepositoryTest, TankRepositoryTest and MeasurementRepositoryTest to use Testcontainer
- Removed H2 from project

* sabi-157 Test case classification and use of test containers for integration tests
- Refactored MeasurementServiceTest
- PatchedSpringBoot to 3.2.3 (required refinement of MAPStruts Mapper)

* sabi-157 Test case classification and use of test containers for integration tests
- Refactored TankServiceTest
- Refactored TestDataFactory

* sabi-157 Test case classification and use of test containers for integration tests
- Refactored UserServiceTest

* sabi-157 Test case classification and use of test containers for integration tests
- Refactored test location of controllers
- Migrated NotificationServiceTest
- Migrated FishServiceTest

* sabi-157 Test case classification and use of test containers for integration tests
- Refactored test location of controllers
- Migrated CoralServiceTest
- Introduced first suite classes, for selective test execution.

* sabi-157 Test case classification and use of test containers for integration tests
- PatchManagement

* sabi-157 Test case classification and use of test containers for integration tests
- MoreSuites
- Service Layer completed
- Next: Module Tests.

* sabi-157 Test case classification and use of test containers for integration tests
- Interlude: PatchManagement SB 3.3.3 etc...
- Next: Module Tests.

* sabi-157 Test case classification and use of test containers for integration tests
- Couldn't Mock Rest API Layer without Testcontainer due to lack of seperation on application context without JPA.
- Experimental refactored MotdControlor to favor the new RestClient istead of RestTemplate.

* sabi-157 Test case classification and use of test containers for integration tests
- Minor Patchmanagement
- Renamed TAGs of APITest to ModuleTest due to issue spec.

* sabi-157 Test case classification and use of test containers for integration tests
- Removed H2 hints in comments

* sabi-157 Test case classification and use of test containers for integration tests
- Test preview switch with maven compiler plugin - java 22 build on github is failing
  • Loading branch information
StefanSchubert authored Oct 3, 2024
1 parent 60a4e69 commit e2b6adb
Show file tree
Hide file tree
Showing 80 changed files with 2,405 additions and 1,594 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
java-version: '21'
java-version: '22'
distribution: 'corretto'
# maven repo cache save and restore
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand Down Expand Up @@ -88,4 +88,4 @@ jobs:
run: cd devops/GenericPiMetricsEndpoint; mvn -B compile --file pom.xml

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
14 changes: 7 additions & 7 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}

steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
- uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
# maven repo cache save and restore
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand All @@ -46,14 +46,14 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
# maven repo cache save and restore
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ The AI challenge here is, that if the human provided data on a given problem con
I declare the Sabi Project climate-friendly because of:
* You as a user, who is **not** demanding, that the Sabi Service is up and running 24/7 with
99% availability, accepting minor service outages, thus enabling the low-energy platform for the project.
* The decision to use raspberry pis as operation platform, which have a very low energy profile (Have a look at my pis here: https://github.com/StefanSchubert/sabi/wiki/07.-Deployment-View )
* The decision to use raspberry pis as an operation platform, which have a very low energy profile (Have a look at my pis here: https://github.com/StefanSchubert/sabi/wiki/07.-Deployment-View )
The alternative would be running in a public cloud, which would allow 99% availability but surly a much bigger CO2 footprint (as well as bigger costs).
* The private cloud at my homesite is powered by a green electricity tariff of my power supply provider.
I in future I will generate my own electricity through solarcells on the roof.
* The private cloud at my home-site is powered by a green electricity tariff of my power supply provider.
In future, I will generate my own electricity through solar-cells on the roof.

## Project Planning

Expand Down
19 changes: 10 additions & 9 deletions captcha/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<!-- Taking care to have all spring dependencies right. -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
<version>3.3.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>de.bluewhale</groupId>
<artifactId>captcha-light</artifactId>
<version>1.2.5</version>
<version>1.2.6</version>
<packaging>jar</packaging>
<description>A REST-full microservice service for CAPTCHA running as spring boot application</description>

Expand All @@ -41,16 +41,16 @@


<properties>
<java.version>21</java.version>
<java.version>22</java.version>
<log4j2.version>2.20.0</log4j2.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<springdoc.openapiv2.version>2.3.0</springdoc.openapiv2.version>
<micrometer.prometheus.version>1.12.3</micrometer.prometheus.version>
<lombok.version>1.18.30</lombok.version>
<owasp.plugin.version>9.0.9</owasp.plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<versions.maven.plugin.version>2.16.2</versions.maven.plugin.version>
<springdoc.openapiv2.version>2.6.0</springdoc.openapiv2.version>
<micrometer.prometheus.version>1.13.5</micrometer.prometheus.version>
<lombok.version>1.18.34</lombok.version>
<owasp.plugin.version>10.0.4</owasp.plugin.version>
<maven-surefire-plugin.version>3.5.0</maven-surefire-plugin.version>
<versions.maven.plugin.version>2.17.1</versions.maven.plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -145,6 +145,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<enablePreview>true</enablePreview>
<release>${java.version}</release>
<encoding>UTF-8</encoding>
</configuration>
Expand Down
79 changes: 47 additions & 32 deletions sabi-boundary/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>de.bluewhale</groupId>
<artifactId>sabi-boundary</artifactId>
<version>1.2.6</version>
<version>1.2.9</version>
<packaging>jar</packaging>
<description>
Contains the DTOs and Utility classes which will be used by the server and client module.
Expand All @@ -35,21 +35,20 @@
</developers>

<properties>
<java.version>21</java.version>
<lombok.version>1.18.30</lombok.version>
<java.version>22</java.version>
<lombok.version>1.18.34</lombok.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<hibernate.validator.version>5.1.0.Final</hibernate.validator.version>
<aspectj.version>1.5.4</aspectj.version>
<springdoc.openapiv2.version>2.3.0</springdoc.openapiv2.version>
<owasp.plugin.version>9.0.7</owasp.plugin.version>
<springdoc.openapiv2.version>2.6.0</springdoc.openapiv2.version>
<owasp.plugin.version>10.0.3</owasp.plugin.version>
<maven.war.plugin.version>4.0.0-M2</maven.war.plugin.version>
<maven.clean.plugin.version>3.3.2</maven.clean.plugin.version>
<maven.site.plugin.version>4.0.0-M13</maven.site.plugin.version>
<maven.compiler.plugin.version>3.12.1</maven.compiler.plugin.version>
<buildhelper.maven.plugin.version>3.5.0</buildhelper.maven.plugin.version>
<versions.maven.plugin.version>2.16.2</versions.maven.plugin.version>

<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
<buildhelper.maven.plugin.version>3.6.0</buildhelper.maven.plugin.version>
<versions.maven.plugin.version>2.17.1</versions.maven.plugin.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -148,30 +147,46 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- Used for vulnerability checks
The examples below can be executed using mvn verify.
-->
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${owasp.plugin.version}</version>
<configuration>
<!-- You need to register yourself at https://nvd.nist.gov/
to get an API-KEY, which you can store in the
properties section of your local settings.xml -->
<nvdApiKey>${nvd.api.key}</nvdApiKey>
</configuration>

<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>owasp-check</id>
<!-- Used for vulnerability checks
The examples below can be executed using mvn verify.
-->
<activation>
<property>
<!-- Check only, if we have injected an API key -->
<name>nvd.api.key</name>
<value>!@{nvd.api.key}</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${owasp.plugin.version}</version>
<configuration>
<!-- You need to register yourself at https://nvd.nist.gov/
to get an API-KEY, which you can store in the
properties section of your local settings.xml -->
<nvdApiKey>${nvd.api.key}</nvdApiKey>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 by Stefan Schubert under the MIT License (MIT).
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT).
* See project LICENSE file for the detailed terms and conditions.
*/

Expand Down Expand Up @@ -35,7 +35,7 @@ public class AquariumTo implements Serializable {
private String description;

@Schema(description = "API-Key which can be used to submit temperature measurements for this tank by an IoT device.", required = false)
private String temperatueApiKey;
private String temperatureApiKey;

@Schema(description = "Flag telling if this tank is still in used, or if it meanwhile has been disolved.", required = false)
private Boolean active;
Expand Down
12 changes: 6 additions & 6 deletions sabi-database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>21</java.version>
<flyway.version>10.0.0</flyway.version>
<mariadb.client.version>3.1.0</mariadb.client.version>
<maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
<versions.maven.plugin.version>2.16.1</versions.maven.plugin.version>
<owasp.plugin.version>8.4.0</owasp.plugin.version>
<java.version>22</java.version>
<flyway.version>10.14.0</flyway.version>
<mariadb.client.version>3.4.0</mariadb.client.version>
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
<versions.maven.plugin.version>2.17.1</versions.maven.plugin.version>
<owasp.plugin.version>10.0.3</owasp.plugin.version>
<!-- Uncomment those or place them into your maven settings.xml in an own profile as I won't
checkin those secrets for stage and production
<mariadb.schema>sabi</mariadb.schema>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
update sabi.unit
/*
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT).
* See project LICENSE file for the detailed terms and conditions.
*/

update unit
set name = 'Mg (ppm)',
description = 'Magnesium concentration in ppm (1 ppm = 1.023 mg/L)'
where id = 4;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
INSERT INTO sabi.parameter (id, description, used_threshold_unit_id, min_threshold, max_threshold)
INSERT INTO parameter (id, description, used_threshold_unit_id, min_threshold, max_threshold)
VALUES (3, 'Magnesium', 4, 1270, 1320);

/*
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT).
* See project LICENSE file for the detailed terms and conditions.
*/

-- Convert mg/L thresholds into ppm for Carbon
update sabi.parameter
set sabi.parameter.min_threshold = 1.157,
sabi.parameter.max_threshold = 1.78
update parameter
set parameter.min_threshold = 1.157,
parameter.max_threshold = 1.78
where id = 1;
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
alter table sabi.parameter drop foreign key parameter_ibfk_1;
/*
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT).
* See project LICENSE file for the detailed terms and conditions.
*/

alter table sabi.parameter
alter table parameter drop foreign key parameter_ibfk_1;

alter table parameter
change used_threshold_unit_id belonging_unit_id int unsigned not null;

alter table sabi.parameter
alter table parameter
add constraint parameter_unit
foreign key (belonging_unit_id) references unit (id);
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
INSERT INTO sabi.parameter (id, description, belonging_unit_id, min_threshold, max_threshold)
/*
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT).
* See project LICENSE file for the detailed terms and conditions.
*/

INSERT INTO parameter (id, description, belonging_unit_id, min_threshold, max_threshold)
VALUES (4, 'Calcium', 3, 380, 420);
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
INSERT INTO sabi.parameter (id, description, belonging_unit_id, min_threshold, max_threshold)
/*
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT).
* See project LICENSE file for the detailed terms and conditions.
*/

INSERT INTO parameter (id, description, belonging_unit_id, min_threshold, max_threshold)
VALUES (5, 'PH', 5, 7.8, 8.4);

INSERT INTO sabi.parameter (id, description, belonging_unit_id, min_threshold, max_threshold)
INSERT INTO parameter (id, description, belonging_unit_id, min_threshold, max_threshold)
VALUES (6, 'Phosphat', 10, 0.02, 0.05);
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
update sabi.unit
/*
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT).
* See project LICENSE file for the detailed terms and conditions.
*/

update unit
set name = 'Ca (ppm)',
description = 'Calcium concentration in ppm (1 ppm = 1.023 mg/L)'
where id = 3;
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CREATE TABLE `unit` (


CREATE TABLE `parameter` (
`id` INTEGER UNSIGNED NOT NULL,
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`description` VARCHAR(255) NOT NULL,
`used_threshold_unit_id` INTEGER UNSIGNED NOT NULL,
`min_threshold` FLOAT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT).
* See project LICENSE file for the detailed terms and conditions.
*/


INSERT INTO unit (id, name, description) VALUES (1, 'KH', 'Karbonathärte / Alkanität');
INSERT INTO unit (id, name, description) VALUES (2, '°C', 'Grad Celsius');
Expand Down Expand Up @@ -25,9 +30,9 @@ VALUES (1, 80, 'LITER', 'Nano-Reef', 1, 1, CURRENT_DATE, CURRENT_DATE);
INSERT INTO aquarium (id, size, size_unit, description, active, user_id, created_on, lastmod_on)
VALUES (2, 200, 'LITER', 'Freshwater', 1, 1, CURRENT_DATE, CURRENT_DATE);

INSERT INTO sabi.measurement (id, measured_on, measured_value, unit_id, aquarium_id, created_on, lastmod_on)
INSERT INTO measurement (id, measured_on, measured_value, unit_id, aquarium_id, created_on, lastmod_on)
VALUES (100, '2018-01-17 19:05:29', 27, 2, 1, CURRENT_DATE, CURRENT_DATE);

INSERT INTO sabi.measurement (id, measured_on, measured_value, unit_id, aquarium_id, created_on, lastmod_on)
INSERT INTO measurement (id, measured_on, measured_value, unit_id, aquarium_id, created_on, lastmod_on)
VALUES (101, '2018-01-17 19:06:51', 1.512, 1, 1, CURRENT_DATE, CURRENT_DATE);

Loading

0 comments on commit e2b6adb

Please sign in to comment.