|
1
|
|
package fr.sii.ogham.core.builder.env; |
|
2
|
|
|
|
3
|
|
import java.util.ArrayList; |
|
4
|
|
import java.util.List; |
|
5
|
|
import java.util.Properties; |
|
6
|
|
|
|
7
|
|
import fr.sii.ogham.core.fluent.AbstractParent; |
|
8
|
|
|
|
9
|
|
/** |
|
10
|
|
* A {@link PropertiesBuilder} that registers properties (key/value pairs) that |
|
11
|
|
* is used by an {@link EnvironmentBuilder#properties()}. |
|
12
|
|
* |
|
13
|
|
* @author Aurélien Baudet |
|
14
|
|
* |
|
15
|
|
* @param <P> |
|
16
|
|
* the type of the parent builder (when calling {@link #and()} |
|
17
|
|
* method) |
|
18
|
|
*/ |
|
19
|
|
public class SimplePropertiesBuilder<P> extends AbstractParent<P> implements PropertiesBuilder<P> { |
|
20
|
|
private List<Property> properties; |
|
21
|
|
|
|
22
|
|
/** |
|
23
|
|
* Initializes the builder with the provided parent. The list of properties |
|
24
|
|
* is initialized with an empty list. |
|
25
|
|
* |
|
26
|
|
* @param parent |
|
27
|
|
* the parent builder |
|
28
|
|
*/ |
|
29
|
|
public SimplePropertiesBuilder(P parent) { |
|
30
|
|
super(parent); |
|
31
|
|
properties = new ArrayList<>(); |
|
32
|
|
} |
|
33
|
|
|
|
34
|
|
@Override |
|
35
|
|
public PropertiesBuilder<P> set(String key, String value) { |
|
36
|
|
properties.add(new Property(key, value)); |
|
37
|
6
1. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → NO_COVERAGE
2. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
3. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
4. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
5. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
6. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
|
return this; |
|
38
|
|
} |
|
39
|
|
|
|
40
|
|
@Override |
|
41
|
|
public PropertiesBuilder<P> set(String key, Object value) { |
|
42
|
6
1. set : negated conditional → NO_COVERAGE
2. set : negated conditional → SURVIVED
3. set : negated conditional → KILLED
4. set : negated conditional → KILLED
5. set : negated conditional → KILLED
6. set : negated conditional → KILLED
|
properties.add(new Property(key, value == null ? null : value.toString())); |
|
43
|
5
1. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → NO_COVERAGE
2. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → SURVIVED
3. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
4. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
5. set : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
|
return this; |
|
44
|
|
} |
|
45
|
|
|
|
46
|
|
@Override |
|
47
|
|
public Properties build() { |
|
48
|
|
Properties props = new Properties(); |
|
49
|
|
for (Property prop : properties) { |
|
50
|
12
1. build : negated conditional → NO_COVERAGE
2. build : negated conditional → NO_COVERAGE
3. build : negated conditional → KILLED
4. build : negated conditional → KILLED
5. build : negated conditional → KILLED
6. build : negated conditional → KILLED
7. build : negated conditional → KILLED
8. build : negated conditional → KILLED
9. build : negated conditional → KILLED
10. build : negated conditional → KILLED
11. build : negated conditional → KILLED
12. build : negated conditional → KILLED
|
if (prop.getKey() != null && prop.getValue() != null) { |
|
51
|
|
props.put(prop.getKey(), prop.getValue()); |
|
52
|
2
1. build : negated conditional → NO_COVERAGE
2. build : negated conditional → KILLED
|
} else if (prop.getValue() == null) { |
|
53
|
|
props.remove(prop.getKey()); |
|
54
|
|
} |
|
55
|
|
} |
|
56
|
6
1. build : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → NO_COVERAGE
2. build : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED
3. build : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED
4. build : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED
5. build : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED
6. build : replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED
|
return props; |
|
57
|
|
} |
|
58
|
|
|
|
59
|
|
private static class Property { |
|
60
|
|
private final String key; |
|
61
|
|
private final String value; |
|
62
|
|
|
|
63
|
|
public Property(String key, String value) { |
|
64
|
|
super(); |
|
65
|
|
this.key = key; |
|
66
|
|
this.value = value; |
|
67
|
|
} |
|
68
|
|
|
|
69
|
|
public String getKey() { |
|
70
|
6
1. getKey : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → NO_COVERAGE
2. getKey : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED
3. getKey : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED
4. getKey : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED
5. getKey : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED
6. getKey : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED
|
return key; |
|
71
|
|
} |
|
72
|
|
|
|
73
|
|
public String getValue() { |
|
74
|
6
1. getValue : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → NO_COVERAGE
2. getValue : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → SURVIVED
3. getValue : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → KILLED
4. getValue : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → KILLED
5. getValue : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → KILLED
6. getValue : replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → KILLED
|
return value; |
|
75
|
|
} |
|
76
|
|
} |
|
77
|
|
} |
| | Mutations |
| 37 |
|
1.1 Location : set Killed by : oghamcloudhopper.it.ConnectionFailureTest.invalidSystemId(oghamcloudhopper.it.ConnectionFailureTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED 2.2 Location : set Killed by : oghamall.it.configuration.EmptyBuilderTest.noMimetypeConfigurationCantSendEmail(oghamall.it.configuration.EmptyBuilderTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED 3.3 Location : set Killed by : none replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → NO_COVERAGE 4.4 Location : set Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED 5.5 Location : set Killed by : oghamcore.it.core.convert.CustomConverterTest.asDeveloperIUseMyCustomConverter(oghamcore.it.core.convert.CustomConverterTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED 6.6 Location : set Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED
|
| 42 |
|
1.1 Location : set Killed by : none negated conditional → NO_COVERAGE 2.2 Location : set Killed by : oghamall.it.configuration.EmptyBuilderTest.manualJavaMailConfigurationCanSendEmail(oghamall.it.configuration.EmptyBuilderTest) negated conditional → KILLED 3.3 Location : set Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) negated conditional → KILLED 4.4 Location : set Killed by : none negated conditional → SURVIVED 5.5 Location : set Killed by : oghamcore.ut.core.env.SimplePropertiesTest.asDeveloperIDefineABooleanProperty(oghamcore.ut.core.env.SimplePropertiesTest) negated conditional → KILLED 6.6 Location : set Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec negated conditional → KILLED
|
| 43 |
|
1.1 Location : set Killed by : none replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → NO_COVERAGE 2.2 Location : set Killed by : oghamcore.it.core.sender.AutoRetryTest.smsSentSuccessfullyOnFirstExecution(oghamcore.it.core.sender.AutoRetryTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED 3.3 Location : set Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED 4.4 Location : set Killed by : oghamall.it.configuration.EmptyBuilderTest.noMimetypeConfigurationCantSendEmail(oghamall.it.configuration.EmptyBuilderTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → KILLED 5.5 Location : set Killed by : none replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::set → SURVIVED
|
| 50 |
|
1.1 Location : build Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec negated conditional → KILLED 2.2 Location : build Killed by : none negated conditional → NO_COVERAGE 3.3 Location : build Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest) negated conditional → KILLED 4.4 Location : build Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) negated conditional → KILLED 5.5 Location : build Killed by : oghamcore.ut.core.env.SimplePropertiesTest.asDeveloperIDefineAStringProperty(oghamcore.ut.core.env.SimplePropertiesTest) negated conditional → KILLED 6.6 Location : build Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) negated conditional → KILLED 7.7 Location : build Killed by : none negated conditional → NO_COVERAGE 8.8 Location : build Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) negated conditional → KILLED 9.9 Location : build Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest) negated conditional → KILLED 10.10 Location : build Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec negated conditional → KILLED 11.11 Location : build Killed by : oghamcore.ut.core.env.SimplePropertiesTest.asDeveloperIDefineANullValue(oghamcore.ut.core.env.SimplePropertiesTest) negated conditional → KILLED 12.12 Location : build Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) negated conditional → KILLED
|
| 52 |
|
1.1 Location : build Killed by : oghamcore.ut.core.env.SimplePropertiesTest.asDeveloperIUnsetAValue(oghamcore.ut.core.env.SimplePropertiesTest) negated conditional → KILLED 2.2 Location : build Killed by : none negated conditional → NO_COVERAGE
|
| 56 |
|
1.1 Location : build Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED 2.2 Location : build Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED 3.3 Location : build Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED 4.4 Location : build Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED 5.5 Location : build Killed by : none replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → NO_COVERAGE 6.6 Location : build Killed by : oghamcore.ut.core.env.SimplePropertiesTest.asDeveloperIDefineANullValue(oghamcore.ut.core.env.SimplePropertiesTest) replaced return value with null for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder::build → KILLED
|
| 70 |
|
1.1 Location : getKey Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest) replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED 2.2 Location : getKey Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED 3.3 Location : getKey Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED 4.4 Location : getKey Killed by : none replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → NO_COVERAGE 5.5 Location : getKey Killed by : oghamcore.ut.core.env.SimplePropertiesTest.asDeveloperIDefineAStringProperty(oghamcore.ut.core.env.SimplePropertiesTest) replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED 6.6 Location : getKey Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getKey → KILLED
|
| 74 |
|
1.1 Location : getValue Killed by : none replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → NO_COVERAGE 2.2 Location : getValue Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → KILLED 3.3 Location : getValue Killed by : oghamcore.ut.core.env.SimplePropertiesTest.asDeveloperIDefineANullValue(oghamcore.ut.core.env.SimplePropertiesTest) replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → KILLED 4.4 Location : getValue Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → KILLED 5.5 Location : getValue Killed by : none replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → SURVIVED 6.6 Location : getValue Killed by : oghamall.it.configuration.EmptyBuilderTest.manualJavaMailConfigurationCanSendEmail(oghamall.it.configuration.EmptyBuilderTest) replaced return value with "" for fr/sii/ogham/core/builder/env/SimplePropertiesBuilder$Property::getValue → KILLED
|