-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
- Loading branch information
1 parent
f6ea175
commit db53bbe
Showing
2 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/test/java/org/gridsuite/modification/server/service/NetworkVariantsListenerTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.gridsuite.modification.server.service; | ||
|
||
import org.gridsuite.modification.server.elasticsearch.EquipmentInfosService; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.data.elasticsearch.NoSuchIndexException; | ||
|
||
import java.util.UUID; | ||
|
||
|
||
/** | ||
* @author Franck Lecuyer <franck.lecuyer at rte-france.com> | ||
*/ | ||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) | ||
class NetworkVariantsListenerTests { | ||
private static final UUID NETWORK_UUID = UUID.randomUUID(); | ||
private static final String VARIANT_ID = "variant_1"; | ||
|
||
@Autowired | ||
private EquipmentInfosService equipmentInfosService; | ||
|
||
@AfterEach | ||
void tearDown() { | ||
try { | ||
equipmentInfosService.deleteAll(); | ||
} catch (NoSuchIndexException ex) { | ||
// no need to worry that much | ||
} | ||
} | ||
|
||
@Test | ||
void testVariantNotifications() { | ||
NetworkVariantsListener listener = new NetworkVariantsListener(null, NETWORK_UUID, equipmentInfosService); | ||
|
||
listener.onVariantRemoved(VARIANT_ID); | ||
listener.onVariantCreated("variant_1", "variant_2"); | ||
listener.onVariantOverwritten("variant_2", "variant_3"); | ||
listener.onUpdate(null, null, null, null, null); | ||
listener.onExtensionUpdate(null, null, null, null, null); | ||
listener.onPropertyAdded(null, null, null); | ||
listener.onPropertyReplaced(null, null, null, null); | ||
listener.onPropertyRemoved(null, null, null); | ||
} | ||
} |