Skip to content

Commit

Permalink
build: fix issues and failing tests after migration
Browse files Browse the repository at this point in the history
ING-4375
  • Loading branch information
stempler committed Aug 16, 2024
1 parent 8f8f0d4 commit b2c2346
Show file tree
Hide file tree
Showing 30 changed files with 156 additions and 75 deletions.
3 changes: 3 additions & 0 deletions buildSrc/src/main/groovy/hale.java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ dependencies {
testRuntimeOnly libs.logback.core
testRuntimeOnly libs.logback.classic
testRuntimeOnly project(':common:plugins:eu.esdihumboldt.hale.common.logback.config.test')

// make offline resources available to all tests
testRuntimeOnly project(':util:features:eu.esdihumboldt.util.feature.resource')
}

task sourcesJar(type: Jar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ dependencies {
testImplementation testLibs.junit4
testImplementation project(':common:plugins:eu.esdihumboldt.hale.common.schema.groovy')
testImplementation project(':util:plugins:eu.esdihumboldt.util.test')

testRuntimeOnly project(':common:plugins:eu.esdihumboldt.hale.common.filter')
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,13 @@ dependencies {

testImplementation testLibs.junit4

testImplementation libs.jakarta.xml.bind.api

testImplementation project(':common:plugins:eu.esdihumboldt.hale.common.align.merge.test')
testImplementation project(':common:plugins:eu.esdihumboldt.hale.common.instance.index')
testImplementation project(':common:plugins:eu.esdihumboldt.hale.common.instance.groovy')

// unsafe providers
testRuntimeOnly project(':io:plugins:eu.esdihumboldt.hale.io.schemabuilder')
testRuntimeOnly project(':io:plugins:eu.esdihumboldt.hale.io.instancebuilder')
}
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
/*
* Copyright (c) 2020 wetransform GmbH
*
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution. If not, see <http://www.gnu.org/licenses/>.
*
*
* Contributors:
* wetransform GmbH <http://www.wetransform.to>
*/

package eu.esdihumboldt.hale.common.convert.core;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;

/**
* Convert a {@link String} to a {@link LocalDate}.
*
*
* @author Simon Templer
*/
public class StringToLocalDateConverter extends AbstractStringToDateTimeTypeConverter<LocalDate> {

private static DateTimeFormatter SLASH_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd");

/**
* @see eu.esdihumboldt.hale.common.convert.core.AbstractStringToDateTimeTypeConverter#parse(java.lang.String)
*/
@Override
protected LocalDate parse(String source) {
return LocalDate.parse(source);
try {
return LocalDate.parse(source);
} catch (DateTimeParseException e) {
// try alternative format
return LocalDate.parse(source, SLASH_FORMATTER);
}
}

}
3 changes: 3 additions & 0 deletions common/plugins/eu.esdihumboldt.hale.common.core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ dependencies {
implementation libs.model.project

testImplementation testLibs.junit4

testImplementation project(':util:plugins:eu.esdihumboldt.util.test')

testImplementation project(':ext:nonosgi:org.eclipse.equinox.nonosgi.registry')
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.eclipse.equinox.nonosgi.registry.RegistryFactoryHelper;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Version;

Expand All @@ -39,6 +40,7 @@ public static void init() {

@SuppressWarnings("javadoc")
@Test
@Ignore("Does not work in dev environment because manifest file is not present yet")
public void testGetVersion() {
Version version = HalePlatform.getCoreVersion();
assertNotNull(version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import eu.esdihumboldt.hale.common.core.io.HaleIO
import eu.esdihumboldt.hale.common.core.io.Value
import eu.esdihumboldt.hale.common.core.io.ValueList
import eu.esdihumboldt.hale.common.core.io.ValueMap
import org.eclipse.equinox.nonosgi.registry.RegistryFactoryHelper
import org.junit.BeforeClass
import eu.esdihumboldt.util.test.AbstractPlatformTest
import org.junit.Test
import org.w3c.dom.Element

Expand All @@ -31,13 +30,7 @@ import org.w3c.dom.Element
*
* @author Simon Templer
*/
class ValueMapTypeTest {

@BeforeClass
static void init() {
// initialize registry
RegistryFactoryHelper.getRegistry()
}
class ValueMapTypeTest extends AbstractPlatformTest {

/**
* Test if a map containing simple values and complex values is the same
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import eu.esdihumboldt.hale.common.core.io.HaleIO
import eu.esdihumboldt.hale.common.core.io.Value
import eu.esdihumboldt.hale.common.core.io.ValueList
import eu.esdihumboldt.hale.common.core.io.ValueProperties
import eu.esdihumboldt.util.test.AbstractPlatformTest
import org.eclipse.equinox.nonosgi.registry.RegistryFactoryHelper
import org.junit.BeforeClass
import org.junit.Test
Expand All @@ -32,13 +33,7 @@ import org.w3c.dom.Element
*
* @author Simon Templer
*/
class ValuePropertiesTypeTest {

@BeforeClass
static void init() {
// initialize registry
RegistryFactoryHelper.getRegistry()
}
class ValuePropertiesTypeTest extends AbstractPlatformTest {

/**
* Test if a simple properties map containing only simple values is the same
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
* Copyright (c) 2017 wetransform GmbH
*
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution. If not, see <http://www.gnu.org/licenses/>.
*
*
* Contributors:
* wetransform GmbH <http://www.wetransform.to>
*/

package eu.esdihumboldt.hale.common.filter;
package eu.esdihumboldt.hale.common.filter

import static org.junit.Assert.*

Expand All @@ -24,6 +24,7 @@ import eu.esdihumboldt.hale.common.instance.model.Instance
import eu.esdihumboldt.hale.common.schema.groovy.SchemaBuilder
import eu.esdihumboldt.hale.common.schema.model.Schema
import eu.esdihumboldt.hale.common.schema.model.TypeDefinition
import eu.esdihumboldt.util.test.AbstractPlatformTest
import java.text.SimpleDateFormat
import org.junit.Before
import org.locationtech.jts.geom.Coordinate
Expand All @@ -32,10 +33,10 @@ import org.locationtech.jts.geom.GeometryFactory

/**
* Base class for filter tests providing test instances.
*
*
* @author Simon Templer
*/
abstract class AbstractFilterTest {
abstract class AbstractFilterTest extends AbstractPlatformTest {

private static final String defaultNs = "http://www.my.namespace"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* Copyright (c) 2012 Data Harmonisation Panel
*
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution. If not, see <http://www.gnu.org/licenses/>.
*
*
* Contributors:
* HUMBOLDT EU Integrated Project #030962
* Data Harmonisation Panel <http://www.dhpanel.eu>
Expand Down Expand Up @@ -44,6 +44,7 @@
import eu.esdihumboldt.hale.io.shp.reader.internal.ShapeSchemaReader;
import eu.esdihumboldt.hale.io.xsd.reader.XmlSchemaReader;
import eu.esdihumboldt.util.io.IOUtils;
import eu.esdihumboldt.util.test.AbstractPlatformTest;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
Expand All @@ -56,11 +57,11 @@

/**
* TODO Type description
*
*
* @author Basti
*/
@SuppressWarnings({ "restriction", "javadoc" })
public class FilterTest {
public class FilterTest extends AbstractPlatformTest {

static InstanceCollection complexinstances;
static boolean init = false;
Expand Down Expand Up @@ -148,7 +149,7 @@ public void simpleSchemaTestCQL() throws Exception {

/**
* Test loading a simple XML file with one instance
*
*
* @throws Exception if an error occurs
*/
@Ignore
Expand Down Expand Up @@ -211,15 +212,15 @@ public void testComplexInstancesCQL() throws Exception {
* ((getClass().getResource("/testdata/inspire3/HydroPhysicalWaters.xsd"
* ).toURI()))); IOReport report = reader.execute(null);
* assertTrue(report.isSuccess()); Schema schema = reader.getSchema();
*
*
* StreamGmlReader instanceReader = new GmlInstanceReader();
* instanceReader.setSource(new DefaultInputSupplier(getClass().getResource
* ("/testdata/out/transformWrite_ERM_HPW.gml").toURI()));
* instanceReader.setSourceSchema(schema);
*
*
* instanceReader.validate(); report = instanceReader.execute(null);
* assertTrue(report.isSuccess());
*
*
* InstanceCollection instances = instanceReader.getInstances();
* assertFalse(instances.isEmpty());
*/
Expand Down Expand Up @@ -423,7 +424,7 @@ private InstanceCollection validateSchemaAndInstanceReader(Path shpTempFile)

/**
* Test loading a simple XML file with one instance
*
*
* @throws Exception if an error occurs
*/
@Ignore
Expand Down Expand Up @@ -483,15 +484,15 @@ public void testComplexInstancesECQL() throws Exception {
* ((getClass().getResource("/testdata/inspire3/HydroPhysicalWaters.xsd"
* ).toURI()))); IOReport report = reader.execute(null);
* assertTrue(report.isSuccess()); Schema schema = reader.getSchema();
*
*
* StreamGmlReader instanceReader = new GmlInstanceReader();
* instanceReader.setSource(new DefaultInputSupplier(getClass().getResource
* ("/testdata/out/transformWrite_ERM_HPW.gml").toURI()));
* instanceReader.setSourceSchema(schema);
*
*
* instanceReader.validate(); report = instanceReader.execute(null);
* assertTrue(report.isSuccess());
*
*
* InstanceCollection instances = instanceReader.getInstances();
* assertFalse(instances.isEmpty());
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ dependencies {

testImplementation testLibs.junit4

testRuntimeOnly libs.geotools.epsg

testImplementation project(':io:plugins:eu.esdihumboldt.hale.io.gml')
testImplementation project(':io:plugins:eu.esdihumboldt.hale.io.shp')
testImplementation project(':io:plugins:eu.esdihumboldt.hale.io.xsd')

testImplementation project(':util:plugins:eu.esdihumboldt.util.test')

testImplementation libs.spring.core
testRuntimeOnly project(':common:plugins:eu.esdihumboldt.hale.common.convert')
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* Copyright (c) 2012 Data Harmonisation Panel
*
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution. If not, see <http://www.gnu.org/licenses/>.
*
*
* Contributors:
* HUMBOLDT EU Integrated Project #030962
* Data Harmonisation Panel <http://www.dhpanel.eu>
Expand Down Expand Up @@ -41,6 +41,7 @@
import eu.esdihumboldt.hale.io.gml.reader.internal.StreamGmlReader;
import eu.esdihumboldt.hale.io.gml.reader.internal.XmlInstanceReader;
import eu.esdihumboldt.hale.io.xsd.reader.XmlSchemaReader;
import eu.esdihumboldt.util.test.AbstractPlatformTest;
import java.io.IOException;
import java.net.URI;
import javax.xml.namespace.QName;
Expand All @@ -51,11 +52,11 @@

/**
* Tests for {@link PropertyResolver}
*
*
* @author Sebastian Reinhardt
*/
@SuppressWarnings("restriction")
public class PropertyResolverTest {
public class PropertyResolverTest extends AbstractPlatformTest {

/**
* Wait for needed services to be running
Expand All @@ -73,7 +74,7 @@ public boolean evaluate() {

/**
* Test loading a simple XML file with one instance
*
*
* @throws Exception if an error occurs
*/
@Test
Expand Down Expand Up @@ -116,7 +117,7 @@ public void testLoadShiporder() throws Exception {

/**
* Test with a wrapper instance that has no definition itself.
*
*
* @throws Exception if an error occurs
*/
@Test
Expand Down Expand Up @@ -145,7 +146,7 @@ public void testLoadShiporderWrapped() throws Exception {

/**
* Test with complex instances.
*
*
* @throws Exception if an error occurs
*/
@Ignore
Expand Down
Loading

0 comments on commit b2c2346

Please sign in to comment.