From f0e5c9b5f12f03380a84283ca5503162cd357336 Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 23 Apr 2026 13:11:39 -0400 Subject: [PATCH 01/12] pom: rebrand to com.scanii 8.0.0, Java 21 Co-Authored-By: Claude Sonnet 4.6 --- pom.xml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 555b4ab..5eeefff 100644 --- a/pom.xml +++ b/pom.xml @@ -2,24 +2,24 @@ 4.0.0 - com.uvasoftware + com.scanii scanii-java - 7.4.0-SNAPSHOT + 8.0.0 jar Scanii.com Java SDK scanii-java - https://github.com/uvasoftware/scanii-java + https://github.com/scanii/scanii-java - Uva Software + Scanii https://www.scanii.com UTF-8 UTF-8 - 11 - 11 + 21 + 21 @@ -29,17 +29,17 @@ - scm:git:git@github.com:uvasoftware/scanii-java.git - scm:git:git@github.com:uvasoftware/scanii-java.git - https://github.com/uvasoftware/scanii-java/tree/main + scm:git:git@github.com:scanii/scanii-java.git + scm:git:git@github.com:scanii/scanii-java.git + https://github.com/scanii/scanii-java/tree/main - Uva Software engineers - ping@uvasoftware.com - Uva Software, LLC - https://www.uvasoftware.com + Scanii engineers + hi@scanii.com + Scanii + https://www.scanii.com @@ -58,7 +58,7 @@ true - com.uvasoftware + com.scanii true @@ -149,7 +149,7 @@ 3.6.3 false - 11 + 21 -Xdoclint:none @@ -195,7 +195,7 @@ github GitHub Packages - https://maven.pkg.github.com/uvasoftware/scanii-java + https://maven.pkg.github.com/scanii/scanii-java From c124b6954a88025f1a1e74a0e0bb37aba664765e Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 23 Apr 2026 13:56:58 -0400 Subject: [PATCH 02/12] =?UTF-8?q?refactor:=20rename=20com.uvasoftware.scan?= =?UTF-8?q?ii=20=E2=86=92=20com.scanii?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- .../scanii/ScaniiClient.java | 10 +- .../scanii/ScaniiClientBuilder.java | 6 +- .../scanii/ScaniiClients.java | 4 +- .../scanii/ScaniiException.java | 2 +- .../scanii/ScaniiTarget.java | 2 +- .../scanii/internal/DefaultScaniiClient.java | 12 +- .../scanii/internal/HttpHeaders.java | 2 +- .../scanii/internal/JSON.java | 10 +- .../internal/MultipartBodyPublisher.java | 2 +- .../scanii/models/ScaniiAccountInfo.java | 2 +- .../scanii/models/ScaniiAuthToken.java | 2 +- .../scanii/models/ScaniiPendingResult.java | 2 +- .../scanii/models/ScaniiProcessingResult.java | 2 +- .../scanii/models/ScaniiResult.java | 2 +- src/main/java/module-info.java | 6 +- .../scanii/IntegrationTest.java | 2 +- .../com/{uvasoftware => }/scanii/Sample.java | 4 +- .../scanii/ScaniiClientBuilderTest.java | 6 +- .../scanii/ScaniiClientsTest.java | 6 +- .../scanii/ScaniiTargetTest.java | 2 +- .../internal/DefaultScaniiClientTest.java | 4 +- .../scanii/internal/JSONTest.java | 10 +- .../internal/MultipartBodyPublisherTest.java | 2 +- .../{uvasoftware => }/scanii/misc/EICAR.java | 2 +- .../scanii/misc/Systems.java | 2 +- .../uvasoftware/scanii/ScaniiClientTest.java | 383 ------------------ 26 files changed, 53 insertions(+), 436 deletions(-) rename src/main/java/com/{uvasoftware => }/scanii/ScaniiClient.java (97%) rename src/main/java/com/{uvasoftware => }/scanii/ScaniiClientBuilder.java (95%) rename src/main/java/com/{uvasoftware => }/scanii/ScaniiClients.java (97%) rename src/main/java/com/{uvasoftware => }/scanii/ScaniiException.java (91%) rename src/main/java/com/{uvasoftware => }/scanii/ScaniiTarget.java (97%) rename src/main/java/com/{uvasoftware => }/scanii/internal/DefaultScaniiClient.java (98%) rename src/main/java/com/{uvasoftware => }/scanii/internal/HttpHeaders.java (91%) rename src/main/java/com/{uvasoftware => }/scanii/internal/JSON.java (97%) rename src/main/java/com/{uvasoftware => }/scanii/internal/MultipartBodyPublisher.java (98%) rename src/main/java/com/{uvasoftware => }/scanii/models/ScaniiAccountInfo.java (98%) rename src/main/java/com/{uvasoftware => }/scanii/models/ScaniiAuthToken.java (95%) rename src/main/java/com/{uvasoftware => }/scanii/models/ScaniiPendingResult.java (90%) rename src/main/java/com/{uvasoftware => }/scanii/models/ScaniiProcessingResult.java (98%) rename src/main/java/com/{uvasoftware => }/scanii/models/ScaniiResult.java (95%) rename src/test/java/com/{uvasoftware => }/scanii/IntegrationTest.java (95%) rename src/test/java/com/{uvasoftware => }/scanii/Sample.java (86%) rename src/test/java/com/{uvasoftware => }/scanii/ScaniiClientBuilderTest.java (96%) rename src/test/java/com/{uvasoftware => }/scanii/ScaniiClientsTest.java (93%) rename src/test/java/com/{uvasoftware => }/scanii/ScaniiTargetTest.java (97%) rename src/test/java/com/{uvasoftware => }/scanii/internal/DefaultScaniiClientTest.java (90%) rename src/test/java/com/{uvasoftware => }/scanii/internal/JSONTest.java (98%) rename src/test/java/com/{uvasoftware => }/scanii/internal/MultipartBodyPublisherTest.java (99%) rename src/test/java/com/{uvasoftware => }/scanii/misc/EICAR.java (88%) rename src/test/java/com/{uvasoftware => }/scanii/misc/Systems.java (96%) delete mode 100644 src/test/java/com/uvasoftware/scanii/ScaniiClientTest.java diff --git a/src/main/java/com/uvasoftware/scanii/ScaniiClient.java b/src/main/java/com/scanii/ScaniiClient.java similarity index 97% rename from src/main/java/com/uvasoftware/scanii/ScaniiClient.java rename to src/main/java/com/scanii/ScaniiClient.java index 5dbb542..21e946a 100644 --- a/src/main/java/com/uvasoftware/scanii/ScaniiClient.java +++ b/src/main/java/com/scanii/ScaniiClient.java @@ -1,9 +1,9 @@ -package com.uvasoftware.scanii; +package com.scanii; -import com.uvasoftware.scanii.models.ScaniiAccountInfo; -import com.uvasoftware.scanii.models.ScaniiAuthToken; -import com.uvasoftware.scanii.models.ScaniiPendingResult; -import com.uvasoftware.scanii.models.ScaniiProcessingResult; +import com.scanii.models.ScaniiAccountInfo; +import com.scanii.models.ScaniiAuthToken; +import com.scanii.models.ScaniiPendingResult; +import com.scanii.models.ScaniiProcessingResult; import java.io.InputStream; import java.nio.file.Path; diff --git a/src/main/java/com/uvasoftware/scanii/ScaniiClientBuilder.java b/src/main/java/com/scanii/ScaniiClientBuilder.java similarity index 95% rename from src/main/java/com/uvasoftware/scanii/ScaniiClientBuilder.java rename to src/main/java/com/scanii/ScaniiClientBuilder.java index 0913ca3..7d80f9f 100644 --- a/src/main/java/com/uvasoftware/scanii/ScaniiClientBuilder.java +++ b/src/main/java/com/scanii/ScaniiClientBuilder.java @@ -1,7 +1,7 @@ -package com.uvasoftware.scanii; +package com.scanii; -import com.uvasoftware.scanii.internal.DefaultScaniiClient; -import com.uvasoftware.scanii.models.ScaniiAuthToken; +import com.scanii.internal.DefaultScaniiClient; +import com.scanii.models.ScaniiAuthToken; import java.net.http.HttpClient; import java.util.Collections; diff --git a/src/main/java/com/uvasoftware/scanii/ScaniiClients.java b/src/main/java/com/scanii/ScaniiClients.java similarity index 97% rename from src/main/java/com/uvasoftware/scanii/ScaniiClients.java rename to src/main/java/com/scanii/ScaniiClients.java index 3daf968..328f886 100644 --- a/src/main/java/com/uvasoftware/scanii/ScaniiClients.java +++ b/src/main/java/com/scanii/ScaniiClients.java @@ -1,6 +1,6 @@ -package com.uvasoftware.scanii; +package com.scanii; -import com.uvasoftware.scanii.models.ScaniiAuthToken; +import com.scanii.models.ScaniiAuthToken; import java.net.http.HttpClient; diff --git a/src/main/java/com/uvasoftware/scanii/ScaniiException.java b/src/main/java/com/scanii/ScaniiException.java similarity index 91% rename from src/main/java/com/uvasoftware/scanii/ScaniiException.java rename to src/main/java/com/scanii/ScaniiException.java index 12cc626..dd40ac7 100644 --- a/src/main/java/com/uvasoftware/scanii/ScaniiException.java +++ b/src/main/java/com/scanii/ScaniiException.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii; +package com.scanii; /** * Unchecked exception wrapper. diff --git a/src/main/java/com/uvasoftware/scanii/ScaniiTarget.java b/src/main/java/com/scanii/ScaniiTarget.java similarity index 97% rename from src/main/java/com/uvasoftware/scanii/ScaniiTarget.java rename to src/main/java/com/scanii/ScaniiTarget.java index c48acb7..841cb5e 100644 --- a/src/main/java/com/uvasoftware/scanii/ScaniiTarget.java +++ b/src/main/java/com/scanii/ScaniiTarget.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii; +package com.scanii; import java.net.URI; import java.util.List; diff --git a/src/main/java/com/uvasoftware/scanii/internal/DefaultScaniiClient.java b/src/main/java/com/scanii/internal/DefaultScaniiClient.java similarity index 98% rename from src/main/java/com/uvasoftware/scanii/internal/DefaultScaniiClient.java rename to src/main/java/com/scanii/internal/DefaultScaniiClient.java index 33c13f2..f74c071 100644 --- a/src/main/java/com/uvasoftware/scanii/internal/DefaultScaniiClient.java +++ b/src/main/java/com/scanii/internal/DefaultScaniiClient.java @@ -1,10 +1,10 @@ -package com.uvasoftware.scanii.internal; +package com.scanii.internal; -import com.uvasoftware.scanii.ScaniiClient; -import com.uvasoftware.scanii.ScaniiClients; -import com.uvasoftware.scanii.ScaniiException; -import com.uvasoftware.scanii.ScaniiTarget; -import com.uvasoftware.scanii.models.*; +import com.scanii.ScaniiClient; +import com.scanii.ScaniiClients; +import com.scanii.ScaniiException; +import com.scanii.ScaniiTarget; +import com.scanii.models.*; import java.io.IOException; import java.io.InputStream; import java.net.URI; diff --git a/src/main/java/com/uvasoftware/scanii/internal/HttpHeaders.java b/src/main/java/com/scanii/internal/HttpHeaders.java similarity index 91% rename from src/main/java/com/uvasoftware/scanii/internal/HttpHeaders.java rename to src/main/java/com/scanii/internal/HttpHeaders.java index 921c89d..abcbaf9 100644 --- a/src/main/java/com/uvasoftware/scanii/internal/HttpHeaders.java +++ b/src/main/java/com/scanii/internal/HttpHeaders.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.internal; +package com.scanii.internal; class HttpHeaders { public static final String LOCATION = "Location"; diff --git a/src/main/java/com/uvasoftware/scanii/internal/JSON.java b/src/main/java/com/scanii/internal/JSON.java similarity index 97% rename from src/main/java/com/uvasoftware/scanii/internal/JSON.java rename to src/main/java/com/scanii/internal/JSON.java index 1153413..d817e9b 100644 --- a/src/main/java/com/uvasoftware/scanii/internal/JSON.java +++ b/src/main/java/com/scanii/internal/JSON.java @@ -1,9 +1,9 @@ -package com.uvasoftware.scanii.internal; +package com.scanii.internal; -import com.uvasoftware.scanii.models.ScaniiAccountInfo; -import com.uvasoftware.scanii.models.ScaniiAuthToken; -import com.uvasoftware.scanii.models.ScaniiPendingResult; -import com.uvasoftware.scanii.models.ScaniiProcessingResult; +import com.scanii.models.ScaniiAccountInfo; +import com.scanii.models.ScaniiAuthToken; +import com.scanii.models.ScaniiPendingResult; +import com.scanii.models.ScaniiProcessingResult; import java.time.Instant; import java.util.*; diff --git a/src/main/java/com/uvasoftware/scanii/internal/MultipartBodyPublisher.java b/src/main/java/com/scanii/internal/MultipartBodyPublisher.java similarity index 98% rename from src/main/java/com/uvasoftware/scanii/internal/MultipartBodyPublisher.java rename to src/main/java/com/scanii/internal/MultipartBodyPublisher.java index f13cbcb..c39b337 100644 --- a/src/main/java/com/uvasoftware/scanii/internal/MultipartBodyPublisher.java +++ b/src/main/java/com/scanii/internal/MultipartBodyPublisher.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.internal; +package com.scanii.internal; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/src/main/java/com/uvasoftware/scanii/models/ScaniiAccountInfo.java b/src/main/java/com/scanii/models/ScaniiAccountInfo.java similarity index 98% rename from src/main/java/com/uvasoftware/scanii/models/ScaniiAccountInfo.java rename to src/main/java/com/scanii/models/ScaniiAccountInfo.java index 54dc9ed..b1c1980 100644 --- a/src/main/java/com/uvasoftware/scanii/models/ScaniiAccountInfo.java +++ b/src/main/java/com/scanii/models/ScaniiAccountInfo.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.models; +package com.scanii.models; import java.time.Instant; import java.util.Map; diff --git a/src/main/java/com/uvasoftware/scanii/models/ScaniiAuthToken.java b/src/main/java/com/scanii/models/ScaniiAuthToken.java similarity index 95% rename from src/main/java/com/uvasoftware/scanii/models/ScaniiAuthToken.java rename to src/main/java/com/scanii/models/ScaniiAuthToken.java index 31aa54c..053a287 100644 --- a/src/main/java/com/uvasoftware/scanii/models/ScaniiAuthToken.java +++ b/src/main/java/com/scanii/models/ScaniiAuthToken.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.models; +package com.scanii.models; import java.time.Instant; diff --git a/src/main/java/com/uvasoftware/scanii/models/ScaniiPendingResult.java b/src/main/java/com/scanii/models/ScaniiPendingResult.java similarity index 90% rename from src/main/java/com/uvasoftware/scanii/models/ScaniiPendingResult.java rename to src/main/java/com/scanii/models/ScaniiPendingResult.java index 72c23e1..7e893f0 100644 --- a/src/main/java/com/uvasoftware/scanii/models/ScaniiPendingResult.java +++ b/src/main/java/com/scanii/models/ScaniiPendingResult.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.models; +package com.scanii.models; public class ScaniiPendingResult extends ScaniiResult { private String resourceId; diff --git a/src/main/java/com/uvasoftware/scanii/models/ScaniiProcessingResult.java b/src/main/java/com/scanii/models/ScaniiProcessingResult.java similarity index 98% rename from src/main/java/com/uvasoftware/scanii/models/ScaniiProcessingResult.java rename to src/main/java/com/scanii/models/ScaniiProcessingResult.java index dbbcfd9..ba7ad7c 100644 --- a/src/main/java/com/uvasoftware/scanii/models/ScaniiProcessingResult.java +++ b/src/main/java/com/scanii/models/ScaniiProcessingResult.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.models; +package com.scanii.models; import java.time.Instant; import java.util.ArrayList; diff --git a/src/main/java/com/uvasoftware/scanii/models/ScaniiResult.java b/src/main/java/com/scanii/models/ScaniiResult.java similarity index 95% rename from src/main/java/com/uvasoftware/scanii/models/ScaniiResult.java rename to src/main/java/com/scanii/models/ScaniiResult.java index f10b71c..0ce4e35 100644 --- a/src/main/java/com/uvasoftware/scanii/models/ScaniiResult.java +++ b/src/main/java/com/scanii/models/ScaniiResult.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.models; +package com.scanii.models; public class ScaniiResult { private String rawResponse; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 1c2de9e..6f7d322 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,6 +1,6 @@ -module com.uvasoftware.scanii { +module com.scanii { requires java.net.http; - exports com.uvasoftware.scanii; - exports com.uvasoftware.scanii.models; + exports com.scanii; + exports com.scanii.models; } diff --git a/src/test/java/com/uvasoftware/scanii/IntegrationTest.java b/src/test/java/com/scanii/IntegrationTest.java similarity index 95% rename from src/test/java/com/uvasoftware/scanii/IntegrationTest.java rename to src/test/java/com/scanii/IntegrationTest.java index b7554d5..1ce7d9f 100644 --- a/src/test/java/com/uvasoftware/scanii/IntegrationTest.java +++ b/src/test/java/com/scanii/IntegrationTest.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii; +package com.scanii; import java.time.Duration; import java.time.Instant; diff --git a/src/test/java/com/uvasoftware/scanii/Sample.java b/src/test/java/com/scanii/Sample.java similarity index 86% rename from src/test/java/com/uvasoftware/scanii/Sample.java rename to src/test/java/com/scanii/Sample.java index 456d037..75b9e51 100644 --- a/src/test/java/com/uvasoftware/scanii/Sample.java +++ b/src/test/java/com/scanii/Sample.java @@ -1,6 +1,6 @@ -package com.uvasoftware.scanii; +package com.scanii; -import com.uvasoftware.scanii.models.ScaniiProcessingResult; +import com.scanii.models.ScaniiProcessingResult; import java.nio.file.Path; diff --git a/src/test/java/com/uvasoftware/scanii/ScaniiClientBuilderTest.java b/src/test/java/com/scanii/ScaniiClientBuilderTest.java similarity index 96% rename from src/test/java/com/uvasoftware/scanii/ScaniiClientBuilderTest.java rename to src/test/java/com/scanii/ScaniiClientBuilderTest.java index 61b65bf..9501578 100644 --- a/src/test/java/com/uvasoftware/scanii/ScaniiClientBuilderTest.java +++ b/src/test/java/com/scanii/ScaniiClientBuilderTest.java @@ -1,7 +1,7 @@ -package com.uvasoftware.scanii; +package com.scanii; -import com.uvasoftware.scanii.internal.DefaultScaniiClient; -import com.uvasoftware.scanii.models.ScaniiAuthToken; +import com.scanii.internal.DefaultScaniiClient; +import com.scanii.models.ScaniiAuthToken; import org.junit.jupiter.api.Test; import java.net.http.HttpClient; diff --git a/src/test/java/com/uvasoftware/scanii/ScaniiClientsTest.java b/src/test/java/com/scanii/ScaniiClientsTest.java similarity index 93% rename from src/test/java/com/uvasoftware/scanii/ScaniiClientsTest.java rename to src/test/java/com/scanii/ScaniiClientsTest.java index fd45800..328043c 100644 --- a/src/test/java/com/uvasoftware/scanii/ScaniiClientsTest.java +++ b/src/test/java/com/scanii/ScaniiClientsTest.java @@ -1,7 +1,7 @@ -package com.uvasoftware.scanii; +package com.scanii; -import com.uvasoftware.scanii.internal.DefaultScaniiClient; -import com.uvasoftware.scanii.models.ScaniiAuthToken; +import com.scanii.internal.DefaultScaniiClient; +import com.scanii.models.ScaniiAuthToken; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/uvasoftware/scanii/ScaniiTargetTest.java b/src/test/java/com/scanii/ScaniiTargetTest.java similarity index 97% rename from src/test/java/com/uvasoftware/scanii/ScaniiTargetTest.java rename to src/test/java/com/scanii/ScaniiTargetTest.java index c80bfe1..7319843 100644 --- a/src/test/java/com/uvasoftware/scanii/ScaniiTargetTest.java +++ b/src/test/java/com/scanii/ScaniiTargetTest.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii; +package com.scanii; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/uvasoftware/scanii/internal/DefaultScaniiClientTest.java b/src/test/java/com/scanii/internal/DefaultScaniiClientTest.java similarity index 90% rename from src/test/java/com/uvasoftware/scanii/internal/DefaultScaniiClientTest.java rename to src/test/java/com/scanii/internal/DefaultScaniiClientTest.java index 6667dce..7fc3e05 100644 --- a/src/test/java/com/uvasoftware/scanii/internal/DefaultScaniiClientTest.java +++ b/src/test/java/com/scanii/internal/DefaultScaniiClientTest.java @@ -1,6 +1,6 @@ -package com.uvasoftware.scanii.internal; +package com.scanii.internal; -import com.uvasoftware.scanii.ScaniiTarget; +import com.scanii.ScaniiTarget; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/uvasoftware/scanii/internal/JSONTest.java b/src/test/java/com/scanii/internal/JSONTest.java similarity index 98% rename from src/test/java/com/uvasoftware/scanii/internal/JSONTest.java rename to src/test/java/com/scanii/internal/JSONTest.java index 134338c..e245423 100644 --- a/src/test/java/com/uvasoftware/scanii/internal/JSONTest.java +++ b/src/test/java/com/scanii/internal/JSONTest.java @@ -1,9 +1,9 @@ -package com.uvasoftware.scanii.internal; +package com.scanii.internal; -import com.uvasoftware.scanii.models.ScaniiAccountInfo; -import com.uvasoftware.scanii.models.ScaniiAuthToken; -import com.uvasoftware.scanii.models.ScaniiPendingResult; -import com.uvasoftware.scanii.models.ScaniiProcessingResult; +import com.scanii.models.ScaniiAccountInfo; +import com.scanii.models.ScaniiAuthToken; +import com.scanii.models.ScaniiPendingResult; +import com.scanii.models.ScaniiProcessingResult; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.parallel.Execution; diff --git a/src/test/java/com/uvasoftware/scanii/internal/MultipartBodyPublisherTest.java b/src/test/java/com/scanii/internal/MultipartBodyPublisherTest.java similarity index 99% rename from src/test/java/com/uvasoftware/scanii/internal/MultipartBodyPublisherTest.java rename to src/test/java/com/scanii/internal/MultipartBodyPublisherTest.java index 18c5131..94be29d 100644 --- a/src/test/java/com/uvasoftware/scanii/internal/MultipartBodyPublisherTest.java +++ b/src/test/java/com/scanii/internal/MultipartBodyPublisherTest.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.internal; +package com.scanii.internal; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/uvasoftware/scanii/misc/EICAR.java b/src/test/java/com/scanii/misc/EICAR.java similarity index 88% rename from src/test/java/com/uvasoftware/scanii/misc/EICAR.java rename to src/test/java/com/scanii/misc/EICAR.java index 60c47f7..2ffdafe 100644 --- a/src/test/java/com/uvasoftware/scanii/misc/EICAR.java +++ b/src/test/java/com/scanii/misc/EICAR.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.misc; +package com.scanii.misc; import java.util.Base64; diff --git a/src/test/java/com/uvasoftware/scanii/misc/Systems.java b/src/test/java/com/scanii/misc/Systems.java similarity index 96% rename from src/test/java/com/uvasoftware/scanii/misc/Systems.java rename to src/test/java/com/scanii/misc/Systems.java index 2c24b2a..f431e5d 100644 --- a/src/test/java/com/uvasoftware/scanii/misc/Systems.java +++ b/src/test/java/com/scanii/misc/Systems.java @@ -1,4 +1,4 @@ -package com.uvasoftware.scanii.misc; +package com.scanii.misc; import java.io.IOException; import java.nio.charset.Charset; diff --git a/src/test/java/com/uvasoftware/scanii/ScaniiClientTest.java b/src/test/java/com/uvasoftware/scanii/ScaniiClientTest.java deleted file mode 100644 index fa7eaf2..0000000 --- a/src/test/java/com/uvasoftware/scanii/ScaniiClientTest.java +++ /dev/null @@ -1,383 +0,0 @@ -package com.uvasoftware.scanii; - -import com.uvasoftware.scanii.misc.EICAR; -import com.uvasoftware.scanii.misc.Systems; -import com.uvasoftware.scanii.models.ScaniiAccountInfo; -import com.uvasoftware.scanii.models.ScaniiAuthToken; -import com.uvasoftware.scanii.models.ScaniiPendingResult; -import com.uvasoftware.scanii.models.ScaniiProcessingResult; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.nio.file.Files; -import java.time.Duration; -import java.util.HashMap; -import java.util.Objects; -import java.util.concurrent.TimeUnit; - -class ScaniiClientTest extends IntegrationTest { - private static final String KEY; - private static final String SECRET; - - static { - KEY = System.getenv("SCANII_CREDS").split(":")[0]; - SECRET = System.getenv("SCANII_CREDS").split(":")[1]; - } - - private ScaniiClient client; - - @BeforeEach - void before() { - client = ScaniiClients.createDefault(ScaniiTarget.AUTO, KEY, SECRET); - } - - @Test - void testProcess() throws Exception { - - ScaniiProcessingResult result; - // simple processing clean - result = client.process(Systems.randomFile(1024)); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertNotNull(result.getChecksum()); - Assertions.assertNotNull(result.getResourceLocation()); - Assertions.assertNotNull(result.getRawResponse()); - Assertions.assertNotNull(result.getRequestId()); - Assertions.assertNotNull(result.getContentType()); - Assertions.assertNotNull(result.getHostId()); - Assertions.assertNotNull(result.getFindings()); - Assertions.assertTrue(result.getFindings().isEmpty()); - System.out.println(result); - - // with findings (EICAR decoded in-memory, never written to disk) - result = client.process(new ByteArrayInputStream(EICAR.decode())); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertNotNull(result.getChecksum()); - Assertions.assertNotNull(result.getResourceLocation()); - Assertions.assertNotNull(result.getRawResponse()); - Assertions.assertNotNull(result.getRequestId()); - Assertions.assertNotNull(result.getContentType()); - Assertions.assertNotNull(result.getHostId()); - Assertions.assertNotNull(result.getFindings()); - Assertions.assertEquals(1, result.getFindings().size()); - Assertions.assertEquals("content.malicious.eicar-test-signature", result.getFindings().get(0)); - System.out.println(result); - - // failures: - - } - - @Test - void testProcessWithMetadata() throws Exception { - - ScaniiProcessingResult result; - - // simple processing clean - result = client.process(Systems.randomFile(1024), new HashMap<>() {{ - put("foo", "bar"); - }}); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertEquals("bar", result.getMetadata().get("foo")); - System.out.println(result); - } - - @Test - void testProcessInputStreamWithMetadata() throws Exception { - - ScaniiProcessingResult result; - - FileInputStream is = new FileInputStream(Systems.randomFile(1024).toFile()); - - // simple processing clean - result = client.process(is, new HashMap<>() {{ - put("foo", "bar"); - }}); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertEquals("bar", result.getMetadata().get("foo")); - System.out.println(result); - } - - @Test - void testProcessWithMetadataAndCallback() throws Exception { - ScaniiProcessingResult result; - - // simple processing clean - result = client.process(Systems.randomFile(1024), "https://httpbin.org/post", new HashMap<>() {{ - put("foo", "bar"); - }}); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertEquals("bar", result.getMetadata().get("foo")); - System.out.println(result); - } - - - @Test - void testProcessInputStreamWithMetadataAndCallback() throws Exception { - ScaniiProcessingResult result; - - FileInputStream is = new FileInputStream(Systems.randomFile(1024).toFile()); - - // simple processing clean - result = client.process(is, "https://httpbin.org/post", new HashMap<>() {{ - put("foo", "bar"); - }}); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertEquals("bar", result.getMetadata().get("foo")); - System.out.println(result); - } - - - @Test - void shouldThrowErrorsIfInvalidPost() { - // empty file: - Assertions.assertThrows(ScaniiException.class, () -> client.process(Files.createTempFile(null, null))); - } - - @Test - void shouldThrowErrorsIfInvalidCredentials() { - ScaniiClient client = ScaniiClients.createDefault("foo", "bar"); - - // empty file: - Assertions.assertThrows(ScaniiException.class, () -> client.process(Files.createTempFile(null, null))); - - } - - @Test - void testProcessAsync() throws Exception { - - ScaniiPendingResult result = client.processAsync(Systems.randomFile(1024)); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertNotNull(result.getResourceLocation()); - Assertions.assertNotNull(result.getRawResponse()); - Assertions.assertNotNull(result.getRequestId()); - Assertions.assertNotNull(result.getHostId()); - System.out.println(result); - - ScaniiProcessingResult actualResult = pollForResult(() -> client.retrieve(result.getResourceId()).orElse(null), - Duration.ofMinutes(1)); - // now fetching the retrieve - Assertions.assertNotNull(actualResult.getResourceId()); - Assertions.assertNotNull(actualResult.getChecksum()); - Assertions.assertNull(actualResult.getResourceLocation()); - Assertions.assertNotNull(actualResult.getRawResponse()); - Assertions.assertNotNull(actualResult.getRequestId()); - Assertions.assertNotNull(actualResult.getContentType()); - Assertions.assertNotNull(actualResult.getHostId()); - Assertions.assertNotNull(actualResult.getFindings()); - Assertions.assertTrue(actualResult.getFindings().isEmpty()); - - } - - @Test - void testProcessAsyncWithMetadata() throws Exception { - ScaniiPendingResult result = client.processAsync(Systems.randomFile(1024), new HashMap<>() {{ - put("foo", "bar"); - }}); - - - ScaniiProcessingResult actualResult = pollForResult((() -> client.retrieve(result.getResourceId()) - .orElse(null)), Duration.ofMinutes(1)); - - // now fetching the retrieve - Assertions.assertNotNull(actualResult.getResourceId()); - Assertions.assertEquals("bar", actualResult.getMetadata().get("foo")); - } - - @Test - void testProcessAsyncInputStreamWithMetadata() throws Exception { - - FileInputStream is = new FileInputStream(Systems.randomFile(1024).toFile()); - - ScaniiPendingResult result = client.processAsync(is, new HashMap<>() {{ - put("foo", "bar"); - }}); - - ScaniiProcessingResult actualResult = pollForResult(() -> client.retrieve(result.getResourceId()) - .orElse(null), Duration.ofMinutes(1)); - Assertions.assertNotNull(actualResult.getResourceId()); - Assertions.assertEquals("bar", actualResult.getMetadata().get("foo")); - } - - @Test - void testProcessAsyncWithMetadataAndCallback() throws Exception { - ScaniiPendingResult result = client.processAsync(Systems.randomFile(1024), "https://httpbin.org/post", new HashMap<>() {{ - put("foo", "bar"); - }}); - - ScaniiProcessingResult actualResult = pollForResult(() -> client.retrieve(result.getResourceId()) - .orElse(null), Duration.ofMinutes(1)); - - Assertions.assertNotNull(actualResult.getResourceId()); - Assertions.assertEquals("bar", actualResult.getMetadata().get("foo")); - } - - @Test - void testProcessAsyncInputStreamWithMetadataAndCallback() throws Exception { - - FileInputStream is = new FileInputStream(Systems.randomFile(1024).toFile()); - - ScaniiPendingResult result = client.processAsync(is, "https://httpbin.org/post", new HashMap<>() {{ - put("foo", "bar"); - }}); - - ScaniiProcessingResult actualResult = pollForResult(() -> client.retrieve(result.getResourceId()) - .orElse(null), Duration.ofMinutes(1)); - - Assertions.assertNotNull(actualResult.getResourceId()); - Assertions.assertEquals("bar", actualResult.getMetadata().get("foo")); - } - - @Test - void testFetchWithoutCallback() throws InterruptedException { - - // simple processing clean - ScaniiPendingResult result = client.fetch("https://scanii.s3.amazonaws.com/eicarcom2.zip"); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertNotNull(result.getResourceLocation()); - Assertions.assertNotNull(result.getRawResponse()); - Assertions.assertNotNull(result.getRequestId()); - Assertions.assertNotNull(result.getHostId()); - System.out.println(result); - - ScaniiProcessingResult actualResult = pollForResult(() -> client.retrieve(result.getResourceId()) - .orElse(null), Duration.ofMinutes(1)); - - Assertions.assertNotNull(actualResult.getResourceId()); - Assertions.assertNotNull(actualResult.getChecksum()); - Assertions.assertNull(actualResult.getResourceLocation()); - Assertions.assertNotNull(actualResult.getRawResponse()); - Assertions.assertNotNull(actualResult.getRequestId()); - Assertions.assertNotNull(actualResult.getContentType()); - Assertions.assertNotNull(actualResult.getHostId()); - Assertions.assertNotNull(actualResult.getFindings()); - Assertions.assertEquals("content.malicious.eicar-test-signature", actualResult.getFindings().get(0)); - } - - @Test - void testFetchWithCallback() throws InterruptedException { - - // simple processing clean - ScaniiPendingResult result = client.fetch("https://scanii.s3.amazonaws.com/eicarcom2.zip", "https://httpbin.org/post"); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertNotNull(result.getResourceLocation()); - Assertions.assertNotNull(result.getRawResponse()); - Assertions.assertNotNull(result.getRequestId()); - Assertions.assertNotNull(result.getHostId()); - System.out.println(result); - - ScaniiProcessingResult actualResult = pollForResult(() -> client.retrieve(result.getResourceId()) - .orElse(null), Duration.ofMinutes(1)); - - Assertions.assertNotNull(actualResult.getResourceId()); - Assertions.assertNotNull(actualResult.getChecksum()); - Assertions.assertNull(actualResult.getResourceLocation()); - Assertions.assertNotNull(actualResult.getRawResponse()); - Assertions.assertNotNull(actualResult.getRequestId()); - Assertions.assertNotNull(actualResult.getContentType()); - Assertions.assertNotNull(actualResult.getHostId()); - Assertions.assertNotNull(actualResult.getFindings()); - Assertions.assertEquals("content.malicious.eicar-test-signature", actualResult.getFindings().get(0)); - } - - @Test - void testFetchWithMetadata() throws Exception { - - ScaniiPendingResult result = client.fetch("https://scanii.s3.amazonaws.com/eicarcom2.zip", "http://google.com", new HashMap<>() {{ - put("foo", "bar"); - }}); - Assertions.assertNotNull(result.getResourceId()); - - - ScaniiProcessingResult actualResult = pollForResult(() -> { - System.out.println("attempting to load result " + result.getResourceId()); - return client.retrieve(result.getResourceId()).orElse(null); - }, Duration.ofMinutes(1)); - - Assertions.assertEquals("bar", actualResult.getMetadata().get("foo")); - System.out.println(result); - - - } - - @Test - void testPing() { - Assertions.assertTrue(client.ping()); - } - - @Test - void testCreateAuthToken() throws Exception { - ScaniiAuthToken result = client.createAuthToken(1, TimeUnit.HOURS); - Assertions.assertNotNull(result.getResourceId()); - Assertions.assertNotNull(result.getExpirationDate()); - Assertions.assertNotNull(result.getCreationDate()); - - // now using the auth token to create a new client and process content - ScaniiClient tempClient = ScaniiClients.createDefault(ScaniiTarget.AUTO, result); - ScaniiProcessingResult processingResult = tempClient.process(Systems.randomFile(1024)); - Assertions.assertNotNull(processingResult.getResourceId()); - Assertions.assertNotNull(processingResult.getChecksum()); - Assertions.assertNotNull(processingResult.getResourceLocation()); - Assertions.assertNotNull(processingResult.getRawResponse()); - Assertions.assertNotNull(processingResult.getRequestId()); - Assertions.assertNotNull(processingResult.getContentType()); - Assertions.assertNotNull(processingResult.getHostId()); - Assertions.assertNotNull(processingResult.getFindings()); - Assertions.assertTrue(processingResult.getFindings().isEmpty()); - System.out.println(processingResult); - - } - - @Test - void testDeleteAuthToken() { - ScaniiAuthToken result = client.createAuthToken(1, TimeUnit.HOURS); - Assertions.assertTrue(client.deleteAuthToken(result.getResourceId())); - Assertions.assertThrows(ScaniiException.class, () -> client.deleteAuthToken("abc")); - } - - @Test - void testRetrieveAuthToken() { - ScaniiAuthToken result = client.createAuthToken(1, TimeUnit.HOURS); - ScaniiAuthToken result2 = client.retrieveAuthToken(result.getResourceId()); - Assertions.assertEquals(result.getResourceId(), result2.getResourceId()); - Assertions.assertEquals(result.getCreationDate(), result2.getCreationDate()); - Assertions.assertEquals(result.getExpirationDate(), result2.getExpirationDate()); - } - - - @Test - void shouldPingAllRegions() { - for (ScaniiTarget target : ScaniiTarget.all()) { - System.out.println(target); - ScaniiClient client = ScaniiClients.createDefault(target, KEY, SECRET); - Assertions.assertTrue(client.ping()); - } - } - - @Test - void shouldRetrieveAccountInfo() { - ScaniiAccountInfo account = client.retrieveAccountInfo(); - Assertions.assertNotNull(account.getName()); - Assertions.assertTrue(account.getBalance() > 0); - Assertions.assertTrue(account.getStartingBalance() > 0); - Assertions.assertNotNull(account.getCreationDate()); - Assertions.assertNotNull(account.getModificationDate()); - Assertions.assertFalse(account.getUsers().isEmpty()); - Assertions.assertFalse(account.getKeys().isEmpty()); - Assertions.assertFalse(account.getKeys().isEmpty()); - - var firstKey = account.getKeys().values().stream().findFirst().orElseThrow(); - Assertions.assertNotNull(firstKey.getCreationDate()); - Assertions.assertNotNull(firstKey.getLastSeenDate()); - Assertions.assertNotNull(firstKey.getDetectionCategoriesEnabled()); - - - } - - @Test - void shouldErrorIfPingToInvalidUrl() { - ScaniiClient client = ScaniiClients.createDefault(new ScaniiTarget("http://example.com"), "foo", "bar"); - client.ping(); - } -} From 0b7a01307783f8fc2350d0aca86481a16dfc882d Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 23 Apr 2026 14:03:53 -0400 Subject: [PATCH 03/12] test: replace real-credentials tests with scanii-cli integration tests Co-Authored-By: Claude Sonnet 4.6 --- .../java/com/scanii/ScaniiClientTest.java | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 src/test/java/com/scanii/ScaniiClientTest.java diff --git a/src/test/java/com/scanii/ScaniiClientTest.java b/src/test/java/com/scanii/ScaniiClientTest.java new file mode 100644 index 0000000..0cbee7f --- /dev/null +++ b/src/test/java/com/scanii/ScaniiClientTest.java @@ -0,0 +1,192 @@ +package com.scanii; + +import com.scanii.misc.EICAR; +import com.scanii.misc.Systems; +import com.scanii.models.ScaniiAuthToken; +import com.scanii.models.ScaniiPendingResult; +import com.scanii.models.ScaniiProcessingResult; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.nio.file.Files; +import java.time.Duration; +import java.util.HashMap; +import java.util.concurrent.TimeUnit; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Integration tests against a locally-running scanii-cli mock server. + * + * Start the server before running: + * docker run -d --name scanii-cli -p 4000:4000 ghcr.io/uvasoftware/scanii-cli:latest server + * + * Endpoint: http://localhost:4000 Key: key Secret: secret + */ +class ScaniiClientTest extends IntegrationTest { + private static final String ENDPOINT = System.getenv().getOrDefault("SCANII_ENDPOINT", "http://localhost:4000"); + private static final String KEY = "key"; + private static final String SECRET = "secret"; + + private ScaniiClient client; + + @BeforeEach + void before() { + client = ScaniiClients.createDefault(new ScaniiTarget(ENDPOINT), KEY, SECRET); + } + + @Test + void testProcess() throws Exception { + // clean file — no findings + ScaniiProcessingResult result = client.process(Systems.randomFile(1024)); + assertNotNull(result.getResourceId()); + assertNotNull(result.getChecksum()); + assertNotNull(result.getResourceLocation()); + assertNotNull(result.getRawResponse()); + assertNotNull(result.getRequestId()); + assertNotNull(result.getContentType()); + assertNotNull(result.getHostId()); + assertNotNull(result.getFindings()); + assertTrue(result.getFindings().isEmpty()); + + // EICAR — should trigger finding (decoded in-memory, never written to disk) + result = client.process(new ByteArrayInputStream(EICAR.decode())); + assertNotNull(result.getResourceId()); + assertNotNull(result.getFindings()); + assertEquals(1, result.getFindings().size()); + assertEquals("content.malicious.eicar-test-signature", result.getFindings().get(0)); + } + + @Test + void testProcessWithMetadata() throws Exception { + ScaniiProcessingResult result = client.process(Systems.randomFile(1024), new HashMap<>() {{ + put("foo", "bar"); + }}); + assertNotNull(result.getResourceId()); + assertEquals("bar", result.getMetadata().get("foo")); + } + + @Test + void testProcessInputStreamWithMetadata() throws Exception { + FileInputStream is = new FileInputStream(Systems.randomFile(1024).toFile()); + ScaniiProcessingResult result = client.process(is, new HashMap<>() {{ + put("foo", "bar"); + }}); + assertNotNull(result.getResourceId()); + assertEquals("bar", result.getMetadata().get("foo")); + } + + @Test + void shouldThrowErrorsIfInvalidPost() throws Exception { + assertThrows(ScaniiException.class, () -> client.process(Files.createTempFile(null, null))); + } + + @Test + void shouldThrowErrorsIfInvalidCredentials() { + ScaniiClient badClient = ScaniiClients.createDefault(new ScaniiTarget(ENDPOINT), "bad-key", "bad-secret"); + assertThrows(ScaniiException.class, () -> badClient.process(Systems.randomFile(1024))); + } + + @Test + void testProcessAsync() throws Exception { + ScaniiPendingResult result = client.processAsync(Systems.randomFile(1024)); + assertNotNull(result.getResourceId()); + assertNotNull(result.getResourceLocation()); + assertNotNull(result.getRawResponse()); + assertNotNull(result.getRequestId()); + assertNotNull(result.getHostId()); + + ScaniiProcessingResult actualResult = pollForResult( + () -> client.retrieve(result.getResourceId()).orElse(null), + Duration.ofMinutes(1)); + assertNotNull(actualResult.getResourceId()); + assertNotNull(actualResult.getChecksum()); + assertNull(actualResult.getResourceLocation()); + assertNotNull(actualResult.getRawResponse()); + assertNotNull(actualResult.getRequestId()); + assertNotNull(actualResult.getContentType()); + assertNotNull(actualResult.getHostId()); + assertNotNull(actualResult.getFindings()); + assertTrue(actualResult.getFindings().isEmpty()); + } + + @Test + void testProcessAsyncWithMetadata() throws Exception { + ScaniiPendingResult result = client.processAsync(Systems.randomFile(1024), new HashMap<>() {{ + put("foo", "bar"); + }}); + ScaniiProcessingResult actualResult = pollForResult( + () -> client.retrieve(result.getResourceId()).orElse(null), + Duration.ofMinutes(1)); + assertNotNull(actualResult.getResourceId()); + assertEquals("bar", actualResult.getMetadata().get("foo")); + } + + @Test + void testProcessAsyncInputStreamWithMetadata() throws Exception { + FileInputStream is = new FileInputStream(Systems.randomFile(1024).toFile()); + ScaniiPendingResult result = client.processAsync(is, new HashMap<>() {{ + put("foo", "bar"); + }}); + ScaniiProcessingResult actualResult = pollForResult( + () -> client.retrieve(result.getResourceId()).orElse(null), + Duration.ofMinutes(1)); + assertNotNull(actualResult.getResourceId()); + assertEquals("bar", actualResult.getMetadata().get("foo")); + } + + @Test + void testFetchWithoutCallback() throws InterruptedException { + // scanii-cli fetch endpoint: accepts any location URL + ScaniiPendingResult result = client.fetch("https://scanii.s3.amazonaws.com/eicarcom2.zip"); + assertNotNull(result.getResourceId()); + assertNotNull(result.getResourceLocation()); + assertNotNull(result.getRawResponse()); + assertNotNull(result.getRequestId()); + assertNotNull(result.getHostId()); + + ScaniiProcessingResult actualResult = pollForResult( + () -> client.retrieve(result.getResourceId()).orElse(null), + Duration.ofMinutes(1)); + assertNotNull(actualResult.getResourceId()); + } + + @Test + void testPing() { + assertTrue(client.ping()); + } + + @Test + void testCreateAuthToken() { + ScaniiAuthToken result = client.createAuthToken(1, TimeUnit.HOURS); + assertNotNull(result.getResourceId()); + } + + @Test + void testDeleteAuthToken() { + ScaniiAuthToken result = client.createAuthToken(1, TimeUnit.HOURS); + assertTrue(client.deleteAuthToken(result.getResourceId())); + } + + @Test + void testRetrieveAuthToken() { + ScaniiAuthToken result = client.createAuthToken(1, TimeUnit.HOURS); + ScaniiAuthToken result2 = client.retrieveAuthToken(result.getResourceId()); + assertEquals(result.getResourceId(), result2.getResourceId()); + } + + /** + * TODO: callback integration test — requires scanii-cli callback support. + * See RAFAEL_CHECKLIST.md §1.6 for the prerequisite work. Once scanii-cli + * ships callback simulation, implement this test by spinning up a local HTTP + * server, passing its URL as the callback parameter, and asserting the payload. + */ + @Test + @Disabled("TODO: scanii-cli callback support not yet available — see RAFAEL_CHECKLIST.md §1.6") + void testProcessWithCallback() { + // stub — implement after scanii-cli adds callback simulation + } +} From f16e4f7f4c1db63b3d7a8cddc115bfa9b8c5655f Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 23 Apr 2026 14:09:22 -0400 Subject: [PATCH 04/12] ci: add pr.yml and release.yml workflows Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/main.yaml | 83 ----------------------------- .github/workflows/pr.yml | 62 +++++++++++++++++++++ .github/workflows/pull-request.yaml | 24 --------- .github/workflows/release.yml | 48 +++++++++++++++++ 4 files changed, 110 insertions(+), 107 deletions(-) delete mode 100644 .github/workflows/main.yaml create mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/pull-request.yaml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml deleted file mode 100644 index 4e4120d..0000000 --- a/.github/workflows/main.yaml +++ /dev/null @@ -1,83 +0,0 @@ -name: Main -permissions: - contents: write - actions: write - deployments: write - packages: write -on: - push: - branches: - - main -jobs: - build: - runs-on: ubuntu-latest - name: "Deploying" - env: - JDK_VERSION: "21" - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - java-version: ${{ env.JDK_VERSION }} - cache: "maven" - distribution: "corretto" - - - name: "Removing snapshot from version" - run: | - mvn -q build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion} versions:commit - - - name: Setup central - uses: actions/setup-java@v4 - with: - java-version: ${{ env.JDK_VERSION }} - cache: "maven" - distribution: "corretto" - server-id: central - server-username: MAVEN_USERNAME - server-password: MAVEN_TOKEN - gpg-private-key: ${{secrets.CODESIGN_PGP_KEY}} - gpg-passphrase: PASSPHRASE - - - name: "Maven deploy maven central" - run: mvn deploy --batch-mode -DskipTests --activate-profiles central --no-transfer-progress - env: - MAVEN_USERNAME: ${{secrets.MAVEN_TOKEN_USER}} - MAVEN_TOKEN: ${{secrets.MAVEN_TOKEN}} - PASSPHRASE: ${{secrets.CODESIGN_PGP_PASSPHRASE}} - - - name: Setup github packages - uses: actions/setup-java@v4 - with: - java-version: ${{ env.JDK_VERSION }} - cache: "maven" - distribution: "corretto" - - - name: "Maven deploy github packages" - run: mvn deploy --batch-mode -DskipTests --activate-profiles github --no-transfer-progress - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: "Tag release and rev version" - run: | - # tagging release: - VERSION=$(grep \ pom.xml | xargs | awk -F '[<>]' '{ print $3}') - - echo "################### using version: v$VERSION ###################" - - # tag repo - git config --global user.email "ci@uvasoftware.com" - git config --global user.name "CI" - git tag -a v"${VERSION}" -m "Release by Github Actions v${VERSION}" - git push origin v"${VERSION}" - - # bumping it to a new snapshot release: - mvn -q build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT versions:commit - - VERSION=$(grep \ pom.xml | xargs | awk -F '[<>]' '{ print $3}') - - echo "next version is: $VERSION" - - #commit version change - git status - git commit -a -m "bump to ${VERSION} [ci skip]" - git push origin main diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..55e8be7 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,62 @@ +name: PR + +on: pull_request + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + verify: + name: JDK ${{ matrix.jdk }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + jdk: [21, 25] + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.jdk }} + distribution: corretto + cache: maven + + - name: Download scanii-cli + shell: bash + run: | + VERSION=latest + OS="${{ runner.os }}" + case "$OS" in + Linux) GOOS=linux ;; + macOS) GOOS=darwin ;; + Windows) GOOS=windows ;; + esac + ARCH="$(uname -m)" + case "$ARCH" in + x86_64|amd64) GOARCH=amd64 ;; + arm64|aarch64) GOARCH=arm64 ;; + *) GOARCH=amd64 ;; + esac + EXT="" + [ "$OS" = "Windows" ] && EXT=".exe" + BASE_URL="https://github.com/uvasoftware/scanii-cli/releases/latest/download" + BINARY="scanii-cli_${GOOS}_${GOARCH}${EXT}" + curl -fsSL "$BASE_URL/$BINARY" -o sc${EXT} + chmod +x sc${EXT} + + - name: Start scanii-cli server + shell: bash + run: | + EXT="" + [ "${{ runner.os }}" = "Windows" ] && EXT=".exe" + ./sc${EXT} server & + # wait for the server to be ready + for i in $(seq 1 15); do + curl -sf http://localhost:4000/ping && break || sleep 1 + done + + - name: mvn verify + run: mvn -B verify diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml deleted file mode 100644 index 2bbe2d2..0000000 --- a/.github/workflows/pull-request.yaml +++ /dev/null @@ -1,24 +0,0 @@ -on: pull_request -name: Pull Requests -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] - jdk: [ 11, 17, 21, 25 ] - name: JDK ${{ matrix.jdk }} on ${{ matrix.os }}. - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-java@v5 - with: - java-version: ${{ matrix.jdk }} - cache: "maven" - distribution: "corretto" - - run: mvn -B clean package - env: - SCANII_CREDS: ${{ secrets.SCANII_CREDS }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6069332 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +permissions: + contents: write + +jobs: + release: + name: Release to Maven Central + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Java for signing and publishing + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: corretto + cache: maven + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_TOKEN + gpg-private-key: ${{ secrets.CODESIGN_PGP_KEY }} + gpg-passphrase: PASSPHRASE + + - name: Publish to Maven Central + run: mvn deploy --batch-mode -DskipTests --activate-profiles central --no-transfer-progress + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_TOKEN_USER }} + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} + PASSPHRASE: ${{ secrets.CODESIGN_PGP_PASSPHRASE }} + + - name: Create GitHub Release + uses: actions/github-script@v7 + with: + script: | + const tag = context.ref.replace('refs/tags/', ''); + await github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: tag, + name: tag, + generate_release_notes: true, + }); From d0e9e7272fd6e209543bc559db9e8b5d814f2f72 Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 23 Apr 2026 14:11:10 -0400 Subject: [PATCH 05/12] docs: rewrite README for v8 rebrand Co-Authored-By: Claude Sonnet 4.6 --- README.md | 85 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 000ad92..22b280e 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,71 @@ -### A pure Java interface to the Scanii content processing service - https://www.scanii.com +# scanii-java -### How to use this client +Official Java SDK for the [Scanii](https://www.scanii.com) content processing API. -#### Installing using Maven coordinates: +## SDK Principles -```xml +1. **Light.** SDKs keep a small and narrow list of dependencies so they don't add ops burden to customers. Ideally zero runtime dependencies — stdlib only. Test dependencies are also kept minimal. Build tooling (compilers, bundlers) doesn't count. + +2. **Up to date.** SDKs are always current with the latest Scanii API spec. When the API evolves, the SDKs are upgraded promptly rather than carrying stale versions for years. + +3. **Integration-only.** The SDK's job is to wrap the Scanii REST API. Higher-level concerns — concurrency, retries, queuing, backoff, circuit breaking, batch processing — are the consumer's responsibility. The SDK doesn't make those decisions for them. +## Install + +```xml - com.uvasoftware + com.scanii scanii-java - ${latest.release.version} + 8.0.0 ``` -### Sample usage: +## Quickstart ```java -package com.uvasoftware.scanii; +import com.scanii.ScaniiClient; +import com.scanii.ScaniiClients; +import com.scanii.models.ScaniiProcessingResult; +import java.nio.file.Paths; + +ScaniiClient client = ScaniiClients.createDefault("your-api-key", "your-api-secret"); +ScaniiProcessingResult result = client.process(Paths.get("/path/to/file")); +System.out.printf("findings: %s%n", result.getFindings()); +``` -import com.uvasoftware.scanii.models.ScaniiProcessingResult; +## Regional endpoints -import java.nio.file.Paths; +| Constant | Endpoint | +|---|---| +| `ScaniiTarget.AUTO` | `https://api.scanii.com` | +| `ScaniiTarget.US1` | `https://api-us1.scanii.com` | +| `ScaniiTarget.EU1` | `https://api-eu1.scanii.com` | +| `ScaniiTarget.EU2` | `https://api-eu2.scanii.com` | +| `ScaniiTarget.AP1` | `https://api-ap1.scanii.com` | +| `ScaniiTarget.AP2` | `https://api-ap2.scanii.com` | +| `ScaniiTarget.CA1` | `https://api-ca1.scanii.com` | -public class Sample { - public static void main(String[] args) { - // in this example args contains the key secret and file path: - String key = args[0]; - String secret = args[1]; - ScaniiClient client = ScaniiClients.createDefault(key, secret); - ScaniiProcessingResult result = client.process(Paths.get(args[2])); - System.out.printf("checksum: %s, content-type: %s and findings: %s%n", - result.getChecksum(), - result.getContentType(), - result.getFindings()); - if (result.getFindings().isEmpty()) { - System.out.println("Content is safe!"); - } - } -} +## Local development with scanii-cli + +Run integration tests against a local mock server — no real credentials needed: + +```bash +docker run -d --name scanii-cli -p 4000:4000 ghcr.io/uvasoftware/scanii-cli:latest server +mvn verify ``` -Please note that you will need a valid scanii.com account and API Credentials. +Test credentials: key `key`, secret `secret`, endpoint `http://localhost:4000`. + +## Migration from com.uvasoftware:scanii-java + +Replace the Maven coordinates and rename imports: + +``` +com.uvasoftware.scanii → com.scanii +``` + +The old artifact `com.uvasoftware:scanii-java` is deprecated and will not receive further updates. + +## License -* More advanced usage examples can be - found [here](https://github.com/uvasoftware/scanii-java/blob/master/src/test/java/com/uvasoftware/scanii/ScaniiClientTest.java) -* General documentation on scanii can be found [here](http://docs.scanii.com) -* Javadocs can be found [here](https://www.javadoc.io/doc/com.uvasoftware/scanii-java/latest/index.html) +Apache 2.0 — see [LICENSE](LICENSE). From ea4f4afcb2830f73988d93c5b18822ed64f6c522 Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 23 Apr 2026 14:17:27 -0400 Subject: [PATCH 06/12] docs: add CHANGELOG for 8.0.0 Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b957e7c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,44 @@ +# Changelog + +## [8.0.0] — 2026-04-23 + +### Breaking changes + +- **groupId renamed:** `com.uvasoftware` → `com.scanii` +- **Package renamed:** `com.uvasoftware.scanii` → `com.scanii` +- **Java minimum version raised:** Java 11 → Java 21 LTS + +### Changes + +- Rebranded to `com.scanii:scanii-java` +- Java source and target updated to 21 +- Integration tests now run against [scanii-cli](https://github.com/uvasoftware/scanii-cli) — no real credentials required +- CI matrix: Java 21 and 25 across Ubuntu, macOS, and Windows +- JUnit 5.12.2 + +### Migration + +Update your Maven dependency: + +```xml + + + com.uvasoftware + scanii-java + 7.x.x + + + + + com.scanii + scanii-java + 8.0.0 + +``` + +Then update your imports: +``` +import com.uvasoftware.scanii.* → import com.scanii.* +``` + +The old `com.uvasoftware:scanii-java` coordinates are deprecated. See the migration guide at https://github.com/scanii/scanii-java. From adb362ae6e17534799f521e1e63453dec5927df6 Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 24 Apr 2026 17:26:42 -0400 Subject: [PATCH 07/12] fix: replace remaining uvasoftware references with scanii MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - README, CHANGELOG, pr.yml download URL: ghcr.io/uvasoftware → ghcr.io/scanii - pr.yml readiness probe: /ping → /v2.2/ping (scanii-cli only serves versioned path) - DefaultScaniiClient javadoc: uvasoftware.github.io → scanii.github.io - ScaniiClient javadoc: all docs.scanii.com/v2.1 URLs → v2.2 - pom.xml github profile javadoc source: 11 → 21 (consistent with Java 21 migration) - logback.xml logger name: com.uvasoftware → com.scanii - Remove empty src/test/java/com/uvasoftware/ directory tree Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/pr.yml | 73 +++++++++++-------- .gitignore | 1 + .run/Run Tests.run.xml | 23 ------ CHANGELOG.md | 2 +- README.md | 2 +- pom.xml | 4 +- src/main/java/com/scanii/ScaniiClient.java | 38 +++++----- .../scanii/internal/DefaultScaniiClient.java | 4 +- .../java/com/scanii/ScaniiClientTest.java | 2 +- src/test/resources/logback.xml | 2 +- 10 files changed, 70 insertions(+), 81 deletions(-) delete mode 100644 .run/Run Tests.run.xml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 55e8be7..6a21f97 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,40 +23,51 @@ jobs: java-version: ${{ matrix.jdk }} distribution: corretto cache: maven - - name: Download scanii-cli shell: bash run: | - VERSION=latest - OS="${{ runner.os }}" - case "$OS" in - Linux) GOOS=linux ;; - macOS) GOOS=darwin ;; - Windows) GOOS=windows ;; - esac - ARCH="$(uname -m)" - case "$ARCH" in - x86_64|amd64) GOARCH=amd64 ;; - arm64|aarch64) GOARCH=arm64 ;; - *) GOARCH=amd64 ;; - esac - EXT="" - [ "$OS" = "Windows" ] && EXT=".exe" - BASE_URL="https://github.com/uvasoftware/scanii-cli/releases/latest/download" - BINARY="scanii-cli_${GOOS}_${GOARCH}${EXT}" - curl -fsSL "$BASE_URL/$BINARY" -o sc${EXT} - chmod +x sc${EXT} - - - name: Start scanii-cli server - shell: bash - run: | - EXT="" - [ "${{ runner.os }}" = "Windows" ] && EXT=".exe" - ./sc${EXT} server & - # wait for the server to be ready - for i in $(seq 1 15); do - curl -sf http://localhost:4000/ping && break || sleep 1 - done + set -euo pipefail + # Resolve latest version + VERSION=$(curl -fsSL https://api.github.com/repos/scanii/scanii-cli/releases/latest \ + | grep '"tag_name":' | sed -E 's/.*"v?([^"]+)".*/\1/') + echo "scanii-cli version: $VERSION" + + # Map runner to GoReleaser's OS/arch naming + case "${{ runner.os }}" in + Linux) OS=linux ; EXT=tar.gz ;; + macOS) OS=darwin ; EXT=tar.gz ;; + Windows) OS=windows; EXT=zip ;; + esac + case "$(uname -m)" in + x86_64|amd64) ARCH=amd64 ;; + arm64|aarch64) ARCH=arm64 ;; + *) ARCH=amd64 ;; + esac + + ASSET="scanii-cli-${VERSION}-${OS}-${ARCH}.${EXT}" + URL="https://github.com/scanii/scanii-cli/releases/download/v${VERSION}/${ASSET}" + echo "downloading $URL" + curl -fsSL "$URL" -o "$ASSET" + + # Unpack + if [ "$EXT" = "tar.gz" ]; then + tar -xzf "$ASSET" + else + unzip -q "$ASSET" + fi + + # Find the binary (GoReleaser usually puts it at the root of the archive) + ls -la + - name: Start scanii-cli server + shell: bash + run: | + EXT="" + [ "${{ runner.os }}" = "Windows" ] && EXT=".exe" + ./sc${EXT} server & + # wait for the server to be ready + for i in $(seq 1 15); do + curl -sf http://localhost:4000/v2.2/ping && break || sleep 1 + done - name: mvn verify run: mvn -B verify diff --git a/.gitignore b/.gitignore index c93f80e..2c1f3ce 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ .idea target *.iml +.claude release.properties pom.xml.releaseBackup diff --git a/.run/Run Tests.run.xml b/.run/Run Tests.run.xml deleted file mode 100644 index f13976e..0000000 --- a/.run/Run Tests.run.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b957e7c..a040480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ - Rebranded to `com.scanii:scanii-java` - Java source and target updated to 21 -- Integration tests now run against [scanii-cli](https://github.com/uvasoftware/scanii-cli) — no real credentials required +- Integration tests now run against [scanii-cli](https://github.com/scanii/scanii-cli) — no real credentials required - CI matrix: Java 21 and 25 across Ubuntu, macOS, and Windows - JUnit 5.12.2 diff --git a/README.md b/README.md index 22b280e..6d94893 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ System.out.printf("findings: %s%n", result.getFindings()); Run integration tests against a local mock server — no real credentials needed: ```bash -docker run -d --name scanii-cli -p 4000:4000 ghcr.io/uvasoftware/scanii-cli:latest server +docker run -d --name scanii-cli -p 4000:4000 ghcr.io/scanii/scanii-cli:latest server mvn verify ``` diff --git a/pom.xml b/pom.xml index 5eeefff..aca672b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.scanii scanii-java - 8.0.0 + 8.0.0-SNAPSHOT jar Scanii.com Java SDK scanii-java @@ -220,7 +220,7 @@ 3.6.3 false - 11 + 21 -Xdoclint:none diff --git a/src/main/java/com/scanii/ScaniiClient.java b/src/main/java/com/scanii/ScaniiClient.java index 21e946a..0bbe663 100644 --- a/src/main/java/com/scanii/ScaniiClient.java +++ b/src/main/java/com/scanii/ScaniiClient.java @@ -14,7 +14,7 @@ public interface ScaniiClient { /** - * Submits a file to be processed @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file to be processed @see https://docs.scanii.com/v2.2/resources.html#files * * @param content path to the file to be processed * @param metadata optional metadata to be added to this file @@ -23,7 +23,7 @@ public interface ScaniiClient { ScaniiProcessingResult process(Path content, Map metadata); /** - * Submits a file stream to be processed @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file stream to be processed @see https://docs.scanii.com/v2.2/resources.html#files * * @param content stream of the file to be processed * @param metadata optional metadata to be added to this file @@ -32,7 +32,7 @@ public interface ScaniiClient { ScaniiProcessingResult process(InputStream content, Map metadata); /** - * Submits a file to be processed @see http://docs.scanii.com/v2.1/resources.html#files with optional callback. + * Submits a file to be processed @see https://docs.scanii.com/v2.2/resources.html#files with optional callback. * * @param content path to the file to be processed * @param callback location (URL) to be notified and receive the result @@ -43,7 +43,7 @@ public interface ScaniiClient { /** - * Submits a file stream to be processed @see http://docs.scanii.com/v2.1/resources.html#files with optional callback. + * Submits a file stream to be processed @see https://docs.scanii.com/v2.2/resources.html#files with optional callback. * * @param content file content to be processed * @param callback location (URL) to be notified and receive the result @@ -53,7 +53,7 @@ public interface ScaniiClient { ScaniiProcessingResult process(InputStream content, String callback, Map metadata); /** - * Submits a file to be processed @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file to be processed @see https://docs.scanii.com/v2.2/resources.html#files * * @param content path to the file to be processed * @return scanii result {@link ScaniiProcessingResult} @@ -61,7 +61,7 @@ public interface ScaniiClient { ScaniiProcessingResult process(Path content); /** - * Submits a file stream to be processed @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file stream to be processed @see https://docs.scanii.com/v2.2/resources.html#files * * @param content stream of the file to be processed * @return scanii result {@link ScaniiProcessingResult} @@ -69,7 +69,7 @@ public interface ScaniiClient { ScaniiProcessingResult process(InputStream content); /** - * Submits a file to be processed asynchronously @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file to be processed asynchronously @see https://docs.scanii.com/v2.2/resources.html#files * * @param content path to the file to be processed * @param metadata optional metadata to be added to this file @@ -78,7 +78,7 @@ public interface ScaniiClient { ScaniiPendingResult processAsync(Path content, Map metadata); /** - * Submits a file stream to be processed asynchronously @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file stream to be processed asynchronously @see https://docs.scanii.com/v2.2/resources.html#files * * @param content stream of the file to be processed * @param metadata optional metadata to be added to this file @@ -87,7 +87,7 @@ public interface ScaniiClient { ScaniiPendingResult processAsync(InputStream content, Map metadata); /** - * Submits a file to be processed asynchronously @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file to be processed asynchronously @see https://docs.scanii.com/v2.2/resources.html#files * * @param content path to the file to be processed * @param callback location (URL) to be notified and receive the result @@ -97,7 +97,7 @@ public interface ScaniiClient { ScaniiPendingResult processAsync(Path content, String callback, Map metadata); /** - * Submits a file stream to be processed @see http://docs.scanii.com/v2.1/resources.html#files with optional callback. + * Submits a file stream to be processed @see https://docs.scanii.com/v2.2/resources.html#files with optional callback. * * @param content file content to be processed * @param callback location (URL) to be notified and receive the result @@ -107,7 +107,7 @@ public interface ScaniiClient { ScaniiPendingResult processAsync(InputStream content, String callback, Map metadata); /** - * Submits a file to be processed asynchronously @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file to be processed asynchronously @see https://docs.scanii.com/v2.2/resources.html#files * * @param content path to the file to be processed * @return processing result {@link ScaniiPendingResult} @@ -115,7 +115,7 @@ public interface ScaniiClient { ScaniiPendingResult processAsync(Path content); /** - * Submits a file content stream to be processed asynchronously @see http://docs.scanii.com/v2.1/resources.html#files + * Submits a file content stream to be processed asynchronously @see https://docs.scanii.com/v2.2/resources.html#files * * @param content stream of the file to be processed * @return processing result {@link ScaniiPendingResult} @@ -123,7 +123,7 @@ public interface ScaniiClient { ScaniiPendingResult processAsync(InputStream content); /** - * Fetches the results of a previously processed file @see http://docs.scanii.com/v2.1/resources.html#files + * Fetches the results of a previously processed file @see https://docs.scanii.com/v2.2/resources.html#files * * @param id id of the content/file to be retrieved * @return optional {@link ScaniiProcessingResult} @@ -131,7 +131,7 @@ public interface ScaniiClient { Optional retrieve(String id); /** - * Makes a fetch call to scanii @see http://docs.scanii.com/v2.1/resources.html#files + * Makes a fetch call to scanii @see https://docs.scanii.com/v2.2/resources.html#files * * @param location location (URL) of the content to be processed * @return scanii result {@link ScaniiPendingResult} @@ -139,7 +139,7 @@ public interface ScaniiClient { ScaniiPendingResult fetch(String location); /** - * Makes a fetch call to scanii @see http://docs.scanii.com/v2.1/resources.html#files + * Makes a fetch call to scanii @see https://docs.scanii.com/v2.2/resources.html#files * * @param location location (URL) of the content to be processed * @param callback location (URL) to be notified and receive the result @@ -148,7 +148,7 @@ public interface ScaniiClient { ScaniiPendingResult fetch(String location, String callback); /** - * Makes a fetch call to scanii @see http://docs.scanii.com/v2.1/resources.html#files + * Makes a fetch call to scanii @see https://docs.scanii.com/v2.2/resources.html#files * * @param location location (URL) of the content to be processed * @param callback location (URL) to be notified and receive the result @@ -158,14 +158,14 @@ public interface ScaniiClient { ScaniiPendingResult fetch(String location, String callback, Map metadata); /** - * Pings the scanii service using the credentials provided @see http://docs.scanii.com/v2.1/resources.html#ping + * Pings the scanii service using the credentials provided @see https://docs.scanii.com/v2.2/resources.html#ping * * @return true if we saw a pong back from scanii, false otherwise */ boolean ping(); /** - * Creates a new temporary authentication token @see http://docs.scanii.com/v2.1/resources.html#auth-tokens + * Creates a new temporary authentication token @see https://docs.scanii.com/v2.2/resources.html#auth-tokens * * @param timeout how long the token should be valid for" * @param timeoutUnit unit used to calculate the timeout @@ -189,7 +189,7 @@ public interface ScaniiClient { ScaniiAuthToken retrieveAuthToken(String id); /** - * Retrieves account information @see https://docs.scanii.com/v2.1/resources.html#account + * Retrieves account information @see https://docs.scanii.com/v2.2/resources.html#account * * @return your account information */ diff --git a/src/main/java/com/scanii/internal/DefaultScaniiClient.java b/src/main/java/com/scanii/internal/DefaultScaniiClient.java index f74c071..ef48943 100644 --- a/src/main/java/com/scanii/internal/DefaultScaniiClient.java +++ b/src/main/java/com/scanii/internal/DefaultScaniiClient.java @@ -23,7 +23,7 @@ * Thread safe client to the Scanii content processing service. * Please note that this client does not throw checked exceptions; all exceptions are wrapped around a ScaniiException that extends RuntimeException * - * @see spec + * @see spec */ public class DefaultScaniiClient implements ScaniiClient { private static final System.Logger LOG = System.getLogger(DefaultScaniiClient.class.getName()); @@ -258,7 +258,7 @@ public ScaniiAuthToken createAuthToken(int timeout, TimeUnit timeoutUnit) { HttpResponse response = send(req); - if (response.statusCode() != 201) { + if (response.statusCode() != 201 && response.statusCode() != 200) { parseAndThrowError(response); } diff --git a/src/test/java/com/scanii/ScaniiClientTest.java b/src/test/java/com/scanii/ScaniiClientTest.java index 0cbee7f..f4d9af5 100644 --- a/src/test/java/com/scanii/ScaniiClientTest.java +++ b/src/test/java/com/scanii/ScaniiClientTest.java @@ -22,7 +22,7 @@ * Integration tests against a locally-running scanii-cli mock server. * * Start the server before running: - * docker run -d --name scanii-cli -p 4000:4000 ghcr.io/uvasoftware/scanii-cli:latest server + * docker run -d --name scanii-cli -p 4000:4000 ghcr.io/scanii/scanii-cli:latest server * * Endpoint: http://localhost:4000 Key: key Secret: secret */ diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml index 85ed488..4d1e05e 100644 --- a/src/test/resources/logback.xml +++ b/src/test/resources/logback.xml @@ -9,7 +9,7 @@ - + From eb704cb61e7b4e81cec3aa85a65f2819c04f5831 Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 24 Apr 2026 21:51:17 -0400 Subject: [PATCH 08/12] fix: correct pr.yml YAML structure (Start step was inside run block) The Start scanii-cli server step was indented as part of the Download step's run block instead of being its own top-level step. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/pr.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6a21f97..21dc0f0 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -58,16 +58,17 @@ jobs: # Find the binary (GoReleaser usually puts it at the root of the archive) ls -la - - name: Start scanii-cli server - shell: bash - run: | - EXT="" - [ "${{ runner.os }}" = "Windows" ] && EXT=".exe" - ./sc${EXT} server & - # wait for the server to be ready - for i in $(seq 1 15); do - curl -sf http://localhost:4000/v2.2/ping && break || sleep 1 - done + + - name: Start scanii-cli server + shell: bash + run: | + EXT="" + [ "${{ runner.os }}" = "Windows" ] && EXT=".exe" + ./sc${EXT} server & + # wait for the server to be ready + for i in $(seq 1 15); do + curl -sf http://localhost:4000/v2.2/ping && break || sleep 1 + done - name: mvn verify run: mvn -B verify From 22528efe10292120ca6a334f70f7f1dba3c69d72 Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 24 Apr 2026 21:54:34 -0400 Subject: [PATCH 09/12] fix: copy sc binary out of archive subdirectory after unpack goreleaser uses wrap_in_directory: true so the binary lands at scanii-cli-{VERSION}-{OS}-{ARCH}/sc, not at the archive root. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/pr.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 21dc0f0..9c6aeea 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -56,8 +56,11 @@ jobs: unzip -q "$ASSET" fi - # Find the binary (GoReleaser usually puts it at the root of the archive) - ls -la + # Binary is inside a subdirectory due to wrap_in_directory: true + BINEXT="" + [ "$OS" = "windows" ] && BINEXT=".exe" + cp "scanii-cli-${VERSION}-${OS}-${ARCH}/sc${BINEXT}" "./sc${BINEXT}" + chmod +x ./sc 2>/dev/null || true - name: Start scanii-cli server shell: bash From a16b9b408502f560b4d5af9158ec800d8352d13b Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 24 Apr 2026 21:58:24 -0400 Subject: [PATCH 10/12] fix: authenticate GitHub API call to avoid rate limit 403 on macOS runner Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9c6aeea..b5ff4c8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -28,7 +28,8 @@ jobs: run: | set -euo pipefail # Resolve latest version - VERSION=$(curl -fsSL https://api.github.com/repos/scanii/scanii-cli/releases/latest \ + VERSION=$(curl -fsSL -H "Authorization: Bearer ${{ github.token }}" \ + https://api.github.com/repos/scanii/scanii-cli/releases/latest \ | grep '"tag_name":' | sed -E 's/.*"v?([^"]+)".*/\1/') echo "scanii-cli version: $VERSION" From f7586a7b25e9aa645587111c6cc5ad744647743c Mon Sep 17 00:00:00 2001 From: rafael Date: Sat, 25 Apr 2026 10:07:44 -0400 Subject: [PATCH 11/12] Tweaking readme --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6d94893..7f72376 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,9 @@ Official Java SDK for the [Scanii](https://www.scanii.com) content processing AP ## SDK Principles -1. **Light.** SDKs keep a small and narrow list of dependencies so they don't add ops burden to customers. Ideally zero runtime dependencies — stdlib only. Test dependencies are also kept minimal. Build tooling (compilers, bundlers) doesn't count. - -2. **Up to date.** SDKs are always current with the latest Scanii API spec. When the API evolves, the SDKs are upgraded promptly rather than carrying stale versions for years. - -3. **Integration-only.** The SDK's job is to wrap the Scanii REST API. Higher-level concerns — concurrency, retries, queuing, backoff, circuit breaking, batch processing — are the consumer's responsibility. The SDK doesn't make those decisions for them. +1. **Light.** Zero runtime dependencies, stdlib only. +2. **Up to date.** Always current with the latest Scanii API. +3. **Integration-only.** Wraps the REST API — retries, concurrency, and batching are the caller's responsibility. ## Install From d114cba06b895a9989032047a6e612f4fe94ecfc Mon Sep 17 00:00:00 2001 From: rafael Date: Sat, 25 Apr 2026 10:24:13 -0400 Subject: [PATCH 12/12] fix: restore SNAPSHOT-stripping in release pipeline; drop github deploy profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - release.yml: add "Strip snapshot from version" step before Maven Central deploy, using build-helper:parse-version versions:set (matches the pattern from the pre-rebrand main.yaml at be01218) - pom.xml: remove github profile — Maven Central (central profile) is the sole publishing target Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/release.yml | 6 +++++ pom.xml | 48 ----------------------------------- 2 files changed, 6 insertions(+), 48 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6069332..e857aaf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,12 @@ jobs: gpg-private-key: ${{ secrets.CODESIGN_PGP_KEY }} gpg-passphrase: PASSPHRASE + - name: Strip snapshot from version + run: | + mvn -q build-helper:parse-version versions:set \ + -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion} \ + versions:commit + - name: Publish to Maven Central run: mvn deploy --batch-mode -DskipTests --activate-profiles central --no-transfer-progress env: diff --git a/pom.xml b/pom.xml index aca672b..567fb17 100644 --- a/pom.xml +++ b/pom.xml @@ -189,53 +189,5 @@ - - github - - - github - GitHub Packages - https://maven.pkg.github.com/scanii/scanii-java - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - package - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.6.3 - - false - 21 - - -Xdoclint:none - - - - - attach-javadocs - - jar - - - - - - -