From 849e4df3f0452c8a615a5128a14989db8d73a55e Mon Sep 17 00:00:00 2001 From: TobyODonnell-AIAU Date: Tue, 13 Jan 2026 12:06:34 +1100 Subject: [PATCH 1/3] WI-6851,AT-1856 Update to java 17 and Tika to 3.2.2 --- appveyor.yml | 2 +- pom.xml | 6 +++--- .../aquarius/sdk/timeseries/AquariusClient.java | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 40cdc56..b43f986 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,7 @@ init: skip_tags: true environment: - JAVA_HOME: C:\Program Files\Java\jdk1.8.0 + JAVA_HOME: C:\Program Files\Java\jdk17 M2: $(USERPROFILE)\.m2 install: diff --git a/pom.xml b/pom.xml index 84234b0..20eea7a 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ - 1.8 + 17 UTF-8 1.0.0-SNAPSHOT @@ -67,7 +67,7 @@ org.apache.tika tika-core - 2.9.4 + 3.2.2 com.google.code.gson @@ -94,7 +94,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5 + 3.11.0 ${java.version} ${java.version} diff --git a/src/main/java/com/aquaticinformatics/aquarius/sdk/timeseries/AquariusClient.java b/src/main/java/com/aquaticinformatics/aquarius/sdk/timeseries/AquariusClient.java index 01f077f..7bc6de4 100644 --- a/src/main/java/com/aquaticinformatics/aquarius/sdk/timeseries/AquariusClient.java +++ b/src/main/java/com/aquaticinformatics/aquarius/sdk/timeseries/AquariusClient.java @@ -11,7 +11,6 @@ import org.xml.sax.InputSource; import javax.crypto.Cipher; -import javax.xml.bind.DatatypeConverter; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; @@ -25,6 +24,7 @@ import java.security.spec.RSAPublicKeySpec; import java.time.Duration; import java.time.Instant; +import java.util.Base64; import java.util.HashMap; import java.util.Map; @@ -142,8 +142,8 @@ private String getEncryptedPassword(String plaintextPassword) { String modulusText = xpath.evaluate("/RSAKeyValue/Modulus", document); String exponentText = xpath.evaluate("/RSAKeyValue/Exponent", document); - byte[] modulusByes = DatatypeConverter.parseBase64Binary(modulusText); - byte[] exponentBytes = DatatypeConverter.parseBase64Binary(exponentText); + byte[] modulusByes = Base64.getDecoder().decode(modulusText); + byte[] exponentBytes = Base64.getDecoder().decode(exponentText); BigInteger modulus = new BigInteger(1, modulusByes); BigInteger exponent = new BigInteger(1, exponentBytes); @@ -159,7 +159,7 @@ private String getEncryptedPassword(String plaintextPassword) { // And finally, you can transform the blob into a base-64 string to assign the to // the EncryptedPassword property of the login DTO: - return DatatypeConverter.printBase64Binary(encryptedPasswordBlob); + return Base64.getEncoder().encodeToString(encryptedPasswordBlob); } catch(Exception e) { return plaintextPassword; From 506806c91b08ce0ed28f22f70cde0a692d09f352 Mon Sep 17 00:00:00 2001 From: jesse Date: Mon, 26 Jan 2026 16:56:44 -0800 Subject: [PATCH 2/3] WI-6851 Update Tika dependency version to 3.2.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 20eea7a..85fe37e 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ org.apache.tika tika-core - 3.2.2 + 3.2.3 com.google.code.gson From b5ac69f1e0932e1e4d8e2dad5df23f38cc8e079a Mon Sep 17 00:00:00 2001 From: jesse Date: Thu, 29 Jan 2026 09:58:27 -0800 Subject: [PATCH 3/3] WI-6851 Verify uploads/mime type detection with IT tests - Show SDK working with uploading attachments: POST v1/attachments/upload - Show SDK working associating an uploaded attachment to a Sampling location: POST v1/samplinglocations --- .../sdk/samples/SamplesClientTest.java | 60 +++++++++++++++++++ src/test/resources/test-csv-attachment.csv | 2 + 2 files changed, 62 insertions(+) create mode 100644 src/test/resources/test-csv-attachment.csv diff --git a/src/test/java/com/aquaticinformatics/aquarius/sdk/samples/SamplesClientTest.java b/src/test/java/com/aquaticinformatics/aquarius/sdk/samples/SamplesClientTest.java index c884223..6c29334 100644 --- a/src/test/java/com/aquaticinformatics/aquarius/sdk/samples/SamplesClientTest.java +++ b/src/test/java/com/aquaticinformatics/aquarius/sdk/samples/SamplesClientTest.java @@ -1,7 +1,12 @@ package com.aquaticinformatics.aquarius.sdk.samples; +import java.io.File; +import java.util.List; +import java.util.Objects; +import java.util.UUID; import junitparams.JUnitParamsRunner; + import org.junit.Assert; import org.junit.Before; import org.junit.Rule; @@ -10,6 +15,9 @@ import org.junit.runner.RunWith; import org.junit.experimental.categories.Category; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + @Category(TestRequiresCredentials.class) @RunWith(JUnitParamsRunner.class) public class SamplesClientTest { @@ -47,4 +55,56 @@ public void GetLabs_ConnectedClient_ReturnsSearchResultLaboratory() { System.out.printf("Found %d laboratories\n", searchResultLaboratory.TotalCount); } + + @Test + public void PostLocation_ConnectedClient_IsSuccessful() { + ServiceModel.PostSamplingLocation request = new ServiceModel.PostSamplingLocation(); + String locationId = "location customId" + UUID.randomUUID(); + request.CustomId = locationId; + ServiceModel.SamplingLocation post = client.Api.post(request); + assertEquals(post.getCustomId(), locationId); + } + + + @Test + public void PostUploadAttachment_WithCsvFile_IsSuccessfulAndSetsCorrectMimeType() { + ServiceModel.PostUploadAttachment postUploadAttachment = new ServiceModel.PostUploadAttachment(); + File file = new File("src/test/resources/test-csv-attachment.csv"); + ServiceModel.AttachmentRepresentation attachmentRepresentation = client.postFileWithRequest(file, postUploadAttachment); + + assertEquals(true, attachmentRepresentation.Success); + assertEquals("text/csv", attachmentRepresentation.ContentType); + assertEquals("test-csv-attachment.csv", attachmentRepresentation.FileName); + } + + @Test + public void PostLocationAttachment_WithAttachment_IsSuccessful() { + ServiceModel.PostUploadAttachment postUploadAttachment = new ServiceModel.PostUploadAttachment(); + File file = new File("src/test/resources/test-csv-attachment.csv"); + ServiceModel.AttachmentRepresentation attachmentRepresentation = client.postFileWithRequest(file, postUploadAttachment); + + ServiceModel.PostSamplingLocation postSamplingLocation = new ServiceModel.PostSamplingLocation(); + postSamplingLocation.CustomId = UUID.randomUUID().toString(); + ServiceModel.DomainObjectAttachment e1 = mapToDomainObjectAttachment(attachmentRepresentation); + postSamplingLocation.Attachments = List.of(e1); + ServiceModel.SamplingLocation post = client.Api.post(postSamplingLocation); + assertEquals(1, post.Attachments.size()); + ServiceModel.Attachment firstAttachment = post.getAttachments().get(0).getAttachment(); + assertEquals("test-csv-attachment.csv", firstAttachment.FileName); + + } + + private static ServiceModel.DomainObjectAttachment mapToDomainObjectAttachment(ServiceModel.AttachmentRepresentation from) { + ServiceModel.DomainObjectAttachment e1 = + new ServiceModel.DomainObjectAttachment(); + e1.Id = from.getId(); + ServiceModel.Attachment to = new ServiceModel.Attachment(); + to.setId(from.getId()); + to.setFileSize(from.getFileSize()); + to.setFileName(from.getFileName()); + to.setContentType(from.getContentType()); + to.setFileSize(from.getFileSize()); + e1.Attachment = to; + return e1; + } } diff --git a/src/test/resources/test-csv-attachment.csv b/src/test/resources/test-csv-attachment.csv new file mode 100644 index 0000000..ffb5e18 --- /dev/null +++ b/src/test/resources/test-csv-attachment.csv @@ -0,0 +1,2 @@ +Header1,Header2 +a,b