|
1
|
|
package fr.sii.ogham.sms.builder; |
|
2
|
|
|
|
3
|
|
import java.util.HashMap; |
|
4
|
|
import java.util.Map; |
|
5
|
|
|
|
6
|
|
import fr.sii.ogham.core.builder.Builder; |
|
7
|
|
import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilderHelper; |
|
8
|
|
import fr.sii.ogham.core.builder.context.BuildContext; |
|
9
|
|
import fr.sii.ogham.core.builder.env.EnvironmentBuilder; |
|
10
|
|
import fr.sii.ogham.core.filler.EveryFillerDecorator; |
|
11
|
|
import fr.sii.ogham.core.filler.MessageFiller; |
|
12
|
|
import fr.sii.ogham.core.fluent.AbstractParent; |
|
13
|
|
import fr.sii.ogham.sms.filler.SmsFiller; |
|
14
|
|
import fr.sii.ogham.sms.message.Sms; |
|
15
|
|
|
|
16
|
|
/** |
|
17
|
|
* Configures how Ogham will add default values to the {@link Sms} if some |
|
18
|
|
* information is missing. |
|
19
|
|
* |
|
20
|
|
* If sender phone number is missing, a default one can be defined in |
|
21
|
|
* configuration properties. |
|
22
|
|
* |
|
23
|
|
* If recipient phone number is missing, a default one can be defined in |
|
24
|
|
* configuration properties. |
|
25
|
|
* |
|
26
|
|
* @author Aurélien Baudet |
|
27
|
|
* @see SmsFiller |
|
28
|
|
* |
|
29
|
|
*/ |
|
30
|
|
public class AutofillSmsBuilder extends AbstractParent<SmsBuilder> implements Builder<MessageFiller> { |
|
31
|
|
private final BuildContext buildContext; |
|
32
|
|
private AutofillDefaultPhoneNumberBuilder<String> senderNumberBuilder; |
|
33
|
|
private AutofillDefaultPhoneNumberBuilder<String[]> recipientNumberBuilder; |
|
34
|
|
|
|
35
|
|
/** |
|
36
|
|
* Initializes with the parent builder and the {@link EnvironmentBuilder}. |
|
37
|
|
* The parent builder is used when calling the {@link #and()} method. The |
|
38
|
|
* {@link EnvironmentBuilder} is used by {@link #build()} method to evaluate |
|
39
|
|
* property values. |
|
40
|
|
* |
|
41
|
|
* @param parent |
|
42
|
|
* the parent builder |
|
43
|
|
* @param buildContext |
|
44
|
|
* for property resolution |
|
45
|
|
*/ |
|
46
|
|
public AutofillSmsBuilder(SmsBuilder parent, BuildContext buildContext) { |
|
47
|
|
super(parent); |
|
48
|
|
this.buildContext = buildContext; |
|
49
|
|
} |
|
50
|
|
|
|
51
|
|
/** |
|
52
|
|
* Configures how to handle missing sender phone number: if no sender phone |
|
53
|
|
* number is explicitly defined on the message, Ogham will use this phone |
|
54
|
|
* number as default sender number. |
|
55
|
|
* |
|
56
|
|
* @return the builder to configure default sender number |
|
57
|
|
*/ |
|
58
|
|
public AutofillDefaultPhoneNumberBuilder<String> from() { |
|
59
|
8
1. from : negated conditional → NO_COVERAGE
2. from : negated conditional → KILLED
3. from : negated conditional → KILLED
4. from : negated conditional → KILLED
5. from : negated conditional → KILLED
6. from : negated conditional → KILLED
7. from : negated conditional → KILLED
8. from : negated conditional → KILLED
|
if (senderNumberBuilder == null) { |
|
60
|
|
senderNumberBuilder = new AutofillDefaultPhoneNumberBuilder<>(this, String.class, buildContext); |
|
61
|
|
} |
|
62
|
8
1. from : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → NO_COVERAGE
2. from : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED
3. from : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED
4. from : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED
5. from : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED
6. from : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED
7. from : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED
8. from : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED
|
return senderNumberBuilder; |
|
63
|
|
} |
|
64
|
|
|
|
65
|
|
/** |
|
66
|
|
* Configures how to handle missing recipient phone number: if no recipient |
|
67
|
|
* phone number is explicitly defined on the message, Ogham will use this |
|
68
|
|
* phone number as default recipient number. |
|
69
|
|
* |
|
70
|
|
* @return the builder to configure default recipient number |
|
71
|
|
*/ |
|
72
|
|
public AutofillDefaultPhoneNumberBuilder<String[]> to() { |
|
73
|
8
1. to : negated conditional → NO_COVERAGE
2. to : negated conditional → KILLED
3. to : negated conditional → KILLED
4. to : negated conditional → KILLED
5. to : negated conditional → KILLED
6. to : negated conditional → KILLED
7. to : negated conditional → KILLED
8. to : negated conditional → KILLED
|
if (recipientNumberBuilder == null) { |
|
74
|
|
recipientNumberBuilder = new AutofillDefaultPhoneNumberBuilder<>(this, String[].class, buildContext); |
|
75
|
|
} |
|
76
|
8
1. to : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → NO_COVERAGE
2. to : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED
3. to : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED
4. to : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED
5. to : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED
6. to : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED
7. to : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED
8. to : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED
|
return recipientNumberBuilder; |
|
77
|
|
} |
|
78
|
|
|
|
79
|
|
@Override |
|
80
|
|
public MessageFiller build() { |
|
81
|
|
EveryFillerDecorator filler = buildContext.register(new EveryFillerDecorator()); |
|
82
|
|
Map<String, ConfigurationValueBuilderHelper<?, ?>> props = new HashMap<>(); |
|
83
|
|
props.put("from", (ConfigurationValueBuilderHelper<?, String>) senderNumberBuilder.defaultValue()); |
|
84
|
|
props.put("to", (ConfigurationValueBuilderHelper<?, String[]>) recipientNumberBuilder.defaultValue()); |
|
85
|
|
filler.addFiller(buildContext.register(new SmsFiller(props))); |
|
86
|
7
1. build : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → NO_COVERAGE
2. build : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → SURVIVED
3. build : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED
4. build : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED
5. build : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED
6. build : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED
7. build : replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED
|
return filler; |
|
87
|
|
} |
|
88
|
|
} |
| | Mutations |
| 59 |
|
1.1 Location : from Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec negated conditional → KILLED 2.2 Location : from Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest) negated conditional → KILLED 3.3 Location : from Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest) negated conditional → KILLED 4.4 Location : from Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) negated conditional → KILLED 5.5 Location : from Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests) negated conditional → KILLED 6.6 Location : from Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests) negated conditional → KILLED 7.7 Location : from Killed by : none negated conditional → NO_COVERAGE 8.8 Location : from Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) negated conditional → KILLED
|
| 62 |
|
1.1 Location : from Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED 2.2 Location : from Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED 3.3 Location : from Killed by : none replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → NO_COVERAGE 4.4 Location : from Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED 5.5 Location : from Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED 6.6 Location : from Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED 7.7 Location : from Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED 8.8 Location : from Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::from → KILLED
|
| 73 |
|
1.1 Location : to Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest) negated conditional → KILLED 2.2 Location : to Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest) negated conditional → KILLED 3.3 Location : to Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) negated conditional → KILLED 4.4 Location : to Killed by : none negated conditional → NO_COVERAGE 5.5 Location : to Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests) negated conditional → KILLED 6.6 Location : to Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests) negated conditional → KILLED 7.7 Location : to Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) negated conditional → KILLED 8.8 Location : to Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec negated conditional → KILLED
|
| 76 |
|
1.1 Location : to Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED 2.2 Location : to Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED 3.3 Location : to Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED 4.4 Location : to Killed by : none replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → NO_COVERAGE 5.5 Location : to Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED 6.6 Location : to Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED 7.7 Location : to Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED 8.8 Location : to Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::to → KILLED
|
| 86 |
|
1.1 Location : build Killed by : none replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → NO_COVERAGE 2.2 Location : build Killed by : oghamspringbootv2autoconfigure.it.StaticMethodAccessTest.smsUsingFreemarkerTemplateAndStaticMethodAccessDisabledShouldFail(oghamspringbootv2autoconfigure.it.StaticMethodAccessTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED 3.3 Location : build Killed by : oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest.smsUsingFreemarkerTemplateShouldResolveBeans(oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED 4.4 Location : build Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED 5.5 Location : build Killed by : oghamall.it.sms.SmsCustomImplTest.simple(oghamall.it.sms.SmsCustomImplTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED 6.6 Location : build Killed by : none replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → SURVIVED 7.7 Location : build Killed by : oghamcore.it.core.sender.AutoRetryTest.smsSentSuccessfullyOnFirstExecution(oghamcore.it.core.sender.AutoRetryTest) replaced return value with null for fr/sii/ogham/sms/builder/AutofillSmsBuilder::build → KILLED
|