Skip to content

Commit

Permalink
fixup! build: fix issues and failing tests after migration
Browse files Browse the repository at this point in the history
  • Loading branch information
stempler committed Aug 16, 2024
1 parent fa3866a commit f71e3ae
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
testImplementation libs.groovy.xml

testImplementation project(':common:plugins:eu.esdihumboldt.hale.common.test')
testImplementation project(':common:plugins:eu.esdihumboldt.hale.common.filter')

testRuntimeOnly project(':io:features:eu.esdihumboldt.hale.io.feature.core')
testRuntimeOnly project(':cst:features:eu.esdihumboldt.cst.feature')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-project
platform:/plugin/eu.esdihumboldt.hale.app.transform.test/projects/hydro/project.halex
RESOLVE:projects/hydro/project.halex
-source
platform:/plugin/eu.esdihumboldt.hale.app.transform.test/projects/hydro/hydro-source.gml.gz
RESOLVE:projects/hydro/hydro-source.gml.gz
-Sinspire.sds.localId
1234
-filter
name='River Rede'
-filter-on
River
width='10.0'
width='10.0'
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-project
platform:/plugin/eu.esdihumboldt.hale.app.transform.test/projects/multitype/project.halex
RESOLVE:projects/multitype/project.halex
-source
platform:/plugin/eu.esdihumboldt.hale.app.transform.test/projects/multitype/multi-type-source.xml
RESOLVE:projects/multitype/multi-type-source.xml
-filter
CQL:price>'11'
-filter-on
shirt
name='Polo shirt green'
-exclude-type
shirt
shirt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-project
platform:/plugin/eu.esdihumboldt.hale.app.transform.test/projects/multitype/project.halex
RESOLVE:projects/multitype/project.halex
-source
platform:/plugin/eu.esdihumboldt.hale.app.transform.test/projects/multitype/multi-type-source.xml
RESOLVE:projects/multitype/multi-type-source.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ class ExecuteTest extends AbstractPlatformTest {
tempArgsFile.deleteOnExit()
createTempFile(MULTITYPE_ARGS_2_FILE_PATH, tempArgsFile);

// replace RESOLVE: for correct URL
resolveArgResources(tempArgsFile)

println ">> Arguments will be read from ${tempArgsFile}"
println ">> Transformed data will be written to ${targetFile}..."
transform([
Expand Down Expand Up @@ -157,6 +160,9 @@ class ExecuteTest extends AbstractPlatformTest {
tempArgsFile.deleteOnExit()
createTempFile(MULTITYPE_ARGS_FILE_PATH, tempArgsFile);

// replace RESOLVE: for correct URL
resolveArgResources(tempArgsFile)

println ">> Arguments will be read from ${tempArgsFile}"
println ">> Transformed data will be written to ${targetFile}..."
transform([
Expand Down Expand Up @@ -384,6 +390,9 @@ class ExecuteTest extends AbstractPlatformTest {
tempArgsFile.deleteOnExit()
createTempFile(HYDRO_ARGS_FILE_PATH, tempArgsFile);

// replace RESOLVE: for correct URL
resolveArgResources(tempArgsFile)

println ">> Arguments will be read from ${tempArgsFile}"
println ">> Transformed data will be written to ${targetFile}..."
transform([
Expand Down Expand Up @@ -1100,4 +1109,16 @@ assert aggregated['eu.esdihumboldt.hale.instance.validation.internal'].report.wa

return res
}

def void resolveArgResources(File argFile) {
argFile.text = argFile.readLines().collect {line ->
if (line.startsWith('RESOLVE:')) {
def path = line.substring('RESOLVE:'.length())
getClass().getClassLoader().getResource(path).toString()
}
else {
line
}
}.join('\n')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ class ValueMapTypeTest extends AbstractPlatformTest {
@Test
public void testValueMap() {
ValueMap vm = new ValueMap()
vm['languages' as Value] = new ValueList(['de' as Value, 'en' as Value]) as Value
vm[Value.of('languages')] = new ValueList([
Value.of('de'),
Value.of('en')

Check failure on line 44 in common/plugins/eu.esdihumboldt.hale.common.core/test/eu/esdihumboldt/hale/common/core/io/impl/ValueMapTypeTest.groovy

View workflow job for this annotation

GitHub Actions / check / check / run

ValueMapTypeTest.testValueMap

org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[de, en]' with class 'eu.esdihumboldt.hale.common.core.io.ValueList' to class 'eu.esdihumboldt.hale.common.core.io.Value' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: eu.esdihumboldt.hale.common.core.io.Value(eu.esdihumboldt.hale.common.core.io.impl.StringValue, eu.esdihumboldt.hale.common.core.io.impl.StringValue)
]) as Value
vm[6*7 as Value] = 42 as Value
vm[new ValueList([
1 as Value,
Expand All @@ -65,7 +68,10 @@ class ValueMapTypeTest extends AbstractPlatformTest {
@Test
public void testValueMapJson() {
ValueMap vm = new ValueMap()
vm['languages' as Value] = new ValueList(['de' as Value, 'en' as Value]) as Value
vm[Value.of('languages')] = new ValueList([
Value.of('de'),
Value.of('en')

Check failure on line 73 in common/plugins/eu.esdihumboldt.hale.common.core/test/eu/esdihumboldt/hale/common/core/io/impl/ValueMapTypeTest.groovy

View workflow job for this annotation

GitHub Actions / check / check / run

ValueMapTypeTest.testValueMapJson

org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[de, en]' with class 'eu.esdihumboldt.hale.common.core.io.ValueList' to class 'eu.esdihumboldt.hale.common.core.io.Value' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: eu.esdihumboldt.hale.common.core.io.Value(eu.esdihumboldt.hale.common.core.io.impl.StringValue, eu.esdihumboldt.hale.common.core.io.impl.StringValue)
]) as Value
vm[6*7 as Value] = 42 as Value
vm[new ValueList([
1 as Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class ValuePropertiesTypeTest extends AbstractPlatformTest {
@Test
public void testValueProperties() {
ValueProperties vp = new ValueProperties()
Value name = 'Peter' as Value
Value name = Value.of('Peter')
vp['name'] = name
vp['city'] = 'Petersburg' as Value
vp['city'] = Value.of('Petersburg')
vp['age'] = 2.power(5) as Value

// convert to DOM
Expand All @@ -64,9 +64,9 @@ class ValuePropertiesTypeTest extends AbstractPlatformTest {
@Test
public void testValuePropertiesJson() {
ValueProperties vp = new ValueProperties()
Value name = 'Peter' as Value
Value name = Value.of('Peter')
vp['name'] = name
vp['city'] = 'Petersburg' as Value
vp['city'] = Value.of('Petersburg')
vp['age'] = 2.power(5) as Value

// converter
Expand All @@ -92,11 +92,11 @@ class ValuePropertiesTypeTest extends AbstractPlatformTest {
@Test
public void testValuePropertiesList() {
ValueProperties vp = new ValueProperties()
vp['name'] = 'Peter' as Value
vp['name'] = Value.of('Peter')
vp['cities'] = new ValueList([
'Petersburg' as Value,
'Katzenhirn' as Value,
'Munich' as Value
Value.of('Petersburg'),
Value.of('Katzenhirn'),
Value.of('Munich')

Check failure on line 99 in common/plugins/eu.esdihumboldt.hale.common.core/test/eu/esdihumboldt/hale/common/core/io/impl/ValuePropertiesTypeTest.groovy

View workflow job for this annotation

GitHub Actions / check / check / run

ValuePropertiesTypeTest.testValuePropertiesList

org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[Petersburg, Katzenhirn, Munich]' with class 'eu.esdihumboldt.hale.common.core.io.ValueList' to class 'eu.esdihumboldt.hale.common.core.io.Value' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: eu.esdihumboldt.hale.common.core.io.Value(eu.esdihumboldt.hale.common.core.io.impl.StringValue, eu.esdihumboldt.hale.common.core.io.impl.StringValue, eu.esdihumboldt.hale.common.core.io.impl.StringValue)
]) as Value
vp['age'] = 42 - 10 as Value

Expand All @@ -118,11 +118,11 @@ class ValuePropertiesTypeTest extends AbstractPlatformTest {
@Test
public void testValuePropertiesListJson() {
ValueProperties vp = new ValueProperties()
vp['name'] = 'Peter' as Value
vp['name'] = Value.of('Peter')
vp['cities'] = new ValueList([
'Petersburg' as Value,
'Katzenhirn' as Value,
'Munich' as Value
Value.of('Petersburg'),
Value.of('Katzenhirn'),
Value.of('Munich')

Check failure on line 125 in common/plugins/eu.esdihumboldt.hale.common.core/test/eu/esdihumboldt/hale/common/core/io/impl/ValuePropertiesTypeTest.groovy

View workflow job for this annotation

GitHub Actions / check / check / run

ValuePropertiesTypeTest.testValuePropertiesListJson

org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[Petersburg, Katzenhirn, Munich]' with class 'eu.esdihumboldt.hale.common.core.io.ValueList' to class 'eu.esdihumboldt.hale.common.core.io.Value' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: eu.esdihumboldt.hale.common.core.io.Value(eu.esdihumboldt.hale.common.core.io.impl.StringValue, eu.esdihumboldt.hale.common.core.io.impl.StringValue, eu.esdihumboldt.hale.common.core.io.impl.StringValue)
]) as Value
vp['age'] = 42 - 10 as Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ReferenceFactoryTest extends AbstractPropertiesCompareConstraintFactoryTes
TypeDefinition type = new DefaultTypeDefinition(new QName('ReferencedType'))
Reference ref = new Reference(type)

def typeIndex = [(type): 'someid' as Value]
def typeIndex = [(type): Value.of('someid')]

storeRestoreTest(ref, typeIndex, null)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ElementTypeFactoryTest extends AbstractPropertiesCompareConstraintFactoryT
void testTypeBinding() {
TypeDefinition type = new DefaultTypeDefinition(new QName('BindingType'))

def typeIndex = [(type): 'someid' as Value]
def typeIndex = [(type): Value.of('someid')]

storeRestoreTest(ElementType.createFromType(type), typeIndex, null)
}
Expand Down
2 changes: 2 additions & 0 deletions cst/plugins/eu.esdihumboldt.cst.test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ dependencies {

runtimeOnly project(':io:features:eu.esdihumboldt.hale.io.feature.core')

runtimeOnly project(':cst:plugins:eu.esdihumboldt.cst.functions.string')

// unsafe providers
runtimeOnly project(':io:plugins:eu.esdihumboldt.hale.io.schemabuilder')
runtimeOnly project(':io:plugins:eu.esdihumboldt.hale.io.instancebuilder')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public class Init {

public static void init() {
if (initialized.compareAndSet(false, true)) {
// initialize meta extensions
GroovySystem.getMetaClassRegistry()
.setMetaClassCreationHandle(new CustomMetaClassCreationHandle());

SLF4JBridgeHandler.install();

// initialize registry
RegistryFactoryHelper.getRegistry();

// initialize meta extensions
GroovySystem.getMetaClassRegistry()
.setMetaClassCreationHandle(new CustomMetaClassCreationHandle());
}
}

Expand Down

0 comments on commit f71e3ae

Please sign in to comment.