diff --git a/pom.xml b/pom.xml
index 4173c668..a2880ecb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,6 +57,12 @@
au.org.ala
ala-name-matching
3.5
+
+
+ ch.qos.logback
+ logback-classic
+
+
compile
diff --git a/src/test/java/au/org/ala/sds/ExoticBiologicalControlTest.java b/src/test/java/au/org/ala/sds/ExoticBiologicalControlTest.java
index f47abf10..326cf8ad 100644
--- a/src/test/java/au/org/ala/sds/ExoticBiologicalControlTest.java
+++ b/src/test/java/au/org/ala/sds/ExoticBiologicalControlTest.java
@@ -17,6 +17,7 @@
import au.org.ala.names.search.ALANameSearcher;
import au.org.ala.sds.model.SensitiveTaxon;
import au.org.ala.sds.util.Configuration;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.*;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -34,8 +35,7 @@ public class ExoticBiologicalControlTest {
@BeforeClass
public static void runOnce() throws Exception {
-
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
System.out.println(Configuration.getInstance().getNameMatchingIndex());
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//The URI to the test list - only contains entries that are used in one or more the the tests
diff --git a/src/test/java/au/org/ala/sds/GeneraliseTest.java b/src/test/java/au/org/ala/sds/GeneraliseTest.java
index e0c7f2de..5ba18c88 100644
--- a/src/test/java/au/org/ala/sds/GeneraliseTest.java
+++ b/src/test/java/au/org/ala/sds/GeneraliseTest.java
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
+import au.org.ala.sds.util.TestUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -51,7 +52,7 @@ public static void runOnce() throws Exception {
// ((BasicDataSource) dataSource).setUsername("root");
// ((BasicDataSource) dataSource).setPassword("password");
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//finder = SensitiveSpeciesFinderFactory.getSensitiveSpeciesFinder(cbIndexSearch);
String uri = nameSearcher.getClass().getClassLoader().getResource("sensitive-species.xml").toURI().toString();
diff --git a/src/test/java/au/org/ala/sds/PlantPestCategory5Test.java b/src/test/java/au/org/ala/sds/PlantPestCategory5Test.java
index 413ec951..a5095d38 100644
--- a/src/test/java/au/org/ala/sds/PlantPestCategory5Test.java
+++ b/src/test/java/au/org/ala/sds/PlantPestCategory5Test.java
@@ -18,6 +18,7 @@
import au.org.ala.sds.model.SensitiveTaxon;
import au.org.ala.sds.util.Configuration;
import au.org.ala.sds.util.PlantPestUtils;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.MessageFactory;
import au.org.ala.sds.validation.ServiceFactory;
import au.org.ala.sds.validation.ValidationOutcome;
@@ -46,7 +47,7 @@ public class PlantPestCategory5Test {
@BeforeClass
public static void runOnce() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
System.out.println(Configuration.getInstance().getNameMatchingIndex());
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//The URI to the test list - only contains entries that are used in one or more the the tests
diff --git a/src/test/java/au/org/ala/sds/PlantPestEradicatedTest.java b/src/test/java/au/org/ala/sds/PlantPestEradicatedTest.java
index 277b3e8b..71a0a41f 100644
--- a/src/test/java/au/org/ala/sds/PlantPestEradicatedTest.java
+++ b/src/test/java/au/org/ala/sds/PlantPestEradicatedTest.java
@@ -20,6 +20,7 @@
import au.org.ala.sds.model.Message;
import au.org.ala.sds.util.AUWorkarounds;
import au.org.ala.sds.util.GeoLocationHelper;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.*;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -50,7 +51,9 @@ public static void runOnce() throws Exception {
// ((BasicDataSource) dataSource).setUsername("root");
// ((BasicDataSource) dataSource).setPassword("password");
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
+ Configuration.getInstance().setZoneUrl(PlantPestEradicatedTest.class.getResource("/sensitivity-zones.xml").toExternalForm());
+ Configuration.getInstance().setCategoriesUrl(PlantPestEradicatedTest.class.getResource("/sensitivity-categories.xml").toExternalForm());
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//finder = SensitiveSpeciesFinderFactory.getSensitiveSpeciesFinder("file:///data/sds/sensitive-species-new.xml", cbIndexSearch);
String uri = nameSearcher.getClass().getClassLoader().getResource("sensitive-species.xml").toURI().toString();
diff --git a/src/test/java/au/org/ala/sds/PlantPestIdentifiedToHigherTaxonTest.java b/src/test/java/au/org/ala/sds/PlantPestIdentifiedToHigherTaxonTest.java
index 035f86bd..d71d83bf 100644
--- a/src/test/java/au/org/ala/sds/PlantPestIdentifiedToHigherTaxonTest.java
+++ b/src/test/java/au/org/ala/sds/PlantPestIdentifiedToHigherTaxonTest.java
@@ -18,6 +18,7 @@
import au.org.ala.sds.model.SensitiveTaxon;
import au.org.ala.sds.util.Configuration;
import au.org.ala.sds.util.PlantPestUtils;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.*;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -39,7 +40,7 @@ public class PlantPestIdentifiedToHigherTaxonTest {
@BeforeClass
public static void runOnce() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
System.out.println(Configuration.getInstance().getNameMatchingIndex());
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//The URI to the test list - only contains entries that are used in one or more the the tests
diff --git a/src/test/java/au/org/ala/sds/PlantPestNotKnownInAustraliaTest.java b/src/test/java/au/org/ala/sds/PlantPestNotKnownInAustraliaTest.java
index c8f8a672..5430b03f 100644
--- a/src/test/java/au/org/ala/sds/PlantPestNotKnownInAustraliaTest.java
+++ b/src/test/java/au/org/ala/sds/PlantPestNotKnownInAustraliaTest.java
@@ -19,6 +19,7 @@
import java.util.Map;
import au.org.ala.sds.model.Message;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.*;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -45,7 +46,7 @@ public class PlantPestNotKnownInAustraliaTest {
@BeforeClass
public static void runOnce() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//use test versions
// Configuration.getInstance().setZoneUrl(nameSearcher.getClass().getClassLoader().getResource("sensitivity-zones.xml").toURI().toString());
diff --git a/src/test/java/au/org/ala/sds/PlantPestSubjectToOfficialControlTest.java b/src/test/java/au/org/ala/sds/PlantPestSubjectToOfficialControlTest.java
index 4ecbf0cc..4706efe6 100644
--- a/src/test/java/au/org/ala/sds/PlantPestSubjectToOfficialControlTest.java
+++ b/src/test/java/au/org/ala/sds/PlantPestSubjectToOfficialControlTest.java
@@ -21,6 +21,7 @@
import au.org.ala.sds.model.Message;
import au.org.ala.sds.util.AUWorkarounds;
import au.org.ala.sds.util.GeoLocationHelper;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.*;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -51,7 +52,7 @@ public static void runOnce() throws Exception {
// ((BasicDataSource) dataSource).setUsername("root");
// ((BasicDataSource) dataSource).setPassword("password");
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//finder = SensitiveSpeciesFinderFactory.getSensitiveSpeciesFinder("file:///data/sds/sensitive-species-test.xml", cbIndexSearch);
String uri = nameSearcher.getClass().getClassLoader().getResource("sensitive-species.xml").toURI().toString();
diff --git a/src/test/java/au/org/ala/sds/PlantPestUnderEradicationTest.java b/src/test/java/au/org/ala/sds/PlantPestUnderEradicationTest.java
index c64d709d..72392cc6 100644
--- a/src/test/java/au/org/ala/sds/PlantPestUnderEradicationTest.java
+++ b/src/test/java/au/org/ala/sds/PlantPestUnderEradicationTest.java
@@ -18,6 +18,7 @@
import au.org.ala.sds.model.SensitiveTaxon;
import au.org.ala.sds.util.AUWorkarounds;
import au.org.ala.sds.util.GeoLocationHelper;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.*;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -51,7 +52,7 @@ public static void runOnce() throws Exception {
// ((BasicDataSource) dataSource).setUsername("root");
// ((BasicDataSource) dataSource).setPassword("password");
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//finder = SensitiveSpeciesFinderFactory.getSensitiveSpeciesFinder("file:///data/sds/sensitive-species-new.xml", cbIndexSearch);
String uri = nameSearcher.getClass().getClassLoader().getResource("sensitive-species.xml").toURI().toString();
diff --git a/src/test/java/au/org/ala/sds/ProblematicFileInputTest.java b/src/test/java/au/org/ala/sds/ProblematicFileInputTest.java
index 321abf8e..938fae3c 100644
--- a/src/test/java/au/org/ala/sds/ProblematicFileInputTest.java
+++ b/src/test/java/au/org/ala/sds/ProblematicFileInputTest.java
@@ -2,6 +2,7 @@
import java.util.Map;
+import au.org.ala.sds.util.TestUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -26,7 +27,7 @@ public class ProblematicFileInputTest {
//@BeforeClass
public static void runOnce() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
finder = SensitiveSpeciesFinderFactory.getSensitiveSpeciesFinder("file:///data/sds/sensitive-species.xml", nameSearcher);
}
diff --git a/src/test/java/au/org/ala/sds/ScotlandTests.java b/src/test/java/au/org/ala/sds/ScotlandTests.java
index 1c52da18..a7da9d8f 100644
--- a/src/test/java/au/org/ala/sds/ScotlandTests.java
+++ b/src/test/java/au/org/ala/sds/ScotlandTests.java
@@ -4,6 +4,7 @@
import au.org.ala.sds.model.SensitiveTaxon;
import au.org.ala.sds.model.SensitivityZoneFactory;
import au.org.ala.sds.util.Configuration;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.ValidationOutcome;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -25,7 +26,7 @@ public class ScotlandTests {
@BeforeClass
public static void runOnce() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
SensitivityZoneFactory.reset(); //FIXME this isnt pleasant
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
String uri = nameSearcher.getClass().getClassLoader().getResource("sensitive-species-scotland.xml").toURI().toString();
diff --git a/src/test/java/au/org/ala/sds/SearchTest.java b/src/test/java/au/org/ala/sds/SearchTest.java
index 46e2dda8..30c3ea84 100644
--- a/src/test/java/au/org/ala/sds/SearchTest.java
+++ b/src/test/java/au/org/ala/sds/SearchTest.java
@@ -17,6 +17,7 @@
import au.org.ala.names.search.ALANameSearcher;
import au.org.ala.sds.model.SensitiveTaxon;
import au.org.ala.sds.util.Configuration;
+import au.org.ala.sds.util.TestUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -33,7 +34,7 @@ public class SearchTest {
@BeforeClass
public static void runOnce() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
String uri = nameSearcher.getClass().getClassLoader().getResource("sensitive-species.xml").toURI().toString();
finder = SensitiveSpeciesFinderFactory.getSensitiveSpeciesFinder(uri, nameSearcher, true);
diff --git a/src/test/java/au/org/ala/sds/SensitiveDataServiceTest.java b/src/test/java/au/org/ala/sds/SensitiveDataServiceTest.java
index 58736567..ccb3b32a 100644
--- a/src/test/java/au/org/ala/sds/SensitiveDataServiceTest.java
+++ b/src/test/java/au/org/ala/sds/SensitiveDataServiceTest.java
@@ -16,6 +16,7 @@
import au.org.ala.names.search.ALANameSearcher;
import au.org.ala.sds.util.Configuration;
+import au.org.ala.sds.util.TestUtils;
import au.org.ala.sds.validation.FactCollection;
import au.org.ala.sds.validation.MessageFactory;
import au.org.ala.sds.validation.ValidationOutcome;
@@ -41,7 +42,7 @@ public class SensitiveDataServiceTest {
@BeforeClass
public static void runOnce() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
System.out.println(Configuration.getInstance().getNameMatchingIndex());
nameSearcher = new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex());
//The URI to the test list - only contains entries that are used in one or more the the tests
diff --git a/src/test/java/au/org/ala/sds/model/SensitiveSpeciesStoreTest.java b/src/test/java/au/org/ala/sds/model/SensitiveSpeciesStoreTest.java
index 51774e68..adff13c2 100644
--- a/src/test/java/au/org/ala/sds/model/SensitiveSpeciesStoreTest.java
+++ b/src/test/java/au/org/ala/sds/model/SensitiveSpeciesStoreTest.java
@@ -18,15 +18,13 @@
import au.org.ala.sds.SensitiveSpeciesFinder;
import au.org.ala.sds.SensitiveSpeciesFinderFactory;
import au.org.ala.sds.util.Configuration;
+import au.org.ala.sds.util.TestUtils;
import org.junit.Test;
public class SensitiveSpeciesStoreTest {
@Test
public void testCreate() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
- Configuration.getInstance().setSpeciesUrl(SensitiveSpeciesStoreTest.class.getResource("/sensitive-species.xml").toExternalForm());
- Configuration.getInstance().setZoneUrl(SensitiveSpeciesStoreTest.class.getResource("/sensitivity-zones.xml").toExternalForm());
- Configuration.getInstance().setCategoriesUrl(SensitiveSpeciesStoreTest.class.getResource("/sensitivity-categories.xml").toExternalForm());
+ TestUtils.initConfig();
SensitiveSpeciesFinder finder = SensitiveSpeciesFinderFactory.getSensitiveSpeciesFinder(new ALANameSearcher(Configuration.getInstance().getNameMatchingIndex()));
SensitiveTaxon taxon = finder.findSensitiveSpecies("Acacia dealbata");
}
diff --git a/src/test/java/au/org/ala/sds/model/SensitivityZoneTest.java b/src/test/java/au/org/ala/sds/model/SensitivityZoneTest.java
index 9e01916a..a3ddfb5b 100644
--- a/src/test/java/au/org/ala/sds/model/SensitivityZoneTest.java
+++ b/src/test/java/au/org/ala/sds/model/SensitivityZoneTest.java
@@ -14,12 +14,18 @@
***************************************************************************/
package au.org.ala.sds.model;
+import au.org.ala.sds.util.TestUtils;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
public class SensitivityZoneTest {
+ @BeforeClass
+ public static void runOnce() throws Exception {
+ TestUtils.initConfig();
+ }
@Test
public void isInAustralia() {
diff --git a/src/test/java/au/org/ala/sds/util/GeoLocationTest.java b/src/test/java/au/org/ala/sds/util/GeoLocationTest.java
index 6f3bcc59..c5baf738 100644
--- a/src/test/java/au/org/ala/sds/util/GeoLocationTest.java
+++ b/src/test/java/au/org/ala/sds/util/GeoLocationTest.java
@@ -31,7 +31,7 @@ public class GeoLocationTest {
@BeforeClass
public static void runOnce() throws Exception {
- System.setProperty("sds.config.file", "/sds-test.properties");
+ TestUtils.initConfig();
}
diff --git a/src/test/java/au/org/ala/sds/util/TestUtils.java b/src/test/java/au/org/ala/sds/util/TestUtils.java
new file mode 100644
index 00000000..c53b05d8
--- /dev/null
+++ b/src/test/java/au/org/ala/sds/util/TestUtils.java
@@ -0,0 +1,20 @@
+package au.org.ala.sds.util;
+
+import au.org.ala.names.search.ALANameSearcher;
+import au.org.ala.sds.PlantPestEradicatedTest;
+import au.org.ala.sds.SensitiveSpeciesFinderFactory;
+
+public class TestUtils {
+ /**
+ * Set up a common configuration
+ *
+ * @throws Exception
+ */
+ public static void initConfig() throws Exception {
+ System.setProperty("sds.config.file", "/sds-test.properties");
+ Configuration.getInstance().setSpeciesUrl(TestUtils.class.getResource("/sensitive-species.xml").toExternalForm());
+ Configuration.getInstance().setZoneUrl(TestUtils.class.getResource("/sensitivity-zones.xml").toExternalForm());
+ Configuration.getInstance().setCategoriesUrl(TestUtils.class.getResource("/sensitivity-categories.xml").toExternalForm());
+ }
+
+}
diff --git a/src/test/resources/log4j.xml b/src/test/resources/log4j.xml
index 600b1ad9..cd42d1d2 100644
--- a/src/test/resources/log4j.xml
+++ b/src/test/resources/log4j.xml
@@ -5,7 +5,7 @@
-
+
@@ -27,7 +27,7 @@
-
+