From 8fc39bea429f050a7581859f0de7783715460177 Mon Sep 17 00:00:00 2001 From: "stuart.woodman" Date: Tue, 3 Oct 2023 13:55:18 +1100 Subject: [PATCH 1/6] Upgrade to Spring Boot 3.1.4. Mostly involved switching javax.* imports to jakarta.*. --- pom.xml | 5 +++-- .../java/org/auscope/portal/core/cloud/CloudJob.java | 8 ++++---- .../core/server/controllers/DownloadController.java | 6 +++--- .../core/server/controllers/OPeNDAPController.java | 4 ++-- .../controllers/ServiceConfigurationController.java | 2 +- .../portal/core/server/controllers/WCSController.java | 4 ++-- .../portal/core/server/controllers/WFSController.java | 8 ++++---- .../portal/core/server/controllers/WMSController.java | 4 ++-- .../portal/core/server/http/download/FileUploadBean.java | 9 +++++---- .../org/auscope/portal/core/services/WMSService.java | 4 ++-- .../portal/core/services/cloud/FileStagingService.java | 2 +- .../auscope/portal/core/services/csw/CSWServiceItem.java | 2 +- .../core/server/controllers/TestCSWCacheController.java | 4 ++-- .../core/server/controllers/TestDownloadController.java | 2 +- .../core/server/controllers/TestWCSController.java | 6 +++--- .../core/server/controllers/TestWfsController.java | 4 ++-- .../core/services/cloud/TestFileStagingService.java | 2 +- .../responses/opendap/TestViewVariableFactory.java | 4 ++-- .../core/test/ByteBufferedServletOutputStream.java | 4 ++-- .../core/test/jmock/ReadableServletOutputStream.java | 4 ++-- 20 files changed, 45 insertions(+), 43 deletions(-) diff --git a/pom.xml b/pom.xml index abae43e65..d7dba368f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.auscope.portal portal-core jar - 2.5.0-SNAPSHOT + 2.6.0-SNAPSHOT Portal-Core Core functionality common to various AuScope portals. http://portal.auscope.org @@ -48,7 +48,7 @@ org.springframework.boot spring-boot-starter-parent - 2.6.15 + 3.1.4 @@ -403,6 +403,7 @@ javax.annotation javax.annotation-api + 1.3.2 commons-io diff --git a/src/main/java/org/auscope/portal/core/cloud/CloudJob.java b/src/main/java/org/auscope/portal/core/cloud/CloudJob.java index 0c7d42ac3..4d9c44bde 100644 --- a/src/main/java/org/auscope/portal/core/cloud/CloudJob.java +++ b/src/main/java/org/auscope/portal/core/cloud/CloudJob.java @@ -7,10 +7,10 @@ import java.util.HashMap; import java.util.Map; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.MappedSuperclass; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.MappedSuperclass; /** * Base class representing the base state of a job that is sent to the cloud for processing. diff --git a/src/main/java/org/auscope/portal/core/server/controllers/DownloadController.java b/src/main/java/org/auscope/portal/core/server/controllers/DownloadController.java index de530fe7c..6b4df50a9 100644 --- a/src/main/java/org/auscope/portal/core/server/controllers/DownloadController.java +++ b/src/main/java/org/auscope/portal/core/server/controllers/DownloadController.java @@ -21,9 +21,9 @@ import java.io.OutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.activation.MimetypesFileTypeMap; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.activation.MimetypesFileTypeMap; import javax.naming.OperationNotSupportedException; import org.apache.commons.io.FilenameUtils; diff --git a/src/main/java/org/auscope/portal/core/server/controllers/OPeNDAPController.java b/src/main/java/org/auscope/portal/core/server/controllers/OPeNDAPController.java index d9189a91d..e2133eb35 100644 --- a/src/main/java/org/auscope/portal/core/server/controllers/OPeNDAPController.java +++ b/src/main/java/org/auscope/portal/core/server/controllers/OPeNDAPController.java @@ -6,8 +6,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletResponse; import org.json.JSONObject; diff --git a/src/main/java/org/auscope/portal/core/server/controllers/ServiceConfigurationController.java b/src/main/java/org/auscope/portal/core/server/controllers/ServiceConfigurationController.java index ef283dd6c..049014f30 100644 --- a/src/main/java/org/auscope/portal/core/server/controllers/ServiceConfigurationController.java +++ b/src/main/java/org/auscope/portal/core/server/controllers/ServiceConfigurationController.java @@ -2,7 +2,7 @@ import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.auscope.portal.core.configuration.ServiceConfiguration; import org.auscope.portal.core.configuration.ServiceConfigurationItem; diff --git a/src/main/java/org/auscope/portal/core/server/controllers/WCSController.java b/src/main/java/org/auscope/portal/core/server/controllers/WCSController.java index 80665af8f..908dfe5ef 100644 --- a/src/main/java/org/auscope/portal/core/server/controllers/WCSController.java +++ b/src/main/java/org/auscope/portal/core/server/controllers/WCSController.java @@ -9,8 +9,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/org/auscope/portal/core/server/controllers/WFSController.java b/src/main/java/org/auscope/portal/core/server/controllers/WFSController.java index 6deadbc2d..c0c413047 100644 --- a/src/main/java/org/auscope/portal/core/server/controllers/WFSController.java +++ b/src/main/java/org/auscope/portal/core/server/controllers/WFSController.java @@ -7,10 +7,10 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; +import jakarta.servlet.http.HttpServletRequest; import org.apache.http.HttpStatus; import org.auscope.portal.core.services.WFSGml32Service; diff --git a/src/main/java/org/auscope/portal/core/server/controllers/WMSController.java b/src/main/java/org/auscope/portal/core/server/controllers/WMSController.java index b5dc760e6..68e6671ab 100644 --- a/src/main/java/org/auscope/portal/core/server/controllers/WMSController.java +++ b/src/main/java/org/auscope/portal/core/server/controllers/WMSController.java @@ -13,8 +13,8 @@ import java.util.List; import javax.naming.OperationNotSupportedException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; diff --git a/src/main/java/org/auscope/portal/core/server/http/download/FileUploadBean.java b/src/main/java/org/auscope/portal/core/server/http/download/FileUploadBean.java index 1c6bcf54a..5c0bb210d 100644 --- a/src/main/java/org/auscope/portal/core/server/http/download/FileUploadBean.java +++ b/src/main/java/org/auscope/portal/core/server/http/download/FileUploadBean.java @@ -1,16 +1,17 @@ package org.auscope.portal.core.server.http.download; -import org.springframework.web.multipart.commons.CommonsMultipartFile; +import org.springframework.web.multipart.MultipartFile; + public class FileUploadBean { - private CommonsMultipartFile file; + private MultipartFile file; - public CommonsMultipartFile getFile() { + public MultipartFile getFile() { return file; } - public void setFile(CommonsMultipartFile file) { + public void setFile(MultipartFile file) { this.file = file; } } diff --git a/src/main/java/org/auscope/portal/core/services/WMSService.java b/src/main/java/org/auscope/portal/core/services/WMSService.java index 5ce62ecdc..f5f20da38 100644 --- a/src/main/java/org/auscope/portal/core/services/WMSService.java +++ b/src/main/java/org/auscope/portal/core/services/WMSService.java @@ -11,8 +11,8 @@ import java.util.stream.Stream; import javax.naming.OperationNotSupportedException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; diff --git a/src/main/java/org/auscope/portal/core/services/cloud/FileStagingService.java b/src/main/java/org/auscope/portal/core/services/cloud/FileStagingService.java index 4018e3dc0..1ac6ceb2a 100644 --- a/src/main/java/org/auscope/portal/core/services/cloud/FileStagingService.java +++ b/src/main/java/org/auscope/portal/core/services/cloud/FileStagingService.java @@ -9,7 +9,7 @@ import java.util.ArrayList; import java.util.List; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/org/auscope/portal/core/services/csw/CSWServiceItem.java b/src/main/java/org/auscope/portal/core/services/csw/CSWServiceItem.java index a0b28fcc3..54b1acbe3 100644 --- a/src/main/java/org/auscope/portal/core/services/csw/CSWServiceItem.java +++ b/src/main/java/org/auscope/portal/core/services/csw/CSWServiceItem.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.Collection; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.auscope.portal.core.server.OgcServiceProviderType; diff --git a/src/test/java/org/auscope/portal/core/server/controllers/TestCSWCacheController.java b/src/test/java/org/auscope/portal/core/server/controllers/TestCSWCacheController.java index e38203198..f379b3114 100644 --- a/src/test/java/org/auscope/portal/core/server/controllers/TestCSWCacheController.java +++ b/src/test/java/org/auscope/portal/core/server/controllers/TestCSWCacheController.java @@ -7,8 +7,8 @@ import java.util.Map; import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.json.JSONArray; import org.json.JSONObject; diff --git a/src/test/java/org/auscope/portal/core/server/controllers/TestDownloadController.java b/src/test/java/org/auscope/portal/core/server/controllers/TestDownloadController.java index 63befbdd9..0f371cc22 100644 --- a/src/test/java/org/auscope/portal/core/server/controllers/TestDownloadController.java +++ b/src/test/java/org/auscope/portal/core/server/controllers/TestDownloadController.java @@ -8,7 +8,7 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; diff --git a/src/test/java/org/auscope/portal/core/server/controllers/TestWCSController.java b/src/test/java/org/auscope/portal/core/server/controllers/TestWCSController.java index cc5cd5bbc..3a370fbc5 100644 --- a/src/test/java/org/auscope/portal/core/server/controllers/TestWCSController.java +++ b/src/test/java/org/auscope/portal/core/server/controllers/TestWCSController.java @@ -9,9 +9,9 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import javax.servlet.ServletOutputStream; -import javax.servlet.WriteListener; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.WriteListener; +import jakarta.servlet.http.HttpServletResponse; import org.auscope.portal.core.services.WCSService; import org.auscope.portal.core.services.responses.csw.CSWGeographicBoundingBox; diff --git a/src/test/java/org/auscope/portal/core/server/controllers/TestWfsController.java b/src/test/java/org/auscope/portal/core/server/controllers/TestWfsController.java index 4fdd4777a..3800b1b56 100644 --- a/src/test/java/org/auscope/portal/core/server/controllers/TestWfsController.java +++ b/src/test/java/org/auscope/portal/core/server/controllers/TestWfsController.java @@ -2,8 +2,8 @@ import java.net.URI; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; import org.apache.http.client.methods.HttpRequestBase; import org.auscope.portal.core.services.PortalServiceException; diff --git a/src/test/java/org/auscope/portal/core/services/cloud/TestFileStagingService.java b/src/test/java/org/auscope/portal/core/services/cloud/TestFileStagingService.java index 2c9e9dd0a..9626d17d0 100644 --- a/src/test/java/org/auscope/portal/core/services/cloud/TestFileStagingService.java +++ b/src/test/java/org/auscope/portal/core/services/cloud/TestFileStagingService.java @@ -9,7 +9,7 @@ import java.util.Date; import java.util.List; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.auscope.portal.core.cloud.CloudJob; diff --git a/src/test/java/org/auscope/portal/core/services/responses/opendap/TestViewVariableFactory.java b/src/test/java/org/auscope/portal/core/services/responses/opendap/TestViewVariableFactory.java index 5d54a2441..93bdb1279 100644 --- a/src/test/java/org/auscope/portal/core/services/responses/opendap/TestViewVariableFactory.java +++ b/src/test/java/org/auscope/portal/core/services/responses/opendap/TestViewVariableFactory.java @@ -4,8 +4,8 @@ import java.util.Arrays; import java.util.List; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.json.JSONArray; import org.json.JSONObject; diff --git a/src/test/java/org/auscope/portal/core/test/ByteBufferedServletOutputStream.java b/src/test/java/org/auscope/portal/core/test/ByteBufferedServletOutputStream.java index 7ff1f84bf..4f77480e8 100644 --- a/src/test/java/org/auscope/portal/core/test/ByteBufferedServletOutputStream.java +++ b/src/test/java/org/auscope/portal/core/test/ByteBufferedServletOutputStream.java @@ -3,8 +3,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; -import javax.servlet.ServletOutputStream; -import javax.servlet.WriteListener; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.WriteListener; /** * Test class extension of a ServletOutputStream that allows access to an underlying byte[] of data that was written diff --git a/src/test/java/org/auscope/portal/core/test/jmock/ReadableServletOutputStream.java b/src/test/java/org/auscope/portal/core/test/jmock/ReadableServletOutputStream.java index 75bebe04b..16be8c0f5 100644 --- a/src/test/java/org/auscope/portal/core/test/jmock/ReadableServletOutputStream.java +++ b/src/test/java/org/auscope/portal/core/test/jmock/ReadableServletOutputStream.java @@ -5,8 +5,8 @@ import java.io.IOException; import java.util.zip.ZipInputStream; -import javax.servlet.ServletOutputStream; -import javax.servlet.WriteListener; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.WriteListener; /** * A ServletOutputStream extension that buffers any written data and gives methods to access that data. From abb85c006a83e64de9515154e318b929d017e1af Mon Sep 17 00:00:00 2001 From: jia020 Date: Wed, 4 Oct 2023 00:08:33 +0000 Subject: [PATCH 2/6] Autogenerated JaCoCo coverage badge --- .github/coverage/jacoco.csv | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/coverage/jacoco.csv b/.github/coverage/jacoco.csv index 6a71f0185..41f13401d 100644 --- a/.github/coverage/jacoco.csv +++ b/.github/coverage/jacoco.csv @@ -1,6 +1,6 @@ GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,COMPLEXITY_MISSED,COMPLEXITY_COVERED,METHOD_MISSED,METHOD_COVERED -Portal-Core,org.auscope.portal.core.server,PortalProfileXmlWebApplicationContext,24,0,2,0,5,0,3,0,2,0 Portal-Core,org.auscope.portal.core.server,PortalPropertySourcesPlaceholderConfigurer,99,0,10,0,25,0,8,0,3,0 +Portal-Core,org.auscope.portal.core.server,PortalProfileXmlWebApplicationContext,24,0,2,0,5,0,3,0,2,0 Portal-Core,org.auscope.portal.core.server,OgcServiceProviderType,0,36,0,2,0,6,0,3,0,2 Portal-Core,org.auscope.portal.core.services.methodmakers,GeonetworkMethodMaker,210,0,0,0,39,0,7,0,7,0 Portal-Core,org.auscope.portal.core.services.methodmakers,SOSMethodMaker,4,295,8,18,1,61,8,8,0,3 @@ -173,8 +173,8 @@ Portal-Core,org.auscope.portal.core.services.responses.csw,CSWGetDomainResponse. Portal-Core,org.auscope.portal.core.services.responses.csw,CSWRecordTransformerFactory,9,14,0,0,2,3,2,2,2,2 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWOnlineResourceFactory,3,109,2,4,1,28,3,3,1,2 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWTemporalExtent,26,0,0,0,11,0,6,0,6,0 -Portal-Core,org.auscope.portal.core.services.responses.csw,CSWGetCapabilities.CSWGetCapabilitiesNamespace,0,18,0,0,0,4,0,1,0,1 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWGetRecordResponse,0,160,3,5,0,36,3,7,0,6 +Portal-Core,org.auscope.portal.core.services.responses.csw,CSWGetCapabilities.CSWGetCapabilitiesNamespace,0,18,0,0,0,4,0,1,0,1 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWContact,3,83,0,0,1,28,1,19,1,19 Portal-Core,org.auscope.portal.core.services.responses.csw,AbstractCSWOnlineResource.OnlineResourceType,0,81,0,0,0,14,0,1,0,1 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWRecordTransformer.Scope,0,15,0,0,0,2,0,1,0,1 @@ -224,8 +224,8 @@ Portal-Core,org.auscope.portal.core.services,SISSVoc3Service,6,203,1,9,2,57,3,11 Portal-Core,org.auscope.portal.core.services,GoogleCloudMonitoringService,190,127,3,7,52,32,10,7,8,4 Portal-Core,org.auscope.portal.core.services,CSWFilterService,211,360,10,18,41,66,12,17,6,9 Portal-Core,org.auscope.portal.core.services,CSWCacheService.CSWCacheUpdateThread,114,901,13,65,24,181,13,34,0,8 -Portal-Core,org.auscope.portal.core.services,VocabularyCacheService.VocabularyCacheUpdateThread,0,121,0,6,0,33,0,8,0,5 Portal-Core,org.auscope.portal.core.services,SISSVoc2Service,0,151,2,4,0,35,2,4,0,3 +Portal-Core,org.auscope.portal.core.services,VocabularyCacheService.VocabularyCacheUpdateThread,0,121,0,6,0,33,0,8,0,5 Portal-Core,org.auscope.portal.core.services,SearchService,796,0,95,0,137,0,57,0,9,0 Portal-Core,org.auscope.portal.core.services,GoogleCloudMonitoringCachedService.CacheEntry,51,0,0,0,21,0,8,0,8,0 Portal-Core,org.auscope.portal.core.services,VocabularyFilterService,8,345,8,24,2,85,8,21,0,13 @@ -237,8 +237,8 @@ Portal-Core,org.auscope.portal.core.util,FileIOUtil,415,569,50,58,118,142,47,31, Portal-Core,org.auscope.portal.core.util,MimeUtil,20,143,5,15,6,33,6,7,1,2 Portal-Core,org.auscope.portal.core.util,DOMResponseUtil,19,41,0,0,5,11,1,1,1,1 Portal-Core,org.auscope.portal.core.util,ResourceUtil,15,14,1,1,2,5,2,2,1,2 -Portal-Core,org.auscope.portal.core.util,SLDLoader,137,84,11,9,29,22,10,5,3,2 Portal-Core,org.auscope.portal.core.util,DateUtil.TimeField,0,33,0,0,0,2,0,1,0,1 +Portal-Core,org.auscope.portal.core.util,SLDLoader,137,84,11,9,29,22,10,5,3,2 Portal-Core,org.auscope.portal.core.util,DOMUtil,3,136,0,2,1,37,1,9,1,8 Portal-Core,org.auscope.portal.core.util,HttpUtil,92,48,4,2,19,7,5,2,3,1 Portal-Core,org.auscope.portal.core.util,TextUtil,58,50,11,3,10,11,10,3,4,2 From 267dacb05e35a85f22883dcf1b15f9a31c99fa57 Mon Sep 17 00:00:00 2001 From: Vincent Fazio Date: Tue, 31 Oct 2023 14:09:08 +1100 Subject: [PATCH 3/6] AUS-4017 Create CSW layers using multiple ids, keywords or service names --- .../view/knownlayer/CSWRecordSelector.java | 59 ++++++++++--------- .../knownlayer/TestKnownLayerSelectors.java | 15 +++-- 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/main/java/org/auscope/portal/core/view/knownlayer/CSWRecordSelector.java b/src/main/java/org/auscope/portal/core/view/knownlayer/CSWRecordSelector.java index 0b215ca56..dd305c136 100644 --- a/src/main/java/org/auscope/portal/core/view/knownlayer/CSWRecordSelector.java +++ b/src/main/java/org/auscope/portal/core/view/knownlayer/CSWRecordSelector.java @@ -10,18 +10,18 @@ */ public class CSWRecordSelector implements KnownLayerSelector { - private String recordId; - private String descriptiveKeyword; - private String serviceName; + private String[] recordIds; + private String[] descriptiveKeywords; + private String[] serviceNames; /** * @param descriptiveKeyword * the descriptive keyword used to identify CSW records */ public CSWRecordSelector() { - this.descriptiveKeyword = null; - this.recordId = null; - this.serviceName = null; + this.descriptiveKeywords = new String[0]; + this.recordIds = new String[0]; + this.serviceNames = new String[0]; } /** @@ -29,8 +29,8 @@ public CSWRecordSelector() { * * @return record id string */ - public String getRecordId() { - return recordId; + public String[] getRecordIds() { + return recordIds; } /** @@ -39,8 +39,8 @@ public String getRecordId() { * @param recordId record id string * @return */ - public void setRecordId(String recordId) { - this.recordId = recordId; + public void setRecordIds(String[] recordIds) { + this.recordIds = recordIds; } /** @@ -48,8 +48,8 @@ public void setRecordId(String recordId) { * * @return the descriptiveKeyword */ - public String getDescriptiveKeyword() { - return descriptiveKeyword; + public String[] getDescriptiveKeywords() { + return descriptiveKeywords; } /** @@ -58,8 +58,8 @@ public String getDescriptiveKeyword() { * @param descriptiveKeyword * the descriptiveKeyword to set */ - public void setDescriptiveKeyword(String descriptiveKeyword) { - this.descriptiveKeyword = descriptiveKeyword; + public void setDescriptiveKeywords(String[] descriptiveKeywords) { + this.descriptiveKeywords = descriptiveKeywords; } /** @@ -67,8 +67,8 @@ public void setDescriptiveKeyword(String descriptiveKeyword) { * * @return the service name */ - public String getServiceName() { - return serviceName; + public String[] getServiceNames() { + return serviceNames; } /** @@ -77,8 +77,8 @@ public String getServiceName() { * @param serviceName the service name string to search for in CSW records * */ - public void setServiceName(String serviceName) { - this.serviceName = serviceName; + public void setServiceNames(String[] serviceNames) { + this.serviceNames = serviceNames; } /** @@ -87,18 +87,21 @@ public void setServiceName(String serviceName) { */ @Override public RelationType isRelatedRecord(CSWRecord record) { - if (recordId != null && recordId.equals(record.getFileIdentifier())) { - return RelationType.Belongs; + for (String recordId: recordIds) { + if (recordId.equals(record.getFileIdentifier())) { + return RelationType.Belongs; + } } - - if (descriptiveKeyword != null && record.containsKeyword(descriptiveKeyword)) { - return RelationType.Belongs; + for (String descriptiveKeyword: descriptiveKeywords) { + if (record.containsKeyword(descriptiveKeyword)) { + return RelationType.Belongs; + } + } + for (String serviceName: serviceNames) { + if (serviceName.equals(record.getServiceName())) { + return RelationType.Belongs; + } } - - if (serviceName != null && serviceName.equals(record.getServiceName())) { - return RelationType.Belongs; - } - return RelationType.NotRelated; } } diff --git a/src/test/java/org/auscope/portal/core/view/knownlayer/TestKnownLayerSelectors.java b/src/test/java/org/auscope/portal/core/view/knownlayer/TestKnownLayerSelectors.java index 737763396..4430cc081 100644 --- a/src/test/java/org/auscope/portal/core/view/knownlayer/TestKnownLayerSelectors.java +++ b/src/test/java/org/auscope/portal/core/view/knownlayer/TestKnownLayerSelectors.java @@ -104,11 +104,12 @@ public void setupRecordList() throws MalformedURLException { @Test public void testCSWKeywordSelector() { CSWRecordSelector selector = new CSWRecordSelector(); - selector.setDescriptiveKeyword("Report"); + String[] keywords = {"Report", "WMS"}; + selector.setDescriptiveKeywords(keywords); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(0))); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(1))); - Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(2))); + Assert.assertEquals(RelationType.Belongs, selector.isRelatedRecord(recordList.get(2))); Assert.assertEquals(RelationType.Belongs, selector.isRelatedRecord(recordList.get(3))); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(4))); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(5))); @@ -122,9 +123,10 @@ public void testCSWKeywordSelector() { @Test public void testCSWServiceNameSelector() { CSWRecordSelector selector = new CSWRecordSelector(); - selector.setServiceName("name4"); + String[] names = {"name1", "name4"}; + selector.setServiceNames(names); - Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(0))); + Assert.assertEquals(RelationType.Belongs, selector.isRelatedRecord(recordList.get(0))); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(1))); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(2))); Assert.assertEquals(RelationType.Belongs, selector.isRelatedRecord(recordList.get(3))); @@ -140,10 +142,11 @@ public void testCSWServiceNameSelector() { @Test public void testCSWIdSelector() { CSWRecordSelector selector = new CSWRecordSelector(); - selector.setRecordId("id4"); + String[] ids = {"id2", "id4"}; + selector.setRecordIds(ids); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(0))); - Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(1))); + Assert.assertEquals(RelationType.Belongs, selector.isRelatedRecord(recordList.get(1))); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(2))); Assert.assertEquals(RelationType.Belongs, selector.isRelatedRecord(recordList.get(3))); Assert.assertEquals(RelationType.NotRelated, selector.isRelatedRecord(recordList.get(4))); From abeda602aff596b99cab0f33bc4b41e2fd53ae4f Mon Sep 17 00:00:00 2001 From: laughing0li Date: Wed, 8 Nov 2023 04:26:00 +0000 Subject: [PATCH 4/6] Autogenerated JaCoCo coverage badge --- .github/badges/jacoco.svg | 2 +- .github/coverage/jacoco.csv | 8 ++++---- .github/coverage/percentage.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/badges/jacoco.svg b/.github/badges/jacoco.svg index 925b64726..a0b3ff5af 100644 --- a/.github/badges/jacoco.svg +++ b/.github/badges/jacoco.svg @@ -1 +1 @@ -coverage63.9% \ No newline at end of file +coverage64% \ No newline at end of file diff --git a/.github/coverage/jacoco.csv b/.github/coverage/jacoco.csv index 41f13401d..7bce84d36 100644 --- a/.github/coverage/jacoco.csv +++ b/.github/coverage/jacoco.csv @@ -1,6 +1,6 @@ GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,COMPLEXITY_MISSED,COMPLEXITY_COVERED,METHOD_MISSED,METHOD_COVERED -Portal-Core,org.auscope.portal.core.server,PortalPropertySourcesPlaceholderConfigurer,99,0,10,0,25,0,8,0,3,0 Portal-Core,org.auscope.portal.core.server,PortalProfileXmlWebApplicationContext,24,0,2,0,5,0,3,0,2,0 +Portal-Core,org.auscope.portal.core.server,PortalPropertySourcesPlaceholderConfigurer,99,0,10,0,25,0,8,0,3,0 Portal-Core,org.auscope.portal.core.server,OgcServiceProviderType,0,36,0,2,0,6,0,3,0,2 Portal-Core,org.auscope.portal.core.services.methodmakers,GeonetworkMethodMaker,210,0,0,0,39,0,7,0,7,0 Portal-Core,org.auscope.portal.core.services.methodmakers,SOSMethodMaker,4,295,8,18,1,61,8,8,0,3 @@ -94,7 +94,7 @@ Portal-Core,org.auscope.portal.core.services.responses.opendap,SimpleBounds,6,15 Portal-Core,org.auscope.portal.core.services.responses.opendap,SimpleAxis,0,35,0,0,0,14,0,5,0,5 Portal-Core,org.auscope.portal.core.services.responses.opendap,ViewVariableFactory,56,407,14,38,11,78,15,19,1,7 Portal-Core,org.auscope.portal.core.services.responses.opendap,SimpleGrid,13,25,0,0,1,10,1,3,1,3 -Portal-Core,org.auscope.portal.core.view.knownlayer,CSWRecordSelector,9,58,0,12,3,18,3,11,3,5 +Portal-Core,org.auscope.portal.core.view.knownlayer,CSWRecordSelector,9,100,0,12,3,21,3,11,3,5 Portal-Core,org.auscope.portal.core.view.knownlayer,KMLSelector,11,44,0,6,4,9,3,5,3,2 Portal-Core,org.auscope.portal.core.view.knownlayer,WMSSelectors,34,51,4,2,9,12,5,3,3,2 Portal-Core,org.auscope.portal.core.view.knownlayer,KnownLayerGrouping,8,21,0,0,1,8,1,4,1,4 @@ -173,8 +173,8 @@ Portal-Core,org.auscope.portal.core.services.responses.csw,CSWGetDomainResponse. Portal-Core,org.auscope.portal.core.services.responses.csw,CSWRecordTransformerFactory,9,14,0,0,2,3,2,2,2,2 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWOnlineResourceFactory,3,109,2,4,1,28,3,3,1,2 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWTemporalExtent,26,0,0,0,11,0,6,0,6,0 -Portal-Core,org.auscope.portal.core.services.responses.csw,CSWGetRecordResponse,0,160,3,5,0,36,3,7,0,6 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWGetCapabilities.CSWGetCapabilitiesNamespace,0,18,0,0,0,4,0,1,0,1 +Portal-Core,org.auscope.portal.core.services.responses.csw,CSWGetRecordResponse,0,160,3,5,0,36,3,7,0,6 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWContact,3,83,0,0,1,28,1,19,1,19 Portal-Core,org.auscope.portal.core.services.responses.csw,AbstractCSWOnlineResource.OnlineResourceType,0,81,0,0,0,14,0,1,0,1 Portal-Core,org.auscope.portal.core.services.responses.csw,CSWRecordTransformer.Scope,0,15,0,0,0,2,0,1,0,1 @@ -237,8 +237,8 @@ Portal-Core,org.auscope.portal.core.util,FileIOUtil,415,569,50,58,118,142,47,31, Portal-Core,org.auscope.portal.core.util,MimeUtil,20,143,5,15,6,33,6,7,1,2 Portal-Core,org.auscope.portal.core.util,DOMResponseUtil,19,41,0,0,5,11,1,1,1,1 Portal-Core,org.auscope.portal.core.util,ResourceUtil,15,14,1,1,2,5,2,2,1,2 -Portal-Core,org.auscope.portal.core.util,DateUtil.TimeField,0,33,0,0,0,2,0,1,0,1 Portal-Core,org.auscope.portal.core.util,SLDLoader,137,84,11,9,29,22,10,5,3,2 +Portal-Core,org.auscope.portal.core.util,DateUtil.TimeField,0,33,0,0,0,2,0,1,0,1 Portal-Core,org.auscope.portal.core.util,DOMUtil,3,136,0,2,1,37,1,9,1,8 Portal-Core,org.auscope.portal.core.util,HttpUtil,92,48,4,2,19,7,5,2,3,1 Portal-Core,org.auscope.portal.core.util,TextUtil,58,50,11,3,10,11,10,3,4,2 diff --git a/.github/coverage/percentage.txt b/.github/coverage/percentage.txt index 1bf92f3ad..0094383c7 100644 --- a/.github/coverage/percentage.txt +++ b/.github/coverage/percentage.txt @@ -1 +1 @@ -63.9714 +64.0027 From 5ae2fe27e86bf8cd53e90f7761b3ab2a7c33a9c4 Mon Sep 17 00:00:00 2001 From: Vincent Fazio Date: Wed, 8 Nov 2023 16:01:59 +1100 Subject: [PATCH 5/6] AUS-4050 Update package versions to improve security --- pom.xml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index d7dba368f..ebe4e9cc1 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.4 + 3.1.5 @@ -323,7 +323,7 @@ org.json json - 20230227 + 20231013 @@ -415,18 +415,13 @@ joda-time 2.12.5 - - org.apache.jena - jena-arq - 4.2.0 - - - org.slf4j - jcl-over-slf4j - - - - + + org.apache.jena + apache-jena-libs + 4.10.0 + pom + + com.github.openstack4j.core openstack4j-core 3.9 From 2748592130f88f39387e30b5bd776b6e01362f59 Mon Sep 17 00:00:00 2001 From: "stuart.woodman" Date: Wed, 6 Dec 2023 14:24:10 +1100 Subject: [PATCH 6/6] KnownLayers build will be triggered immediately after CSW caching. --- .../auscope/portal/core/services/CSWCacheService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/auscope/portal/core/services/CSWCacheService.java b/src/main/java/org/auscope/portal/core/services/CSWCacheService.java index 092b1f67f..a83fb724b 100644 --- a/src/main/java/org/auscope/portal/core/services/CSWCacheService.java +++ b/src/main/java/org/auscope/portal/core/services/CSWCacheService.java @@ -31,6 +31,8 @@ import org.auscope.portal.core.services.responses.csw.CSWRecordTransformerFactory; import org.auscope.portal.core.util.FileIOUtil; import org.objenesis.strategy.StdInstantiatorStrategy; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import com.esotericsoftware.kryo.Kryo; @@ -84,6 +86,11 @@ public class CSWCacheService { /** If true, this class will force the usage of HTTP GetMethods instead of POST methods (where possible). Useful workaround for some CSW services */ protected boolean forceGetMethods = false; protected Date lastCacheUpdate; + + // KnownLayerService needs to be informed when indexing is finished, must be @Lazy loaded to avoid circular dependencies + @Autowired + @Lazy + private KnownLayerService knownLayerService; /** * Creates a new instance of a CSWKeywordCacheService. This constructor is normally autowired by the spring framework. @@ -257,6 +264,10 @@ private synchronized void updateFinished(Map> newKeywordC this.keywordsByRegistry = newKeywordByEndpointCache; } saveCacheToFile(); + + // Inform KnownLayerService that there are potentially new CSWRecords + knownLayerService.updateKnownLayersCache(); + this.updateRunning = false; this.lastCacheUpdate = new Date();