Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ plugins {
ext {
//version (changing these should be considered thoroughly!)
javaVersion = JavaVersion.VERSION_21
groovyVersion = "4.0"
groovyBinaryVersion = "4.0.28"
groovyBinaryVersion = "5.0.3"

junitVersion = '6.0.1'
testcontainersVersion = '2.0.3'
Expand Down Expand Up @@ -80,7 +79,7 @@ dependencies {

testImplementation "org.junit.platform:junit-platform-launcher:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
testImplementation "org.spockframework:spock-core:2.3-groovy-$groovyVersion"
testImplementation "org.spockframework:spock-core:2.4-groovy-5.0"
testImplementation 'org.objenesis:objenesis:3.4' // Mock creation with constructor parameters
testImplementation 'net.bytebuddy:byte-buddy:1.18.2' // Mocks of classes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

public class TimeBasedSimpleValueFactory<V extends Value>
extends TimeBasedValueFactory<SimpleTimeBasedValueData<V>, V> {
private static final String TIME = "time";
/* Energy price */
private static final String PRICE = "price";
/* Energy / Power */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class SqlConnectorIT extends Specification implements TestContainerHelper {
def "A SQL connector is instantiated correctly"() {
expect:
connector.with {
assert it.jdbcUrl == postgreSQLContainer.jdbcUrl
assert it.connectionProps.getProperty("user") == postgreSQLContainer.username
assert it.connectionProps.getProperty("password") == postgreSQLContainer.password
it.jdbcUrl == postgreSQLContainer.jdbcUrl
it.connectionProps.getProperty("user") == postgreSQLContainer.username
it.connectionProps.getProperty("password") == postgreSQLContainer.password
/* SQL connection should be null, but we cannot test it here, as it would fire the default getter, which
* initializes a connection, if it is not yet initialized. */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class BufferedCsvWriterTest extends Specification {

then:
actual.with {
assert it.headLineElements == ["a", "b", "c"] as String[]
assert it.csvSep == ","
it.headLineElements == ["a", "b", "c"] as String[]
it.csvSep == ","
}
expectedFile.exists()
expectedFile.file // is it a file?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ class CsvFileDefinitionTest extends Specification {

then:
actual.with {
assert it.filePath.fileName == Path.of(this.fileName)
assert it.directoryPath == this.directory
assert it.headLineElements() == this.headLineElements
assert it.csvSep() == this.csvSep
it.filePath.fileName == Path.of(this.fileName)
it.directoryPath == this.directory
it.headLineElements() == this.headLineElements
it.csvSep() == this.csvSep
}
}

Expand All @@ -81,10 +81,10 @@ class CsvFileDefinitionTest extends Specification {

then:
actual.with {
assert it.filePath.fileName == Path.of(this.fileName)
assert it.directoryPath == this.directory
assert it.headLineElements() == this.headLineElements
assert it.csvSep() == this.csvSep
it.filePath.fileName == Path.of(this.fileName)
it.directoryPath == this.directory
it.headLineElements() == this.headLineElements
it.csvSep() == this.csvSep
}
}

Expand All @@ -98,9 +98,9 @@ class CsvFileDefinitionTest extends Specification {

then:
actual.with {
assert it.filePath == expected.filePath
assert it.headLineElements() == expected.headLineElements()
assert it.csvSep() == expected.csvSep()
it.filePath == expected.filePath
it.headLineElements() == expected.headLineElements()
it.csvSep() == expected.csvSep()
}
}

Expand All @@ -115,9 +115,9 @@ class CsvFileDefinitionTest extends Specification {

then:
actual.with {
assert it.filePath == expected.filePath
assert it.headLineElements() == expected.headLineElements()
assert it.csvSep() == expected.csvSep()
it.filePath == expected.filePath
it.headLineElements() == expected.headLineElements()
it.csvSep() == expected.csvSep()
}
}

Expand Down Expand Up @@ -154,9 +154,9 @@ class CsvFileDefinitionTest extends Specification {

then:
actual.with {
assert it.filePath == expected.filePath
assert it.headLineElements() == expected.headLineElements()
assert it.csvSep() == expected.csvSep()
it.filePath == expected.filePath
it.headLineElements() == expected.headLineElements()
it.csvSep() == expected.csvSep()
}
}

Expand All @@ -179,9 +179,9 @@ class CsvFileDefinitionTest extends Specification {

then:
actual.with {
assert it.filePath == expected.filePath
assert it.headLineElements() == expected.headLineElements()
assert it.csvSep() == expected.csvSep()
it.filePath == expected.filePath
it.headLineElements() == expected.headLineElements()
it.csvSep() == expected.csvSep()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class LineGraphicInputFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert path == getGeometry(parameter["path"])
assert graphicLayer == parameter["graphiclayer"]
assert line == lineInput
uuid == UUID.fromString(parameter["uuid"])
path == getGeometry(parameter["path"])
graphicLayer == parameter["graphiclayer"]
line == lineInput
}
}
def "A LineGraphicInputFactory should parse a valid LineGraphicInput with different geoPosition strings correctly"() {
Expand All @@ -73,7 +73,7 @@ class LineGraphicInputFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert path == GridAndGeoUtils.buildSafeLineString(getGeometry(parameter["path"]) as LineString)
path == GridAndGeoUtils.buildSafeLineString(getGeometry(parameter["path"]) as LineString)
}

where:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class NodeGraphicInputFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert point == getGeometry(parameter["point"])
assert path == getGeometry(parameter["path"])
assert graphicLayer == parameter["graphiclayer"]
assert node == nodeInput
uuid == UUID.fromString(parameter["uuid"])
point == getGeometry(parameter["point"])
path == getGeometry(parameter["path"])
graphicLayer == parameter["graphiclayer"]
node == nodeInput
}
}

Expand All @@ -77,7 +77,7 @@ class NodeGraphicInputFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert path == GridAndGeoUtils.buildSafeLineString(getGeometry(parameter["path"]) as LineString)
path == GridAndGeoUtils.buildSafeLineString(getGeometry(parameter["path"]) as LineString)
}
where:
geoLineString | _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime == OperationTime.notLimited()
assert operator == operatorInput
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
operationTime == OperationTime.notLimited()
operator == operatorInput
id == parameter["id"]
}
}

Expand All @@ -73,10 +73,10 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime == OperationTime.notLimited()
assert operator == operatorInput
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
operationTime == OperationTime.notLimited()
operator == operatorInput
id == parameter["id"]
}

where:
Expand Down Expand Up @@ -106,12 +106,12 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime.startDate.present
assert operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
assert !operationTime.endDate.present
assert operator == operatorInput
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
operationTime.startDate.present
operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
!operationTime.endDate.present
operator == operatorInput
id == parameter["id"]
}
}

