From 7546030da20e5839306821e8408df4e85d0b6ec2 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Mon, 29 Apr 2024 09:50:02 +0200 Subject: [PATCH 1/8] Upgrade Maven plugins --- pom.xml | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index b8447db..31454b4 100644 --- a/pom.xml +++ b/pom.xml @@ -78,13 +78,6 @@ - - maven-release-plugin - 2.5.3 - - @{project.version} - - org.jasig.maven maven-notice-plugin @@ -117,11 +110,11 @@ maven-enforcer-plugin - 3.0.0-M1 + 3.4.1 - 3.0 + 3.6.3 @@ -142,40 +135,48 @@ maven-compiler-plugin - 3.7.0 + 3.13.0 maven-surefire-plugin - 2.21.0 + 3.2.5 maven-deploy-plugin - 2.8.2 + 3.1.2 maven-clean-plugin - 3.0.0 + 3.3.2 maven-dependency-plugin - 3.0.2 + 3.6.1 maven-install-plugin - 2.5.2 + 3.1.2 maven-resources-plugin - 3.0.2 + 3.3.1 + + + maven-javadoc-plugin + 3.6.3 + + + maven-source-plugin + 3.3.1 maven-jar-plugin - 3.0.2 + 3.4.1 com.github.siom79.japicmp japicmp-maven-plugin - 0.11.0 + 0.21.1 ${project.build.directory}/${project.build.finalName}.${project.packaging} @@ -207,7 +208,6 @@ maven-javadoc-plugin - 3.0.0 attach-javadocs @@ -222,7 +222,6 @@ maven-source-plugin - 3.0.1 attach-sources From 7bbae0666c1aece8d8c96f9d4e19ad0d72ad98b5 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Mon, 29 Apr 2024 09:59:14 +0200 Subject: [PATCH 2/8] Upgrade Maven license plugin --- pom.xml | 26 +++++++++++-------- src/{main => }/license-header.txt | 0 .../cache2/fallback/FallbackKeeper.java | 2 +- .../fallback/FallbackKeeperFailedHandler.java | 2 +- .../cache2/fallback/LoaderWithFallback.java | 2 +- .../fallback/disk/DiskFallbackKeeper.java | 2 +- .../fallback/disk/DiskFallbackLoader.java | 2 +- .../cache2/fallback/disk/FallbackFile.java | 2 +- .../disk/FallbackFileNamingStrategy.java | 2 +- .../disk/LoaderWithDiskFallbackDecorator.java | 2 +- .../cache2/fallback/disk/LockedFile.java | 2 +- .../cache2/fallback/marshall/Marshaller.java | 2 +- .../marshall/SerializingMarshaller.java | 2 +- .../cache2/function/ThrowingRunnable.java | 2 +- .../no/digipost/cache2/inmemory/Cache.java | 2 +- .../digipost/cache2/inmemory/CacheConfig.java | 2 +- .../digipost/cache2/inmemory/CacheStats.java | 2 +- .../cache2/inmemory/ConfiguresCaffeine.java | 2 +- .../cache2/inmemory/SingleCached.java | 2 +- .../no/digipost/cache2/loader/Callables.java | 2 +- .../no/digipost/cache2/loader/Loader.java | 2 +- .../cache2/loader/LoaderDecorator.java | 2 +- .../cache2/loader/LoaderTransformer.java | 2 +- .../disk/CacheWithDiskFallbackTest.java | 2 +- .../disk/DiskStorageConcurrencyTest.java | 2 +- .../disk/DiskStorageFallbackTest.java | 2 +- .../testharness/FailingCacheLoader.java | 2 +- .../fallback/testharness/OkCacheLoader.java | 2 +- .../testharness/RandomAnswerCacheLoader.java | 2 +- .../testharness/SimulatedLoaderFailure.java | 2 +- .../digipost/cache2/inmemory/CacheTest.java | 2 +- 31 files changed, 44 insertions(+), 40 deletions(-) rename src/{main => }/license-header.txt (100%) diff --git a/pom.xml b/pom.xml index 31454b4..f1e34d5 100644 --- a/pom.xml +++ b/pom.xml @@ -93,19 +93,23 @@ com.mycila license-maven-plugin - 3.0 + 4.3 -
src/main/license-header.txt
true - - LICENSE* - NOTICE - .java-version - src/main/notice/NOTICE.template - **/*.xml - src/test/resources/** - .github/**/*.yml - + + +
src/license-header.txt
+ + LICENSE* + NOTICE + .java-version + src/main/notice/NOTICE.template + **/*.xml + src/test/resources/** + .github/**/*.yml + +
+
diff --git a/src/main/license-header.txt b/src/license-header.txt similarity index 100% rename from src/main/license-header.txt rename to src/license-header.txt diff --git a/src/main/java/no/digipost/cache2/fallback/FallbackKeeper.java b/src/main/java/no/digipost/cache2/fallback/FallbackKeeper.java index 97b52e0..277d610 100644 --- a/src/main/java/no/digipost/cache2/fallback/FallbackKeeper.java +++ b/src/main/java/no/digipost/cache2/fallback/FallbackKeeper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/FallbackKeeperFailedHandler.java b/src/main/java/no/digipost/cache2/fallback/FallbackKeeperFailedHandler.java index 51d94f0..e9bc379 100644 --- a/src/main/java/no/digipost/cache2/fallback/FallbackKeeperFailedHandler.java +++ b/src/main/java/no/digipost/cache2/fallback/FallbackKeeperFailedHandler.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/LoaderWithFallback.java b/src/main/java/no/digipost/cache2/fallback/LoaderWithFallback.java index 86a68e1..f9e3ef2 100644 --- a/src/main/java/no/digipost/cache2/fallback/LoaderWithFallback.java +++ b/src/main/java/no/digipost/cache2/fallback/LoaderWithFallback.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/disk/DiskFallbackKeeper.java b/src/main/java/no/digipost/cache2/fallback/disk/DiskFallbackKeeper.java index b775959..794213e 100644 --- a/src/main/java/no/digipost/cache2/fallback/disk/DiskFallbackKeeper.java +++ b/src/main/java/no/digipost/cache2/fallback/disk/DiskFallbackKeeper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/disk/DiskFallbackLoader.java b/src/main/java/no/digipost/cache2/fallback/disk/DiskFallbackLoader.java index 1f904e7..a460419 100644 --- a/src/main/java/no/digipost/cache2/fallback/disk/DiskFallbackLoader.java +++ b/src/main/java/no/digipost/cache2/fallback/disk/DiskFallbackLoader.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/disk/FallbackFile.java b/src/main/java/no/digipost/cache2/fallback/disk/FallbackFile.java index a923868..1c3de62 100644 --- a/src/main/java/no/digipost/cache2/fallback/disk/FallbackFile.java +++ b/src/main/java/no/digipost/cache2/fallback/disk/FallbackFile.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/disk/FallbackFileNamingStrategy.java b/src/main/java/no/digipost/cache2/fallback/disk/FallbackFileNamingStrategy.java index 4e63939..4aad247 100644 --- a/src/main/java/no/digipost/cache2/fallback/disk/FallbackFileNamingStrategy.java +++ b/src/main/java/no/digipost/cache2/fallback/disk/FallbackFileNamingStrategy.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/disk/LoaderWithDiskFallbackDecorator.java b/src/main/java/no/digipost/cache2/fallback/disk/LoaderWithDiskFallbackDecorator.java index 2a8a330..71b77ba 100644 --- a/src/main/java/no/digipost/cache2/fallback/disk/LoaderWithDiskFallbackDecorator.java +++ b/src/main/java/no/digipost/cache2/fallback/disk/LoaderWithDiskFallbackDecorator.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/disk/LockedFile.java b/src/main/java/no/digipost/cache2/fallback/disk/LockedFile.java index b9cce6c..6d72ebb 100644 --- a/src/main/java/no/digipost/cache2/fallback/disk/LockedFile.java +++ b/src/main/java/no/digipost/cache2/fallback/disk/LockedFile.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/marshall/Marshaller.java b/src/main/java/no/digipost/cache2/fallback/marshall/Marshaller.java index 86ca5d5..768ec4c 100644 --- a/src/main/java/no/digipost/cache2/fallback/marshall/Marshaller.java +++ b/src/main/java/no/digipost/cache2/fallback/marshall/Marshaller.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/fallback/marshall/SerializingMarshaller.java b/src/main/java/no/digipost/cache2/fallback/marshall/SerializingMarshaller.java index ead2776..5f63275 100644 --- a/src/main/java/no/digipost/cache2/fallback/marshall/SerializingMarshaller.java +++ b/src/main/java/no/digipost/cache2/fallback/marshall/SerializingMarshaller.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/function/ThrowingRunnable.java b/src/main/java/no/digipost/cache2/function/ThrowingRunnable.java index 793dd21..aa50eb6 100644 --- a/src/main/java/no/digipost/cache2/function/ThrowingRunnable.java +++ b/src/main/java/no/digipost/cache2/function/ThrowingRunnable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/inmemory/Cache.java b/src/main/java/no/digipost/cache2/inmemory/Cache.java index 7fc8539..a5bd255 100644 --- a/src/main/java/no/digipost/cache2/inmemory/Cache.java +++ b/src/main/java/no/digipost/cache2/inmemory/Cache.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/inmemory/CacheConfig.java b/src/main/java/no/digipost/cache2/inmemory/CacheConfig.java index 08f230b..fa11891 100644 --- a/src/main/java/no/digipost/cache2/inmemory/CacheConfig.java +++ b/src/main/java/no/digipost/cache2/inmemory/CacheConfig.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/inmemory/CacheStats.java b/src/main/java/no/digipost/cache2/inmemory/CacheStats.java index ef5474a..3f8fcbd 100644 --- a/src/main/java/no/digipost/cache2/inmemory/CacheStats.java +++ b/src/main/java/no/digipost/cache2/inmemory/CacheStats.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/inmemory/ConfiguresCaffeine.java b/src/main/java/no/digipost/cache2/inmemory/ConfiguresCaffeine.java index 3ba1015..22aad58 100644 --- a/src/main/java/no/digipost/cache2/inmemory/ConfiguresCaffeine.java +++ b/src/main/java/no/digipost/cache2/inmemory/ConfiguresCaffeine.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/inmemory/SingleCached.java b/src/main/java/no/digipost/cache2/inmemory/SingleCached.java index 11a8954..3549a8b 100644 --- a/src/main/java/no/digipost/cache2/inmemory/SingleCached.java +++ b/src/main/java/no/digipost/cache2/inmemory/SingleCached.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/loader/Callables.java b/src/main/java/no/digipost/cache2/loader/Callables.java index 16baf72..9b00714 100644 --- a/src/main/java/no/digipost/cache2/loader/Callables.java +++ b/src/main/java/no/digipost/cache2/loader/Callables.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/loader/Loader.java b/src/main/java/no/digipost/cache2/loader/Loader.java index 3f45a52..a54227b 100644 --- a/src/main/java/no/digipost/cache2/loader/Loader.java +++ b/src/main/java/no/digipost/cache2/loader/Loader.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/loader/LoaderDecorator.java b/src/main/java/no/digipost/cache2/loader/LoaderDecorator.java index 1a6efb1..da02def 100644 --- a/src/main/java/no/digipost/cache2/loader/LoaderDecorator.java +++ b/src/main/java/no/digipost/cache2/loader/LoaderDecorator.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/no/digipost/cache2/loader/LoaderTransformer.java b/src/main/java/no/digipost/cache2/loader/LoaderTransformer.java index 71090a3..39ca3d5 100644 --- a/src/main/java/no/digipost/cache2/loader/LoaderTransformer.java +++ b/src/main/java/no/digipost/cache2/loader/LoaderTransformer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/no/digipost/cache2/fallback/disk/CacheWithDiskFallbackTest.java b/src/test/java/no/digipost/cache2/fallback/disk/CacheWithDiskFallbackTest.java index 96c88ad..0a0b659 100644 --- a/src/test/java/no/digipost/cache2/fallback/disk/CacheWithDiskFallbackTest.java +++ b/src/test/java/no/digipost/cache2/fallback/disk/CacheWithDiskFallbackTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageConcurrencyTest.java b/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageConcurrencyTest.java index 53f819f..8d95ec1 100644 --- a/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageConcurrencyTest.java +++ b/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageConcurrencyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageFallbackTest.java b/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageFallbackTest.java index c4f1139..a852b98 100644 --- a/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageFallbackTest.java +++ b/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageFallbackTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/no/digipost/cache2/fallback/testharness/FailingCacheLoader.java b/src/test/java/no/digipost/cache2/fallback/testharness/FailingCacheLoader.java index a81781b..6e71059 100644 --- a/src/test/java/no/digipost/cache2/fallback/testharness/FailingCacheLoader.java +++ b/src/test/java/no/digipost/cache2/fallback/testharness/FailingCacheLoader.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/no/digipost/cache2/fallback/testharness/OkCacheLoader.java b/src/test/java/no/digipost/cache2/fallback/testharness/OkCacheLoader.java index 9977428..b19eaf2 100644 --- a/src/test/java/no/digipost/cache2/fallback/testharness/OkCacheLoader.java +++ b/src/test/java/no/digipost/cache2/fallback/testharness/OkCacheLoader.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/no/digipost/cache2/fallback/testharness/RandomAnswerCacheLoader.java b/src/test/java/no/digipost/cache2/fallback/testharness/RandomAnswerCacheLoader.java index a391274..e4e7c8b 100644 --- a/src/test/java/no/digipost/cache2/fallback/testharness/RandomAnswerCacheLoader.java +++ b/src/test/java/no/digipost/cache2/fallback/testharness/RandomAnswerCacheLoader.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/no/digipost/cache2/fallback/testharness/SimulatedLoaderFailure.java b/src/test/java/no/digipost/cache2/fallback/testharness/SimulatedLoaderFailure.java index a7ad564..a3fcc42 100644 --- a/src/test/java/no/digipost/cache2/fallback/testharness/SimulatedLoaderFailure.java +++ b/src/test/java/no/digipost/cache2/fallback/testharness/SimulatedLoaderFailure.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/no/digipost/cache2/inmemory/CacheTest.java b/src/test/java/no/digipost/cache2/inmemory/CacheTest.java index aa89e83..587bc51 100644 --- a/src/test/java/no/digipost/cache2/inmemory/CacheTest.java +++ b/src/test/java/no/digipost/cache2/inmemory/CacheTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) Posten Norge AS * * Licensed under the Apache License, Version 2.0 (the "License"); From fd747716114faaf01d198114b206c7318a058609 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Mon, 29 Apr 2024 09:59:29 +0200 Subject: [PATCH 3/8] Add .editorconfig indent_style=tab because seems like that is what is used already. Tab is better wrt accessability anyway. --- .editorconfig | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6587718 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,31 @@ +# +# Copyright (C) Posten Norge AS +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 4 +charset = utf-8 +continuation_indent_size = 8 + +[*.yml] +indent_size = 2 + +[*.md] +indent_size = 2 From 041d532de8ab3765cf9d15a0564dd1b2184ab9b8 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Mon, 29 Apr 2024 10:40:18 +0200 Subject: [PATCH 4/8] Upgrade to JUnit 5 --- pom.xml | 42 +++++++++----- .../disk/CacheWithDiskFallbackTest.java | 21 +++---- .../disk/DiskStorageConcurrencyTest.java | 43 ++++++--------- .../disk/DiskStorageFallbackTest.java | 55 ++++++++----------- .../digipost/cache2/inmemory/CacheTest.java | 17 +++--- 5 files changed, 88 insertions(+), 90 deletions(-) diff --git a/pom.xml b/pom.xml index f1e34d5..76368e3 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,25 @@ 1.8 + + + + org.junit + junit-bom + 5.10.2 + pom + import + + + org.mockito + mockito-bom + 4.11.0 + pom + import + + + + com.github.ben-manes.caffeine @@ -38,33 +57,30 @@ 1.7.25 - junit - junit - 4.13.2 + org.junit.jupiter + junit-jupiter-api test - - - org.hamcrest - hamcrest-core - - org.hamcrest - java-hamcrest - 2.0.0.0 + hamcrest + 2.2 test no.digipost digg - 0.14 + 0.34 test org.mockito mockito-core - 2.16.0 + test + + + org.mockito + mockito-junit-jupiter test diff --git a/src/test/java/no/digipost/cache2/fallback/disk/CacheWithDiskFallbackTest.java b/src/test/java/no/digipost/cache2/fallback/disk/CacheWithDiskFallbackTest.java index 0a0b659..a09e6a1 100644 --- a/src/test/java/no/digipost/cache2/fallback/disk/CacheWithDiskFallbackTest.java +++ b/src/test/java/no/digipost/cache2/fallback/disk/CacheWithDiskFallbackTest.java @@ -21,9 +21,8 @@ import no.digipost.cache2.inmemory.Cache; import no.digipost.cache2.inmemory.SingleCached; import no.digipost.cache2.loader.LoaderDecorator; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import java.io.IOException; import java.nio.file.Path; @@ -32,26 +31,23 @@ import static no.digipost.cache2.fallback.disk.FallbackFileNamingStrategy.USE_KEY_TOSTRING_AS_FILENAME; import static no.digipost.cache2.loader.Callables.toLoader; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; -public class CacheWithDiskFallbackTest { - - @Rule - public final TemporaryFolder fallbackFolder = new TemporaryFolder(); +class CacheWithDiskFallbackTest { private static final String KEY1 = "key1"; private static final String KEY2 = "key2"; private static final String CONTENT1 = "content1"; private static final String CONTENT2 = "content2"; - public static final String FIRST_VALUE = "thevalue"; + private static final String FIRST_VALUE = "thevalue"; @Test - public void test_single_cached() throws IOException { + void test_single_cached(@TempDir Path diskFallbackFolder) throws IOException { LoaderDecorator diskFallbackDecorator = new LoaderWithDiskFallbackDecorator<>( - fallbackFolder.getRoot().toPath(), USE_KEY_TOSTRING_AS_FILENAME, new SerializingMarshaller()); + diskFallbackFolder, USE_KEY_TOSTRING_AS_FILENAME, new SerializingMarshaller()); SingleCached cache = new SingleCached<>(diskFallbackDecorator.decorate(toLoader(new FailSecondCacheLoader(FIRST_VALUE)))); assertThat(cache.get(), is(FIRST_VALUE)); @@ -60,8 +56,7 @@ public void test_single_cached() throws IOException { } @Test - public void test_cache_with_multiple_keys() throws IOException { - final Path cacheDir = fallbackFolder.newFolder().toPath(); + void test_cache_with_multiple_keys(@TempDir Path cacheDir) throws IOException { final Cache cache = Cache.create(); final LoaderDecorator diskFallbackFactory = new LoaderWithDiskFallbackDecorator<>(cacheDir, USE_KEY_TOSTRING_AS_FILENAME, new SerializingMarshaller()); diff --git a/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageConcurrencyTest.java b/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageConcurrencyTest.java index 8d95ec1..b5dd589 100644 --- a/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageConcurrencyTest.java +++ b/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageConcurrencyTest.java @@ -20,15 +20,15 @@ import no.digipost.cache2.fallback.testharness.RandomAnswerCacheLoader; import no.digipost.cache2.loader.Loader; import no.digipost.cache2.loader.LoaderDecorator; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.rules.Timeout; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; +import org.mockito.junit.jupiter.MockitoExtension; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; @@ -40,32 +40,25 @@ import static no.digipost.DiggExceptions.mayThrow; import static no.digipost.cache2.fallback.disk.FallbackFileNamingStrategy.USE_KEY_TOSTRING_AS_FILENAME; import static no.digipost.cache2.loader.Callables.toLoader; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; -public class DiskStorageConcurrencyTest { - - @Rule - public final TemporaryFolder temporaryFolder = new TemporaryFolder(); - - @Rule - public final Timeout timeout = Timeout.seconds(60); - - @Rule - public final MockitoRule mockito = MockitoJUnit.rule(); +@ExtendWith(MockitoExtension.class) +@Timeout(60) +class DiskStorageConcurrencyTest { private ExecutorService executorService; - @Before - public void setUpExecutor() { + @BeforeEach + void setUpExecutor() { executorService = Executors.newFixedThreadPool(30); } @Test - public void massive_concurrency() throws Exception { + void massive_concurrency(@TempDir Path diskFallbackDir) throws Exception { String key = getClass().getSimpleName(); LoaderDecorator cacheLoaderFactory = new LoaderWithDiskFallbackDecorator<>( - temporaryFolder.getRoot().toPath(), USE_KEY_TOSTRING_AS_FILENAME, new SerializingMarshaller(), new FallbackKeeperFailedHandler.Rethrow()); + diskFallbackDir, USE_KEY_TOSTRING_AS_FILENAME, new SerializingMarshaller(), new FallbackKeeperFailedHandler.Rethrow()); Callable fallbackLoader = new Loader.AsCallable<>(cacheLoaderFactory.decorate(toLoader(new RandomAnswerCacheLoader())), key); fallbackLoader.call(); // initialize disk-fallback @@ -78,8 +71,8 @@ public void massive_concurrency() throws Exception { } - @After - public void shutdownExecutor() { + @AfterEach + void shutdownExecutor() { executorService.shutdownNow(); } diff --git a/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageFallbackTest.java b/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageFallbackTest.java index a852b98..7a8d40c 100644 --- a/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageFallbackTest.java +++ b/src/test/java/no/digipost/cache2/fallback/disk/DiskStorageFallbackTest.java @@ -24,12 +24,10 @@ import no.digipost.cache2.loader.Loader; import no.digipost.cache2.loader.LoaderDecorator; import no.digipost.time.ControllableClock; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.TemporaryFolder; -import org.junit.rules.Timeout; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.io.TempDir; import java.io.IOException; import java.io.InputStream; @@ -42,60 +40,55 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; import static no.digipost.cache2.fallback.disk.FallbackFileNamingStrategy.USE_KEY_TOSTRING_AS_FILENAME; import static no.digipost.cache2.loader.Callables.toLoader; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; -public class DiskStorageFallbackTest { - - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - @Rule - public final Timeout timeout = new Timeout(10, TimeUnit.SECONDS); +@Timeout(10) +class DiskStorageFallbackTest { private final ControllableClock clock = ControllableClock.freezedAt(Instant.now()); - public static final String FIRST_CONTENT = "first_content"; - public static final String SECOND_CONTENT = "second_content"; - public static final String THIRD_CONTENT = "third_content"; + private static final String FIRST_CONTENT = "first_content"; + private static final String SECOND_CONTENT = "second_content"; + private static final String THIRD_CONTENT = "third_content"; private final String key = getClass().getSimpleName() + "_cachekey"; + + @TempDir private Path cache; private ExecutorService executor; - @Before - public void setUp() throws IOException { - cache = temporaryFolder.getRoot().toPath().resolve("fallback"); + @BeforeEach + void setUp() { executor = Executors.newSingleThreadExecutor(); } @Test - public void should_load_cache_from_disk_as_fallback() throws Exception { + void should_load_cache_from_disk_as_fallback() throws Exception { assertThat(newDiskFallback(new OkCacheLoader(FIRST_CONTENT)).call(), is(FIRST_CONTENT)); assertThat(newDiskFallback(new FailingCacheLoader()).call(), is(FIRST_CONTENT)); } @Test - public void should_fail_if_underlying_loader_fails_and_not_stored_on_disk() throws Exception { - expectedException.expect(SimulatedLoaderFailure.class); - newDiskFallback(new FailingCacheLoader()).call(); + void should_fail_if_underlying_loader_fails_and_not_stored_on_disk() throws Exception { + Callable failingCacheLoader = newDiskFallback(new FailingCacheLoader()); + assertThrows(SimulatedLoaderFailure.class, failingCacheLoader::call); } @Test - public void should_primarily_return_value_from_underlying_loader() throws Exception { + void should_primarily_return_value_from_underlying_loader() throws Exception { newDiskFallback(new OkCacheLoader(FIRST_CONTENT)).call(); assertThat(newDiskFallback(new OkCacheLoader(SECOND_CONTENT)).call(), is(SECOND_CONTENT)); } @Test - public void should_not_allow_concurrent_updates_of_disk_fallback() throws Exception { + void should_not_allow_concurrent_updates_of_disk_fallback() throws Exception { newDiskFallback(new OkCacheLoader(FIRST_CONTENT)).call(); final WaitOnWriteMarshaller waitingMarshaller = new WaitOnWriteMarshaller(); @@ -116,7 +109,7 @@ public void should_not_allow_concurrent_updates_of_disk_fallback() throws Except @Test - public void should_allow_update_of_disk_fallback_if_lock_expired() throws Exception { + void should_allow_update_of_disk_fallback_if_lock_expired() throws Exception { LoaderDecorator diskFallbackDecorator = new LoaderWithDiskFallbackDecorator<>(cache, USE_KEY_TOSTRING_AS_FILENAME, new SerializingMarshaller(), new FallbackKeeperFailedHandler.Rethrow(), clock); Loader diskFallback = diskFallbackDecorator.decorate(toLoader(new OkCacheLoader(FIRST_CONTENT))); @@ -143,7 +136,7 @@ private Callable newDiskFallback(Callable loader, Marshaller { + private static class WaitOnWriteMarshaller extends SerializingMarshaller { private CountDownLatch waitOnWrite = new CountDownLatch(1); private CountDownLatch waitBeforeStartWrite = new CountDownLatch(1); diff --git a/src/test/java/no/digipost/cache2/inmemory/CacheTest.java b/src/test/java/no/digipost/cache2/inmemory/CacheTest.java index 587bc51..481dc68 100644 --- a/src/test/java/no/digipost/cache2/inmemory/CacheTest.java +++ b/src/test/java/no/digipost/cache2/inmemory/CacheTest.java @@ -17,7 +17,8 @@ import no.digipost.cache2.loader.Loader; import no.digipost.time.ControllableClock; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import java.util.List; import java.util.concurrent.Callable; @@ -37,12 +38,12 @@ import static no.digipost.DiggExceptions.mayThrow; import static no.digipost.cache2.inmemory.CacheConfig.clockTicker; import static no.digipost.cache2.inmemory.CacheConfig.expireAfterAccess; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.everyItem; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; -public class CacheTest { +class CacheTest { private final AtomicInteger num = new AtomicInteger(-1); private final Loader incrementingValue = key -> num.incrementAndGet(); @@ -53,12 +54,12 @@ public class CacheTest { new SingleCached("CacheTest", incrementingValue, new Cache("single-int", asList(expireAfterAccess(ofSeconds(1)), clockTicker(clock)))); @Test - public void resolvesValueOnFirstAccess() { + void resolvesValueOnFirstAccess() { assertThat(value.get(), is(0)); } @Test - public void reusesCachedValueWhileAccessingWithinExpiryTime() throws Exception { + void reusesCachedValueWhileAccessingWithinExpiryTime() throws Exception { assertThat(asList(value.get(), value.get(), value.get()), everyItem(is(0))); clock.timePasses(ofMillis(900)); assertThat(value.get(), is(0)); @@ -68,8 +69,8 @@ public void reusesCachedValueWhileAccessingWithinExpiryTime() throws Exception { assertThat(asList(value.get(), value.get(), value.get()), contains(1, 1, 1)); } - @Test(timeout = 40000) - public void threadSafety() throws InterruptedException { + @Test @Timeout(40) + void threadSafety() throws InterruptedException { final int threadAmount = 300; ExecutorService threadpool = Executors.newFixedThreadPool(threadAmount); try { @@ -90,7 +91,7 @@ public void threadSafety() throws InterruptedException { } @Test - public void invalidatingCache() { + void invalidatingCache() { assertThat(value.get(), is(0)); assertThat(value.get(), is(0)); clock.timePasses(ofMinutes(1)); From 91b5dee80afc78f5c8d42473a38835d4902204a8 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Mon, 29 Apr 2024 12:28:28 +0200 Subject: [PATCH 5/8] Use util profiles in digipost-open-super-pom:13 https://github.com/digipost/digipost-open-super-pom --- .mvn/maven.config | 1 + LICENSE_BSD | 24 ---- LICENSE_EPL_1.0 | 70 --------- LICENSE_MIT | 17 --- pom.xml | 135 +++--------------- src/{main/notice => }/NOTICE.template | 0 .../disk/FallbackFileNamingStrategy.java | 3 +- .../cache2/fallback/disk/LockedFile.java | 2 +- src/main/notice/license-mappings.xml | 8 -- src/test/resources/simplelogger.properties | 16 +++ 10 files changed, 40 insertions(+), 236 deletions(-) create mode 100644 .mvn/maven.config delete mode 100644 LICENSE_BSD delete mode 100644 LICENSE_EPL_1.0 delete mode 100644 LICENSE_MIT rename src/{main/notice => }/NOTICE.template (100%) delete mode 100644 src/main/notice/license-mappings.xml diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000..511133e --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1 @@ +-P build-sources-and-javadoc,dependency-analyze,check-license-header,include-NOTICE \ No newline at end of file diff --git a/LICENSE_BSD b/LICENSE_BSD deleted file mode 100644 index 8492112..0000000 --- a/LICENSE_BSD +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2015, Posten Norge AS -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSE_EPL_1.0 b/LICENSE_EPL_1.0 deleted file mode 100644 index 3d967ae..0000000 --- a/LICENSE_EPL_1.0 +++ /dev/null @@ -1,70 +0,0 @@ -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: -i) changes to the Program, and -ii) additions to the Program; -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and -b) its license agreement: -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and -b) a copy of this Agreement must be included with each copy of the Program. -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/LICENSE_MIT b/LICENSE_MIT deleted file mode 100644 index e14c371..0000000 --- a/LICENSE_MIT +++ /dev/null @@ -1,17 +0,0 @@ -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -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. \ No newline at end of file diff --git a/pom.xml b/pom.xml index 76368e3..483ce10 100644 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,28 @@ + 4.0.0 no.digipost digipost-open-super-pom - 6 + 13 digipost-cache @@ -96,37 +113,13 @@ org.jasig.maven - maven-notice-plugin - 1.1.0 - - ${project.basedir}/src/main/notice/NOTICE.template - - ${project.basedir}/src/main/notice/license-mappings.xml - - test - + notice-maven-plugin + 2.0.0 com.mycila license-maven-plugin 4.3 - - true - - -
src/license-header.txt
- - LICENSE* - NOTICE - .java-version - src/main/notice/NOTICE.template - **/*.xml - src/test/resources/** - .github/**/*.yml - -
-
-
maven-enforcer-plugin @@ -198,14 +191,9 @@ japicmp-maven-plugin 0.21.1 - - ${project.build.directory}/${project.build.finalName}.${project.packaging} - - true - true - no.digipost + no.digipost.cache2 @@ -213,87 +201,6 @@
- - com.mycila - license-maven-plugin - - - check-license-header - test - - check - - - - - - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - -missing - - - - maven-source-plugin - - - attach-sources - - jar - - - true - - - - - - org.jasig.maven - maven-notice-plugin - - - check-NOTICE-file - verify - - check - - - - - - jakarta.xml.bind - jakarta.xml.bind-api - 2.3.2 - - - org.glassfish.jaxb - jaxb-runtime - 2.3.2 - runtime - - - - - maven-dependency-plugin - - - - analyze-only - - - true - true - - - - maven-enforcer-plugin diff --git a/src/main/notice/NOTICE.template b/src/NOTICE.template similarity index 100% rename from src/main/notice/NOTICE.template rename to src/NOTICE.template diff --git a/src/main/java/no/digipost/cache2/fallback/disk/FallbackFileNamingStrategy.java b/src/main/java/no/digipost/cache2/fallback/disk/FallbackFileNamingStrategy.java index 4aad247..207f326 100644 --- a/src/main/java/no/digipost/cache2/fallback/disk/FallbackFileNamingStrategy.java +++ b/src/main/java/no/digipost/cache2/fallback/disk/FallbackFileNamingStrategy.java @@ -32,8 +32,7 @@ public String toFilename(Object key) { * * The filename returned should not contain any special characters. Ideally matching pattern [a-z0-9]+ . * - * @param key - * @return + * @return a filename for the given key */ String toFilename(K key); diff --git a/src/main/java/no/digipost/cache2/fallback/disk/LockedFile.java b/src/main/java/no/digipost/cache2/fallback/disk/LockedFile.java index 6d72ebb..4c6a1a4 100644 --- a/src/main/java/no/digipost/cache2/fallback/disk/LockedFile.java +++ b/src/main/java/no/digipost/cache2/fallback/disk/LockedFile.java @@ -98,7 +98,7 @@ public boolean runIfLock(ThrowingRunnable operation) th * lockFile.release(); * } * } - * + * } * * * @return {@code true} if the lock was acquired, {@code false} false otherwise. diff --git a/src/main/notice/license-mappings.xml b/src/main/notice/license-mappings.xml deleted file mode 100644 index 3f646c5..0000000 --- a/src/main/notice/license-mappings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/src/test/resources/simplelogger.properties b/src/test/resources/simplelogger.properties index 1977476..d14f758 100644 --- a/src/test/resources/simplelogger.properties +++ b/src/test/resources/simplelogger.properties @@ -1 +1,17 @@ +# +# Copyright (C) Posten Norge AS +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + org.slf4j.simpleLogger.defaultLogLevel=error \ No newline at end of file From edb9f846a4f4d512afd5b7d09838de2330e2cfa0 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Mon, 29 Apr 2024 12:39:03 +0200 Subject: [PATCH 6/8] Upgrade caffeine to 2.9.3 --- NOTICE | 2 ++ pom.xml | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index c3fb6b3..24627c7 100644 --- a/NOTICE +++ b/NOTICE @@ -9,7 +9,9 @@ Licensed under Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.html This software includes third party software subject to the following licenses: Caffeine cache under Apache License, Version 2.0 + Checker Qual under The MIT License Digipost Caching under The Apache Software License, Version 2.0 + error-prone annotations under Apache 2.0 SLF4J API Module under MIT License diff --git a/pom.xml b/pom.xml index 483ce10..2b93275 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,8 @@ com.github.ben-manes.caffeine caffeine - 2.6.2 + + 2.9.3 org.slf4j @@ -135,7 +136,9 @@ *:*:*:*:test - com.github.ben-manes.caffeine:caffeine + com.github.ben-manes.caffeine + org.checkerframework + com.google.errorprone org.slf4j:slf4j-api true From 4ae8539176e8025b06a3fee030b4edf4bb0eef26 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Mon, 29 Apr 2024 12:41:09 +0200 Subject: [PATCH 7/8] Upgrade SLF4J API to 2.0.13 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2b93275..e45c05a 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ org.slf4j slf4j-api - 1.7.25 + 2.0.13 org.junit.jupiter @@ -104,7 +104,7 @@ org.slf4j slf4j-simple - 1.7.25 + 2.0.13 test From f0968351739cc32c85a591877ed0a9d7624ebc30 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Mon, 29 Apr 2024 12:54:59 +0200 Subject: [PATCH 8/8] Upgrade GitHub actions --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f2a956..d16c8e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} distribution: 'temurin' @@ -47,7 +47,7 @@ jobs: name: Deploy snapshot steps: - uses: actions/checkout@v4 - - uses: digipost/action-maven-publish@1.1.0 + - uses: digipost/action-maven-publish@v1 with: sonatype_secrets: ${{ secrets.sonatype_secrets }} release_version: ${{ needs.makeversion.outputs.version }} @@ -62,7 +62,7 @@ jobs: - name: Check out Git repository uses: actions/checkout@v4 - name: Release to Central Repository - uses: digipost/action-maven-publish@1.1.0 + uses: digipost/action-maven-publish@v1 with: sonatype_secrets: ${{ secrets.sonatype_secrets }} release_version: ${{ needs.makeversion.outputs.version }}