|
6 | 6 | */
|
7 | 7 | package com.powsybl.network.store.client;
|
8 | 8 |
|
| 9 | +import com.powsybl.network.store.iidm.impl.CachedNetworkStoreClient; |
| 10 | +import com.powsybl.network.store.iidm.impl.OfflineNetworkStoreClient; |
| 11 | +import com.powsybl.network.store.model.ResourceType; |
| 12 | +import org.junit.Test; |
| 13 | + |
| 14 | +import java.util.UUID; |
| 15 | +import java.util.concurrent.ForkJoinPool; |
| 16 | + |
| 17 | +import static org.junit.Assert.assertFalse; |
| 18 | +import static org.junit.Assert.assertTrue; |
| 19 | + |
9 | 20 | /**
|
10 | 21 | * @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
|
11 | 22 | */
|
12 | 23 | public class PreloadingAllCollectionsTest {
|
13 | 24 |
|
14 |
| -// @Test |
15 |
| -// public void test() { |
16 |
| -// var client = new PreloadingNetworkStoreClient(new CachedNetworkStoreClient(new OfflineNetworkStoreClient()), false, ForkJoinPool.commonPool()); |
17 |
| -// UUID networkUuid = UUID.fromString("7928181c-7977-4592-ba19-88027e4254e4"); |
18 |
| -// client.getSubstations(networkUuid, 0); |
19 |
| -// assertTrue(client.isResourceTypeCached(networkUuid, 0, ResourceType.SUBSTATION)); |
20 |
| -// for (ResourceType resourceType : ResourceType.values()) { |
21 |
| -// if (resourceType != ResourceType.SUBSTATION) { |
22 |
| -// assertFalse(client.isResourceTypeCached(networkUuid, 0, ResourceType.GENERATOR)); |
23 |
| -// } |
24 |
| -// } |
25 |
| -// } |
26 |
| -// |
27 |
| -// @Test |
28 |
| -// public void testWithAllCollections() { |
29 |
| -// var client = new PreloadingNetworkStoreClient(new CachedNetworkStoreClient(new OfflineNetworkStoreClient()), true, ForkJoinPool.commonPool()); |
30 |
| -// UUID networkUuid = UUID.fromString("7928181c-7977-4592-ba19-88027e4254e4"); |
31 |
| -// client.getSubstations(networkUuid, 0); |
32 |
| -// for (ResourceType resourceType : ResourceType.values()) { |
33 |
| -// if (PreloadingNetworkStoreClient.RESOURCE_TYPES_NEEDED_FOR_BUS_VIEW.contains(resourceType)) { |
34 |
| -// assertTrue(client.isResourceTypeCached(networkUuid, 0, resourceType)); |
35 |
| -// } else { |
36 |
| -// assertFalse(client.isResourceTypeCached(networkUuid, 0, resourceType)); |
37 |
| -// } |
38 |
| -// } |
39 |
| -// } |
| 25 | + @Test |
| 26 | + public void testWithAllCollections() { |
| 27 | + var client = new PreloadingNetworkStoreClient(new CachedNetworkStoreClient(new OfflineNetworkStoreClient()), true, ForkJoinPool.commonPool()); |
| 28 | + UUID networkUuid = UUID.fromString("7928181c-7977-4592-ba19-88027e4254e4"); |
| 29 | + assertTrue(client.shouldLoadAllCollectionsForBusView(ResourceType.SUBSTATION)); |
| 30 | + client.getSubstations(networkUuid, 0); |
| 31 | + assertFalse(client.shouldLoadAllCollectionsForBusView(ResourceType.SUBSTATION)); |
| 32 | + } |
40 | 33 | }
|
0 commit comments