1
|
|
package fr.sii.ogham.core.condition.provider; |
2
|
|
|
3
|
|
import static fr.sii.ogham.core.condition.fluent.Conditions.alwaysTrue; |
4
|
|
|
5
|
|
import fr.sii.ogham.core.builder.condition.RequiredProperties; |
6
|
|
import fr.sii.ogham.core.builder.condition.RequiredProperty; |
7
|
|
import fr.sii.ogham.core.condition.AndCondition; |
8
|
|
import fr.sii.ogham.core.condition.Condition; |
9
|
|
import fr.sii.ogham.core.condition.fluent.Conditions; |
10
|
|
import fr.sii.ogham.core.env.PropertyResolver; |
11
|
|
|
12
|
|
/** |
13
|
|
* Provider that handle {@link RequiredProperties} annotation to provide a |
14
|
|
* condition. |
15
|
|
* |
16
|
|
* It delegates handling of {@link RequiredProperty} to |
17
|
|
* {@link RequiredPropertyAnnotationProvider}. |
18
|
|
* |
19
|
|
* @author Aurélien Baudet |
20
|
|
* |
21
|
|
* @param <T> |
22
|
|
* the kind of the object under conditions |
23
|
|
*/ |
24
|
|
public class RequiredPropertiesAnnotationProvider<T> implements ConditionProvider<RequiredProperties, T> { |
25
|
|
private final PropertyResolver propertyResolver; |
26
|
|
private final RequiredPropertyAnnotationProvider<T> delegate; |
27
|
|
|
28
|
|
public RequiredPropertiesAnnotationProvider(PropertyResolver propertyResolver) { |
29
|
|
super(); |
30
|
|
this.propertyResolver = propertyResolver; |
31
|
|
this.delegate = new RequiredPropertyAnnotationProvider<>(propertyResolver); |
32
|
|
} |
33
|
|
|
34
|
|
@Override |
35
|
|
public Condition<T> provide(RequiredProperties annotation) { |
36
|
8
1. provide : negated conditional → NO_COVERAGE
2. provide : negated conditional → KILLED
3. provide : negated conditional → KILLED
4. provide : negated conditional → KILLED
5. provide : negated conditional → KILLED
6. provide : negated conditional → KILLED
7. provide : negated conditional → KILLED
8. provide : negated conditional → KILLED
|
if (annotation == null) { |
37
|
8
1. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → NO_COVERAGE
2. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → SURVIVED
3. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED
4. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED
5. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED
6. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED
7. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED
8. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED
|
return alwaysTrue(); |
38
|
|
} else { |
39
|
|
AndCondition<T> mainCondition = new AndCondition<>(); |
40
|
|
for (String requiredProperties : annotation.value()) { |
41
|
|
mainCondition = mainCondition.and(Conditions.<T> requiredProperty(propertyResolver, requiredProperties)); |
42
|
|
} |
43
|
|
for (RequiredProperty subAnnotation : annotation.props()) { |
44
|
|
mainCondition = mainCondition.and(delegate.provide(subAnnotation)); |
45
|
|
} |
46
|
2
1. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → NO_COVERAGE
2. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED
|
return mainCondition; |
47
|
|
} |
48
|
|
} |
49
|
|
|
50
|
|
} |
| | Mutations |
36 |
|
1.1 Location : provide Killed by : oghamcore.it.core.condition.provider.RequiredPropertiesAnnotationProviderSpec negated conditional → KILLED 2.2 Location : provide Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests) negated conditional → KILLED 3.3 Location : provide Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec negated conditional → KILLED 4.4 Location : provide Killed by : oghamjavamail.it.builder.JavaMailCustomConfigurationTest.noHostDefinedShouldFail(oghamjavamail.it.builder.JavaMailCustomConfigurationTest) negated conditional → KILLED 5.5 Location : provide Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest) negated conditional → KILLED 6.6 Location : provide Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests) negated conditional → KILLED 7.7 Location : provide Killed by : none negated conditional → NO_COVERAGE 8.8 Location : provide Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) negated conditional → KILLED
|
37 |
|
1.1 Location : provide Killed by : none replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → NO_COVERAGE 2.2 Location : provide Killed by : oghamjavamail.it.builder.JavaMailCustomConfigurationTest.noHostDefinedShouldFail(oghamjavamail.it.builder.JavaMailCustomConfigurationTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED 3.3 Location : provide Killed by : oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest.missingBeanErrorUsingThymeleaf(oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED 4.4 Location : provide Killed by : oghamspringbootv2autoconfigure.it.StaticMethodAccessTest.emailUsingFreemarkerTemplateAndStaticMethodAccessDisabledShouldFail(oghamspringbootv2autoconfigure.it.StaticMethodAccessTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED 5.5 Location : provide Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED 6.6 Location : provide Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED 7.7 Location : provide Killed by : oghamcore.it.core.condition.provider.RequiredPropertiesAnnotationProviderSpec replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED 8.8 Location : provide Killed by : none replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → SURVIVED
|
46 |
|
1.1 Location : provide Killed by : oghamcore.it.core.condition.provider.RequiredPropertiesAnnotationProviderSpec replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → KILLED 2.2 Location : provide Killed by : none replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredPropertiesAnnotationProvider::provide → NO_COVERAGE
|