| 1 |
|
package org.kuali.db; |
| 2 |
|
|
| 3 |
|
import static org.junit.Assert.assertEquals; |
| 4 |
|
|
| 5 |
|
import java.io.IOException; |
| 6 |
|
import java.util.Properties; |
| 7 |
|
|
| 8 |
|
import org.junit.Test; |
| 9 |
|
import org.springframework.util.PropertyPlaceholderHelper; |
| 10 |
|
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 3 |
Complexity Density: 0.21 |
|
| 11 |
|
public class PropertyPlaceholderHelperTest { |
| 12 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
4
-
|
|
| 13 |
0
|
@Test... |
| 14 |
|
public void replacePlaceholders() { |
| 15 |
0
|
Properties properties = new Properties(); |
| 16 |
0
|
properties.put("schema", "KSEMBEDDED"); |
| 17 |
0
|
String value = "DROP USER ${schema} CASCADE;"; |
| 18 |
0
|
PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper("${", "}"); |
| 19 |
0
|
value = helper.replacePlaceholders(value, properties); |
| 20 |
0
|
assertEquals(value, "DROP USER KSEMBEDDED CASCADE;"); |
| 21 |
|
} |
| 22 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
4
-
|
|
| 23 |
0
|
@Test... |
| 24 |
|
public void nestedProperties() { |
| 25 |
0
|
Properties properties = new Properties(); |
| 26 |
0
|
properties.put("db.vendor", "derby"); |
| 27 |
0
|
properties.put("datasource.url.oracle", "jdbc:oracle:thin:@localhost:1521:XE"); |
| 28 |
0
|
properties.put("datasource.url.derby", "jdbc:derby://localhost:1527/derby/rice-db;create=true"); |
| 29 |
0
|
properties.put("datasource.url", "${datasource.url.${db.vendor}}"); |
| 30 |
0
|
PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper("${", "}"); |
| 31 |
0
|
String value = "${datasource.url}"; |
| 32 |
0
|
value = helper.replacePlaceholders(value, properties); |
| 33 |
|
|
| 34 |
|
} |
| 35 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
| 36 |
0
|
@Test... |
| 37 |
|
public void configContext() throws IOException { |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
} |