Skip to content

Commit

Permalink
- update gradle 6.0.1 -> 2.7
Browse files Browse the repository at this point in the history
- kill one-jar gradle plugin
- update pmd from 6.24.0 -> 6.38.0
  • Loading branch information
johanneshiry committed Aug 30, 2021
1 parent 47bc608 commit dbb49d2
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 85 deletions.
42 changes: 20 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
id 'pmd' // code check, working on source code
id 'com.diffplug.spotless' version '5.14.3'//code format
id 'com.github.spotbugs' version '4.7.3' // code check, working on byte code
id 'com.github.onslip.gradle-one-jar' version '1.0.6' // pack a self contained jar
id 'de.undercouch.download' version '4.1.2'
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
id 'jacoco' // java code coverage plugin
Expand All @@ -33,7 +32,6 @@ apply from: scriptsLocation + 'pmd.gradle'
apply from: scriptsLocation + 'spotbugs.gradle'
apply from: scriptsLocation + 'spotless.gradle'
apply from: scriptsLocation + 'checkJavaVersion.gradle'
apply from: scriptsLocation + 'selfContainedJar.gradle'
apply from: scriptsLocation + 'documentation.gradle'
apply from: scriptsLocation + 'jacoco.gradle' // jacoco java code coverage
apply from: scriptsLocation + 'mavenCentralPublish.gradle'
Expand All @@ -46,47 +44,47 @@ repositories {
maven { url 'https://www.jitpack.io' } // allows github repos as dependencies

// sonatype snapshot repo
maven { url 'http://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }

}

dependencies {
// ie³ power system utils
compile 'com.github.ie3-institute:PowerSystemUtils:1.5.3'
implementation 'com.github.ie3-institute:PowerSystemUtils:1.5.3'

implementation 'tech.units:indriya:2.1.2'

// JTS Topology Suite for GeoPositions, License: EPL 1.0 / EDL 1.0
compile 'org.locationtech.jts:jts-core:1.18.1'
compile 'org.locationtech.jts.io:jts-io-common:1.18.1'
implementation 'org.locationtech.jts:jts-core:1.18.1'
implementation 'org.locationtech.jts.io:jts-io-common:1.18.1'

// Graphs
compile 'org.jgrapht:jgrapht-core:1.4.0'
implementation 'org.jgrapht:jgrapht-core:1.4.0'

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

// testcontainers (docker framework for testing)
testCompile "org.testcontainers:testcontainers:$testcontainersVersion"
testCompile "org.testcontainers:spock:$testcontainersVersion"
testCompile "org.testcontainers:influxdb:$testcontainersVersion"
testCompile "org.testcontainers:postgresql:$testcontainersVersion"
testCompile "org.testcontainers:couchbase:$testcontainersVersion"
testImplementation "org.testcontainers:testcontainers:$testcontainersVersion"
testImplementation "org.testcontainers:spock:$testcontainersVersion"
testImplementation "org.testcontainers:influxdb:$testcontainersVersion"
testImplementation "org.testcontainers:postgresql:$testcontainersVersion"
testImplementation "org.testcontainers:couchbase:$testcontainersVersion"

// logging
compile 'org.apache.logging.log4j:log4j-api:2.14.1' // log4j
compile 'org.apache.logging.log4j:log4j-core:2.14.1' // log4j
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.1' // log4j -> slf4j
implementation 'org.apache.logging.log4j:log4j-api:2.14.1' // log4j
implementation 'org.apache.logging.log4j:log4j-core:2.14.1' // log4j
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.1' // log4j -> slf4j

// Databases
compile 'org.influxdb:influxdb-java:2.21'
compile 'com.couchbase.client:java-client:3.2.0'
implementation 'org.influxdb:influxdb-java:2.21'
implementation 'com.couchbase.client:java-client:3.2.0'
runtimeOnly 'org.postgresql:postgresql:42.2.23' // postgresql jdbc driver required during runtime

compile 'commons-io:commons-io:2.11.0' // I/O functionalities
compile 'org.apache.commons:commons-compress:1.21' // I/O functionalities
implementation 'commons-io:commons-io:2.11.0' // I/O functionalities
implementation 'org.apache.commons:commons-compress:1.21' // I/O functionalities
}

wrapper {
Expand Down
4 changes: 2 additions & 2 deletions gradle/scripts/pmd.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
pmd {
ignoreFailures true // dont let the build fail on rule violations

toolVersion = "6.24.0"
toolVersion = "6.38.0"

// pmd rule priority is a range from 1 to 5, with 1 being the highest priority
// the default rule priority is 5
rulePriority 2
rulesMinimumPriority = 2
}
6 changes: 0 additions & 6 deletions gradle/scripts/selfContainedJar.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Mon Dec 02 10:39:11 CET 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
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

0 comments on commit dbb49d2

Please sign in to comment.