diff --git a/src/test/java/org/gridsuite/modification/server/service/BuildTest.java b/src/test/java/org/gridsuite/modification/server/service/BuildTest.java index 56c559a8b..f505fba68 100644 --- a/src/test/java/org/gridsuite/modification/server/service/BuildTest.java +++ b/src/test/java/org/gridsuite/modification/server/service/BuildTest.java @@ -822,77 +822,6 @@ public void runBuildTest() throws Exception { assertEquals(1, tbseqVariant1.size()); assertEquals(tbseqVariant1.size(), tbseqVariant2.size()); - // deactivate some modifications and rebuild VARIANT_ID - network.getVariantManager().cloneVariant(VariantManagerConstants.INITIAL_VARIANT_ID, NetworkCreation.VARIANT_ID, true); - - AtomicReference lineModificationEntityUuid = new AtomicReference<>(); - AtomicReference loadCreationEntityUuid = new AtomicReference<>(); - AtomicReference equipmentDeletionEntityUuid = new AtomicReference<>(); - List modificationsInfos = networkModificationService.getNetworkModifications(TEST_GROUP_ID, false, true); - modificationsInfos.addAll(networkModificationService.getNetworkModifications(TEST_GROUP_ID_2, false, true)); - modificationsInfos.forEach(modificationInfos -> { - if (modificationInfos.getClass().equals(EquipmentAttributeModificationInfos.class)) { - if (((EquipmentAttributeModificationInfos) modificationInfos).getEquipmentId().equals("line1")) { - lineModificationEntityUuid.set(modificationInfos.getUuid()); - } - } else if (modificationInfos.getClass().equals(LoadCreationInfos.class)) { - if (((LoadCreationInfos) modificationInfos).getEquipmentId().equals("newLoad1")) { - loadCreationEntityUuid.set(modificationInfos.getUuid()); - } - } else if (modificationInfos.getClass().equals(EquipmentDeletionInfos.class)) { - if (((EquipmentDeletionInfos) modificationInfos).getEquipmentId().equals("v2shunt")) { - equipmentDeletionEntityUuid.set(modificationInfos.getUuid()); - } - } - }); - - buildInfosJson = objectWriter.writeValueAsString(buildInfos); - - mockMvc.perform(post(uriString, TEST_NETWORK_ID).content(buildInfosJson).contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()); - - resultMessage = output.receive(TIMEOUT, buildResultDestination); - assertNotNull(resultMessage); - assertEquals("me", resultMessage.getHeaders().get("receiver")); - // 1 : SWITCH equipments are reduced to collection impact - // + 2 substation modifications - // = 3 - testElementImpacts(mapper, new String(resultMessage.getPayload()), 3, Set.of(IdentifiableType.SWITCH), Set.of("newSubstation", "s1")); - buildMessage = output.receive(TIMEOUT, consumeBuildDestination); - assertNotNull(buildMessage); - assertEquals("me", buildMessage.getHeaders().get("receiver")); - - // test that only active modifications have been made on variant VARIANT_ID - network.getVariantManager().setWorkingVariant(NetworkCreation.VARIANT_ID); - assertTrue(network.getSwitch("v1d1").isOpen()); - assertNull(network.getLine("line1").getExtension(OperatingStatus.class)); - assertEquals(55., network.getGenerator("idGenerator").getTargetP(), 0.1); - assertEquals(2, network.getTwoWindingsTransformer("trf1").getRatioTapChanger().getTapPosition()); - assertEquals(0, network.getThreeWindingsTransformer("trf6").getLeg1().getPhaseTapChanger().getTapPosition()); - assertNotNull(network.getLoad("newLoad")); - assertNull(network.getLoad("newLoad1")); - assertEquals(EnergySource.HYDRO, network.getGenerator(NEW_GENERATOR_ID).getEnergySource()); - assertEquals("v2", network.getGenerator(NEW_GENERATOR_ID).getTerminal().getVoltageLevel().getId()); - assertEquals(500., network.getGenerator(NEW_GENERATOR_ID).getMaxP(), 0.1); - assertEquals(100., network.getGenerator(NEW_GENERATOR_ID).getTargetP(), 0.1); - assertTrue(network.getGenerator(NEW_GENERATOR_ID).isVoltageRegulatorOn()); - assertEquals(225., network.getGenerator(NEW_GENERATOR_ID).getTargetV(), 0.1); - assertEquals("v1", network.getLine("newLine").getTerminal1().getVoltageLevel().getId()); - assertEquals("v2", network.getLine("newLine").getTerminal2().getVoltageLevel().getId()); - assertEquals(4., network.getLine("newLine").getB1(), 0.1); - assertEquals("v1", network.getTwoWindingsTransformer("new2wt").getTerminal1().getVoltageLevel().getId()); - assertEquals("v2", network.getTwoWindingsTransformer("new2wt").getTerminal2().getVoltageLevel().getId()); - assertEquals(2., network.getTwoWindingsTransformer("new2wt").getX(), 0.1); - assertEquals(5., network.getTwoWindingsTransformer("new2wt").getRatedU1(), 0.1); - assertEquals(1, network.getTwoWindingsTransformer("new2wt").getRatedS(), 0.1); - assertEquals(4, network.getTwoWindingsTransformer("new2wt").getRatioTapChanger().getStepCount()); - assertEquals(3, network.getTwoWindingsTransformer("new2wt").getPhaseTapChanger().getStepCount()); - assertEquals(PhaseTapChanger.RegulationMode.CURRENT_LIMITER, network.getTwoWindingsTransformer("new2wt").getPhaseTapChanger().getRegulationMode()); - assertNotNull(network.getShuntCompensator("v2shunt")); - assertEquals(Country.FR, network.getSubstation("newSubstation").getCountry().orElse(Country.AF)); - assertNotNull(network.getVoltageLevel("vl9")); - assertNotNull(network.getShuntCompensator("shunt9")); - TestUtils.purgeRequests(server); }