Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ckittl committed Jan 28, 2022
1 parent 1cf83de commit a8f1f98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait CsvTestDataMeta {
static String participantsFolderPath = testParticipantsBaseFolderPath.concat(File.separator).concat("participants")
static String resultEntitiesFolderPath = testParticipantsBaseFolderPath.concat(File.separator).concat("results")
static String timeSeriesFolderPath = testTimeSeriesBaseFolderPath
static String weatherFolderPath = new File(getClass().getResource('/weather').toURI()).absolutePath
static String weatherFolderPath = new File(CsvTestDataMeta.getResource('/weather').toURI()).absolutePath
static String cosmoWeatherFolderPath = weatherFolderPath.concat(File.separator).concat("cosmo")
static String iconWeatherFolderPath = weatherFolderPath.concat(File.separator).concat("icon")
static String thermalFolderPath = testParticipantsBaseFolderPath.concat(File.separator).concat("thermal")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package edu.ie3.datamodel.io.source.csv

import edu.ie3.datamodel.io.factory.timeseries.CosmoTimeBasedWeatherValueFactory
import edu.ie3.datamodel.io.naming.EntityPersistenceNamingStrategy
import edu.ie3.datamodel.io.naming.FileNamingStrategy
import edu.ie3.datamodel.io.source.IdCoordinateSource
import edu.ie3.datamodel.models.timeseries.individual.IndividualTimeSeries
import edu.ie3.datamodel.models.timeseries.individual.TimeBasedValue
Expand Down Expand Up @@ -38,7 +39,7 @@ class CsvWeatherSourceCosmoTest extends Specification implements CsvTestDataMeta
def setupSpec() {
coordinateSource = CosmoWeatherTestData.coordinateSource
def weatherFactory = new CosmoTimeBasedWeatherValueFactory()
source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new EntityPersistenceNamingStrategy(), coordinateSource, weatherFactory)
source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new FileNamingStrategy(), coordinateSource, weatherFactory)
}

def "A CsvWeatherSource can read and correctly parse a single value for a specific date and coordinate"() {
Expand Down Expand Up @@ -105,7 +106,7 @@ class CsvWeatherSourceCosmoTest extends Specification implements CsvTestDataMeta
def coordinateSource = Mock(IdCoordinateSource)
coordinateSource.getCoordinate(_) >> { args -> args[0] == 5 ? Optional.of(defaultCoordinate) : Optional.empty() }
def weatherFactory = new CosmoTimeBasedWeatherValueFactory()
def source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new EntityPersistenceNamingStrategy(), coordinateSource, weatherFactory)
def source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new FileNamingStrategy(), coordinateSource, weatherFactory)
def fieldToValues = [
"uuid" : "71a79f59-eebf-40c1-8358-ba7414077d57",
"time" : "2020-10-16T12:40:42Z",
Expand Down Expand Up @@ -149,7 +150,7 @@ class CsvWeatherSourceCosmoTest extends Specification implements CsvTestDataMeta
def coordinateSource = Mock(IdCoordinateSource)
coordinateSource.getCoordinate(_) >> { args -> args[0] == 5 ? Optional.of(defaultCoordinate) : Optional.empty() }
def weatherFactory = new CosmoTimeBasedWeatherValueFactory()
def source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new EntityPersistenceNamingStrategy(), coordinateSource, weatherFactory)
def source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new FileNamingStrategy(), coordinateSource, weatherFactory)
def fieldToValues = [
"uuid" : "71a79f59-eebf-40c1-8358-ba7414077d57",
"time" : "2020-10-16T12:40:42Z",
Expand All @@ -174,7 +175,7 @@ class CsvWeatherSourceCosmoTest extends Specification implements CsvTestDataMeta
def coordinateSource = Mock(IdCoordinateSource)
coordinateSource.getCoordinate(_) >> { args -> args[0] == 5 ? Optional.of(defaultCoordinate) : Optional.empty() }
def weatherFactory = new CosmoTimeBasedWeatherValueFactory()
def source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new EntityPersistenceNamingStrategy(), coordinateSource, weatherFactory)
def source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new FileNamingStrategy(), coordinateSource, weatherFactory)
def fieldToValues = [
"uuid" : "71a79f59-eebf-40c1-8358-ba7414077d57",
"time" : "2020-10-16T12:40:42Z",
Expand All @@ -197,7 +198,7 @@ class CsvWeatherSourceCosmoTest extends Specification implements CsvTestDataMeta
def coordinateSource = Mock(IdCoordinateSource)
coordinateSource.getCoordinate(_) >> Optional.empty()
def weatherFactory = new CosmoTimeBasedWeatherValueFactory()
def source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new EntityPersistenceNamingStrategy(), coordinateSource, weatherFactory)
def source = new CsvWeatherSource(";", cosmoWeatherFolderPath, new FileNamingStrategy(), coordinateSource, weatherFactory)
def fieldToValues = [
"uuid" : "71a79f59-eebf-40c1-8358-ba7414077d57",
"time" : "2020-10-16T12:40:42Z",
Expand Down

0 comments on commit a8f1f98

Please sign in to comment.