| Helge | 45948bc | 2024-09-17 11:59:43 +0200 | [diff] [blame^] | 1 | package de.ids_mannheim.korap.plkexport; |
| 2 | |
| 3 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 4 | |
| 5 | import java.util.Properties; |
| 6 | |
| 7 | import org.junit.Test; |
| 8 | |
| 9 | import de.ids_mannheim.korap.plkexport.ExWSConf; |
| 10 | |
| 11 | public class ExWSConfTest { |
| 12 | |
| 13 | /** |
| 14 | * Test the return of properties. |
| 15 | * If no property file is passed, the default properties |
| 16 | * should be loaded. If there is a property file, the properties in |
| 17 | * this file should additionall be loaded. Default properties should be |
| 18 | * overwritten if they exist in both file. |
| 19 | */ |
| 20 | @Test |
| 21 | public void testExportWsOverlProp () { |
| 22 | // No property file |
| 23 | ExWSConf.clearProp(); |
| 24 | Properties properties = ExWSConf.properties(null); |
| 25 | assertEquals("localhost", (properties.getProperty("server.host"))); |
| 26 | assertEquals("1024", (properties.getProperty("server.port"))); |
| 27 | assertEquals("dummdidumm.ids-mannheim.de", properties.getProperty("asset.host")); |
| 28 | assertEquals("5", properties.getProperty("conf.page_size")); |
| 29 | //Property file |
| 30 | ExWSConf.clearProp(); |
| 31 | Properties propsec = ExWSConf.properties("exportPluginSec.conf"); |
| 32 | assertEquals("localhost", (propsec.getProperty("server.host"))); |
| 33 | assertEquals("1024", (propsec.getProperty("server.port"))); |
| 34 | assertEquals("korap.ids-mannheim.de", propsec.getProperty("api.host")); |
| 35 | assertEquals("55", propsec.getProperty("conf.page_size")); |
| 36 | assertEquals("ajlakjldkjf", propsec.getProperty("rtf.trail")); |
| 37 | } |
| 38 | |
| 39 | } |
| 40 | |