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 66c47a7
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 36 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 @@ -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.ValueMap
import eu.esdihumboldt.util.nonosgi.Init
import eu.esdihumboldt.util.test.AbstractPlatformTest
import org.junit.Test
import org.w3c.dom.Element
Expand All @@ -39,13 +40,16 @@ 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')] = Value.of(new ValueList([
Value.of('de'),
Value.of('en')
]))
vm[6*7 as Value] = 42 as Value
vm[new ValueList([
vm[Value.of(new ValueList([
1 as Value,
2 as Value,
3 as Value
]) as Value] = 123 as Value
]))] = 123 as Value

// convert to DOM
Element fragment = HaleIO.getComplexElement(vm)
Expand All @@ -65,13 +69,16 @@ 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')] = Value.of(new ValueList([
Value.of('de'),
Value.of('en')
]))
vm[6*7 as Value] = 42 as Value
vm[new ValueList([
vm[Value.of(new ValueList([
1 as Value,
2 as Value,
3 as Value
]) as Value] = 123 as Value
]))] = 123 as Value

// converter
ValueMapType vmt = new ValueMapType()
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,12 +92,12 @@ class ValuePropertiesTypeTest extends AbstractPlatformTest {
@Test
public void testValuePropertiesList() {
ValueProperties vp = new ValueProperties()
vp['name'] = 'Peter' as Value
vp['cities'] = new ValueList([
'Petersburg' as Value,
'Katzenhirn' as Value,
'Munich' as Value
]) as Value
vp['name'] = Value.of('Peter')
vp['cities'] = Value.of(new ValueList([
Value.of('Petersburg'),
Value.of('Katzenhirn'),
Value.of('Munich')
]))
vp['age'] = 42 - 10 as Value

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

// converter
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 66c47a7

Please sign in to comment.