-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from trivago/custom-parameters-file
Version 2.0.0
- Loading branch information
Showing
21 changed files
with
424 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
language: java | ||
sudo: false # faster builds | ||
language: | ||
java | ||
|
||
before_install: | ||
- pip install --user codecov | ||
|
||
script: | ||
before_script: | ||
- cd plugin-code | ||
- mvn cobertura:cobertura | ||
- pip install --user codecov | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
- codecov | ||
|
||
- codecov |
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
Empty file.
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
51 changes: 51 additions & 0 deletions
51
plugin-code/src/main/java/com/trivago/cluecumber/properties/LinkedProperties.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,51 @@ | ||
package com.trivago.cluecumber.properties; | ||
|
||
import java.util.Enumeration; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
import java.util.Set; | ||
|
||
public class LinkedProperties extends Properties { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private Map<Object, Object> linkMap = new LinkedHashMap<>(); | ||
|
||
@Override | ||
public synchronized Object put(Object key, Object value) { | ||
return linkMap.put(key, value); | ||
} | ||
|
||
@Override | ||
public synchronized boolean contains(Object value) { | ||
return linkMap.containsValue(value); | ||
} | ||
|
||
@Override | ||
public boolean containsValue(Object value) { | ||
return linkMap.containsValue(value); | ||
} | ||
|
||
@Override | ||
public synchronized Enumeration<Object> elements() { | ||
throw new UnsupportedOperationException( | ||
"Please use keySet() or entrySet() instead of Enumeration."); | ||
} | ||
|
||
@Override | ||
public Set<Map.Entry<Object, Object>> entrySet() { | ||
return linkMap.entrySet(); | ||
} | ||
|
||
@Override | ||
public synchronized void clear() { | ||
linkMap.clear(); | ||
} | ||
|
||
@Override | ||
public synchronized boolean containsKey(Object key) { | ||
return linkMap.containsKey(key); | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
plugin-code/src/main/java/com/trivago/cluecumber/properties/PropertiesFileLoader.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,37 @@ | ||
package com.trivago.cluecumber.properties; | ||
|
||
import com.trivago.cluecumber.exceptions.CluecumberPluginException; | ||
import com.trivago.cluecumber.filesystem.FileIO; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
import java.io.IOException; | ||
import java.io.StringReader; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
@Singleton | ||
public class PropertiesFileLoader { | ||
|
||
private FileIO fileIO; | ||
|
||
@Inject | ||
public PropertiesFileLoader(final FileIO fileIO) { | ||
this.fileIO = fileIO; | ||
} | ||
|
||
LinkedHashMap<String, String> loadPropertiesMap(final String propertiesFilePath) throws CluecumberPluginException { | ||
LinkedHashMap<String, String> propertiesMap = new LinkedHashMap<>(); | ||
String content = fileIO.readContentFromFile(propertiesFilePath); | ||
LinkedProperties properties = new LinkedProperties(); | ||
try { | ||
properties.load(new StringReader(content)); | ||
} catch (IOException e) { | ||
throw new CluecumberPluginException("Could not parse properties file '" + "': " + e.getMessage()); | ||
} | ||
for (Map.Entry<Object, Object> propertyEntry : properties.entrySet()) { | ||
propertiesMap.put((String) propertyEntry.getKey(), (String) propertyEntry.getValue()); | ||
} | ||
return propertiesMap; | ||
} | ||
} |
Oops, something went wrong.