FileResolutionBuilder.java

1
package fr.sii.ogham.core.builder.resolution;
2
3
import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilder;
4
import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilderDelegate;
5
import fr.sii.ogham.core.builder.context.BuildContext;
6
import fr.sii.ogham.core.builder.env.EnvironmentBuilder;
7
import fr.sii.ogham.core.resource.resolver.FileResolver;
8
import fr.sii.ogham.core.resource.resolver.ResourceResolver;
9
10
/**
11
 * Configure resource resolver that loads files from filesystem.
12
 * 
13
 * <p>
14
 * You can define the lookup (the prefix that indicates that filesystem
15
 * resolution must be used). For example:
16
 * 
17
 * <pre>
18
 * .file().lookup("file:");
19
 * 
20
 * // path prefixed by file: matches 
21
 * // then file resolver is used
22
 * resourceResolver.getResource("file:foo/bar.html");
23
 * // path is not prefixed (or using another prefix) doesn't match 
24
 * // then file resolver is not used
25
 * resourceResolver.getResource("foo/bar.html");
26
 * </pre>
27
 * 
28
 * <p>
29
 * You can define a path prefix and suffix for finding resources:
30
 * 
31
 * <pre>
32
 * .file().lookup("file:").pathPrefix("foo/").pathSuffix(".html");
33
 * 
34
 * resourceResolver.getResource("bar");
35
 * </pre>
36
 * 
37
 * This will use the file resolver and the real path is {@code foo/bar.html}.
38
 * 
39
 * @author Aurélien Baudet
40
 *
41
 * @param <P>
42
 *            the type of the parent builder (when calling {@link #and()}
43
 *            method)
44
 */
45
public class FileResolutionBuilder<P> extends AbstractSingleResolutionBuilder<FileResolutionBuilder<P>, P> implements PrefixSuffixBuilder<FileResolutionBuilder<P>> {
46
47
	/**
48
	 * Initializes with the parent builder and the {@link EnvironmentBuilder}.
49
	 * The parent builder is used when calling the {@link #and()} method. The
50
	 * {@link EnvironmentBuilder} is used when calling {@link #build()} method
51
	 * in order to evaluate property value.
52
	 * 
53
	 * @param parent
54
	 *            the parent builder
55
	 * @param buildContext
56
	 *            for property resolution
57
	 */
58
	public FileResolutionBuilder(P parent, BuildContext buildContext) {
59
		super(FileResolutionBuilder.class, parent, buildContext);
60
	}
61
62
	@Override
63
	protected ResourceResolver createResolver() {
64 8 1. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → NO_COVERAGE
2. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → SURVIVED
3. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED
4. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED
5. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED
6. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED
7. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED
8. createResolver : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED
		return new FileResolver(lookups);
65
	}
66
67
	@Override
68
	public FileResolutionBuilder<P> pathPrefix(String prefix) {
69 4 1. pathPrefix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → SURVIVED
2. pathPrefix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE
3. pathPrefix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED
4. pathPrefix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED
		pathPrefixValueBuilder.setValue(prefix);
70 4 1. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → NO_COVERAGE
2. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED
3. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED
4. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED
		return myself;
71
	}
72
73
	@Override
74
	public ConfigurationValueBuilder<FileResolutionBuilder<P>, String> pathPrefix() {
75 4 1. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → NO_COVERAGE
2. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED
3. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED
4. pathPrefix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED
		return new ConfigurationValueBuilderDelegate<>(myself, pathPrefixValueBuilder);
76
	}
77
78
	@Override
79
	public FileResolutionBuilder<P> pathSuffix(String suffix) {
80 1 1. pathSuffix : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE
		pathSuffixValueBuilder.setValue(suffix);
81 1 1. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → NO_COVERAGE
		return myself;
82
	}
83
84
	@Override
85
	public ConfigurationValueBuilder<FileResolutionBuilder<P>, String> pathSuffix() {
86 4 1. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → NO_COVERAGE
2. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED
3. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED
4. pathSuffix : replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED
		return new ConfigurationValueBuilderDelegate<>(myself, pathSuffixValueBuilder);
87
	}
88
}

Mutations

64

1.1
Location : createResolver
Killed by : oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest.missingBeanErrorUsingThymeleaf(oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED

2.2
Location : createResolver
Killed by : none
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → NO_COVERAGE

3.3
Location : createResolver
Killed by : oghamspringbootv2autoconfigure.it.StaticMethodAccessTest.emailUsingFreemarkerTemplateAndStaticMethodAccessDisabledShouldFail(oghamspringbootv2autoconfigure.it.StaticMethodAccessTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED

4.4
Location : createResolver
Killed by : oghamthymeleafv2.it.ThymeleafDetectorTest.notFound(oghamthymeleafv2.it.ThymeleafDetectorTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED

5.5
Location : createResolver
Killed by : oghamfremarker.it.FreeMarkerParserTest.nested(oghamfremarker.it.FreeMarkerParserTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED

6.6
Location : createResolver
Killed by : oghamthymeleafv3.it.ThymeleafDetectorTest.notFound(oghamthymeleafv3.it.ThymeleafDetectorTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED

7.7
Location : createResolver
Killed by : none
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → SURVIVED

8.8
Location : createResolver
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.unreadableCss(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::createResolver → KILLED

69

1.1
Location : pathPrefix
Killed by : oghamthymeleafv3.it.ExternalFileTest.fileUnreadable(oghamthymeleafv3.it.ExternalFileTest)
removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED

2.2
Location : pathPrefix
Killed by : none
removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → SURVIVED

3.3
Location : pathPrefix
Killed by : none
removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE

4.4
Location : pathPrefix
Killed by : oghamthymeleafv2.it.ExternalFileTest.fileUpdatedButUseThymeleafCache(oghamthymeleafv2.it.ExternalFileTest)
removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → KILLED

70

1.1
Location : pathPrefix
Killed by : none
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → NO_COVERAGE

2.2
Location : pathPrefix
Killed by : oghamfremarker.it.FreeMarkerParserTest.nested(oghamfremarker.it.FreeMarkerParserTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED

3.3
Location : pathPrefix
Killed by : oghamthymeleafv2.it.ThymeleafDetectorTest.notFound(oghamthymeleafv2.it.ThymeleafDetectorTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED

4.4
Location : pathPrefix
Killed by : oghamthymeleafv3.it.ThymeleafDetectorTest.notFound(oghamthymeleafv3.it.ThymeleafDetectorTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED

75

1.1
Location : pathPrefix
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED

2.2
Location : pathPrefix
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED

3.3
Location : pathPrefix
Killed by : none
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → NO_COVERAGE

4.4
Location : pathPrefix
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathPrefix → KILLED

80

1.1
Location : pathSuffix
Killed by : none
removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE

81

1.1
Location : pathSuffix
Killed by : none
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → NO_COVERAGE

86

1.1
Location : pathSuffix
Killed by : none
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → NO_COVERAGE

2.2
Location : pathSuffix
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED

3.3
Location : pathSuffix
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED

4.4
Location : pathSuffix
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/core/builder/resolution/FileResolutionBuilder::pathSuffix → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM