| 1 | package fr.sii.ogham.core.env; | |
| 2 | ||
| 3 | ||
| 4 | import static fr.sii.ogham.core.CoreConstants.SERIAL_VERSION_UID; | |
| 5 | ||
| 6 | import java.io.PrintStream; | |
| 7 | import java.io.PrintWriter; | |
| 8 | import java.util.Collection; | |
| 9 | import java.util.Enumeration; | |
| 10 | import java.util.Properties; | |
| 11 | import java.util.Set; | |
| 12 | ||
| 13 | /** | |
| 14 | * Extends {@link Properties} and wraps a {@link PropertyResolver}. The aim is | |
| 15 | * to be able to use a {@link Properties} object required by Java Mail while | |
| 16 | * real property handling is managed by the underlying {@link PropertyResolver}. | |
| 17 | * | |
| 18 | * @author Aurélien Baudet | |
| 19 | * | |
| 20 | */ | |
| 21 | public class PropertiesBridge extends Properties { | |
| 22 | private static final long serialVersionUID = SERIAL_VERSION_UID; | |
| 23 | private final transient PropertyResolver propertyResolver; | |
| 24 | ||
| 25 | /** | |
| 26 | * Wraps the property resolver | |
| 27 | * | |
| 28 | * @param propertyResolver | |
| 29 | * the property resolver to wrap | |
| 30 | */ | |
| 31 | public PropertiesBridge(PropertyResolver propertyResolver) { | |
| 32 | super(); | |
| 33 | this.propertyResolver = propertyResolver; | |
| 34 | } | |
| 35 | ||
| 36 | @Override | |
| 37 | public String getProperty(String key) { | |
| 38 |
4
1. getProperty : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::getProperty → NO_COVERAGE 2. getProperty : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::getProperty → TIMED_OUT 3. getProperty : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::getProperty → KILLED 4. getProperty : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::getProperty → KILLED |
return propertyResolver.getProperty(key); |
| 39 | } | |
| 40 | ||
| 41 | @Override | |
| 42 | public String getProperty(String key, String defaultValue) { | |
| 43 |
4
1. getProperty : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::getProperty → NO_COVERAGE 2. getProperty : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::getProperty → TIMED_OUT 3. getProperty : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::getProperty → KILLED 4. getProperty : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::getProperty → KILLED |
return propertyResolver.getProperty(key, defaultValue); |
| 44 | } | |
| 45 | ||
| 46 | @Override | |
| 47 | public Enumeration<?> propertyNames() { | |
| 48 | throw new UnsupportedOperationException(); | |
| 49 | } | |
| 50 | ||
| 51 | @Override | |
| 52 | public Set<String> stringPropertyNames() { | |
| 53 | throw new UnsupportedOperationException(); | |
| 54 | } | |
| 55 | ||
| 56 | @Override | |
| 57 | public void list(PrintStream out) { | |
| 58 | throw new UnsupportedOperationException(); | |
| 59 | } | |
| 60 | ||
| 61 | @Override | |
| 62 | public void list(PrintWriter out) { | |
| 63 | throw new UnsupportedOperationException(); | |
| 64 | } | |
| 65 | ||
| 66 | @Override | |
| 67 | public synchronized int size() { | |
| 68 | throw new UnsupportedOperationException(); | |
| 69 | } | |
| 70 | ||
| 71 | @Override | |
| 72 | public synchronized boolean isEmpty() { | |
| 73 | throw new UnsupportedOperationException(); | |
| 74 | } | |
| 75 | ||
| 76 | @Override | |
| 77 | public synchronized Enumeration<Object> keys() { | |
| 78 | throw new UnsupportedOperationException(); | |
| 79 | } | |
| 80 | ||
| 81 | @Override | |
| 82 | public synchronized Enumeration<Object> elements() { | |
| 83 | throw new UnsupportedOperationException(); | |
| 84 | } | |
| 85 | ||
| 86 | @Override | |
| 87 | public synchronized boolean contains(Object value) { | |
| 88 | throw new UnsupportedOperationException(); | |
| 89 | } | |
| 90 | ||
| 91 | @Override | |
| 92 | public boolean containsValue(Object value) { | |
| 93 | throw new UnsupportedOperationException(); | |
| 94 | } | |
| 95 | ||
| 96 | @Override | |
| 97 | public synchronized boolean containsKey(Object key) { | |
| 98 |
2
1. containsKey : replaced boolean return with false for fr/sii/ogham/core/env/PropertiesBridge::containsKey → NO_COVERAGE 2. containsKey : replaced boolean return with true for fr/sii/ogham/core/env/PropertiesBridge::containsKey → NO_COVERAGE |
return propertyResolver.containsProperty((String) key); |
| 99 | } | |
| 100 | ||
| 101 | @Override | |
| 102 | public synchronized Object get(Object key) { | |
| 103 |
3
1. get : replaced return value with null for fr/sii/ogham/core/env/PropertiesBridge::get → SURVIVED 2. get : replaced return value with null for fr/sii/ogham/core/env/PropertiesBridge::get → NO_COVERAGE 3. get : replaced return value with null for fr/sii/ogham/core/env/PropertiesBridge::get → TIMED_OUT |
return propertyResolver.getProperty((String) key, Object.class); |
| 104 | } | |
| 105 | ||
| 106 | @Override | |
| 107 | public Set<Object> keySet() { | |
| 108 | throw new UnsupportedOperationException(); | |
| 109 | } | |
| 110 | ||
| 111 | @Override | |
| 112 | public Set<java.util.Map.Entry<Object, Object>> entrySet() { | |
| 113 | throw new UnsupportedOperationException(); | |
| 114 | } | |
| 115 | ||
| 116 | @Override | |
| 117 | public Collection<Object> values() { | |
| 118 | throw new UnsupportedOperationException(); | |
| 119 | } | |
| 120 | ||
| 121 | @Override | |
| 122 | public synchronized String toString() { | |
| 123 |
3
1. toString : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::toString → SURVIVED 2. toString : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::toString → NO_COVERAGE 3. toString : replaced return value with "" for fr/sii/ogham/core/env/PropertiesBridge::toString → TIMED_OUT |
return propertyResolver.toString(); |
| 124 | } | |
| 125 | | |
| 126 | @Override | |
| 127 | public synchronized boolean equals(Object other) { | |
| 128 |
2
1. equals : replaced boolean return with false for fr/sii/ogham/core/env/PropertiesBridge::equals → NO_COVERAGE 2. equals : replaced boolean return with true for fr/sii/ogham/core/env/PropertiesBridge::equals → NO_COVERAGE |
return super.equals(other); |
| 129 | } | |
| 130 | ||
| 131 | @Override | |
| 132 | public synchronized int hashCode() { | |
| 133 |
1
1. hashCode : replaced int return with 0 for fr/sii/ogham/core/env/PropertiesBridge::hashCode → NO_COVERAGE |
return super.hashCode(); |
| 134 | } | |
| 135 | } | |
Mutations | ||
| 38 |
1.1 2.2 3.3 4.4 |
|
| 43 |
1.1 2.2 3.3 4.4 |
|
| 98 |
1.1 2.2 |
|
| 103 |
1.1 2.2 3.3 |
|
| 123 |
1.1 2.2 3.3 |
|
| 128 |
1.1 2.2 |
|
| 133 |
1.1 |