Skip to content

Commit

Permalink
set stashed status for all modification (#346)
Browse files Browse the repository at this point in the history
- add unit test to check stashed is set

Signed-off-by: jamal-khey <[email protected]>
  • Loading branch information
jamal-khey committed Oct 16, 2023
1 parent 2c3209a commit 73591df
Show file tree
Hide file tree
Showing 81 changed files with 177 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public GroovyScriptInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.script(getScript());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public BatteryCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.voltageLevelId(getVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private void assignAttributes(ConverterStationCreationInfos converterStationCrea

public ConverterStationCreationInfos toConverterStationInfos() {
return ConverterStationCreationInfos.builder()
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.lossFactor(getLossFactor())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public GeneratorCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.voltageLevelId(getVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void update(ModificationInfos modificationInfos) {
}

private void assignAttributes(LineCreationInfos lineCreationInfos) {
setStashed(lineCreationInfos.getStashed());
shuntConductance1 = lineCreationInfos.getShuntConductance1();
shuntSusceptance1 = lineCreationInfos.getShuntSusceptance1();
shuntConductance2 = lineCreationInfos.getShuntConductance2();
Expand All @@ -64,6 +65,7 @@ public LineCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.seriesResistance(getSeriesResistance())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public LoadCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.voltageLevelId(getVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public ShuntCompensatorCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.voltageLevelId(getVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public SubstationCreationInfos toSubstationCreationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.substationCountry(getCountry())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public TwoWindingsTransformerCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.seriesResistance(getSeriesResistance())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public VoltageLevelCreationInfos toModificationInfos() {
}

public VoltageLevelCreationInfos toVoltageLevelCreationInfos() {
return toVoltageLevelCreationInfosBuilder().build();
return toVoltageLevelCreationInfosBuilder().stashed(false).build();
}

private VoltageLevelCreationInfos.VoltageLevelCreationInfosBuilder<?, ?> toVoltageLevelCreationInfosBuilder() {
Expand All @@ -92,6 +92,7 @@ public VoltageLevelCreationInfos toVoltageLevelCreationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.substationId(getSubstationId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public void update(@NonNull ModificationInfos modificationInfos) {
}

private void assignAttributes(VscCreationInfos vscCreationInfos) {
this.setStashed(vscCreationInfos.getStashed());
this.activePower = vscCreationInfos.getActivePower();
this.angleDroopActivePowerControl = vscCreationInfos.getAngleDroopActivePowerControl();
this.droop = vscCreationInfos.getDroop();
Expand All @@ -115,10 +116,10 @@ public VscCreationInfos toModificationInfos() {
private VscCreationInfos.VscCreationInfosBuilder<?, ?> toVscCreationInfosBuilder() {
ConverterStationCreationInfos converterStationCreationInfos1 = getConverterStation1() == null ? null : getConverterStation1().toConverterStationInfos();
ConverterStationCreationInfos converterStationCreationInfos2 = getConverterStation2() == null ? null : getConverterStation2().toConverterStationInfos();

return VscCreationInfos.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.activePower(getActivePower())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public EquipmentDeletionInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentType(getEquipmentType());
if (equipmentInfos != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public BatteryModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public BranchStatusModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.action(getAction())
.energizedVoltageLevelId(getEnergizedVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public DeleteAttachingLineInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToAttachTo1Id(getLineToAttachTo1Id())
.lineToAttachTo2Id(getLineToAttachTo2Id())
.attachedLineId(getAttachedLineId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public DeleteVoltageLevelOnLineInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToAttachTo1Id(getLineToAttachTo1Id())
.lineToAttachTo2Id(getLineToAttachTo2Id())
.replacingLine1Id(getReplacingLine1Id())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public GenerationDispatchInfos toModificationInfos() {
return GenerationDispatchInfos.builder()
.date(getDate())
.uuid(getId())
.stashed(getStashed())
.lossCoefficient(getLossCoefficient())
.defaultOutageRate(getDefaultOutageRate())
.generatorsWithoutOutage(toGeneratorsFilters(generatorsWithoutOutage))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public GeneratorModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public GeneratorScalingInfos toModificationInfos() {
return GeneratorScalingInfos.builder()
.date(getDate())
.uuid(getId())
.stashed(getStashed())
.variationType(getVariationType())
.variations(getVariations().stream()
.map(ScalingVariationEntity::toScalingVariationInfos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public LineAttachToVoltageLevelInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToAttachToId(getLineToAttachToId())
.percent(getPercent())
.attachmentPointId(getAttachmentPointId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public LineModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.seriesResistance(toAttributeModification(getSeriesResistance()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void update(@NonNull ModificationInfos modificationInfos) {
}

private void assignAttributes(LineSplitWithVoltageLevelInfos splitWithVoltageLevelInfos) {
setStashed(splitWithVoltageLevelInfos.getStashed());
lineToSplitId = splitWithVoltageLevelInfos.getLineToSplitId();
percent = splitWithVoltageLevelInfos.getPercent();
mayVoltageLevelCreation = null; // Need for the update
Expand All @@ -89,6 +90,7 @@ public LineSplitWithVoltageLevelInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToSplitId(getLineToSplitId())
.percent(getPercent())
.mayNewVoltageLevelInfos(mayVoltageLevelCreation == null ? null : mayVoltageLevelCreation.toVoltageLevelCreationInfos())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private LinesAttachToSplitLinesInfos.LinesAttachToSplitLinesInfosBuilder toLines
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToAttachTo1Id(getLineToAttachTo1Id())
.lineToAttachTo2Id(getLineToAttachTo2Id())
.attachedLineId(getAttachedLineId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public LoadModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public LoadScalingInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.variationType(getVariationType())
.variations(getVariations().stream()
.map(ScalingVariationEntity::toScalingVariationInfos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public ShuntCompensatorModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.voltageLevelId(getVoltageLevelId())
.equipmentId(getEquipmentId())
.equipmentName(toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public SubstationModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.substationCountry(AttributeModification.toAttributeModification(getSubstationCountryValue(), getSubstationCountryOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public TwoWindingsTransformerModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.seriesResistance(AttributeModification.toAttributeModification(getSeriesResistance()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public VoltageInitModificationInfos toModificationInfos() {
return VoltageInitModificationInfos.builder()
.date(getDate())
.uuid(getId())
.stashed(getStashed())
.generators(toGeneratorsModification(generators))
.transformers(toTransformersModification(transformers))
.staticVarCompensators(toStaticVarCompensatorsModification(staticVarCompensators))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public VoltageLevelModificationInfos toModificationInfos() {
.uuid(getId())
.equipmentId(getEquipmentId())
.date(getDate())
.stashed(getStashed())
.equipmentName(toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.nominalVoltage(toAttributeModification(getNominalVoltage()))
.lowVoltageLimit(toAttributeModification(getLowVoltageLimit()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public EquipmentAttributeModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentAttributeName(getAttributeName())
.equipmentAttributeValue(getAttributeValue())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ public void testCreateVoltageInitModification() throws Exception {
.shuntCompensatorId("v6shunt")
.sectionCount(1)
.connect(false)
.build()))
.build())).stashed(false)
.build();

MvcResult mvcResult = mockMvc.perform(post("/v1/groups/modification")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public void testRead() throws Exception {
});

assertThat(receivedModification).recursivelyEquals(modificationToRead);
assertNotNull(receivedModification.getStashed());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BatteryCreationInfos.builder()
.stashed(false)
.equipmentId("idBattery2")
.equipmentName("nameBattery2")
.voltageLevelId("v1")
Expand All @@ -60,6 +61,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BatteryCreationInfos.builder()
.stashed(false)
.equipmentId("idBattery2")
.equipmentName("nameBatteryModified")
.voltageLevelId("v1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ protected Network createNetwork(UUID networkUuid) {
protected ModificationInfos buildModification() {
// create new battery in voltage level with node/breaker topology (in voltage level "v2" and busbar section "1B")
return BatteryCreationInfos.builder()
.stashed(false)
.equipmentId("idBattery1")
.equipmentName("idBattery1")
.voltageLevelId("v2")
Expand All @@ -65,6 +66,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BatteryCreationInfos.builder()
.stashed(false)
.equipmentId("idBattery2")
.equipmentName("nameBatteryModified")
.voltageLevelId("v1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BatteryModificationInfos.builder()
.stashed(false)
.equipmentId("v3Battery")
.equipmentName(new AttributeModification<>("newV1Battery", OperationType.SET))
.activePowerSetpoint(new AttributeModification<>(80.0, OperationType.SET))
Expand All @@ -59,6 +60,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BatteryModificationInfos.builder()
.stashed(false)
.equipmentId("idBattery")
.equipmentName(new AttributeModification<>("newV1BatteryEdited", OperationType.SET))
.activePowerSetpoint(new AttributeModification<>(81.0, OperationType.SET))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(TARGET_LINE_ID)
.energizedVoltageLevelId("vl1")
.action(BranchStatusModificationInfos.ActionType.ENERGISE_END_ONE).build();
Expand All @@ -51,6 +52,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId("line1")
.energizedVoltageLevelId("vl1_bis")
.action(BranchStatusModificationInfos.ActionType.TRIP).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(TARGET_LINE_ID)
.energizedVoltageLevelId("vl2")
.action(BranchStatusModificationInfos.ActionType.ENERGISE_END_TWO).build();
Expand All @@ -51,6 +52,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId("line1")
.energizedVoltageLevelId("vl2_bis")
.action(BranchStatusModificationInfos.ActionType.TRIP).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(TARGET_LINE_ID)
.action(BranchStatusModificationInfos.ActionType.LOCKOUT).build();
}

@Override
protected ModificationInfos buildModificationUpdate() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(UPDATE_BRANCH_ID)
.action(BranchStatusModificationInfos.ActionType.SWITCH_ON).build();
}
Expand Down
Loading

0 comments on commit 73591df

Please sign in to comment.