-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
171 additions
and
101 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
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
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
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
44 changes: 44 additions & 0 deletions
44
simulator-starter/src/main/java/org/citrusframework/simulator/dictionary/XmlUtils.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,44 @@ | ||
package org.citrusframework.simulator.dictionary; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
import org.citrusframework.exceptions.CitrusRuntimeException; | ||
import org.citrusframework.spi.Resource; | ||
import org.slf4j.Logger; | ||
|
||
class XmlUtils { | ||
|
||
private XmlUtils(){ | ||
// Temporary utility class | ||
} | ||
|
||
// TODO: Remove if PR has been resolved and released: https://github.com/citrusframework/citrus/pull/1044 | ||
static void loadXMLMappingFile(Logger logger, Resource mappingFile, Map<String, String> mappings) { | ||
if (mappingFile != null) { | ||
logger.debug("Reading data dictionary mapping: {}", mappingFile.getLocation()); | ||
|
||
Properties props = new Properties(); | ||
try (InputStream inputStream = mappingFile.getInputStream()) { | ||
props.loadFromXML(inputStream); | ||
} catch (IOException e) { | ||
throw new CitrusRuntimeException(e); | ||
} | ||
|
||
for (Map.Entry<Object, Object> entry : props.entrySet()) { | ||
String key = entry.getKey().toString(); | ||
|
||
logger.debug("Loading data dictionary mapping: {}={}", key, props.getProperty(key)); | ||
|
||
if (logger.isDebugEnabled() && mappings.containsKey(key)) { | ||
logger.warn("Overwriting data dictionary mapping '{}'; old value: {} new value: {}", key, mappings.get(key), props.getProperty(key)); | ||
} | ||
|
||
mappings.put(key, props.getProperty(key)); | ||
} | ||
|
||
logger.info("Loaded data dictionary mapping: {}", mappingFile.getLocation()); | ||
} | ||
} | ||
} |
Oops, something went wrong.