-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved current SVC mock implementation to test; removed pcp and rcp bi…
…nary files (as specific to a particular Eurostag's version)
- Loading branch information
Christian Biasuzzi
committed
Mar 28, 2017
1 parent
08d813b
commit 03fd977
Showing
11 changed files
with
95 additions
and
55 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
Binary file removed
BIN
-48 Bytes
iidm-ddb/iidm-ddb-eurostag-import-export/src/main/resources/dummefd.pcp
Binary file not shown.
Binary file removed
BIN
-2.08 KB
iidm-ddb/iidm-ddb-eurostag-import-export/src/main/resources/dummefd.rcp
Binary file not shown.
Binary file removed
BIN
-48 Bytes
iidm-ddb/iidm-ddb-eurostag-import-export/src/main/resources/dummycm.pcp
Binary file not shown.
Binary file removed
BIN
-2.08 KB
iidm-ddb/iidm-ddb-eurostag-import-export/src/main/resources/dummycm.rcp
Binary file not shown.
Binary file removed
BIN
-48 Bytes
iidm-ddb/iidm-ddb-eurostag-import-export/src/main/resources/interdum.pcp
Binary file not shown.
Binary file removed
BIN
-2.43 KB
iidm-ddb/iidm-ddb-eurostag-import-export/src/main/resources/interdum.rcp
Binary file not shown.
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
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
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
86 changes: 86 additions & 0 deletions
86
iidm-ddb/iidm-ddb-eurostag-import-export/src/test/java/TestDynamicDatabaseSVCMock.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,86 @@ | ||
/** | ||
* Copyright (c) 2017, 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/. | ||
*/ | ||
|
||
import com.google.common.io.CharStreams; | ||
import com.google.common.jimfs.Configuration; | ||
import com.google.common.jimfs.Jimfs; | ||
import eu.itesla_project.iidm.ddb.eurostag_imp_exp.DynamicDatabaseClient; | ||
import eu.itesla_project.iidm.network.Network; | ||
import eu.itesla_project.iidm.network.test.SvcTestCaseFactory; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.io.InputStreamReader; | ||
import java.nio.file.FileSystem; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
/** | ||
* @author Christian Biasuzzi <christian.biasuzzi@techrain.it> | ||
*/ | ||
public class TestDynamicDatabaseSVCMock { | ||
|
||
private FileSystem fileSystem; | ||
|
||
private static final String DTA_FILENAME = "sim.dta"; | ||
private static final List<String> SVC_REGULATORS_FILENAMES = Arrays.asList("dummefd.fri", | ||
"dummefd.frm", | ||
"dummefd.par", | ||
"dummycm.fri", | ||
"dummycm.frm", | ||
"dummycm.par", | ||
"interdum.frm", | ||
"interdum.par", | ||
"interdum.fri"); | ||
|
||
|
||
@Before | ||
public void setUp() throws Exception { | ||
fileSystem = Jimfs.newFileSystem(Configuration.unix()); | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
fileSystem.close(); | ||
} | ||
|
||
@Test | ||
public void test_SvcTestCase() throws Exception { | ||
Network network = SvcTestCaseFactory.create(); | ||
|
||
Map<String, String> iidm2eurostag = new HashMap<>(); | ||
iidm2eurostag.put("G1", "G1"); | ||
iidm2eurostag.put("B1", "B1"); | ||
iidm2eurostag.put("SVC2", "SVC2"); | ||
iidm2eurostag.put("B2", "B2"); | ||
|
||
Path workingDir = Files.createDirectory(fileSystem.getPath("/workingdir")); | ||
|
||
DynamicDatabaseClient ddbClient = new IIDMDynamicDatabaseSVCMockFactory().create(false); | ||
ddbClient.dumpDtaFile(workingDir, DTA_FILENAME, network, new HashMap<String, Character>(), "mock", iidm2eurostag); | ||
|
||
File expectedDtaFile = new File(getClass().getResource("/sim_test_svc.dta").toURI()); | ||
Path testFile = workingDir.resolve(DTA_FILENAME); | ||
assertEquals(CharStreams.toString(new InputStreamReader(Files.newInputStream(expectedDtaFile.toPath()))), | ||
CharStreams.toString(new InputStreamReader(Files.newInputStream(testFile)))); | ||
|
||
SVC_REGULATORS_FILENAMES.stream() | ||
.forEach(filename -> assertTrue(Files.isRegularFile(workingDir.resolve(filename)))); | ||
|
||
} | ||
|
||
|
||
} |