Skip to content

Commit

Permalink
Merge pull request #40 from charvolant/master
Browse files Browse the repository at this point in the history
Release 1.4.7
  • Loading branch information
charvolant authored May 24, 2022
2 parents b2b8157 + a2c9f92 commit 014eb1a
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 40 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ jdk:
branches:
only:
- master
- develop
before_install:
- mkdir -p ~/.m2; wget -q -O ~/.m2/settings.xml https://raw.githubusercontent.com/AtlasOfLivingAustralia/travis-build-configuration/master/travis_maven_settings.xml
- sudo mkdir -p /data/lucene; sudo wget -O /data/lucene/namematching-20200214.tgz https://biocache.ala.org.au/archives/nameindexes/20200214/namematching-20200214.tgz
- sudo mkdir -p /data/lucene; sudo wget -O /data/lucene/namematching-20210811-3.tgz https://archives.ala.org.au/archives/nameindexes/20210811-3/namematching-20210811-3.tgz
- cd /data/lucene
- sudo tar zxvf namematching-20200214.tgz
- sudo ln -s namematching-20200214 namematching
- sudo tar zxvf namematching-20210811-3.tgz
- sudo ln -s namematching-20210811-3 namematching
- ls -laF
- cd $TRAVIS_BUILD_DIR

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sds [![Build Status](https://travis-ci.com/AtlasOfLivingAustralia/sds.svg?branch#master)](https://travis-ci.com/AtlasOfLivingAustralia/sds)
# sds [![Build Status](https://travis-ci.com/AtlasOfLivingAustralia/sds.svg?branch=master)](https://app.travis-ci.com/github/AtlasOfLivingAustralia/sds)


The sensitive data service manages sensitivity concerns in the conservation and biosecurity areas.
Expand Down Expand Up @@ -65,7 +65,7 @@ value for the property is http://spatial.ala.org.au/layers-service/intersect/
to sensitive species are correctly determined. This property is only used by the Tests and sds-webapp2. When you construct
your sensitive data service you will need to an ALASearcher to be used:
au.org.ala.sds.SensitiveSpeciesFinderFactory#getSensitiveSpeciesFinder(String dataUrl, ALANameSearcher nameSearcher). The
default value for this is /data/lucene/namematching_v13 which should be overridden with the correct value.
default value for this is /data/lucene/namematching which can either be used as a link or be overridden with the correct value.

* list-url - the URL to the list tool that is used to generate the species xml file, by default https://lists.ala.org.au

Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namematching-index - The location to the name matching index. The SDS uses the n
to sensitive species are correctly determined. This property is only used by the Tests and sds-webapp2. When you construct
your sensitive data service you will need to an ALASearcher to be used:
au.org.ala.sds.SensitiveSpeciesFinderFactory#getSensitiveSpeciesFinder(String dataUrl, ALANameSearcher nameSearcher). The
default value for this is /data/lucene/namematching_v13 which should be overridden with the correct value.
default value for this is /data/lucene/namematching which can either be used as a link or be overridden with the correct value.

list-url - the URL to the list tool that is used to generate the species xml file, by default https://lists.ala.org.au

Expand Down
12 changes: 3 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>au.org.ala</groupId>
<artifactId>sds</artifactId>
<version>1.4.6</version>
<version>1.4.7</version>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/AtlasOfLivingAustralia/sds/issues</url>
Expand Down Expand Up @@ -55,14 +55,8 @@
</dependency>
<dependency>
<groupId>au.org.ala</groupId>
<artifactId>ala-name-matching</artifactId>
<version>3.5</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
<artifactId>ala-name-matching-search</artifactId>
<version>4.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public ValidationOutcome validate(Map<String, String> occurrence) {
GeneralisedLocation gl = GeneralisedLocationFactory.getGeneralisedLocation(latitude, longitude, instances, zones);
ValidationOutcome outcome = new ValidationOutcome(report);

// Specify instances
outcome.setInstances(instances);

// Assemble result map
Map<String, Object> results = new HashMap<String, Object>();
Map<String, String> originalSensitiveValues = new HashMap<String, String>();
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/au/org/ala/sds/validation/ValidationOutcome.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*/
package au.org.ala.sds.validation;

import au.org.ala.sds.model.SensitivityInstance;

import java.util.List;
import java.util.Map;

/**
Expand All @@ -15,6 +18,7 @@ public class ValidationOutcome {
private boolean sensitive = false;
private boolean loadable = false;
private boolean controlledAccess = false;
private List<SensitivityInstance> instances;
private ValidationReport report;
private Map<String, Object> result;

Expand Down Expand Up @@ -68,6 +72,14 @@ public void setControlledAccess(boolean controlledAccess){
this.controlledAccess = controlledAccess;
}

public List<SensitivityInstance> getInstances() {
return this.instances;
}

public void setInstances(List<SensitivityInstance> instances) {
this.instances = instances;
}

public boolean isControlledAccess(){
return this.controlledAccess;
}
Expand All @@ -86,6 +98,7 @@ public String toString() {
"valid=" + valid +
", sensitive=" + sensitive +
", loadable=" + loadable +
", instances=" + instances +
", report=" + report +
", result=" + result +
'}';
Expand Down
22 changes: 4 additions & 18 deletions src/test/java/au/org/ala/sds/FileInputTest.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
package au.org.ala.sds;

import java.util.Map;

import au.org.ala.names.search.ALANameSearcher;
import org.apache.commons.lang.StringUtils;
import org.junit.BeforeClass;
import org.junit.Test;

import au.org.ala.names.search.ALANameIndexer;
import au.org.ala.sds.dao.DataRowHandler;
import au.org.ala.sds.dao.DataStreamDao;
import au.org.ala.sds.dao.DataStreamDaoFactory;
import au.org.ala.sds.dto.DataColumnMapper;
import au.org.ala.sds.dto.DataStreamProperties;
import au.org.ala.sds.model.Message;
import au.org.ala.sds.model.SensitiveTaxon;
import au.org.ala.sds.util.Configuration;
import au.org.ala.sds.validation.FactCollection;
import au.org.ala.sds.validation.ServiceFactory;
import au.org.ala.sds.validation.ValidationOutcome;
import au.org.ala.sds.validation.ValidationReport;
import au.org.ala.sds.validation.ValidationService;
import au.org.ala.sds.validation.*;
import org.apache.commons.lang.StringUtils;

import java.util.Map;

public class FileInputTest {

Expand Down
6 changes: 5 additions & 1 deletion src/test/java/au/org/ala/sds/GeneraliseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ public void notBirdsAustraliaInNsw() {

assertTrue(outcome.isValid());
assertTrue(outcome.isSensitive());
// Has two instances but only one valid for location
assertNotNull(outcome.getInstances());
assertEquals(1, outcome.getInstances().size());
assertEquals("New South Wales", outcome.getInstances().get(0).getZone().getName());
}

/**
Expand Down Expand Up @@ -322,7 +326,7 @@ public void vicSpeciesInVic() {
*/
@Test
public void findSpeciesByLsid() {
SensitiveTaxon ss = finder.findSensitiveSpeciesByLsid("urn:lsid:biodiversity.org.au:afd.taxon:0217f06f-664c-4c64-bc59-1b54650fa23d");
SensitiveTaxon ss = finder.findSensitiveSpeciesByLsid("https://biodiversity.org.au/afd/taxa/5815e99d-01cd-4a92-99ba-36f480c4834d");
assertNotNull(ss);
String latitude = "-33.630629"; // NSW
String longitude = "150.441284";
Expand Down
14 changes: 10 additions & 4 deletions src/test/java/au/org/ala/sds/PlantPestEradicatedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void papayaFruitFlyInPQADuringEradication() {
//assertNotNull(outcome.getAnnotation());
assertNotNull(outcome.getReport().getAssertion());
// Current version of SDS does not include plant pest status and name index does not contain name
assertEquals(MessageFactory.getMessageText(MessageFactory.PLANT_PEST_MSG_CAT2_A1, "Bactrocera papayae"),outcome.getReport().getAssertion());
assertEquals(MessageFactory.getMessageText(MessageFactory.PLANT_PEST_MSG_CAT2_A1, "Bactrocera (Bactrocera) dorsalis"),outcome.getReport().getAssertion());
}

@Test
Expand All @@ -109,8 +109,14 @@ public void citrusCankerInPQABeforeEradication() {
assertTrue(outcome.isLoadable());
assertTrue(outcome.isControlledAccess());
//test for the correct messages
assertEquals(MessageFactory.getMessageText(MessageFactory.PLANT_PEST_MSG_CAT2_B1, "Xanthomonas axonopodis citri","Emerald"),outcome.getReport().getAssertion());
assertTrue(outcome.getReport().getMessages().get(0).getMessageText().contains("Xanthomonas axonopodis citri,2004-01-29 and Emerald has been forwarded to a secure view with the Atlas of Living Australia"));
assertEquals(MessageFactory.getMessageText(MessageFactory.PLANT_PEST_MSG_CAT2_B1, "Xanthomonas citri (ex Hasse 1915) Gabriel et al. subsp. citri 2007","Emerald"),outcome.getReport().getAssertion());
assertEquals("Your record Xanthomonas citri (ex Hasse 1915) Gabriel et al. subsp. citri 2007,2004-01-29 and Emerald has been forwarded to a secure view with the Atlas of Living Australia.\n" +
"This record has been determined to have plant biosecurity sensitivity because the record is an earlier collection of a pest believed eradicated from Emerald and therefore Australia.\n" +
"Please note the following:\n" +
"1) Diagnostic keys and guidance on other tools for identifying many exotic plant pests, particularly those considered Emergency Plant Pests under the EPPRD, are becoming readily available through the Plant Biosecurity Toolbox and Biosecurity Bank developed by the CRC for Plant Biosecurity.\n" +
"2) The Emergency Plant Pest Response Deed (Section 4) (http://www.planthealthaustralia.com.au/go/phau/epprd/epprd-information) imposes reporting obligations where an Emergency Plant Pest is suspected. Most States also have requirements for reporting the presence of many other potentially harmful exotic plant pests not included in the EPPRD.\n" +
"3) When the presence of an exotic plant pest is suspected, phone the Exotic Plant Pest Hotline 1800 084 881. (PPC2-B2)",
outcome.getReport().getMessages().get(0).getMessageText());
}

@Test
Expand Down Expand Up @@ -193,6 +199,6 @@ public void citrusCankerNoDate(){
assertTrue(outcome.isControlledAccess());
// Current version of SDS does not include plant pest status and name index does not contain name
assertTrue(outcome.getReport().getMessages().get(0).getMessageText().contains("and Emerald has been forwarded to a secure view with the Atlas of Living Australia"));
assertEquals(MessageFactory.getMessageText(MessageFactory.PLANT_PEST_MSG_CAT2_A1, "Xanthomonas axonopodis citri"),outcome.getReport().getAssertion());
assertEquals(MessageFactory.getMessageText(MessageFactory.PLANT_PEST_MSG_CAT2_A1, "Xanthomonas citri (ex Hasse 1915) Gabriel et al. subsp. citri 2007"),outcome.getReport().getAssertion());
}
}
2 changes: 1 addition & 1 deletion src/test/java/au/org/ala/sds/SearchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void lookupCrex() {

@Test
public void lookupMitchellsByLsid() {
SensitiveTaxon ss = finder.findSensitiveSpeciesByLsid("urn:lsid:biodiversity.org.au:afd.taxon:0217f06f-664c-4c64-bc59-1b54650fa23d");
SensitiveTaxon ss = finder.findSensitiveSpeciesByLsid("https://biodiversity.org.au/afd/taxa/5815e99d-01cd-4a92-99ba-36f480c4834d");
assertNotNull(ss);
assertEquals("Lophochroa leadbeateri", ss.getTaxonName());
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/sds-test.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Overriden properties for tests
name.index.dir=/data/lucene/namematching-20200214
name.index.dir=/data/lucene/namematching-20210811-3

0 comments on commit 014eb1a

Please sign in to comment.