Expand All @@ -133,12 +133,12 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert !operationTime.startDate.present
assert operationTime.endDate.present
assert operationTime.endDate.get() == ZonedDateTime.parse(parameter["operatesuntil"])
assert operator == operatorInput
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
!operationTime.startDate.present
operationTime.endDate.present
operationTime.endDate.get() == ZonedDateTime.parse(parameter["operatesuntil"])
operator == operatorInput
id == parameter["id"]
}
}

Expand All @@ -161,13 +161,13 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime.startDate.present
assert operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
assert operationTime.endDate.present
assert operationTime.endDate.get() == ZonedDateTime.parse(parameter["operatesuntil"])
assert operator == operatorInput
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
operationTime.startDate.present
operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
operationTime.endDate.present
operationTime.endDate.get() == ZonedDateTime.parse(parameter["operatesuntil"])
operator == operatorInput
id == parameter["id"]
}
}

Expand All @@ -187,10 +187,10 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime == OperationTime.notLimited()
assert operator == OperatorInput.NO_OPERATOR_ASSIGNED
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
operationTime == OperationTime.notLimited()
operator == OperatorInput.NO_OPERATOR_ASSIGNED
id == parameter["id"]
}
}

Expand All @@ -211,12 +211,12 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime.startDate.present
assert operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
assert !operationTime.endDate.present
assert operator == OperatorInput.NO_OPERATOR_ASSIGNED
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
operationTime.startDate.present
operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
!operationTime.endDate.present
operator == OperatorInput.NO_OPERATOR_ASSIGNED
id == parameter["id"]
}
}

