Skip to content
Merged
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
1,158 changes: 596 additions & 562 deletions Jenkinsfile

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {

ext {
//version (changing these should be considered thoroughly!)
javaVersion = JavaVersion.VERSION_1_8
javaVersion = JavaVersion.VERSION_17
tscfgVersion = '0.9.9'
testcontainersVersion = '1.16.2'

Expand Down Expand Up @@ -74,7 +74,7 @@ dependencies {

// testing
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
testImplementation 'org.spockframework:spock-core:2.1-M2-groovy-3.0'
testImplementation 'org.objenesis:objenesis:3.2' // Mock creation with constructor parameters

// testcontainers (docker framework for testing)
Expand Down
12 changes: 11 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m


# Workaround to make spotless work with java 17 -
# see https://github.com/diffplug/spotless/tree/main/plugin-gradle#google-java-format and
# https://github.com/ie3-institute/PowerSystemDataModel/issues/481 for details
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down
2 changes: 1 addition & 1 deletion gradle/scripts/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// general configuration
jacoco {
toolVersion = "0.8.4"
toolVersion = "0.8.7"
reportsDir = file("$buildDir/reports/jacoco")
}

Expand Down
8 changes: 4 additions & 4 deletions gradle/scripts/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ spotless {
//sets a license header, removes unused imports and formats conforming to the google java format
java {
removeUnusedImports() // removes any unused imports
googleJavaFormat()
googleJavaFormat('1.13.0')
licenseHeader ie3LicHead
}


/* cf. https://github.com/diffplug/spotless/tree/master/plugin-gradle */
groovy {
licenseHeader ie3LicHead
excludeJava() // excludes all Java sources within the Groovy source dirs from formatting

target '**.groovy', 'Jenkinsfile'
licenseHeader "#!groovy\n\n" + ie3LicHead, "////////////////////////////////"
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
// so it formats Java files by default (unless `excludeJava` is used).
greclipse()
indentWithSpaces 2
}

groovyGradle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ public Optional<IndividualTimeSeriesMetaInformation> getIndividualTimeSeriesMeta
*/
private Map<UUID, CsvIndividualTimeSeriesMetaInformation>
buildIndividualTimeSeriesMetaInformation() {
return getIndividualTimeSeriesFilePaths()
.parallelStream()
return getIndividualTimeSeriesFilePaths().parallelStream()
.map(
filePath -> {
/* Extract meta information from file path and enhance it with the file path itself */
Expand All @@ -260,8 +259,7 @@ public Optional<IndividualTimeSeriesMetaInformation> getIndividualTimeSeriesMeta
*/
public Map<ColumnScheme, Set<CsvIndividualTimeSeriesMetaInformation>>
getCsvIndividualTimeSeriesMetaInformation(ColumnScheme... columnSchemes) {
return getIndividualTimeSeriesFilePaths()
.parallelStream()
return getIndividualTimeSeriesFilePaths().parallelStream()
.map(
pathString -> {
String filePathWithoutEnding = removeFileEnding(pathString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ private SortedMap<String, FieldSourceToMethod> buildFieldToSource(
Class<T> timeSeriesClass, Class<E> entryClass, Class<V> valueClass) {
/* Get the mapping from field name to getter method ignoring the getter for returning all entries */
Map<String, FieldSourceToMethod> timeSeriesMapping =
mapFieldNameToGetter(timeSeriesClass, Arrays.asList("entries", "uuid", "type")).entrySet()
mapFieldNameToGetter(timeSeriesClass, Arrays.asList("entries", "uuid", "type"))
.entrySet()
.stream()
.collect(
Collectors.toMap(
Expand Down Expand Up @@ -136,7 +137,8 @@ private SortedMap<String, FieldSourceToMethod> buildFieldToSource(
mapFieldNameToGetter(
valueClass,
Arrays.asList("solarIrradiance", "temperature", "wind"))
.entrySet().stream()
.entrySet()
.stream()
.map(
entry ->
new AbstractMap.SimpleEntry<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,7 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap(
Collection<Map<String, String>> allRows = csvRowFieldValueMapping(reader, headline);

return distinctRowsWithLog(
allRows,
fieldToValues -> fieldToValues.get("uuid"),
entityClass.getSimpleName(),
"UUID")
allRows, fieldToValues -> fieldToValues.get("uuid"), entityClass.getSimpleName(), "UUID")
.parallelStream();
} catch (IOException e) {
log.warn(
Expand Down Expand Up @@ -455,8 +452,7 @@ protected Set<Map<String, String>> distinctRowsWithLog(

/* Check for rows with the same key based on the provided key extractor function */
Set<Map<String, String>> distinctIdSet =
allRowsSet
.parallelStream()
allRowsSet.parallelStream()
.filter(ValidationUtils.distinctByKey(keyExtractor))
.collect(Collectors.toSet());
if (distinctIdSet.size() != allRowsSet.size()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap() {
.get(factory.getLatField())
.concat(fieldToValues.get(factory.getLonField()));
return distinctRowsWithLog(
withDistinctCoordinateId, coordinateExtractor, "coordinate id mapping", "coordinate")
withDistinctCoordinateId, coordinateExtractor, "coordinate id mapping", "coordinate")
.parallelStream();
} catch (IOException e) {
log.error("Cannot read the file for coordinate id to coordinate mapping.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap(
.get(weatherFactory.getTimeFieldString())
.concat(fieldToValues.get(weatherFactory.getCoordinateIdFieldString()));
return distinctRowsWithLog(
allRows, timeCoordinateIdExtractor, entityClass.getSimpleName(), "UUID")
allRows, timeCoordinateIdExtractor, entityClass.getSimpleName(), "UUID")
.parallelStream();

} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ public GraphicElements(List<GraphicInput> graphics) {

/* init sets */
this.nodeGraphics =
graphics
.parallelStream()
graphics.parallelStream()
.filter(graphic -> graphic instanceof NodeGraphicInput)
.map(graphic -> (NodeGraphicInput) graphic)
.collect(Collectors.toSet());
this.lineGraphics =
graphics
.parallelStream()
graphics.parallelStream()
.filter(graphic -> graphic instanceof LineGraphicInput)
.map(graphic -> (LineGraphicInput) graphic)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,38 +84,32 @@ public RawGridElements(List<AssetInput> rawGridElements) {

/* init sets */
this.nodes =
rawGridElements
.parallelStream()
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof NodeInput)
.map(nodeInput -> (NodeInput) nodeInput)
.collect(Collectors.toSet());
this.lines =
rawGridElements
.parallelStream()
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof LineInput)
.map(lineInput -> (LineInput) lineInput)
.collect(Collectors.toSet());
this.transformer2Ws =
rawGridElements
.parallelStream()
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof Transformer2WInput)
.map(trafo2wInput -> (Transformer2WInput) trafo2wInput)
.collect(Collectors.toSet());
this.transformer3Ws =
rawGridElements
.parallelStream()
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof Transformer3WInput)
.map(trafo3wInput -> (Transformer3WInput) trafo3wInput)
.collect(Collectors.toSet());
this.switches =
rawGridElements
.parallelStream()
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof SwitchInput)
.map(switchInput -> (SwitchInput) switchInput)
.collect(Collectors.toSet());
this.measurementUnits =
rawGridElements
.parallelStream()
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof MeasurementUnitInput)
.map(measurementUnitInput -> (MeasurementUnitInput) measurementUnitInput)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,62 +106,52 @@ public SystemParticipants(List<SystemParticipantInput> systemParticipants) {

/* init sets */
this.bmPlants =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof BmInput)
.map(bmInput -> (BmInput) bmInput)
.collect(Collectors.toSet());
this.chpPlants =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof ChpInput)
.map(chpInput -> (ChpInput) chpInput)
.collect(Collectors.toSet());
this.evCS =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof EvcsInput)
.map(evcsInput -> (EvcsInput) evcsInput)
.collect(Collectors.toSet());
this.evs =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof EvInput)
.map(evInput -> (EvInput) evInput)
.collect(Collectors.toSet());
this.fixedFeedIns =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof FixedFeedInInput)
.map(fixedFeedInInpu -> (FixedFeedInInput) fixedFeedInInpu)
.collect(Collectors.toSet());
this.heatPumps =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof HpInput)
.map(hpInput -> (HpInput) hpInput)
.collect(Collectors.toSet());
this.loads =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof LoadInput)
.map(loadInput -> (LoadInput) loadInput)
.collect(Collectors.toSet());
this.pvPlants =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof PvInput)
.map(pvInput -> (PvInput) pvInput)
.collect(Collectors.toSet());
this.storages =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof StorageInput)
.map(storageInput -> (StorageInput) storageInput)
.collect(Collectors.toSet());
this.wecPlants =
systemParticipants
.parallelStream()
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof WecInput)
.map(wecInput -> (WecInput) wecInput)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ private ChargingPointTypeUtils() {
Stream.concat(
Stream.of(type.getId().toLowerCase()),
type.getSynonymousIds().stream().map(String::toLowerCase))
.collect(Collectors.toMap(Function.identity(), v -> type)).entrySet()
.collect(Collectors.toMap(Function.identity(), v -> type))
.entrySet()
.stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ private static SystemParticipants updateSystemParticipantsWithNodes(
SystemParticipants systemParticipants, Map<NodeInput, NodeInput> oldToNewNodes) {

List<SystemParticipantInput> sysParts =
systemParticipants
.allEntitiesAsList()
.parallelStream()
systemParticipants.allEntitiesAsList().parallelStream()
.map(
sysPart -> {
if (oldToNewNodes.containsKey(sysPart.getNode())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import edu.ie3.datamodel.io.naming.FileNamingStrategy
*/
trait CsvTestDataMeta {

static String testParticipantsBaseFolderPath = new File(getClass().getResource('/testGridFiles').toURI()).absolutePath
static String testTimeSeriesBaseFolderPath = new File(getClass().getResource('/testTimeSeriesFiles').toURI()).absolutePath
static String testParticipantsBaseFolderPath = new File(CsvTestDataMeta.getResource('/testGridFiles').toURI()).absolutePath
static String testTimeSeriesBaseFolderPath = new File(CsvTestDataMeta.getResource('/testTimeSeriesFiles').toURI()).absolutePath
static String graphicsFolderPath = testParticipantsBaseFolderPath.concat(File.separator).concat("graphics")
static String typeFolderPath = testParticipantsBaseFolderPath.concat(File.separator).concat("types")
static String gridFolderPath = testParticipantsBaseFolderPath.concat(File.separator).concat("grid")
Expand Down