Skip to content

Commit 2aff90f

Browse files
Merge branch 'dev' into df/#1278-v2g-rtd
2 parents dc52e0d + cda4611 commit 2aff90f

23 files changed

+591
-52
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### Added
1010
- Implemented GitHub Actions for automatic code integration. [#1237](https://github.com/ie3-institute/PowerSystemDataModel/issues/1237)
11+
- Added `CopyBuilders` to `Line-/Transformer2W-/Tranformer3WTypeInput` [#1275](https://github.com/ie3-institute/PowerSystemDataModel/issues/1275)
1112

1213
### Fixed
13-
14+
- Fixed SonarQube junit path issue in GitHub Actions [#1284](https://github.com/ie3-institute/PowerSystemDataModel/issues/1284)
1415
### Changed
1516
- Replaced `return this` with `return thisInstance` in CopyBuilders [#1250](https://github.com/ie3-institute/PowerSystemDataModel/issues/1250)
1617

build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
id 'de.undercouch.download' version '5.6.0'
1010
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
1111
id 'jacoco' // java code coverage plugin
12-
id "org.sonarqube" version "6.0.1.5171" // sonarqube
12+
id "org.sonarqube" version "6.1.0.5360" // sonarqube
1313
id 'net.thauvin.erik.gradle.semver' version '1.0.4' // semantic versioning
1414
id "com.github.johnrengelman.shadow" version "8.1.1" // fat jar
1515
}
@@ -81,7 +81,7 @@ dependencies {
8181
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
8282
testImplementation "org.spockframework:spock-core:2.3-groovy-$groovyVersion"
8383
testImplementation 'org.objenesis:objenesis:3.4' // Mock creation with constructor parameters
84-
testImplementation 'net.bytebuddy:byte-buddy:1.17.2' // Mocks of classes
84+
testImplementation 'net.bytebuddy:byte-buddy:1.17.4' // Mocks of classes
8585

8686
// testcontainers (docker framework for testing)
8787
testImplementation "org.testcontainers:testcontainers:$testcontainersVersion"
@@ -97,7 +97,7 @@ dependencies {
9797
implementation 'org.apache.logging.log4j:log4j-slf4j-impl' // log4j -> slf4j
9898

9999
// Databases
100-
implementation 'org.influxdb:influxdb-java:2.24'
100+
implementation 'org.influxdb:influxdb-java:2.25'
101101
implementation 'com.couchbase.client:java-client:3.7.9'
102102
runtimeOnly 'org.postgresql:postgresql:42.7.5' // postgresql jdbc driver required during runtime
103103

@@ -115,7 +115,7 @@ tasks.withType(Javadoc){
115115
failOnError = false // TODO: Temp until JavaDoc issues are resolved
116116
}
117117

118-
task printVersion {
118+
tasks.register('printVersion') {
119119
doLast {
120120
println project.version
121121
}

gradle/scripts/semVer.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// tasks for semantic versioning using semver-gradle https://github.com/ethauvin/semver-gradle
22

3-
task currentVersion {
4-
doFirst{
3+
tasks.register('currentVersion') {
4+
doFirst {
55
println semver.semver
66
}
77
}
88

9-
task devVersion {
10-
doFirst{
9+
tasks.register('devVersion') {
10+
doFirst {
1111
println "${semver.major}.${semver.minor}-SNAPSHOT"
1212
}
1313
}

gradle/scripts/sonarqube.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ sonarqube {
1414
'src/test/groovy'] // test src dirs
1515
// reports stuff (for all languages)
1616
property 'sonar.junit.reportPaths', [
17-
'build/test-results/allTests'] // Comma-delimited list of paths to Surefire XML-format reports.
17+
'build/test-results/test'] // Comma-delimited list of paths to Surefire XML-format reports.
1818
// unit tests reports dirs
1919
property "sonar.coverage.jacoco.xmlReportsPath", [
2020
"build/reports/jacoco/test/jacocoTestReport.xml"] // Comma-separated list of paths to JaCoCo (jacoco.xml) report files.

gradle/scripts/tests.gradle

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
test {
22
useJUnitPlatform()
33
testLogging {
4-
events "skipped", "failed"
4+
events = ["skipped", "failed"]
55
}
66

77
// Improve logging for failed Spock tests
88
testLogging {
9-
exceptionFormat "Full"
9+
exceptionFormat = "Full"
1010
}
1111
}
1212

13-
task unitTest(type: Test) {
14-
description 'Run only unit tests.'
15-
group 'Verification'
13+
tasks.register('unitTest', Test) {
14+
description = 'Run only unit tests.'
15+
group = 'Verification'
1616

1717
filter {
1818
includeTestsMatching '*Test*.*'
1919
excludeTestsMatching '*IT'
2020
}
2121
useJUnitPlatform()
2222
testLogging {
23-
events "skipped", "failed"
23+
events = ["skipped", "failed"]
2424
}
2525
}
2626

27-
task integrationTest(type: Test) {
28-
description 'Run only the integration tests.'
29-
group 'Verification'
27+
tasks.register('integrationTest', Test) {
28+
description = 'Run only the integration tests.'
29+
group = 'Verification'
3030

3131
filter {
3232
includeTestsMatching '*IT.*'
3333
excludeTestsMatching '*Test*.*'
3434
}
3535
useJUnitPlatform()
3636
testLogging {
37-
events "skipped", "failed"
37+
events = ["skipped", "failed"]
3838
}
3939

4040
mustRunAfter unitTest

src/main/java/edu/ie3/datamodel/models/input/AssetTypeInput.java

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public String getId() {
2626
return id;
2727
}
2828

29+
public abstract AssetTypeInputCopyBuilder<?> copy();
30+
2931
@Override
3032
public boolean equals(Object o) {
3133
if (this == o) return true;

src/main/java/edu/ie3/datamodel/models/input/connector/type/LineTypeInput.java

+71
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ public ComparableQuantity<ElectricPotential> getvRated() {
8282
return vRated;
8383
}
8484

85+
@Override
86+
public LineTypeInputCopyBuilder copy() {
87+
return new LineTypeInputCopyBuilder(this);
88+
}
89+
8590
@Override
8691
public boolean equals(Object o) {
8792
if (this == o) return true;
@@ -121,4 +126,70 @@ public String toString() {
121126
+ vRated
122127
+ '}';
123128
}
129+
130+
/**
131+
* Abstract class for all builder that build child entities of abstract class {@link
132+
* LineTypeInput}
133+
*/
134+
public static final class LineTypeInputCopyBuilder
135+
extends AssetTypeInput.AssetTypeInputCopyBuilder<LineTypeInputCopyBuilder> {
136+
137+
private ComparableQuantity<SpecificConductance> b;
138+
private ComparableQuantity<SpecificConductance> g;
139+
private ComparableQuantity<SpecificResistance> r;
140+
private ComparableQuantity<SpecificResistance> x;
141+
private ComparableQuantity<ElectricCurrent> iMax;
142+
private ComparableQuantity<ElectricPotential> vRated;
143+
144+
protected LineTypeInputCopyBuilder(LineTypeInput entity) {
145+
super(entity);
146+
this.b = entity.b;
147+
this.g = entity.g;
148+
this.r = entity.r;
149+
this.x = entity.x;
150+
this.iMax = entity.iMax;
151+
this.vRated = entity.vRated;
152+
}
153+
154+
/** Setter */
155+
public LineTypeInputCopyBuilder b(ComparableQuantity<SpecificConductance> b) {
156+
this.b = b;
157+
return thisInstance();
158+
}
159+
160+
public LineTypeInputCopyBuilder g(ComparableQuantity<SpecificConductance> g) {
161+
this.g = g;
162+
return thisInstance();
163+
}
164+
165+
public LineTypeInputCopyBuilder r(ComparableQuantity<SpecificResistance> r) {
166+
this.r = r;
167+
return thisInstance();
168+
}
169+
170+
public LineTypeInputCopyBuilder x(ComparableQuantity<SpecificResistance> x) {
171+
this.x = x;
172+
return thisInstance();
173+
}
174+
175+
public LineTypeInputCopyBuilder iMax(ComparableQuantity<ElectricCurrent> iMax) {
176+
this.iMax = iMax;
177+
return thisInstance();
178+
}
179+
180+
public LineTypeInputCopyBuilder vRated(ComparableQuantity<ElectricPotential> vRated) {
181+
this.vRated = vRated;
182+
return thisInstance();
183+
}
184+
185+
@Override
186+
public LineTypeInput build() {
187+
return new LineTypeInput(getUuid(), getId(), b, g, r, x, iMax, vRated);
188+
}
189+
190+
@Override
191+
protected LineTypeInputCopyBuilder thisInstance() {
192+
return this;
193+
}
194+
}
124195
}

src/main/java/edu/ie3/datamodel/models/input/connector/type/Transformer2WTypeInput.java

+124
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public int getTapMax() {
142142
return tapMax;
143143
}
144144

145+
@Override
146+
public Transformer2WTypeInputCopyBuilder copy() {
147+
return new Transformer2WTypeInputCopyBuilder(this);
148+
}
149+
145150
@Override
146151
public boolean equals(Object o) {
147152
if (this == o) return true;
@@ -216,4 +221,123 @@ public String toString() {
216221
+ tapMax
217222
+ '}';
218223
}
224+
225+
/**
226+
* Abstract class for all builder that build child entities of abstract class {@link
227+
* Transformer2WTypeInput}
228+
*/
229+
public static final class Transformer2WTypeInputCopyBuilder
230+
extends AssetTypeInput.AssetTypeInputCopyBuilder<Transformer2WTypeInputCopyBuilder> {
231+
232+
private ComparableQuantity<ElectricResistance> rSc;
233+
private ComparableQuantity<ElectricResistance> xSc;
234+
private ComparableQuantity<Power> sRated;
235+
private ComparableQuantity<ElectricPotential> vRatedA;
236+
private ComparableQuantity<ElectricPotential> vRatedB;
237+
private ComparableQuantity<ElectricConductance> gM;
238+
private ComparableQuantity<ElectricConductance> bM;
239+
private ComparableQuantity<Dimensionless> dV;
240+
private ComparableQuantity<Angle> dPhi;
241+
private boolean tapSide;
242+
private int tapNeutr;
243+
private int tapMin;
244+
private int tapMax;
245+
246+
private Transformer2WTypeInputCopyBuilder(Transformer2WTypeInput entity) {
247+
super(entity);
248+
this.rSc = entity.rSc;
249+
this.xSc = entity.xSc;
250+
this.sRated = entity.sRated;
251+
this.vRatedA = entity.vRatedA;
252+
this.vRatedB = entity.vRatedB;
253+
this.gM = entity.gM;
254+
this.bM = entity.bM;
255+
this.dV = entity.dV;
256+
this.dPhi = entity.dPhi;
257+
this.tapSide = entity.tapSide;
258+
this.tapNeutr = entity.tapNeutr;
259+
this.tapMin = entity.tapMin;
260+
this.tapMax = entity.tapMax;
261+
}
262+
263+
/** Setter */
264+
public Transformer2WTypeInputCopyBuilder rSc(ComparableQuantity<ElectricResistance> rSc) {
265+
this.rSc = rSc;
266+
return thisInstance();
267+
}
268+
269+
public Transformer2WTypeInputCopyBuilder xSc(ComparableQuantity<ElectricResistance> xSc) {
270+
this.xSc = xSc;
271+
return thisInstance();
272+
}
273+
274+
public Transformer2WTypeInputCopyBuilder sRated(ComparableQuantity<Power> sRated) {
275+
this.sRated = sRated;
276+
return thisInstance();
277+
}
278+
279+
public Transformer2WTypeInputCopyBuilder vRatedA(
280+
ComparableQuantity<ElectricPotential> vRatedA) {
281+
this.vRatedA = vRatedA;
282+
return thisInstance();
283+
}
284+
285+
public Transformer2WTypeInputCopyBuilder vRatedB(
286+
ComparableQuantity<ElectricPotential> vRatedB) {
287+
this.vRatedB = vRatedB;
288+
return thisInstance();
289+
}
290+
291+
public Transformer2WTypeInputCopyBuilder gM(ComparableQuantity<ElectricConductance> gM) {
292+
this.gM = gM;
293+
return thisInstance();
294+
}
295+
296+
public Transformer2WTypeInputCopyBuilder bM(ComparableQuantity<ElectricConductance> bM) {
297+
this.bM = bM;
298+
return thisInstance();
299+
}
300+
301+
public Transformer2WTypeInputCopyBuilder dV(ComparableQuantity<Dimensionless> dV) {
302+
this.dV = dV;
303+
return thisInstance();
304+
}
305+
306+
public Transformer2WTypeInputCopyBuilder dPhi(ComparableQuantity<Angle> dPhi) {
307+
this.dPhi = dPhi;
308+
return thisInstance();
309+
}
310+
311+
public Transformer2WTypeInputCopyBuilder tapSide(boolean tapSide) {
312+
this.tapSide = tapSide;
313+
return thisInstance();
314+
}
315+
316+
public Transformer2WTypeInputCopyBuilder tapNeutr(int tapNeutr) {
317+
this.tapNeutr = tapNeutr;
318+
return thisInstance();
319+
}
320+
321+
public Transformer2WTypeInputCopyBuilder tapMin(int tapMin) {
322+
this.tapMin = tapMin;
323+
return thisInstance();
324+
}
325+
326+
public Transformer2WTypeInputCopyBuilder tapMax(int tapMax) {
327+
this.tapMax = tapMax;
328+
return thisInstance();
329+
}
330+
331+
@Override
332+
public Transformer2WTypeInput build() {
333+
return new Transformer2WTypeInput(
334+
getUuid(), getId(), rSc, xSc, sRated, vRatedA, vRatedB, gM, bM, dV, dPhi, tapSide,
335+
tapNeutr, tapMin, tapMax);
336+
}
337+
338+
@Override
339+
protected Transformer2WTypeInputCopyBuilder thisInstance() {
340+
return this;
341+
}
342+
}
219343
}

0 commit comments

Comments
 (0)