Expand All @@ -237,12 +237,12 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert !operationTime.startDate.present
assert operationTime.endDate.present
assert operationTime.endDate.get() == ZonedDateTime.parse(parameter["operatesuntil"])
assert operator == OperatorInput.NO_OPERATOR_ASSIGNED
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
!operationTime.startDate.present
operationTime.endDate.present
operationTime.endDate.get() == ZonedDateTime.parse(parameter["operatesuntil"])
operator == OperatorInput.NO_OPERATOR_ASSIGNED
id == parameter["id"]
}
}

Expand All @@ -264,13 +264,13 @@ class AssetInputEntityFactoryTest extends Specification implements FactoryTestHe
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime.startDate.present
assert operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
assert operationTime.endDate.present
assert operationTime.endDate.get() == ZonedDateTime.parse(parameter["operatesuntil"])
assert operator == OperatorInput.NO_OPERATOR_ASSIGNED
assert id == parameter["id"]
uuid == UUID.fromString(parameter["uuid"])
operationTime.startDate.present
operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
operationTime.endDate.present
operationTime.endDate.get() == ZonedDateTime.parse(parameter["operatesuntil"])
operator == OperatorInput.NO_OPERATOR_ASSIGNED
id == parameter["id"]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ class CylindricalStorageInputFactoryTest extends Specification implements Facto
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime == OperationTime.notLimited()
assert operator == OperatorInput.NO_OPERATOR_ASSIGNED
assert id == parameter["id"]
assert thermalBus == thermalBusInput
assert storageVolumeLvl == getQuant(parameter["storagevolumelvl"], StandardUnits.VOLUME)
assert inletTemp == getQuant(parameter["inlettemp"], StandardUnits.TEMPERATURE)
assert returnTemp == getQuant(parameter["returntemp"], StandardUnits.TEMPERATURE)
assert c == getQuant(parameter["c"], StandardUnits.SPECIFIC_HEAT_CAPACITY)
assert pThermalMax == getQuant(parameter["pThermalMax"], StandardUnits.ACTIVE_POWER_IN)
uuid == UUID.fromString(parameter["uuid"])
operationTime == OperationTime.notLimited()
operator == OperatorInput.NO_OPERATOR_ASSIGNED
id == parameter["id"]
thermalBus == thermalBusInput
storageVolumeLvl == getQuant(parameter["storagevolumelvl"], StandardUnits.VOLUME)
inletTemp == getQuant(parameter["inlettemp"], StandardUnits.TEMPERATURE)
returnTemp == getQuant(parameter["returntemp"], StandardUnits.TEMPERATURE)
c == getQuant(parameter["c"], StandardUnits.SPECIFIC_HEAT_CAPACITY)
pThermalMax == getQuant(parameter["pThermalMax"], StandardUnits.ACTIVE_POWER_IN)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ class DomesticHotWaterStorageInputFactoryTest extends Specification implements F
input.success
input.data.get().getClass() == inputClass
input.data.get().with {
assert uuid == UUID.fromString(parameter["uuid"])
assert operationTime == OperationTime.notLimited()
assert operator == OperatorInput.NO_OPERATOR_ASSIGNED
assert id == parameter["id"]
assert thermalBus == thermalBusInput
assert storageVolumeLvl == getQuant(parameter["storagevolumelvl"], StandardUnits.VOLUME)
assert inletTemp == getQuant(parameter["inlettemp"], StandardUnits.TEMPERATURE)
assert returnTemp == getQuant(parameter["returntemp"], StandardUnits.TEMPERATURE)
assert c == getQuant(parameter["c"], StandardUnits.SPECIFIC_HEAT_CAPACITY)
assert pThermalMax == getQuant(parameter["pThermalMax"], StandardUnits.ACTIVE_POWER_IN)
uuid == UUID.fromString(parameter["uuid"])
operationTime == OperationTime.notLimited()
operator == OperatorInput.NO_OPERATOR_ASSIGNED
id == parameter["id"]
thermalBus == thermalBusInput
storageVolumeLvl == getQuant(parameter["storagevolumelvl"], StandardUnits.VOLUME)
inletTemp == getQuant(parameter["inlettemp"], StandardUnits.TEMPERATURE)
returnTemp == getQuant(parameter["returntemp"], StandardUnits.TEMPERATURE)
c == getQuant(parameter["c"], StandardUnits.SPECIFIC_HEAT_CAPACITY)
pThermalMax == getQuant(parameter["pThermalMax"], StandardUnits.ACTIVE_POWER_IN)
}
}
}
Loading
Loading