JsmppServerInitializer.java

1
package fr.sii.ogham.testing.extension.spring;
2
3
import org.slf4j.Logger;
4
import org.slf4j.LoggerFactory;
5
import org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition;
6
import org.springframework.beans.factory.config.BeanDefinition;
7
import org.springframework.context.ApplicationContext;
8
import org.springframework.context.ApplicationContextInitializer;
9
import org.springframework.context.ConfigurableApplicationContext;
10
import org.springframework.context.support.GenericApplicationContext;
11
import org.springframework.core.env.Environment;
12
import org.springframework.test.context.support.TestPropertySourceUtils;
13
14
import fr.sii.ogham.testing.extension.junit.sms.JsmppServerRule;
15
import fr.sii.ogham.testing.util.RandomPortUtils;
16
17
/**
18
 * Initializer for Spring Boot tests that registers:
19
 * <ul>
20
 * <li>{@code "jsmpp.server.port"} property in Spring {@link Environment}</li>
21
 * <li>{@link JsmppServerRule} bean in Spring {@link ApplicationContext} through
22
 * {@link JsmppServerTestConfiguration} in order to use the port defined by
23
 * {@code "jsmpp.server.port"} property</li>
24
 * </ul>
25
 * 
26
 * @author Aurélien Baudet
27
 *
28
 */
29
public class JsmppServerInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
30
	private static final Logger LOG = LoggerFactory.getLogger(JsmppServerInitializer.class);
31
32
	@Override
33
	public void initialize(ConfigurableApplicationContext applicationContext) {
34 3 1. initialize : negated conditional → NO_COVERAGE
2. initialize : negated conditional → KILLED
3. initialize : negated conditional → KILLED
		if (applicationContext instanceof GenericApplicationContext) {
35
			BeanDefinition configBean = new AnnotatedGenericBeanDefinition(JsmppServerTestConfiguration.class);
36 3 1. initialize : removed call to org/springframework/context/support/GenericApplicationContext::registerBeanDefinition → NO_COVERAGE
2. initialize : removed call to org/springframework/context/support/GenericApplicationContext::registerBeanDefinition → KILLED
3. initialize : removed call to org/springframework/context/support/GenericApplicationContext::registerBeanDefinition → KILLED
			((GenericApplicationContext) applicationContext).registerBeanDefinition("jsmppServerTestConfiguration", configBean);
37
		}
38
		int port = RandomPortUtils.findAvailableTcpPort();
39
		LOG.debug("Registering {} port for JSMPP server", port);
40 3 1. initialize : removed call to org/springframework/test/context/support/TestPropertySourceUtils::addInlinedPropertiesToEnvironment → NO_COVERAGE
2. initialize : removed call to org/springframework/test/context/support/TestPropertySourceUtils::addInlinedPropertiesToEnvironment → KILLED
3. initialize : removed call to org/springframework/test/context/support/TestPropertySourceUtils::addInlinedPropertiesToEnvironment → KILLED
		TestPropertySourceUtils.addInlinedPropertiesToEnvironment(applicationContext, "jsmpp.server.port=" + port);
41
	}
42
}

Mutations

34

1.1
Location : initialize
Killed by : oghamspringbootv2autoconfigure.it.SpringWebBeanResolutionTest.emailUsingThymeleafTemplateInAsyncMethodCantResolveUrls(oghamspringbootv2autoconfigure.it.SpringWebBeanResolutionTest)
negated conditional → KILLED

2.2
Location : initialize
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : initialize
Killed by : oghamspringbootv1autoconfigure.it.SpringWebBeanResolutionTest.emailUsingThymeleafTemplateInAsyncMethodCantResolveUrls(oghamspringbootv1autoconfigure.it.SpringWebBeanResolutionTest)
negated conditional → KILLED

36

1.1
Location : initialize
Killed by : oghamspringbootv2autoconfigure.it.SpringWebBeanResolutionTest.emailUsingThymeleafTemplateInAsyncMethodCantResolveUrls(oghamspringbootv2autoconfigure.it.SpringWebBeanResolutionTest)
removed call to org/springframework/context/support/GenericApplicationContext::registerBeanDefinition → KILLED

2.2
Location : initialize
Killed by : oghamspringbootv1autoconfigure.it.SpringWebBeanResolutionTest.emailUsingThymeleafTemplateInAsyncMethodCantResolveUrls(oghamspringbootv1autoconfigure.it.SpringWebBeanResolutionTest)
removed call to org/springframework/context/support/GenericApplicationContext::registerBeanDefinition → KILLED

3.3
Location : initialize
Killed by : none
removed call to org/springframework/context/support/GenericApplicationContext::registerBeanDefinition → NO_COVERAGE

40

1.1
Location : initialize
Killed by : oghamspringbootv2autoconfigure.it.SpringWebBeanResolutionTest.emailUsingThymeleafTemplateInAsyncMethodCantResolveUrls(oghamspringbootv2autoconfigure.it.SpringWebBeanResolutionTest)
removed call to org/springframework/test/context/support/TestPropertySourceUtils::addInlinedPropertiesToEnvironment → KILLED

2.2
Location : initialize
Killed by : none
removed call to org/springframework/test/context/support/TestPropertySourceUtils::addInlinedPropertiesToEnvironment → NO_COVERAGE

3.3
Location : initialize
Killed by : oghamspringbootv1autoconfigure.it.SpringWebBeanResolutionTest.emailUsingThymeleafTemplateInAsyncMethodCantResolveUrls(oghamspringbootv1autoconfigure.it.SpringWebBeanResolutionTest)
removed call to org/springframework/test/context/support/TestPropertySourceUtils::addInlinedPropertiesToEnvironment → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM