conflict_resolution
stringlengths
27
16k
<<<<<<< ======= import java.util.Set; import java.util.concurrent.atomic.AtomicReference; >>>>>>> import java.util.concurrent.atomic.AtomicReference; <<<<<<< ======= import javax.servlet.ServletRegistration.Dynamic; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; >>>>>>> import javax.servlet.ServletRegistration.Dynamic; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
<<<<<<< static final double TIMEOUT_DEFAULT = BleManagerConfig.DEFAULT_TASK_TIMEOUT; static final double TIMEOUT_CONNECTION = BleManagerConfig.DEFAULT_TASK_TIMEOUT; private BleDevice m_device; private BleServer m_server; ======= private BleDevice m_device; >>>>>>> static final double TIMEOUT_DEFAULT = BleManagerConfig.DEFAULT_TASK_TIMEOUT; static final double TIMEOUT_CONNECTION = BleManagerConfig.DEFAULT_TASK_TIMEOUT; private BleDevice m_device; private BleServer m_server; private BleDevice m_device;
<<<<<<< void webServerWithMultipartConfigDisabled() { ======= public void webServerWithNonAbsoluteMultipartLocationUndertowConfiguration() { this.context = new AnnotationConfigServletWebServerApplicationContext( WebServerWithNonAbsolutePathUndertow.class, BaseConfiguration.class); this.context.getBean(MultipartConfigElement.class); verifyServletWorks(); assertThat(this.context.getBean(StandardServletMultipartResolver.class)) .isSameAs(this.context.getBean(DispatcherServlet.class).getMultipartResolver()); } @Test public void webServerWithMultipartConfigDisabled() { >>>>>>> void webServerWithNonAbsoluteMultipartLocationUndertowConfiguration() { this.context = new AnnotationConfigServletWebServerApplicationContext( WebServerWithNonAbsolutePathUndertow.class, BaseConfiguration.class); this.context.getBean(MultipartConfigElement.class); verifyServletWorks(); assertThat(this.context.getBean(StandardServletMultipartResolver.class)) .isSameAs(this.context.getBean(DispatcherServlet.class).getMultipartResolver()); } @Test void webServerWithMultipartConfigDisabled() { <<<<<<< @Configuration(proxyBeanMethods = false) static class WebServerWithCustomMultipartResolver { ======= @Configuration @EnableWebMvc public static class WebServerWithNonAbsolutePathUndertow { @Bean MultipartConfigElement multipartConfigElement() { return new MultipartConfigElement("test/not-absolute"); } @Bean UndertowServletWebServerFactory webServerFactory() { return new UndertowServletWebServerFactory(); } @Bean WebController webController() { return new WebController(); } } @Configuration public static class WebServerWithCustomMultipartResolver { >>>>>>> @Configuration(proxyBeanMethods = false) @EnableWebMvc static class WebServerWithNonAbsolutePathUndertow { @Bean MultipartConfigElement multipartConfigElement() { return new MultipartConfigElement("test/not-absolute"); } @Bean UndertowServletWebServerFactory webServerFactory() { return new UndertowServletWebServerFactory(); } @Bean WebController webController() { return new WebController(); } } @Configuration(proxyBeanMethods = false) static class WebServerWithCustomMultipartResolver {
<<<<<<< ======= import com.idevicesinc.sweetblue.utils.Pointer; >>>>>>> import com.idevicesinc.sweetblue.utils.Pointer;
<<<<<<< RestTemplate template = this.builder.customizers(customizer1) .additionalCustomizers(customizer2).build(); InOrder ordered = inOrder(customizer1, customizer2); ordered.verify(customizer1).customize(template); ordered.verify(customizer2).customize(template); } @Test public void customizerShouldBeAppliedAtTheEnd() { ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class); ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); this.builder.interceptors(this.interceptor) .messageConverters(this.messageConverter).rootUri("http://localhost:8080") .errorHandler(errorHandler).basicAuthentication("spring", "boot") .requestFactory(() -> requestFactory).customizers((restTemplate) -> { assertThat(restTemplate.getInterceptors()).hasSize(2) .contains(this.interceptor).anyMatch( (ic) -> ic instanceof BasicAuthenticationInterceptor); assertThat(restTemplate.getMessageConverters()) .contains(this.messageConverter); assertThat(restTemplate.getUriTemplateHandler()) .isInstanceOf(RootUriTemplateHandler.class); assertThat(restTemplate.getErrorHandler()).isEqualTo(errorHandler); ClientHttpRequestFactory actualRequestFactory = restTemplate .getRequestFactory(); assertThat(actualRequestFactory) .isInstanceOf(InterceptingClientHttpRequestFactory.class); assertThat(actualRequestFactory).hasFieldOrPropertyWithValue( "requestFactory", requestFactory); }).build(); ======= RestTemplate template = this.builder.customizers(customizer1).additionalCustomizers(customizer2).build(); verify(customizer1).customize(template); verify(customizer2).customize(template); >>>>>>> RestTemplate template = this.builder.customizers(customizer1).additionalCustomizers(customizer2).build(); InOrder ordered = inOrder(customizer1, customizer2); ordered.verify(customizer1).customize(template); ordered.verify(customizer2).customize(template); } @Test public void customizerShouldBeAppliedAtTheEnd() { ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class); ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); this.builder.interceptors(this.interceptor).messageConverters(this.messageConverter) .rootUri("http://localhost:8080").errorHandler(errorHandler).basicAuthentication("spring", "boot") .requestFactory(() -> requestFactory).customizers((restTemplate) -> { assertThat(restTemplate.getInterceptors()).hasSize(2).contains(this.interceptor) .anyMatch((ic) -> ic instanceof BasicAuthenticationInterceptor); assertThat(restTemplate.getMessageConverters()).contains(this.messageConverter); assertThat(restTemplate.getUriTemplateHandler()).isInstanceOf(RootUriTemplateHandler.class); assertThat(restTemplate.getErrorHandler()).isEqualTo(errorHandler); ClientHttpRequestFactory actualRequestFactory = restTemplate.getRequestFactory(); assertThat(actualRequestFactory).isInstanceOf(InterceptingClientHttpRequestFactory.class); assertThat(actualRequestFactory).hasFieldOrPropertyWithValue("requestFactory", requestFactory); }).build(); <<<<<<< .requestFactory(HttpComponentsClientHttpRequestFactory.class) .setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(((RequestConfig) ReflectionTestUtils.getField(requestFactory, "requestConfig")).getConnectTimeout()).isEqualTo(1234); ======= .requestFactory(HttpComponentsClientHttpRequestFactory.class).setConnectTimeout(1234).build() .getRequestFactory(); assertThat(((RequestConfig) ReflectionTestUtils.getField(requestFactory, "requestConfig")).getConnectTimeout()) .isEqualTo(1234); >>>>>>> .requestFactory(HttpComponentsClientHttpRequestFactory.class).setConnectTimeout(Duration.ofMillis(1234)) .build().getRequestFactory(); assertThat(((RequestConfig) ReflectionTestUtils.getField(requestFactory, "requestConfig")).getConnectTimeout()) .isEqualTo(1234); <<<<<<< .requestFactory(HttpComponentsClientHttpRequestFactory.class) .setReadTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(((RequestConfig) ReflectionTestUtils.getField(requestFactory, "requestConfig")).getSocketTimeout()).isEqualTo(1234); ======= .requestFactory(HttpComponentsClientHttpRequestFactory.class).setReadTimeout(1234).build() .getRequestFactory(); assertThat(((RequestConfig) ReflectionTestUtils.getField(requestFactory, "requestConfig")).getSocketTimeout()) .isEqualTo(1234); >>>>>>> .requestFactory(HttpComponentsClientHttpRequestFactory.class).setReadTimeout(Duration.ofMillis(1234)) .build().getRequestFactory(); assertThat(((RequestConfig) ReflectionTestUtils.getField(requestFactory, "requestConfig")).getSocketTimeout()) .isEqualTo(1234); <<<<<<< ClientHttpRequestFactory requestFactory = this.builder .requestFactory(SimpleClientHttpRequestFactory.class) .setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234); ======= ClientHttpRequestFactory requestFactory = this.builder.requestFactory(SimpleClientHttpRequestFactory.class) .setConnectTimeout(1234).build().getRequestFactory(); assertThat(ReflectionTestUtils.getField(requestFactory, "connectTimeout")).isEqualTo(1234); >>>>>>> ClientHttpRequestFactory requestFactory = this.builder.requestFactory(SimpleClientHttpRequestFactory.class) .setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234); <<<<<<< ClientHttpRequestFactory requestFactory = this.builder .requestFactory(SimpleClientHttpRequestFactory.class) .setReadTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234); ======= ClientHttpRequestFactory requestFactory = this.builder.requestFactory(SimpleClientHttpRequestFactory.class) .setReadTimeout(1234).build().getRequestFactory(); assertThat(ReflectionTestUtils.getField(requestFactory, "readTimeout")).isEqualTo(1234); >>>>>>> ClientHttpRequestFactory requestFactory = this.builder.requestFactory(SimpleClientHttpRequestFactory.class) .setReadTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234); <<<<<<< ClientHttpRequestFactory requestFactory = this.builder .requestFactory(OkHttp3ClientHttpRequestFactory.class) .setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(ReflectionTestUtils.getField( ReflectionTestUtils.getField(requestFactory, "client"), "connectTimeout")) ======= ClientHttpRequestFactory requestFactory = this.builder.requestFactory(OkHttp3ClientHttpRequestFactory.class) .setConnectTimeout(1234).build().getRequestFactory(); assertThat( ReflectionTestUtils.getField(ReflectionTestUtils.getField(requestFactory, "client"), "connectTimeout")) >>>>>>> ClientHttpRequestFactory requestFactory = this.builder.requestFactory(OkHttp3ClientHttpRequestFactory.class) .setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat( ReflectionTestUtils.getField(ReflectionTestUtils.getField(requestFactory, "client"), "connectTimeout")) <<<<<<< ClientHttpRequestFactory requestFactory = this.builder .requestFactory(OkHttp3ClientHttpRequestFactory.class) .setReadTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(ReflectionTestUtils.getField( ReflectionTestUtils.getField(requestFactory, "client"), "readTimeout")) .isEqualTo(1234); ======= ClientHttpRequestFactory requestFactory = this.builder.requestFactory(OkHttp3ClientHttpRequestFactory.class) .setReadTimeout(1234).build().getRequestFactory(); assertThat(ReflectionTestUtils.getField(ReflectionTestUtils.getField(requestFactory, "client"), "readTimeout")) .isEqualTo(1234); >>>>>>> ClientHttpRequestFactory requestFactory = this.builder.requestFactory(OkHttp3ClientHttpRequestFactory.class) .setReadTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(ReflectionTestUtils.getField(ReflectionTestUtils.getField(requestFactory, "client"), "readTimeout")) .isEqualTo(1234); <<<<<<< this.builder .requestFactory( () -> new BufferingClientHttpRequestFactory(requestFactory)) .setConnectTimeout(Duration.ofMillis(1234)).build(); assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234); ======= this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).setConnectTimeout(1234) .build(); assertThat(ReflectionTestUtils.getField(requestFactory, "connectTimeout")).isEqualTo(1234); >>>>>>> this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)) .setConnectTimeout(Duration.ofMillis(1234)).build(); assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234); <<<<<<< this.builder .requestFactory( () -> new BufferingClientHttpRequestFactory(requestFactory)) .setReadTimeout(Duration.ofMillis(1234)).build(); assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234); ======= this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).setReadTimeout(1234) .build(); assertThat(ReflectionTestUtils.getField(requestFactory, "readTimeout")).isEqualTo(1234); >>>>>>> this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)) .setReadTimeout(Duration.ofMillis(1234)).build(); assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234);
<<<<<<< @Generated( value = { "http://www.jooq.org", "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ" ) ======= @Generated(value = { "https://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ") >>>>>>> @Generated( value = { "https://www.jooq.org", "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ" )
<<<<<<< void defaultServletConfiguration() throws IOException { ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition( new SimpleMetadataReaderFactory().getMetadataReader(DefaultConfigurationServlet.class.getName())); this.handler.handle(scanned, this.registry); ======= public void defaultServletConfiguration() throws IOException { AnnotatedBeanDefinition servletdefinition = createBeanDefinition(DefaultConfigurationServlet.class); this.handler.handle(servletdefinition, this.registry); >>>>>>> void defaultServletConfiguration() throws IOException { AnnotatedBeanDefinition servletdefinition = createBeanDefinition(DefaultConfigurationServlet.class); this.handler.handle(servletdefinition, this.registry); <<<<<<< void servletWithCustomName() throws IOException { ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition( new SimpleMetadataReaderFactory().getMetadataReader(CustomNameServlet.class.getName())); this.handler.handle(scanned, this.registry); ======= public void servletWithCustomName() throws IOException { AnnotatedBeanDefinition definition = createBeanDefinition(CustomNameServlet.class); this.handler.handle(definition, this.registry); >>>>>>> void servletWithCustomName() throws IOException { AnnotatedBeanDefinition definition = createBeanDefinition(CustomNameServlet.class); this.handler.handle(definition, this.registry); <<<<<<< void asyncSupported() throws IOException { BeanDefinition servletRegistrationBean = getBeanDefinition(AsyncSupportedServlet.class); ======= public void asyncSupported() throws IOException { BeanDefinition servletRegistrationBean = handleBeanDefinitionForClass(AsyncSupportedServlet.class); >>>>>>> void asyncSupported() throws IOException { BeanDefinition servletRegistrationBean = handleBeanDefinitionForClass(AsyncSupportedServlet.class); <<<<<<< void initParameters() throws IOException { BeanDefinition servletRegistrationBean = getBeanDefinition(InitParametersServlet.class); ======= public void initParameters() throws IOException { BeanDefinition servletRegistrationBean = handleBeanDefinitionForClass(InitParametersServlet.class); >>>>>>> void initParameters() throws IOException { BeanDefinition servletRegistrationBean = handleBeanDefinitionForClass(InitParametersServlet.class);
<<<<<<< import org.junit.jupiter.api.Test; ======= import liquibase.integration.spring.SpringLiquibase; import org.junit.Test; >>>>>>> import liquibase.integration.spring.SpringLiquibase; import org.junit.jupiter.api.Test;
<<<<<<< assertThat(this.gradleBuild.script( "src/main/gradle/managing-dependencies/configure-bom-with-plugins") .build("dependencyManagement").getOutput()).contains( "org.springframework.boot:spring-boot-starter TEST-SNAPSHOT"); ======= assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom-with-plugins") .build("dependencyManagement").getOutput()).contains("org.springframework.boot:spring-boot-starter "); >>>>>>> assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom-with-plugins") .build("dependencyManagement").getOutput()) .contains("org.springframework.boot:spring-boot-starter TEST-SNAPSHOT");
<<<<<<< public void init() throws Exception { FS commandFileSystem = createFileSystem( this.properties.getCommandPathPatterns(), this.properties.getDisabledCommands()); FS configurationFileSystem = createFileSystem( this.properties.getConfigPathPatterns(), new String[0]); ======= public void init() { FS commandFileSystem = createFileSystem(this.properties .getCommandPathPatterns()); FS configurationFileSystem = createFileSystem(this.properties .getConfigPathPatterns()); >>>>>>> public void init() { FS commandFileSystem = createFileSystem( this.properties.getCommandPathPatterns(), this.properties.getDisabledCommands()); FS configurationFileSystem = createFileSystem( this.properties.getConfigPathPatterns(), new String[0]); <<<<<<< protected FS createFileSystem(String[] pathPatterns, String[] filterPatterns) throws IOException, URISyntaxException { ======= protected FS createFileSystem(String[] pathPatterns) { >>>>>>> protected FS createFileSystem(String[] pathPatterns, String[] filterPatterns) {
<<<<<<< public void thymeleafCacheIsFalse() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class)); SpringResourceTemplateResolver resolver = this.context .getBean(SpringResourceTemplateResolver.class); ======= public void thymeleafCacheIsFalse() { this.context = initializeAndRun(Config.class); SpringResourceTemplateResolver resolver = this.context.getBean(SpringResourceTemplateResolver.class); >>>>>>> public void thymeleafCacheIsFalse() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class)); SpringResourceTemplateResolver resolver = this.context.getBean(SpringResourceTemplateResolver.class); <<<<<<< public void defaultPropertyCanBeOverriddenFromCommandLine() throws Exception { this.context = getContext( () -> initializeAndRun(Config.class, "--spring.thymeleaf.cache=true")); SpringResourceTemplateResolver resolver = this.context .getBean(SpringResourceTemplateResolver.class); ======= public void defaultPropertyCanBeOverriddenFromCommandLine() { this.context = initializeAndRun(Config.class, "--spring.thymeleaf.cache=true"); SpringResourceTemplateResolver resolver = this.context.getBean(SpringResourceTemplateResolver.class); >>>>>>> public void defaultPropertyCanBeOverriddenFromCommandLine() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class, "--spring.thymeleaf.cache=true")); SpringResourceTemplateResolver resolver = this.context.getBean(SpringResourceTemplateResolver.class); <<<<<<< this.context = getContext(() -> initializeAndRun(Config.class)); SpringResourceTemplateResolver resolver = this.context .getBean(SpringResourceTemplateResolver.class); ======= this.context = initializeAndRun(Config.class); SpringResourceTemplateResolver resolver = this.context.getBean(SpringResourceTemplateResolver.class); >>>>>>> this.context = getContext(() -> initializeAndRun(Config.class)); SpringResourceTemplateResolver resolver = this.context.getBean(SpringResourceTemplateResolver.class); <<<<<<< public void restartTriggeredOnClassPathChangeWithRestart() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class)); ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.emptySet(), true); ======= public void restartTriggeredOnClassPathChangeWithRestart() { this.context = initializeAndRun(Config.class); ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.emptySet(), true); >>>>>>> public void restartTriggeredOnClassPathChangeWithRestart() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class)); ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.emptySet(), true); <<<<<<< public void restartNotTriggeredOnClassPathChangeWithRestart() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class)); ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.emptySet(), false); ======= public void restartNotTriggeredOnClassPathChangeWithRestart() { this.context = initializeAndRun(Config.class); ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.emptySet(), false); >>>>>>> public void restartNotTriggeredOnClassPathChangeWithRestart() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class)); ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.emptySet(), false); <<<<<<< public void restartWatchingClassPath() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class)); ClassPathFileSystemWatcher watcher = this.context .getBean(ClassPathFileSystemWatcher.class); ======= public void restartWatchingClassPath() { this.context = initializeAndRun(Config.class); ClassPathFileSystemWatcher watcher = this.context.getBean(ClassPathFileSystemWatcher.class); >>>>>>> public void restartWatchingClassPath() throws Exception { this.context = getContext(() -> initializeAndRun(Config.class)); ClassPathFileSystemWatcher watcher = this.context.getBean(ClassPathFileSystemWatcher.class); <<<<<<< this.context = getContext(() -> initializeAndRun(Config.class, properties)); ClassPathFileSystemWatcher classPathWatcher = this.context .getBean(ClassPathFileSystemWatcher.class); Object watcher = ReflectionTestUtils.getField(classPathWatcher, "fileSystemWatcher"); ======= this.context = initializeAndRun(Config.class, properties); ClassPathFileSystemWatcher classPathWatcher = this.context.getBean(ClassPathFileSystemWatcher.class); Object watcher = ReflectionTestUtils.getField(classPathWatcher, "fileSystemWatcher"); >>>>>>> this.context = getContext(() -> initializeAndRun(Config.class, properties)); ClassPathFileSystemWatcher classPathWatcher = this.context.getBean(ClassPathFileSystemWatcher.class); Object watcher = ReflectionTestUtils.getField(classPathWatcher, "fileSystemWatcher"); <<<<<<< properties.put("spring.devtools.restart.additional-paths", "src/main/java,src/test/java"); this.context = getContext(() -> initializeAndRun(Config.class, properties)); ClassPathFileSystemWatcher classPathWatcher = this.context .getBean(ClassPathFileSystemWatcher.class); Object watcher = ReflectionTestUtils.getField(classPathWatcher, "fileSystemWatcher"); ======= properties.put("spring.devtools.restart.additional-paths", "src/main/java,src/test/java"); this.context = initializeAndRun(Config.class, properties); ClassPathFileSystemWatcher classPathWatcher = this.context.getBean(ClassPathFileSystemWatcher.class); Object watcher = ReflectionTestUtils.getField(classPathWatcher, "fileSystemWatcher"); >>>>>>> properties.put("spring.devtools.restart.additional-paths", "src/main/java,src/test/java"); this.context = getContext(() -> initializeAndRun(Config.class, properties)); ClassPathFileSystemWatcher classPathWatcher = this.context.getBean(ClassPathFileSystemWatcher.class); Object watcher = ReflectionTestUtils.getField(classPathWatcher, "fileSystemWatcher"); <<<<<<< private ConfigurableApplicationContext getContext( Supplier<ConfigurableApplicationContext> supplier) throws Exception { AtomicReference<ConfigurableApplicationContext> atomicReference = new AtomicReference<>(); Thread thread = new Thread(() -> { ConfigurableApplicationContext context = supplier.get(); atomicReference.getAndSet(context); }); thread.start(); thread.join(); return atomicReference.get(); } private ConfigurableApplicationContext initializeAndRun(Class<?> config, String... args) { ======= private ConfigurableApplicationContext initializeAndRun(Class<?> config, String... args) { >>>>>>> private ConfigurableApplicationContext getContext(Supplier<ConfigurableApplicationContext> supplier) throws Exception { AtomicReference<ConfigurableApplicationContext> atomicReference = new AtomicReference<>(); Thread thread = new Thread(() -> { ConfigurableApplicationContext context = supplier.get(); atomicReference.getAndSet(context); }); thread.start(); thread.join(); return atomicReference.get(); } private ConfigurableApplicationContext initializeAndRun(Class<?> config, String... args) { <<<<<<< @Configuration(proxyBeanMethods = false) @Import({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ThymeleafAutoConfiguration.class }) ======= @Configuration @Import({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ThymeleafAutoConfiguration.class }) >>>>>>> @Configuration(proxyBeanMethods = false) @Import({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ThymeleafAutoConfiguration.class }) <<<<<<< @Configuration(proxyBeanMethods = false) @ImportAutoConfiguration({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ThymeleafAutoConfiguration.class }) ======= @Configuration @ImportAutoConfiguration({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ThymeleafAutoConfiguration.class }) >>>>>>> @Configuration(proxyBeanMethods = false) @ImportAutoConfiguration({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ThymeleafAutoConfiguration.class }) <<<<<<< @Configuration(proxyBeanMethods = false) @Import({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ResourceProperties.class }) ======= @Configuration @Import({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ResourceProperties.class }) >>>>>>> @Configuration(proxyBeanMethods = false) @Import({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, ResourceProperties.class })
<<<<<<< public void serializeNullsTrue() { this.contextRunner.withPropertyValues("spring.gson.serialize-nulls:true") .run((context) -> { Gson gson = context.getBean(Gson.class); assertThat(gson.serializeNulls()).isTrue(); }); ======= public void serializeNulls() { this.contextRunner.withPropertyValues("spring.gson.serialize-nulls:true").run((context) -> { Gson gson = context.getBean(Gson.class); assertThat(gson.serializeNulls()).isTrue(); }); >>>>>>> public void serializeNullsTrue() { this.contextRunner.withPropertyValues("spring.gson.serialize-nulls:true").run((context) -> { Gson gson = context.getBean(Gson.class); assertThat(gson.serializeNulls()).isTrue(); });
<<<<<<< String contents = contentOf(this.file); contents = contents.substring(0, contents .indexOf(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 }))); ======= String contents = new String(FileCopyUtils.copyToByteArray(this.file)); contents = contents.substring(0, contents.indexOf(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 }))); >>>>>>> String contents = contentOf(this.file); contents = contents.substring(0, contents.indexOf(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 }))); <<<<<<< String contents = contentOf(this.file); assertThat(contents).as("Is executable") .startsWith(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 })); ======= String contents = new String(FileCopyUtils.copyToByteArray(this.file)); assertThat(contents).as("Is executable").startsWith(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 })); >>>>>>> String contents = contentOf(this.file); assertThat(contents).as("Is executable").startsWith(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 })); <<<<<<< verifier.assertHasEntryNameStartingWith("BOOT-INF/lib/jakarta.servlet-api-4"); assertThat(verifier .hasEntry("org/springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isTrue(); assertThat(verifier .hasEntry("BOOT-INF/classes/org/test/SampleApplication.class")) .as("Own classes").isTrue(); ======= verifier.assertHasEntryNameStartingWith("BOOT-INF/lib/javax.servlet-api-4"); assertThat(verifier.hasEntry("org/springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isTrue(); assertThat(verifier.hasEntry("BOOT-INF/classes/org/test/SampleApplication.class")).as("Own classes") .isTrue(); >>>>>>> verifier.assertHasEntryNameStartingWith("BOOT-INF/lib/jakarta.servlet-api-4"); assertThat(verifier.hasEntry("org/springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isTrue(); assertThat(verifier.hasEntry("BOOT-INF/classes/org/test/SampleApplication.class")).as("Own classes") .isTrue(); <<<<<<< verifier.assertHasEntryNameStartingWith( "WEB-INF/lib-provided/jakarta.servlet-api-4"); assertThat(verifier .hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isTrue(); assertThat(verifier .hasEntry("WEB-INF/classes/org/" + "test/SampleApplication.class")) .as("Own classes").isTrue(); ======= verifier.assertHasEntryNameStartingWith("WEB-INF/lib-provided/javax.servlet-api-4"); assertThat(verifier.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isTrue(); assertThat(verifier.hasEntry("WEB-INF/classes/org/" + "test/SampleApplication.class")).as("Own classes") .isTrue(); >>>>>>> verifier.assertHasEntryNameStartingWith("WEB-INF/lib-provided/jakarta.servlet-api-4"); assertThat(verifier.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isTrue(); assertThat(verifier.hasEntry("WEB-INF/classes/org/" + "test/SampleApplication.class")).as("Own classes") .isTrue(); <<<<<<< verifier.assertHasNoEntryNameStartingWith("lib/jakarta.servlet-api"); assertThat(verifier .hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isFalse(); assertThat(verifier.hasEntry("org/" + "test/SampleModule.class")) .as("Own classes").isTrue(); ======= verifier.assertHasNoEntryNameStartingWith("lib/javax.servlet-api"); assertThat(verifier.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isFalse(); assertThat(verifier.hasEntry("org/" + "test/SampleModule.class")).as("Own classes").isTrue(); >>>>>>> verifier.assertHasNoEntryNameStartingWith("lib/jakarta.servlet-api"); assertThat(verifier.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class")) .as("Unpacked launcher classes").isFalse(); assertThat(verifier.hasEntry("org/" + "test/SampleModule.class")).as("Own classes").isTrue();
<<<<<<< @Generated( value = { "http://www.jooq.org", "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ" ) ======= @Generated(value = { "https://www.jooq.org", "jOOQ version:3.6.2" }, comments = "This class is generated by jOOQ") >>>>>>> @Generated( value = { "https://www.jooq.org", "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ" )
<<<<<<< m_adapter = new CharacteristicAdapter(m_device, m_service, m_characteristicList); ======= m_adapter = new CharacteristicAdapter(this, m_device, m_characteristicList); >>>>>>> m_adapter = new CharacteristicAdapter(this, m_device, m_service, m_characteristicList);
<<<<<<< import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentMatchers; ======= import org.junit.Test; import org.junit.runner.RunWith; >>>>>>> import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; <<<<<<< import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; ======= import org.springframework.test.context.junit4.SpringRunner; >>>>>>> import org.springframework.test.context.junit.jupiter.SpringExtension;
<<<<<<< @Testcontainers @ContextConfiguration( initializers = DataRedisTestPropertiesIntegrationTests.Initializer.class) ======= @RunWith(SpringRunner.class) @ContextConfiguration(initializers = DataRedisTestPropertiesIntegrationTests.Initializer.class) >>>>>>> @Testcontainers @ContextConfiguration(initializers = DataRedisTestPropertiesIntegrationTests.Initializer.class)
<<<<<<< import java.io.File; ======= import java.util.logging.Handler; import java.util.logging.LogManager; >>>>>>> import java.io.File; import java.util.logging.Handler; import java.util.logging.LogManager; <<<<<<< import org.springframework.boot.logging.AbstractLoggingSystemTests; ======= import org.slf4j.bridge.SLF4JBridgeHandler; >>>>>>> import org.slf4j.bridge.SLF4JBridgeHandler; import org.springframework.boot.logging.AbstractLoggingSystemTests; <<<<<<< @Test public void noFile() throws Exception { this.loggingSystem.beforeInitialize(); this.logger.info("Hidden"); this.loggingSystem.initialize(null, null); this.logger.info("Hello world"); String output = this.output.toString().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); assertFalse("Output not hidden:\n" + output, output.contains("Hidden")); assertFalse(new File(tmpDir() + "/spring.log").exists()); ======= @After public void clear() { this.loggingSystem.cleanUp(); System.clearProperty("LOG_FILE"); System.clearProperty("LOG_PATH"); System.clearProperty("PID"); >>>>>>> @Override @After public void clear() { this.loggingSystem.cleanUp(); } @Test public void noFile() throws Exception { this.loggingSystem.beforeInitialize(); this.logger.info("Hidden"); this.loggingSystem.initialize(null, null); this.logger.info("Hello world"); String output = this.output.toString().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); assertFalse("Output not hidden:\n" + output, output.contains("Hidden")); assertFalse(new File(tmpDir() + "/spring.log").exists()); <<<<<<< @Test @Ignore("Fails on Bamboo") public void loggingThatUsesJulIsCaptured() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null); java.util.logging.Logger julLogger = java.util.logging.Logger .getLogger(getClass().getName()); julLogger.severe("Hello world"); String output = this.output.toString().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); } ======= @Test public void bridgeHandlerLifecycle() { assertFalse(bridgeHandlerInstalled()); this.loggingSystem.beforeInitialize(); assertTrue(bridgeHandlerInstalled()); this.loggingSystem.cleanUp(); assertFalse(bridgeHandlerInstalled()); } private boolean bridgeHandlerInstalled() { java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger(""); Handler[] handlers = rootLogger.getHandlers(); for (Handler handler : handlers) { if (handler instanceof SLF4JBridgeHandler) { return true; } } return false; } >>>>>>> @Test @Ignore("Fails on Bamboo") public void loggingThatUsesJulIsCaptured() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null); java.util.logging.Logger julLogger = java.util.logging.Logger .getLogger(getClass().getName()); julLogger.severe("Hello world"); String output = this.output.toString().trim(); assertTrue("Wrong output:\n" + output, output.contains("Hello world")); } @Test public void bridgeHandlerLifecycle() { assertFalse(bridgeHandlerInstalled()); this.loggingSystem.beforeInitialize(); assertTrue(bridgeHandlerInstalled()); this.loggingSystem.cleanUp(); assertFalse(bridgeHandlerInstalled()); } private boolean bridgeHandlerInstalled() { java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger(""); Handler[] handlers = rootLogger.getHandlers(); for (Handler handler : handlers) { if (handler instanceof SLF4JBridgeHandler) { return true; } } return false; }
<<<<<<< void specificPort() { ======= public void specificPort() throws Exception { >>>>>>> void specificPort() throws Exception {
<<<<<<< public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) { getLoggerConfig(null).removeFilter(FILTER); super.initialize(initializationContext, configLocation, logFile); ======= public void initialize(String configLocation, LogFile logFile) { getRootLoggerConfig().removeFilter(FILTER); super.initialize(configLocation, logFile); >>>>>>> public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) { getRootLoggerConfig().removeFilter(FILTER); super.initialize(initializationContext, configLocation, logFile);
<<<<<<< import org.glassfish.jersey.server.model.Resource; import org.junit.jupiter.api.Test; ======= import org.junit.Test; >>>>>>> import org.junit.jupiter.api.Test; <<<<<<< import org.springframework.boot.actuate.endpoint.EndpointId; import org.springframework.boot.actuate.endpoint.http.ActuatorMediaType; import org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper; import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver; import org.springframework.boot.actuate.endpoint.web.EndpointMapping; import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes; import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer; import org.springframework.boot.actuate.endpoint.web.jersey.JerseyEndpointResourceFactory; ======= >>>>>>> <<<<<<< @Configuration(proxyBeanMethods = false) ======= @Test public void toAnyEndpointShouldMatchServletEndpoint() { getContextRunner().withPropertyValues("spring.security.user.password=password", "management.endpoints.web.exposure.include=se1").run((context) -> { WebTestClient webTestClient = getWebTestClient(context); webTestClient.get().uri("/actuator/se1").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/actuator/se1").header("Authorization", getBasicAuth()).exchange() .expectStatus().isOk(); webTestClient.get().uri("/actuator/se1/list").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/actuator/se1/list").header("Authorization", getBasicAuth()).exchange() .expectStatus().isOk(); }); } @Test public void toAnyEndpointWhenApplicationPathSetShouldMatchServletEndpoint() { getContextRunner().withPropertyValues("spring.jersey.application-path=/admin", "spring.security.user.password=password", "management.endpoints.web.exposure.include=se1") .run((context) -> { WebTestClient webTestClient = getWebTestClient(context); webTestClient.get().uri("/admin/actuator/se1").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/admin/actuator/se1").header("Authorization", getBasicAuth()).exchange() .expectStatus().isOk(); webTestClient.get().uri("/admin/actuator/se1/list").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/admin/actuator/se1/list").header("Authorization", getBasicAuth()) .exchange().expectStatus().isOk(); }); } @Override protected WebApplicationContextRunner createContextRunner() { return new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new) .withClassLoader(new FilteredClassLoader("org.springframework.web.servlet.DispatcherServlet")) .withUserConfiguration(JerseyEndpointConfiguration.class) .withConfiguration(AutoConfigurations.of(JerseyAutoConfiguration.class)); } @Configuration >>>>>>> @Test void toAnyEndpointShouldMatchServletEndpoint() { getContextRunner().withPropertyValues("spring.security.user.password=password", "management.endpoints.web.exposure.include=se1").run((context) -> { WebTestClient webTestClient = getWebTestClient(context); webTestClient.get().uri("/actuator/se1").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/actuator/se1").header("Authorization", getBasicAuth()).exchange() .expectStatus().isOk(); webTestClient.get().uri("/actuator/se1/list").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/actuator/se1/list").header("Authorization", getBasicAuth()).exchange() .expectStatus().isOk(); }); } @Test void toAnyEndpointWhenApplicationPathSetShouldMatchServletEndpoint() { getContextRunner().withPropertyValues("spring.jersey.application-path=/admin", "spring.security.user.password=password", "management.endpoints.web.exposure.include=se1") .run((context) -> { WebTestClient webTestClient = getWebTestClient(context); webTestClient.get().uri("/admin/actuator/se1").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/admin/actuator/se1").header("Authorization", getBasicAuth()).exchange() .expectStatus().isOk(); webTestClient.get().uri("/admin/actuator/se1/list").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/admin/actuator/se1/list").header("Authorization", getBasicAuth()) .exchange().expectStatus().isOk(); }); } @Override protected WebApplicationContextRunner createContextRunner() { return new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new) .withClassLoader(new FilteredClassLoader("org.springframework.web.servlet.DispatcherServlet")) .withUserConfiguration(JerseyEndpointConfiguration.class) .withConfiguration(AutoConfigurations.of(JerseyAutoConfiguration.class)); } @Configuration <<<<<<< @Bean ResourceConfigCustomizer webEndpointRegistrar() { return this::customize; } private void customize(ResourceConfig config) { List<String> mediaTypes = Arrays.asList(javax.ws.rs.core.MediaType.APPLICATION_JSON, ActuatorMediaType.V2_JSON); EndpointMediaTypes endpointMediaTypes = new EndpointMediaTypes(mediaTypes, mediaTypes); WebEndpointDiscoverer discoverer = new WebEndpointDiscoverer(this.applicationContext, new ConversionServiceParameterValueMapper(), endpointMediaTypes, Arrays.asList(EndpointId::toString), Collections.emptyList(), Collections.emptyList()); Collection<Resource> resources = new JerseyEndpointResourceFactory().createEndpointResources( new EndpointMapping("/actuator"), discoverer.getEndpoints(), endpointMediaTypes, new EndpointLinksResolver(discoverer.getEndpoints()), true); config.registerResources(new HashSet<>(resources)); } ======= >>>>>>>
<<<<<<< import org.junit.jupiter.api.Test; ======= import java.util.Map; import org.junit.Test; >>>>>>> import java.util.Map; import org.junit.jupiter.api.Test; <<<<<<< void runShouldHaveEndpointBean() { this.contextRunner.withPropertyValues("management.endpoint.shutdown.enabled:true") .withPropertyValues("management.endpoints.web.exposure.include=shutdown") .run((context) -> assertThat(context).hasSingleBean(ShutdownEndpoint.class)); ======= @SuppressWarnings("unchecked") public void runShouldHaveEndpointBeanThatIsNotDisposable() { this.contextRunner.withPropertyValues("management.endpoint.shutdown.enabled:true").run((context) -> { assertThat(context).hasSingleBean(ShutdownEndpoint.class); ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); Map<String, Object> disposableBeans = (Map<String, Object>) ReflectionTestUtils.getField(beanFactory, "disposableBeans"); assertThat(disposableBeans).isEmpty(); }); >>>>>>> void runShouldHaveEndpointBeanThatIsNotDisposable() { this.contextRunner.withPropertyValues("management.endpoint.shutdown.enabled:true") .withPropertyValues("management.endpoints.web.exposure.include=shutdown").run((context) -> { assertThat(context).hasSingleBean(ShutdownEndpoint.class); ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); Map<String, Object> disposableBeans = (Map<String, Object>) ReflectionTestUtils .getField(beanFactory, "disposableBeans"); assertThat(disposableBeans).isEmpty(); });
<<<<<<< BuildResult result = this.gradleBuild.gradleVersion("4.3").buildAndFail(); assertThat(result.getOutput()).contains("Spring Boot plugin requires Gradle 4.4" + " or later. The current version is Gradle 4.3"); ======= BuildResult result = this.gradleBuild.gradleVersion("3.5.1").buildAndFail(); assertThat(result.getOutput()) .contains("Spring Boot plugin requires Gradle 4.0" + " or later. The current version is Gradle 3.5.1"); >>>>>>> BuildResult result = this.gradleBuild.gradleVersion("4.3").buildAndFail(); assertThat(result.getOutput()) .contains("Spring Boot plugin requires Gradle 4.4" + " or later. The current version is Gradle 4.3");
<<<<<<< this.context = new AnnotationConfigApplicationContext(); new ElasticsearchNodeTemplate().doWithNode((node) -> { TestPropertyValues .of("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs", "spring.data.elasticsearch.cluster-nodes:localhost:" + node.getTcpPort()) .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class); this.context.refresh(); assertHasSingleBean(ElasticsearchTemplate.class); }); ======= load("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs"); assertThat(this.context.getBeanNamesForType(ElasticsearchTemplate.class)) .hasSize(1); >>>>>>> this.context = new AnnotationConfigApplicationContext(); new ElasticsearchNodeTemplate().doWithNode((node) -> { TestPropertyValues .of("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs", "spring.data.elasticsearch.cluster-nodes:localhost:" + node.getTcpPort()) .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class); this.context.refresh(); assertHasSingleBean(ElasticsearchTemplate.class); }); <<<<<<< this.context = new AnnotationConfigApplicationContext(); new ElasticsearchNodeTemplate().doWithNode((node) -> { TestPropertyValues .of("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs", "spring.data.elasticsearch.cluster-nodes:localhost:" + node.getTcpPort()) .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class); this.context.refresh(); assertHasSingleBean(SimpleElasticsearchMappingContext.class); }); ======= load("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs"); assertThat( this.context.getBeanNamesForType(SimpleElasticsearchMappingContext.class)) .hasSize(1); >>>>>>> this.context = new AnnotationConfigApplicationContext(); new ElasticsearchNodeTemplate().doWithNode((node) -> { TestPropertyValues .of("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs", "spring.data.elasticsearch.cluster-nodes:localhost:" + node.getTcpPort()) .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class); this.context.refresh(); assertHasSingleBean(SimpleElasticsearchMappingContext.class); }); <<<<<<< this.context = new AnnotationConfigApplicationContext(); new ElasticsearchNodeTemplate().doWithNode((node) -> { TestPropertyValues .of("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs", "spring.data.elasticsearch.cluster-nodes:localhost:" + node.getTcpPort()) .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class); this.context.refresh(); assertHasSingleBean(ElasticsearchConverter.class); }); } private void assertHasSingleBean(Class<?> type) { assertThat(this.context.getBeanNamesForType(type)).hasSize(1); ======= load("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs"); assertThat(this.context.getBeanNamesForType(ElasticsearchConverter.class)) .hasSize(1); >>>>>>> this.context = new AnnotationConfigApplicationContext(); new ElasticsearchNodeTemplate().doWithNode((node) -> { TestPropertyValues .of("spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs", "spring.data.elasticsearch.cluster-nodes:localhost:" + node.getTcpPort()) .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class); this.context.refresh(); assertHasSingleBean(ElasticsearchConverter.class); });
<<<<<<< TestPropertyValues .of("spring.data.elasticsearch.cluster-nodes:localhost:" + elasticsearch.getMappedTransportPort(), "spring.data.elasticsearch.cluster-name:docker-cluster") .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class); this.context.refresh(); List<DiscoveryNode> connectedNodes = this.context.getBean(TransportClient.class) .connectedNodes(); assertThat(connectedNodes).hasSize(1); ======= new ElasticsearchNodeTemplate().doWithNode((node) -> { TestPropertyValues.of("spring.data.elasticsearch.cluster-nodes:localhost:" + node.getTcpPort(), "spring.data.elasticsearch.properties.path.home:target/es/client").applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class); this.context.refresh(); List<DiscoveryNode> connectedNodes = this.context.getBean(TransportClient.class).connectedNodes(); assertThat(connectedNodes).hasSize(1); }); >>>>>>> TestPropertyValues .of("spring.data.elasticsearch.cluster-nodes:localhost:" + elasticsearch.getMappedTransportPort(), "spring.data.elasticsearch.cluster-name:docker-cluster") .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class); this.context.refresh(); List<DiscoveryNode> connectedNodes = this.context.getBean(TransportClient.class).connectedNodes(); assertThat(connectedNodes).hasSize(1);
<<<<<<< this.profiles = Collections.asLifoQueue(new LinkedList<String>()); this.processedProfiles = new LinkedList<String>(); ======= >>>>>>> <<<<<<< msg.append("Loaded "); maybeActivateProfiles( propertySource.getProperty(ACTIVE_PROFILES_PROPERTY)); addIncludeProfiles( propertySource.getProperty(INCLUDE_PROFILES_PROPERTY)); ======= handleProfileProperties(propertySource); >>>>>>> msg.append("Loaded "); handleProfileProperties(propertySource); <<<<<<< /** * Return the active profiles that have not been processed yet. * <p> * If a profile is enabled via both {@link #ACTIVE_PROFILES_PROPERTY} and * {@link ConfigurableEnvironment#addActiveProfile(String)} it needs to be * filtered so that the {@link #ACTIVE_PROFILES_PROPERTY} value takes precedence. * <p> * Concretely, if the "cloud" profile is enabled via the environment, it will take * less precedence that any profile set via the {@link #ACTIVE_PROFILES_PROPERTY}. * @param initialActiveProfiles the profiles that have been enabled via * {@link #ACTIVE_PROFILES_PROPERTY} * @return the additional profiles from the environment to enable */ private List<String> filterEnvironmentProfiles( Set<String> initialActiveProfiles) { List<String> additionalProfiles = new ArrayList<String>(); for (String profile : this.environment.getActiveProfiles()) { if (!initialActiveProfiles.contains(profile)) { additionalProfiles.add(profile); } } return additionalProfiles; ======= private void handleProfileProperties(PropertySource<?> propertySource) { Set<String> activeProfiles = getProfilesForValue( propertySource.getProperty(ACTIVE_PROFILES_PROPERTY)); maybeActivateProfiles(activeProfiles); Set<String> includeProfiles = getProfilesForValue( propertySource.getProperty(INCLUDE_PROFILES_PROPERTY)); addProfiles(includeProfiles); >>>>>>> private void handleProfileProperties(PropertySource<?> propertySource) { Set<String> activeProfiles = getProfilesForValue( propertySource.getProperty(ACTIVE_PROFILES_PROPERTY)); maybeActivateProfiles(activeProfiles); Set<String> includeProfiles = getProfilesForValue( propertySource.getProperty(INCLUDE_PROFILES_PROPERTY)); addProfiles(includeProfiles); <<<<<<< if (value != null) { this.logger.debug("Profiles already activated, '" + value ======= if (!profiles.isEmpty()) { this.debug.add("Profiles already activated, '" + profiles >>>>>>> if (!profiles.isEmpty()) { this.logger.debug("Profiles already activated, '" + profiles <<<<<<< Set<String> profiles = getProfilesForValue(value); activateProfiles(profiles); ======= >>>>>>> <<<<<<< this.logger.debug("Activated profiles " ======= addProfiles(profiles); this.debug.add("Activated profiles " >>>>>>> addProfiles(profiles); this.logger.debug("Activated profiles "
<<<<<<< Map<String, AnsiElement> elements = new HashMap<>(); elements.put("faint", AnsiStyle.FAINT); elements.put("red", AnsiColor.RED); elements.put("green", AnsiColor.GREEN); elements.put("yellow", AnsiColor.YELLOW); elements.put("blue", AnsiColor.BLUE); elements.put("magenta", AnsiColor.MAGENTA); elements.put("cyan", AnsiColor.CYAN); ELEMENTS = Collections.unmodifiableMap(elements); ======= Map<String, AnsiElement> ansiElements = new HashMap<String, AnsiElement>(); ansiElements.put("faint", AnsiStyle.FAINT); ansiElements.put("red", AnsiColor.RED); ansiElements.put("green", AnsiColor.GREEN); ansiElements.put("yellow", AnsiColor.YELLOW); ansiElements.put("blue", AnsiColor.BLUE); ansiElements.put("magenta", AnsiColor.MAGENTA); ansiElements.put("cyan", AnsiColor.CYAN); elements = Collections.unmodifiableMap(ansiElements); >>>>>>> Map<String, AnsiElement> ansiElements = new HashMap<>(); ansiElements.put("faint", AnsiStyle.FAINT); ansiElements.put("red", AnsiColor.RED); ansiElements.put("green", AnsiColor.GREEN); ansiElements.put("yellow", AnsiColor.YELLOW); ansiElements.put("blue", AnsiColor.BLUE); ansiElements.put("magenta", AnsiColor.MAGENTA); ansiElements.put("cyan", AnsiColor.CYAN); elements = Collections.unmodifiableMap(ansiElements); <<<<<<< Map<Integer, AnsiElement> levels = new HashMap<>(); levels.put(Level.FATAL.intLevel(), AnsiColor.RED); levels.put(Level.ERROR.intLevel(), AnsiColor.RED); levels.put(Level.WARN.intLevel(), AnsiColor.YELLOW); LEVELS = Collections.unmodifiableMap(levels); ======= Map<Integer, AnsiElement> ansiLevels = new HashMap<Integer, AnsiElement>(); ansiLevels.put(Level.FATAL.intLevel(), AnsiColor.RED); ansiLevels.put(Level.ERROR.intLevel(), AnsiColor.RED); ansiLevels.put(Level.WARN.intLevel(), AnsiColor.YELLOW); levels = Collections.unmodifiableMap(ansiLevels); >>>>>>> Map<Integer, AnsiElement> ansiLevels = new HashMap<>(); ansiLevels.put(Level.FATAL.intLevel(), AnsiColor.RED); ansiLevels.put(Level.ERROR.intLevel(), AnsiColor.RED); ansiLevels.put(Level.WARN.intLevel(), AnsiColor.YELLOW); levels = Collections.unmodifiableMap(ansiLevels);
<<<<<<< @Configuration(proxyBeanMethods = false) @ConditionalOnClass(CachingConnectionFactory.class) ======= @Configuration >>>>>>> @Configuration(proxyBeanMethods = false) <<<<<<< CachingConnectionFactory cachingJmsConnectionFactory(JmsProperties jmsProperties) { JmsProperties.Cache cacheProperties = jmsProperties.getCache(); CachingConnectionFactory connectionFactory = new CachingConnectionFactory(createConnectionFactory()); connectionFactory.setCacheConsumers(cacheProperties.isConsumers()); connectionFactory.setCacheProducers(cacheProperties.isProducers()); connectionFactory.setSessionCacheSize(cacheProperties.getSessionCacheSize()); return connectionFactory; } @Bean @ConditionalOnProperty(prefix = "spring.jms.cache", name = "enabled", havingValue = "false") ActiveMQConnectionFactory jmsConnectionFactory() { return createConnectionFactory(); } ======= static class CachingConnectionFactoryConfiguration { @Bean @ConditionalOnProperty(prefix = "spring.jms.cache", name = "enabled", havingValue = "true", matchIfMissing = true) public CachingConnectionFactory cachingJmsConnectionFactory(JmsProperties jmsProperties, ActiveMQProperties properties, ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) { JmsProperties.Cache cacheProperties = jmsProperties.getCache(); CachingConnectionFactory connectionFactory = new CachingConnectionFactory( new ActiveMQConnectionFactoryFactory(properties, factoryCustomizers.orderedStream().collect(Collectors.toList())) .createConnectionFactory(ActiveMQConnectionFactory.class)); connectionFactory.setCacheConsumers(cacheProperties.isConsumers()); connectionFactory.setCacheProducers(cacheProperties.isProducers()); connectionFactory.setSessionCacheSize(cacheProperties.getSessionCacheSize()); return connectionFactory; } >>>>>>> static class CachingConnectionFactoryConfiguration { @Bean @ConditionalOnProperty(prefix = "spring.jms.cache", name = "enabled", havingValue = "true", matchIfMissing = true) CachingConnectionFactory cachingJmsConnectionFactory(JmsProperties jmsProperties, ActiveMQProperties properties, ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) { JmsProperties.Cache cacheProperties = jmsProperties.getCache(); CachingConnectionFactory connectionFactory = new CachingConnectionFactory( new ActiveMQConnectionFactoryFactory(properties, factoryCustomizers.orderedStream().collect(Collectors.toList())) .createConnectionFactory(ActiveMQConnectionFactory.class)); connectionFactory.setCacheConsumers(cacheProperties.isConsumers()); connectionFactory.setCacheProducers(cacheProperties.isProducers()); connectionFactory.setSessionCacheSize(cacheProperties.getSessionCacheSize()); return connectionFactory; } <<<<<<< @ConditionalOnProperty(prefix = "spring.activemq.pool", name = "enabled", havingValue = "true", matchIfMissing = false) JmsPoolConnectionFactory pooledJmsConnectionFactory(ActiveMQProperties properties, ======= @ConditionalOnProperty(prefix = "spring.activemq.pool", name = "enabled", havingValue = "true") public JmsPoolConnectionFactory pooledJmsConnectionFactory(ActiveMQProperties properties, >>>>>>> @ConditionalOnProperty(prefix = "spring.activemq.pool", name = "enabled", havingValue = "true") JmsPoolConnectionFactory pooledJmsConnectionFactory(ActiveMQProperties properties,
<<<<<<< inOrder.verify(listener) .onApplicationEvent(isA(ApplicationEnvironmentPreparedEvent.class)); inOrder.verify(listener) .onApplicationEvent(isA(ApplicationContextInitializedEvent.class)); ======= inOrder.verify(listener).onApplicationEvent(isA(ApplicationEnvironmentPreparedEvent.class)); >>>>>>> inOrder.verify(listener).onApplicationEvent(isA(ApplicationEnvironmentPreparedEvent.class)); inOrder.verify(listener).onApplicationEvent(isA(ApplicationContextInitializedEvent.class)); <<<<<<< beanFactory.registerSingleton("commandLineRunner", (CommandLineRunner) (args) -> { assertThat(SpringApplicationTests.this.output.toString()) .contains("Started"); commandLineRunner.run(args); }); beanFactory.registerSingleton("applicationRunner", (ApplicationRunner) (args) -> { assertThat(SpringApplicationTests.this.output.toString()) .contains("Started"); applicationRunner.run(args); }); ======= beanFactory.registerSingleton("commandLineRunner", new CommandLineRunner() { @Override public void run(String... args) throws Exception { assertThat(SpringApplicationTests.this.output.toString()).contains("Started"); commandLineRunner.run(args); } }); beanFactory.registerSingleton("applicationRunner", new ApplicationRunner() { @Override public void run(ApplicationArguments args) throws Exception { assertThat(SpringApplicationTests.this.output.toString()).contains("Started"); applicationRunner.run(args); } }); >>>>>>> beanFactory.registerSingleton("commandLineRunner", (CommandLineRunner) (args) -> { assertThat(SpringApplicationTests.this.output.toString()).contains("Started"); commandLineRunner.run(args); }); beanFactory.registerSingleton("applicationRunner", (ApplicationRunner) (args) -> { assertThat(SpringApplicationTests.this.output.toString()).contains("Started"); applicationRunner.run(args); }); <<<<<<< application.addInitializers((context) -> context.getBeanFactory() .registerSingleton("runner", runner)); assertThatIllegalStateException().isThrownBy(application::run).withCause(failure); verify(listener).onApplicationEvent(isA(ApplicationStartedEvent.class)); verify(listener).onApplicationEvent(isA(ApplicationFailedEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationReadyEvent.class)); ======= application.addInitializers((context) -> context.getBeanFactory().registerSingleton("runner", runner)); this.thrown.expectCause(equalTo(failure)); try { application.run(); } finally { verify(listener).onApplicationEvent(isA(ApplicationStartedEvent.class)); verify(listener).onApplicationEvent(isA(ApplicationFailedEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationReadyEvent.class)); } >>>>>>> application.addInitializers((context) -> context.getBeanFactory().registerSingleton("runner", runner)); assertThatIllegalStateException().isThrownBy(application::run).withCause(failure); verify(listener).onApplicationEvent(isA(ApplicationStartedEvent.class)); verify(listener).onApplicationEvent(isA(ApplicationFailedEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationReadyEvent.class)); <<<<<<< application.addInitializers((context) -> context.getBeanFactory() .registerSingleton("runner", runner)); assertThatIllegalStateException().isThrownBy(application::run).withCause(failure); verify(listener).onApplicationEvent(isA(ApplicationStartedEvent.class)); verify(listener).onApplicationEvent(isA(ApplicationFailedEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationReadyEvent.class)); ======= application.addInitializers((context) -> context.getBeanFactory().registerSingleton("runner", runner)); this.thrown.expectCause(equalTo(failure)); try { application.run(); } finally { verify(listener).onApplicationEvent(isA(ApplicationStartedEvent.class)); verify(listener).onApplicationEvent(isA(ApplicationFailedEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationReadyEvent.class)); } >>>>>>> application.addInitializers((context) -> context.getBeanFactory().registerSingleton("runner", runner)); assertThatIllegalStateException().isThrownBy(application::run).withCause(failure); verify(listener).onApplicationEvent(isA(ApplicationStartedEvent.class)); verify(listener).onApplicationEvent(isA(ApplicationFailedEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationReadyEvent.class)); <<<<<<< willThrow(failure).given(listener) .onApplicationEvent(isA(ApplicationReadyEvent.class)); assertThatExceptionOfType(RuntimeException.class).isThrownBy(application::run) .isEqualTo(failure); verify(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationFailedEvent.class)); ======= willThrow(failure).given(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); this.thrown.expect(equalTo(failure)); try { application.run(); } finally { verify(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationFailedEvent.class)); } >>>>>>> willThrow(failure).given(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); assertThatExceptionOfType(RuntimeException.class).isThrownBy(application::run).isEqualTo(failure); verify(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationFailedEvent.class)); <<<<<<< willThrow(failure).given(listener) .onApplicationEvent(isA(ApplicationReadyEvent.class)); assertThatExceptionOfType(RuntimeException.class).isThrownBy(application::run); verify(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationFailedEvent.class)); assertThat(exitCodeListener.getExitCode()).isEqualTo(11); assertThat(this.output.toString()).contains("Application run failed"); ======= willThrow(failure).given(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); try { application.run(); fail("Run should have failed with a RuntimeException"); } catch (RuntimeException ex) { verify(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationFailedEvent.class)); assertThat(exitCodeListener.getExitCode()).isEqualTo(11); assertThat(this.output.toString()).contains("Application run failed"); } >>>>>>> willThrow(failure).given(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); assertThatExceptionOfType(RuntimeException.class).isThrownBy(application::run); verify(listener).onApplicationEvent(isA(ApplicationReadyEvent.class)); verify(listener, never()).onApplicationEvent(isA(ApplicationFailedEvent.class)); assertThat(exitCodeListener.getExitCode()).isEqualTo(11); assertThat(this.output.toString()).contains("Application run failed"); <<<<<<< assertThatExceptionOfType(RuntimeException.class).isThrownBy(application::run); ArgumentCaptor<RuntimeException> exceptionCaptor = ArgumentCaptor .forClass(RuntimeException.class); ======= try { application.run(); fail("Did not throw"); } catch (RuntimeException ex) { } ArgumentCaptor<RuntimeException> exceptionCaptor = ArgumentCaptor.forClass(RuntimeException.class); >>>>>>> assertThatExceptionOfType(RuntimeException.class).isThrownBy(application::run); ArgumentCaptor<RuntimeException> exceptionCaptor = ArgumentCaptor.forClass(RuntimeException.class); <<<<<<< assertThatExceptionOfType(ApplicationContextException.class) .isThrownBy(application::run); verifyListenerEvents(listener, ApplicationStartingEvent.class, ApplicationEnvironmentPreparedEvent.class, ApplicationContextInitializedEvent.class, ApplicationPreparedEvent.class, ApplicationFailedEvent.class); ======= try { application.run(); fail("Run should have failed with an ApplicationContextException"); } catch (ApplicationContextException ex) { verifyListenerEvents(listener, ApplicationStartingEvent.class, ApplicationEnvironmentPreparedEvent.class, ApplicationPreparedEvent.class, ApplicationFailedEvent.class); } >>>>>>> assertThatExceptionOfType(ApplicationContextException.class).isThrownBy(application::run); verifyListenerEvents(listener, ApplicationStartingEvent.class, ApplicationEnvironmentPreparedEvent.class, ApplicationContextInitializedEvent.class, ApplicationPreparedEvent.class, ApplicationFailedEvent.class); <<<<<<< assertThatExceptionOfType(BeanCreationException.class) .isThrownBy(application::run); verifyListenerEvents(listener, ApplicationStartingEvent.class, ApplicationEnvironmentPreparedEvent.class, ApplicationContextInitializedEvent.class, ApplicationPreparedEvent.class, ApplicationFailedEvent.class); ======= try { application.run(); fail("Run should have failed with a BeanCreationException"); } catch (BeanCreationException ex) { verifyListenerEvents(listener, ApplicationStartingEvent.class, ApplicationEnvironmentPreparedEvent.class, ApplicationPreparedEvent.class, ApplicationFailedEvent.class); } >>>>>>> assertThatExceptionOfType(BeanCreationException.class).isThrownBy(application::run); verifyListenerEvents(listener, ApplicationStartingEvent.class, ApplicationEnvironmentPreparedEvent.class, ApplicationContextInitializedEvent.class, ApplicationPreparedEvent.class, ApplicationFailedEvent.class); <<<<<<< application.addInitializers((applicationContext) -> applicationContext .addApplicationListener(listener)); assertThatExceptionOfType(ApplicationContextException.class) .isThrownBy(application::run); verifyListenerEvents(listener, ApplicationFailedEvent.class); ======= application.addInitializers((applicationContext) -> applicationContext.addApplicationListener(listener)); try { application.run(); fail("Run should have failed with an ApplicationContextException"); } catch (ApplicationContextException ex) { verifyListenerEvents(listener, ApplicationFailedEvent.class); } >>>>>>> application.addInitializers((applicationContext) -> applicationContext.addApplicationListener(listener)); assertThatExceptionOfType(ApplicationContextException.class).isThrownBy(application::run); verifyListenerEvents(listener, ApplicationFailedEvent.class); <<<<<<< application.addInitializers((applicationContext) -> applicationContext .addApplicationListener(listener)); assertThatExceptionOfType(BeanCreationException.class) .isThrownBy(application::run); verifyListenerEvents(listener, ApplicationFailedEvent.class); ======= application.addInitializers((applicationContext) -> applicationContext.addApplicationListener(listener)); try { application.run(); fail("Run should have failed with a BeanCreationException"); } catch (BeanCreationException ex) { verifyListenerEvents(listener, ApplicationFailedEvent.class); } >>>>>>> application.addInitializers((applicationContext) -> applicationContext.addApplicationListener(listener)); assertThatExceptionOfType(BeanCreationException.class).isThrownBy(application::run); verifyListenerEvents(listener, ApplicationFailedEvent.class); <<<<<<< TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); application.addListeners( (ApplicationListener<ApplicationEnvironmentPreparedEvent>) (event) -> { assertThat(event.getEnvironment()) .isInstanceOf(StandardServletEnvironment.class); TestPropertySourceUtils.addInlinedPropertiesToEnvironment( event.getEnvironment(), "foo=bar"); event.getSpringApplication() .setWebApplicationType(WebApplicationType.NONE); }); ======= TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); application.addListeners((ApplicationListener<ApplicationEnvironmentPreparedEvent>) (event) -> { Assertions.assertThat(event.getEnvironment()).isInstanceOf(StandardServletEnvironment.class); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(event.getEnvironment(), "foo=bar"); event.getSpringApplication().setWebApplicationType(WebApplicationType.NONE); }); >>>>>>> TestSpringApplication application = new TestSpringApplication(ExampleConfig.class); application.addListeners((ApplicationListener<ApplicationEnvironmentPreparedEvent>) (event) -> { assertThat(event.getEnvironment()).isInstanceOf(StandardServletEnvironment.class); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(event.getEnvironment(), "foo=bar"); event.getSpringApplication().setWebApplicationType(WebApplicationType.NONE); }); <<<<<<< @Test public void beanDefinitionOverridingIsDisabledByDefault() { assertThatExceptionOfType(BeanDefinitionOverrideException.class).isThrownBy( () -> new SpringApplication(ExampleConfig.class, OverrideConfig.class) .run()); } @Test public void beanDefinitionOverridingCanBeEnabled() { assertThat( new SpringApplication(ExampleConfig.class, OverrideConfig.class) .run("--spring.main.allow-bean-definition-overriding=true", "--spring.main.web-application-type=none") .getBean("someBean")).isEqualTo("override"); } private Condition<ConfigurableEnvironment> matchingPropertySource( final Class<?> propertySourceClass, final String name) { ======= private Condition<ConfigurableEnvironment> matchingPropertySource(final Class<?> propertySourceClass, final String name) { >>>>>>> @Test public void beanDefinitionOverridingIsDisabledByDefault() { assertThatExceptionOfType(BeanDefinitionOverrideException.class) .isThrownBy(() -> new SpringApplication(ExampleConfig.class, OverrideConfig.class).run()); } @Test public void beanDefinitionOverridingCanBeEnabled() { assertThat(new SpringApplication(ExampleConfig.class, OverrideConfig.class) .run("--spring.main.allow-bean-definition-overriding=true", "--spring.main.web-application-type=none") .getBean("someBean")).isEqualTo("override"); } private Condition<ConfigurableEnvironment> matchingPropertySource(final Class<?> propertySourceClass, final String name) {
<<<<<<< import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.apache.coyote.ProtocolHandler; import org.apache.coyote.http11.AbstractHttp11Protocol; ======= >>>>>>> import org.apache.coyote.ProtocolHandler; import org.apache.coyote.http11.AbstractHttp11Protocol; <<<<<<< @AfterEach void restoreTccl() { ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", null); ReflectionTestUtils.setField(URL.class, "factory", null); ======= @After public void restoreTccl() { >>>>>>> @AfterEach void restoreTccl() {
<<<<<<< RestTemplate template = this.builder .basicAuthentication("spring", "boot", StandardCharsets.UTF_8).build(); ClientHttpRequestFactory requestFactory = template.getRequestFactory(); Object authentication = ReflectionTestUtils.getField(requestFactory, "authentication"); assertThat(authentication).extracting("username", "password", "charset") .containsExactly("spring", "boot", StandardCharsets.UTF_8); ======= RestTemplate template = this.builder.basicAuthentication("spring", "boot").build(); ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0); assertThat(interceptor).isInstanceOf(BasicAuthenticationInterceptor.class); assertThat(interceptor).extracting("username").containsExactly("spring"); assertThat(interceptor).extracting("password").containsExactly("boot"); } @Test @Deprecated public void basicAuthorizationShouldApply() { RestTemplate template = this.builder.basicAuthorization("spring", "boot").build(); ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0); assertThat(interceptor).isInstanceOf(BasicAuthenticationInterceptor.class); assertThat(interceptor).extracting("username").containsExactly("spring"); assertThat(interceptor).extracting("password").containsExactly("boot"); >>>>>>> RestTemplate template = this.builder.basicAuthentication("spring", "boot", StandardCharsets.UTF_8).build(); ClientHttpRequestFactory requestFactory = template.getRequestFactory(); Object authentication = ReflectionTestUtils.getField(requestFactory, "authentication"); assertThat(authentication).extracting("username", "password", "charset").containsExactly("spring", "boot", StandardCharsets.UTF_8); <<<<<<< assertThat(restTemplate.getInterceptors()).hasSize(1); assertThat(restTemplate.getMessageConverters()) .contains(this.messageConverter); assertThat(restTemplate.getUriTemplateHandler()) .isInstanceOf(RootUriTemplateHandler.class); ======= assertThat(restTemplate.getInterceptors()).hasSize(2).contains(this.interceptor) .anyMatch((ic) -> ic instanceof BasicAuthenticationInterceptor); assertThat(restTemplate.getMessageConverters()).contains(this.messageConverter); assertThat(restTemplate.getUriTemplateHandler()).isInstanceOf(RootUriTemplateHandler.class); >>>>>>> assertThat(restTemplate.getInterceptors()).hasSize(1); assertThat(restTemplate.getMessageConverters()).contains(this.messageConverter); assertThat(restTemplate.getUriTemplateHandler()).isInstanceOf(RootUriTemplateHandler.class); <<<<<<< ClientHttpRequestFactory actualRequestFactory = restTemplate .getRequestFactory(); assertThat(actualRequestFactory) .isInstanceOf(InterceptingClientHttpRequestFactory.class); ClientHttpRequestFactory authRequestFactory = (ClientHttpRequestFactory) ReflectionTestUtils .getField(actualRequestFactory, "requestFactory"); assertThat(authRequestFactory).isInstanceOf( BasicAuthenticationClientHttpRequestFactory.class); assertThat(authRequestFactory).hasFieldOrPropertyWithValue( "requestFactory", requestFactory); ======= ClientHttpRequestFactory actualRequestFactory = restTemplate.getRequestFactory(); assertThat(actualRequestFactory).isInstanceOf(InterceptingClientHttpRequestFactory.class); assertThat(actualRequestFactory).hasFieldOrPropertyWithValue("requestFactory", requestFactory); >>>>>>> ClientHttpRequestFactory actualRequestFactory = restTemplate.getRequestFactory(); assertThat(actualRequestFactory).isInstanceOf(InterceptingClientHttpRequestFactory.class); ClientHttpRequestFactory authRequestFactory = (ClientHttpRequestFactory) ReflectionTestUtils .getField(actualRequestFactory, "requestFactory"); assertThat(authRequestFactory).isInstanceOf(BasicAuthenticationClientHttpRequestFactory.class); assertThat(authRequestFactory).hasFieldOrPropertyWithValue("requestFactory", requestFactory); <<<<<<< ======= @Test @SuppressWarnings("deprecation") public void connectTimeoutCanBeSetWithInteger() { ClientHttpRequestFactory requestFactory = this.builder.requestFactory(SimpleClientHttpRequestFactory.class) .setConnectTimeout(1234).build().getRequestFactory(); assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234); } @Test @SuppressWarnings("deprecation") public void readTimeoutCanBeSetWithInteger() { ClientHttpRequestFactory requestFactory = this.builder.requestFactory(SimpleClientHttpRequestFactory.class) .setReadTimeout(1234).build().getRequestFactory(); assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234); } >>>>>>>
<<<<<<< @Test public void testFallbackDefault() throws Exception { load("spring.messages.basename:test/messages"); assertTrue(this.context.getBean(MessageSourceAutoConfiguration.class) .isFallbackToSystemLocale()); } @Test public void testFallbackTurnOff() throws Exception { load("spring.messages.basename:test/messages", "spring.messages.fallback-to-system-locale:false"); assertFalse(this.context.getBean(MessageSourceAutoConfiguration.class) .isFallbackToSystemLocale()); } private void load(String... environment) { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, environment); this.context.register(MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); } ======= @Test public void existingMessageSourceIsPreferred() { this.context = new AnnotationConfigApplicationContext(); this.context.register(CustomMessageSource.class, MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertEquals("foo", this.context.getMessage("foo", null, null, null)); } @Test public void existingMessageSourceInParentIsIgnored() { ConfigurableApplicationContext parent = new AnnotationConfigApplicationContext(); parent.refresh(); try { this.context = new AnnotationConfigApplicationContext(); this.context.setParent(parent); EnvironmentTestUtils.addEnvironment(this.context, "spring.messages.basename:test/messages"); this.context.register(MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertEquals("bar", this.context.getMessage("foo", null, "Foo message", Locale.UK)); } finally { parent.close(); } } >>>>>>> @Test public void testFallbackDefault() throws Exception { load("spring.messages.basename:test/messages"); assertTrue(this.context.getBean(MessageSourceAutoConfiguration.class) .isFallbackToSystemLocale()); } @Test public void testFallbackTurnOff() throws Exception { load("spring.messages.basename:test/messages", "spring.messages.fallback-to-system-locale:false"); assertFalse(this.context.getBean(MessageSourceAutoConfiguration.class) .isFallbackToSystemLocale()); } @Test public void existingMessageSourceIsPreferred() { this.context = new AnnotationConfigApplicationContext(); this.context.register(CustomMessageSource.class, MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertEquals("foo", this.context.getMessage("foo", null, null, null)); } @Test public void existingMessageSourceInParentIsIgnored() { ConfigurableApplicationContext parent = new AnnotationConfigApplicationContext(); parent.refresh(); try { this.context = new AnnotationConfigApplicationContext(); this.context.setParent(parent); EnvironmentTestUtils.addEnvironment(this.context, "spring.messages.basename:test/messages"); this.context.register(MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); assertEquals("bar", this.context.getMessage("foo", null, "Foo message", Locale.UK)); } finally { parent.close(); } } private void load(String... environment) { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, environment); this.context.register(MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); } <<<<<<< ======= @Configuration protected static class CustomMessageSource { @Bean public MessageSource messageSource() { return new MessageSource() { @Override public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { return code; } @Override public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException { return code; } @Override public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { return resolvable.getCodes()[0]; } }; } } >>>>>>> @Configuration protected static class CustomMessageSource { @Bean public MessageSource messageSource() { return new MessageSource() { @Override public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { return code; } @Override public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException { return code; } @Override public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { return resolvable.getCodes()[0]; } }; } }
<<<<<<< Assertions.setExtractBareNamePropertyMethods(false); this.contextRunner.withPropertyValues("spring.resources.cache.period:5") .run((context) -> { Map<PathPattern, Object> handlerMap = getHandlerMap(context); assertThat(handlerMap).hasSize(2); for (Object handler : handlerMap.values()) { if (handler instanceof ResourceWebHandler) { assertThat(((ResourceWebHandler) handler).getCacheControl()) .isEqualToComparingFieldByField( CacheControl.maxAge(5, TimeUnit.SECONDS)); } } }); Assertions.setExtractBareNamePropertyMethods(true); ======= this.contextRunner.withPropertyValues("spring.resources.cache.period:5").run((context) -> { Map<PathPattern, Object> handlerMap = getHandlerMap(context); assertThat(handlerMap).hasSize(2); for (Object handler : handlerMap.values()) { if (handler instanceof ResourceWebHandler) { assertThat(((ResourceWebHandler) handler).getCacheControl()) .isEqualToComparingFieldByField(CacheControl.maxAge(5, TimeUnit.SECONDS)); } } }); >>>>>>> Assertions.setExtractBareNamePropertyMethods(false); this.contextRunner.withPropertyValues("spring.resources.cache.period:5").run((context) -> { Map<PathPattern, Object> handlerMap = getHandlerMap(context); assertThat(handlerMap).hasSize(2); for (Object handler : handlerMap.values()) { if (handler instanceof ResourceWebHandler) { assertThat(((ResourceWebHandler) handler).getCacheControl()) .isEqualToComparingFieldByField(CacheControl.maxAge(5, TimeUnit.SECONDS)); } } }); Assertions.setExtractBareNamePropertyMethods(true); <<<<<<< Assertions.setExtractBareNamePropertyMethods(false); this.contextRunner .withPropertyValues("spring.resources.cache.cachecontrol.max-age:5", "spring.resources.cache.cachecontrol.proxy-revalidate:true") .run((context) -> { ======= this.contextRunner.withPropertyValues("spring.resources.cache.cachecontrol.max-age:5", "spring.resources.cache.cachecontrol.proxy-revalidate:true").run((context) -> { >>>>>>> Assertions.setExtractBareNamePropertyMethods(false); this.contextRunner.withPropertyValues("spring.resources.cache.cachecontrol.max-age:5", "spring.resources.cache.cachecontrol.proxy-revalidate:true").run((context) -> {
<<<<<<< assertThatIllegalArgumentException() .isThrownBy(() -> new ClassPathFileSystemWatcher( mock(FileSystemWatcherFactory.class), mock(ClassPathRestartStrategy.class), (URL[]) null)) .withMessageContaining("Urls must not be null"); ======= this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Urls must not be null"); URL[] urls = null; new ClassPathFileSystemWatcher(mock(FileSystemWatcherFactory.class), mock(ClassPathRestartStrategy.class), urls); >>>>>>> assertThatIllegalArgumentException() .isThrownBy(() -> new ClassPathFileSystemWatcher(mock(FileSystemWatcherFactory.class), mock(ClassPathRestartStrategy.class), (URL[]) null)) .withMessageContaining("Urls must not be null");
<<<<<<< private Set<String> getExcludeHeaders() { Set<String> excludedHeaders = new HashSet<String>(); if (!isIncluded(Include.COOKIES)) { excludedHeaders.add("cookie"); } if (!isIncluded(Include.AUTHORIZATION_HEADER)) { excludedHeaders.add("authorization"); } return excludedHeaders; } private Object getHeaderValue(HttpServletRequest request, String name) { List<String> value = Collections.list(request.getHeaders(name)); if (value.size() == 1) { return value.get(0); } if (value.isEmpty()) { return ""; } return value; } private Map<String, String[]> getParameterMap(HttpServletRequest request) { Map<String, String[]> map = new LinkedHashMap<String, String[]>(); map.putAll(request.getParameterMap()); return map; ======= private Map<String, String[]> getParameterMapCopy(HttpServletRequest request) { return new LinkedHashMap<String, String[]>(request.getParameterMap()); >>>>>>> private Set<String> getExcludeHeaders() { Set<String> excludedHeaders = new HashSet<String>(); if (!isIncluded(Include.COOKIES)) { excludedHeaders.add("cookie"); } if (!isIncluded(Include.AUTHORIZATION_HEADER)) { excludedHeaders.add("authorization"); } return excludedHeaders; } private Object getHeaderValue(HttpServletRequest request, String name) { List<String> value = Collections.list(request.getHeaders(name)); if (value.size() == 1) { return value.get(0); } if (value.isEmpty()) { return ""; } return value; } private Map<String, String[]> getParameterMapCopy(HttpServletRequest request) { return new LinkedHashMap<String, String[]>(request.getParameterMap());
<<<<<<< @Test public void useForwardHeaders() throws Exception { UndertowEmbeddedServletContainerFactory factory = getFactory(); factory.setUseForwardHeaders(true); assertForwardHeaderIsUsed(factory); } @Override protected Object getJspServlet() { return null; // Undertow does not support JSPs } ======= @Test public void eachFactoryUsesADiscreteServletContainer() { assertThat(getServletContainerFromNewFactory(), is(not(equalTo(getServletContainerFromNewFactory())))); } private ServletContainer getServletContainerFromNewFactory() { UndertowEmbeddedServletContainer undertow1 = (UndertowEmbeddedServletContainer) getFactory() .getEmbeddedServletContainer(); return ((DeploymentManager) ReflectionTestUtils.getField(undertow1, "manager")) .getDeployment().getServletContainer(); } >>>>>>> @Test public void useForwardHeaders() throws Exception { UndertowEmbeddedServletContainerFactory factory = getFactory(); factory.setUseForwardHeaders(true); assertForwardHeaderIsUsed(factory); } @Test public void eachFactoryUsesADiscreteServletContainer() { assertThat(getServletContainerFromNewFactory(), is(not(equalTo(getServletContainerFromNewFactory())))); } @Override protected Object getJspServlet() { return null; // Undertow does not support JSPs } private ServletContainer getServletContainerFromNewFactory() { UndertowEmbeddedServletContainer undertow1 = (UndertowEmbeddedServletContainer) getFactory() .getEmbeddedServletContainer(); return ((DeploymentManager) ReflectionTestUtils.getField(undertow1, "manager")) .getDeployment().getServletContainer(); }
<<<<<<< assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites( new String[] { "TLSv1.2" }, new String[] { "TLS_EMPTY_RENEGOTIATION_INFO_SCSV" })) .isInstanceOfAny(SSLException.class, SSLHandshakeException.class, SocketException.class); ======= this.thrown.expect(anyOf(instanceOf(SSLException.class), instanceOf(SocketException.class))); testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.2" }, new String[] { "TLS_EMPTY_RENEGOTIATION_INFO_SCSV" }); >>>>>>> assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.2" }, new String[] { "TLS_EMPTY_RENEGOTIATION_INFO_SCSV" })) .isInstanceOfAny(SSLException.class, SSLHandshakeException.class, SocketException.class); <<<<<<< assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites( new String[] { "TLSv1" }, new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" })) .isInstanceOfAny(SSLException.class, SocketException.class); ======= this.thrown.expect(anyOf(instanceOf(SSLException.class), instanceOf(SocketException.class))); testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1" }, new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" }); >>>>>>> assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1" }, new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" })) .isInstanceOfAny(SSLException.class, SocketException.class); <<<<<<< assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites( new String[] { "TLSv1.1" }, new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" })) .isInstanceOfAny(SSLException.class, SocketException.class); ======= this.thrown.expect(anyOf(instanceOf(SSLException.class), instanceOf(SocketException.class))); testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.1" }, new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" }); >>>>>>> assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.1" }, new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" })) .isInstanceOfAny(SSLException.class, SocketException.class); <<<<<<< return container.getDeploymentManager().getDeployment().getServletContainer(); ======= return ((DeploymentManager) ReflectionTestUtils.getField(container, "manager")).getDeployment() .getServletContainer(); >>>>>>> return container.getDeploymentManager().getDeployment().getServletContainer(); <<<<<<< return ((UndertowServletWebServer) this.webServer).getDeploymentManager() .getDeployment().getMimeExtensionMappings(); ======= return ((DeploymentManager) ReflectionTestUtils.getField(this.webServer, "manager")).getDeployment() .getMimeExtensionMappings(); >>>>>>> return ((UndertowServletWebServer) this.webServer).getDeploymentManager().getDeployment() .getMimeExtensionMappings(); <<<<<<< DeploymentInfo info = ((UndertowServletWebServer) this.webServer) .getDeploymentManager().getDeployment().getDeploymentInfo(); ======= DeploymentInfo info = ((DeploymentManager) ReflectionTestUtils.getField(this.webServer, "manager")) .getDeployment().getDeploymentInfo(); >>>>>>> DeploymentInfo info = ((UndertowServletWebServer) this.webServer).getDeploymentManager().getDeployment() .getDeploymentInfo();
<<<<<<< ======= return findApplicationPath( AnnotationUtils.findAnnotation(this.config.getApplication().getClass(), ApplicationPath.class)); } private static String findApplicationPath(ApplicationPath annotation) { >>>>>>>
<<<<<<< public NettyReactiveWebServerFactory nettyReactiveWebServerFactory( ReactorResourceFactory resourceFactory, ObjectProvider<NettyRouteProvider> routes) { ======= public NettyReactiveWebServerFactory nettyReactiveWebServerFactory(ReactorResourceFactory resourceFactory) { >>>>>>> public NettyReactiveWebServerFactory nettyReactiveWebServerFactory(ReactorResourceFactory resourceFactory, ObjectProvider<NettyRouteProvider> routes) { <<<<<<< public JettyReactiveWebServerFactory jettyReactiveWebServerFactory( JettyResourceFactory resourceFactory, ObjectProvider<JettyServerCustomizer> serverCustomizers) { ======= public JettyReactiveWebServerFactory jettyReactiveWebServerFactory(JettyResourceFactory resourceFactory) { >>>>>>> public JettyReactiveWebServerFactory jettyReactiveWebServerFactory(JettyResourceFactory resourceFactory, ObjectProvider<JettyServerCustomizer> serverCustomizers) {
<<<<<<< * @author Julio José Gómez Díaz ======= * @since 2.0.0 >>>>>>> * @author Julio José Gómez Díaz * @since 2.0.0
<<<<<<< @SpringBootTest( classes = { SampleTomcatWebSocketApplication.class, CustomContainerConfiguration.class }, ======= @RunWith(SpringRunner.class) @SpringBootTest(classes = { SampleTomcatWebSocketApplication.class, CustomContainerConfiguration.class }, >>>>>>> @SpringBootTest(classes = { SampleTomcatWebSocketApplication.class, CustomContainerConfiguration.class }, <<<<<<< void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port + "/ws/echo/websocket") ======= public void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder(ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port + "/ws/echo/websocket") >>>>>>> void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder(ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port + "/ws/echo/websocket") <<<<<<< void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port + "/ws/reverse") ======= public void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder(ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port + "/ws/reverse") >>>>>>> void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder(ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port + "/ws/reverse")
<<<<<<< * @author Brian Clozel ======= * @since 1.0.0 >>>>>>> * @author Brian Clozel * @since 1.0.0
<<<<<<< * Copyright 2012-2018 the original author or authors. ======= * Copyright 2012-2019 the original author or authors. >>>>>>> * Copyright 2012-2019 the original author or authors. <<<<<<< assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("Type must not be null"); ======= this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier); >>>>>>> assertThatIllegalArgumentException().isThrownBy( () -> ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("Type must not be null"); <<<<<<< assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("Type must not be null"); ======= this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier); >>>>>>> assertThatIllegalArgumentException().isThrownBy( () -> ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("Type must not be null"); <<<<<<< assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get( TestAssertProviderApplicationContextClass.class, ApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("Type must be an interface"); ======= this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must be an interface"); ApplicationContextAssertProvider.get(TestAssertProviderApplicationContextClass.class, ApplicationContext.class, this.mockContextSupplier); >>>>>>> assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContextClass.class, ApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("Type must be an interface"); <<<<<<< assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get( TestAssertProviderApplicationContext.class, null, this.mockContextSupplier)) .withMessageContaining("ContextType must not be null"); ======= this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ContextType must not be null"); ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, null, this.mockContextSupplier); >>>>>>> assertThatIllegalArgumentException().isThrownBy(() -> ApplicationContextAssertProvider .get(TestAssertProviderApplicationContext.class, null, this.mockContextSupplier)) .withMessageContaining("ContextType must not be null"); <<<<<<< assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get( TestAssertProviderApplicationContext.class, StaticApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("ContextType must be an interface"); ======= this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ContextType must be an interface"); ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, StaticApplicationContext.class, this.mockContextSupplier); >>>>>>> assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, StaticApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("ContextType must be an interface"); <<<<<<< ApplicationContextAssertProvider<ApplicationContext> context = get( this.startupFailureSupplier); assertThatIllegalStateException() .isThrownBy(() -> context.getSourceApplicationContext()) .withCause(this.startupFailure).withMessageContaining("failed to start"); ======= ApplicationContextAssertProvider<ApplicationContext> context = get(this.startupFailureSupplier); expectStartupFailure(); context.getSourceApplicationContext(); >>>>>>> ApplicationContextAssertProvider<ApplicationContext> context = get(this.startupFailureSupplier); assertThatIllegalStateException().isThrownBy(() -> context.getSourceApplicationContext()) .withCause(this.startupFailure).withMessageContaining("failed to start"); <<<<<<< ApplicationContextAssertProvider<ApplicationContext> context = get( this.startupFailureSupplier); assertThatIllegalStateException().isThrownBy( () -> context.getSourceApplicationContext(ApplicationContext.class)) .withCause(this.startupFailure).withMessageContaining("failed to start"); ======= ApplicationContextAssertProvider<ApplicationContext> context = get(this.startupFailureSupplier); expectStartupFailure(); context.getSourceApplicationContext(ApplicationContext.class); >>>>>>> ApplicationContextAssertProvider<ApplicationContext> context = get(this.startupFailureSupplier); assertThatIllegalStateException() .isThrownBy(() -> context.getSourceApplicationContext(ApplicationContext.class)) .withCause(this.startupFailure).withMessageContaining("failed to start"); <<<<<<< private ApplicationContextAssertProvider<ApplicationContext> get( Supplier<ApplicationContext> contextSupplier) { return ApplicationContextAssertProvider.get( TestAssertProviderApplicationContext.class, ApplicationContext.class, contextSupplier); ======= private void expectStartupFailure() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("failed to start"); this.thrown.expectCause(equalTo(this.startupFailure)); } private ApplicationContextAssertProvider<ApplicationContext> get(Supplier<ApplicationContext> contextSupplier) { return ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, ApplicationContext.class, contextSupplier); >>>>>>> private ApplicationContextAssertProvider<ApplicationContext> get(Supplier<ApplicationContext> contextSupplier) { return ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, ApplicationContext.class, contextSupplier);
<<<<<<< import javafx.stage.Stage; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; ======= import org.slf4j.Logger; import org.slf4j.LoggerFactory; >>>>>>> import javafx.stage.Stage; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
<<<<<<< import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties; ======= import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath; >>>>>>> import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath; <<<<<<< context.registerBean(WebMvcProperties.class); ======= context.registerBean(ServerProperties.class); context.registerBean(DispatcherServletPath.class, () -> dispatcherServletPath); >>>>>>> context.registerBean(DispatcherServletPath.class, () -> dispatcherServletPath);
<<<<<<< import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; ======= import java.util.concurrent.BrokenBarrierException; >>>>>>> import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.BrokenBarrierException; <<<<<<< import java.util.concurrent.CountDownLatch; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; import java.util.concurrent.RunnableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; ======= import java.util.concurrent.CountDownLatch; import java.util.concurrent.CyclicBarrier; >>>>>>> import java.util.concurrent.CountDownLatch; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; import java.util.concurrent.RunnableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; <<<<<<< @Test void whenThereAreNoInFlightRequestsShutDownGracefullyReturnsTrueBeforePeriodElapses() throws Exception { AbstractReactiveWebServerFactory factory = getFactory(); Shutdown shutdown = new Shutdown(); shutdown.setGracePeriod(Duration.ofSeconds(30)); factory.setShutdown(shutdown); this.webServer = factory.getWebServer(new EchoHandler()); this.webServer.start(); long start = System.currentTimeMillis(); assertThat(this.webServer.shutDownGracefully()).isTrue(); long end = System.currentTimeMillis(); assertThat(end - start).isLessThanOrEqualTo(30000); } @Test void whenARequestRemainsInFlightThenShutDownGracefullyReturnsFalseAfterPeriodElapses() throws Exception { AbstractReactiveWebServerFactory factory = getFactory(); Shutdown shutdown = new Shutdown(); shutdown.setGracePeriod(Duration.ofSeconds(5)); factory.setShutdown(shutdown); BlockingHandler blockingHandler = new BlockingHandler(); this.webServer = factory.getWebServer(blockingHandler); this.webServer.start(); Mono<ResponseEntity<Void>> request = getWebClient(this.webServer.getPort()).build().get().retrieve() .toBodilessEntity(); AtomicReference<ResponseEntity<Void>> responseReference = new AtomicReference<>(); CountDownLatch responseLatch = new CountDownLatch(1); request.subscribe((response) -> { responseReference.set(response); responseLatch.countDown(); }); blockingHandler.awaitQueue(); long start = System.currentTimeMillis(); assertThat(this.webServer.shutDownGracefully()).isFalse(); long end = System.currentTimeMillis(); assertThat(end - start).isGreaterThanOrEqualTo(5000); assertThat(responseReference.get()).isNull(); blockingHandler.completeOne(); assertThat(responseLatch.await(5, TimeUnit.SECONDS)).isTrue(); } @Test void whenARequestCompletesDuringGracePeriodThenShutDownGracefullyReturnsTrueBeforePeriodElapses() throws Exception { AbstractReactiveWebServerFactory factory = getFactory(); if (factory instanceof NettyReactiveWebServerFactory) { ReactorResourceFactory resourceFactory = new ReactorResourceFactory(); resourceFactory.afterPropertiesSet(); ((NettyReactiveWebServerFactory) factory).setResourceFactory(resourceFactory); } Shutdown shutdown = new Shutdown(); shutdown.setGracePeriod(Duration.ofSeconds(30)); factory.setShutdown(shutdown); BlockingHandler blockingHandler = new BlockingHandler(); this.webServer = factory.getWebServer(blockingHandler); this.webServer.start(); Mono<ResponseEntity<Void>> request = getWebClient(this.webServer.getPort()).build().get().retrieve() .toBodilessEntity(); AtomicReference<ResponseEntity<Void>> responseReference = new AtomicReference<>(); CountDownLatch responseLatch = new CountDownLatch(1); request.subscribe((response) -> { responseReference.set(response); responseLatch.countDown(); }); blockingHandler.awaitQueue(); long start = System.currentTimeMillis(); Future<Boolean> shutdownResult = initiateGracefulShutdown(); assertThat(responseLatch.getCount()).isEqualTo(1); blockingHandler.completeOne(); assertThat(shutdownResult.get()).isTrue(); long end = System.currentTimeMillis(); assertThat(end - start).isLessThanOrEqualTo(30000); assertThat(responseLatch.await(5, TimeUnit.SECONDS)).isTrue(); } ======= @Test void whenARequestIsActiveThenStopWillComplete() throws InterruptedException, BrokenBarrierException { AbstractReactiveWebServerFactory factory = getFactory(); CyclicBarrier barrier = new CyclicBarrier(2); CountDownLatch latch = new CountDownLatch(1); this.webServer = factory.getWebServer((request, response) -> { try { barrier.await(); latch.await(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } catch (BrokenBarrierException ex) { throw new IllegalStateException(ex); } return response.setComplete(); }); this.webServer.start(); new Thread(() -> getWebClient().build().get().uri("/").exchange().block()).start(); barrier.await(); this.webServer.stop(); latch.countDown(); } >>>>>>> @Test void whenThereAreNoInFlightRequestsShutDownGracefullyReturnsTrueBeforePeriodElapses() throws Exception { AbstractReactiveWebServerFactory factory = getFactory(); Shutdown shutdown = new Shutdown(); shutdown.setGracePeriod(Duration.ofSeconds(30)); factory.setShutdown(shutdown); this.webServer = factory.getWebServer(new EchoHandler()); this.webServer.start(); long start = System.currentTimeMillis(); assertThat(this.webServer.shutDownGracefully()).isTrue(); long end = System.currentTimeMillis(); assertThat(end - start).isLessThanOrEqualTo(30000); } @Test void whenARequestRemainsInFlightThenShutDownGracefullyReturnsFalseAfterPeriodElapses() throws Exception { AbstractReactiveWebServerFactory factory = getFactory(); Shutdown shutdown = new Shutdown(); shutdown.setGracePeriod(Duration.ofSeconds(5)); factory.setShutdown(shutdown); BlockingHandler blockingHandler = new BlockingHandler(); this.webServer = factory.getWebServer(blockingHandler); this.webServer.start(); Mono<ResponseEntity<Void>> request = getWebClient(this.webServer.getPort()).build().get().retrieve() .toBodilessEntity(); AtomicReference<ResponseEntity<Void>> responseReference = new AtomicReference<>(); CountDownLatch responseLatch = new CountDownLatch(1); request.subscribe((response) -> { responseReference.set(response); responseLatch.countDown(); }); blockingHandler.awaitQueue(); long start = System.currentTimeMillis(); assertThat(this.webServer.shutDownGracefully()).isFalse(); long end = System.currentTimeMillis(); assertThat(end - start).isGreaterThanOrEqualTo(5000); assertThat(responseReference.get()).isNull(); blockingHandler.completeOne(); assertThat(responseLatch.await(5, TimeUnit.SECONDS)).isTrue(); } @Test void whenARequestCompletesDuringGracePeriodThenShutDownGracefullyReturnsTrueBeforePeriodElapses() throws Exception { AbstractReactiveWebServerFactory factory = getFactory(); if (factory instanceof NettyReactiveWebServerFactory) { ReactorResourceFactory resourceFactory = new ReactorResourceFactory(); resourceFactory.afterPropertiesSet(); ((NettyReactiveWebServerFactory) factory).setResourceFactory(resourceFactory); } Shutdown shutdown = new Shutdown(); shutdown.setGracePeriod(Duration.ofSeconds(30)); factory.setShutdown(shutdown); BlockingHandler blockingHandler = new BlockingHandler(); this.webServer = factory.getWebServer(blockingHandler); this.webServer.start(); Mono<ResponseEntity<Void>> request = getWebClient(this.webServer.getPort()).build().get().retrieve() .toBodilessEntity(); AtomicReference<ResponseEntity<Void>> responseReference = new AtomicReference<>(); CountDownLatch responseLatch = new CountDownLatch(1); request.subscribe((response) -> { responseReference.set(response); responseLatch.countDown(); }); blockingHandler.awaitQueue(); long start = System.currentTimeMillis(); Future<Boolean> shutdownResult = initiateGracefulShutdown(); assertThat(responseLatch.getCount()).isEqualTo(1); blockingHandler.completeOne(); assertThat(shutdownResult.get()).isTrue(); long end = System.currentTimeMillis(); assertThat(end - start).isLessThanOrEqualTo(30000); assertThat(responseLatch.await(5, TimeUnit.SECONDS)).isTrue(); } @Test void whenARequestIsActiveThenStopWillComplete() throws InterruptedException, BrokenBarrierException { AbstractReactiveWebServerFactory factory = getFactory(); BlockingHandler blockingHandler = new BlockingHandler(); this.webServer = factory.getWebServer(blockingHandler); this.webServer.start(); Mono<ResponseEntity<Void>> request = getWebClient(this.webServer.getPort()).build().get().retrieve() .toBodilessEntity(); AtomicReference<ResponseEntity<Void>> responseReference = new AtomicReference<>(); CountDownLatch responseLatch = new CountDownLatch(1); request.subscribe((response) -> { responseReference.set(response); responseLatch.countDown(); }); blockingHandler.awaitQueue(); this.webServer.stop(); blockingHandler.completeOne(); }
<<<<<<< DispatcherServletRegistrationBean bean = new DispatcherServletRegistrationBean( new DispatcherServlet(), "/test"); assertThatExceptionOfType(UnsupportedOperationException.class) .isThrownBy(() -> bean.setUrlMappings(Collections.emptyList())); ======= DispatcherServletRegistrationBean bean = new DispatcherServletRegistrationBean(new DispatcherServlet(), "/test"); this.thrown.expect(UnsupportedOperationException.class); bean.setUrlMappings(Collections.emptyList()); >>>>>>> DispatcherServletRegistrationBean bean = new DispatcherServletRegistrationBean(new DispatcherServlet(), "/test"); assertThatExceptionOfType(UnsupportedOperationException.class) .isThrownBy(() -> bean.setUrlMappings(Collections.emptyList())); <<<<<<< DispatcherServletRegistrationBean bean = new DispatcherServletRegistrationBean( new DispatcherServlet(), "/test"); assertThatExceptionOfType(UnsupportedOperationException.class) .isThrownBy(() -> bean.addUrlMappings("/test")); ======= DispatcherServletRegistrationBean bean = new DispatcherServletRegistrationBean(new DispatcherServlet(), "/test"); this.thrown.expect(UnsupportedOperationException.class); bean.addUrlMappings("/test"); >>>>>>> DispatcherServletRegistrationBean bean = new DispatcherServletRegistrationBean(new DispatcherServlet(), "/test"); assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> bean.addUrlMappings("/test"));
<<<<<<< import org.springframework.security.oauth2.jwt.NimbusJwtDecoder; ======= import org.springframework.security.oauth2.jwt.JwtValidators; import org.springframework.security.oauth2.jwt.NimbusJwtDecoderJwkSupport; >>>>>>> import org.springframework.security.oauth2.jwt.JwtValidators; import org.springframework.security.oauth2.jwt.NimbusJwtDecoder; <<<<<<< ======= @Bean @ConditionalOnProperty(name = "spring.security.oauth2.resourceserver.jwt.jwk-set-uri") @ConditionalOnMissingBean public JwtDecoder jwtDecoderByJwkKeySetUri() { NimbusJwtDecoderJwkSupport nimbusJwtDecoder = new NimbusJwtDecoderJwkSupport( this.properties.getJwt().getJwkSetUri()); String issuerUri = this.properties.getJwt().getIssuerUri(); if (issuerUri != null) { nimbusJwtDecoder.setJwtValidator(JwtValidators.createDefaultWithIssuer(issuerUri)); } return nimbusJwtDecoder; >>>>>>>
<<<<<<< TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( Collections.emptyList(), "com.foo"); ======= TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "com.foo", "exclude-id"); >>>>>>> TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "com.foo"); <<<<<<< Set<Artifact> artifacts = mojo.filterDependencies( createArtifact("com.foo", "one"), createArtifact("com.foo", "two"), artifact); ======= Set<Artifact> artifacts = mojo.filterDependencies(createArtifact("com.foo", "one"), createArtifact("com.foo", "two"), createArtifact("com.bar", "exclude-id"), artifact); >>>>>>> Set<Artifact> artifacts = mojo.filterDependencies(createArtifact("com.foo", "one"), createArtifact("com.foo", "two"), artifact); <<<<<<< TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( Collections.emptyList(), "com.foo"); ======= TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "com.foo", ""); >>>>>>> TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "com.foo"); <<<<<<< TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( Collections.emptyList(), "", ======= TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "", "", >>>>>>> TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "", <<<<<<< ======= public void filterArtifactIdKeepOrder() throws MojoExecutionException { TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "", "one,three"); Artifact one = createArtifact("com.foo", "one"); Artifact two = createArtifact("com.foo", "two"); Artifact three = createArtifact("com.foo", "three"); Artifact four = createArtifact("com.foo", "four"); Set<Artifact> artifacts = mojo.filterDependencies(one, two, three, four); assertThat(artifacts).containsExactly(two, four); } @Test >>>>>>> <<<<<<< TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( Collections.emptyList(), "com.foo"); ======= TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "com.foo", ""); >>>>>>> TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.emptyList(), "com.foo"); <<<<<<< TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( Collections.singletonList(exclude), ""); ======= TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.singletonList(exclude), "", ""); >>>>>>> TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(Collections.singletonList(exclude), ""); <<<<<<< private TestableDependencyFilterMojo(List<Exclude> excludes, String excludeGroupIds, ArtifactsFilter... additionalFilters) { ======= @SuppressWarnings("deprecation") private TestableDependencyFilterMojo(List<Exclude> excludes, String excludeGroupIds, String excludeArtifactIds, ArtifactsFilter... additionalFilters) { >>>>>>> private TestableDependencyFilterMojo(List<Exclude> excludes, String excludeGroupIds, ArtifactsFilter... additionalFilters) {
<<<<<<< * @author Artsiom Yudovin ======= * @since 1.0.0 >>>>>>> * @author Artsiom Yudovin * @since 1.0.0
<<<<<<< public WebFluxConfig(ResourceProperties resourceProperties, WebFluxProperties webFluxProperties, ListableBeanFactory beanFactory, ObjectProvider<HandlerMethodArgumentResolver> resolvers, ObjectProvider<CodecCustomizer> codecCustomizers, ======= public WebFluxConfig(ResourceProperties resourceProperties, WebFluxProperties webFluxProperties, ListableBeanFactory beanFactory, ObjectProvider<List<HandlerMethodArgumentResolver>> resolvers, ObjectProvider<List<CodecCustomizer>> codecCustomizers, >>>>>>> public WebFluxConfig(ResourceProperties resourceProperties, WebFluxProperties webFluxProperties, ListableBeanFactory beanFactory, ObjectProvider<HandlerMethodArgumentResolver> resolvers, ObjectProvider<CodecCustomizer> codecCustomizers, <<<<<<< this.argumentResolvers = resolvers; this.codecCustomizers = codecCustomizers; this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizer .getIfAvailable(); this.viewResolvers = viewResolvers; ======= this.argumentResolvers = resolvers.getIfAvailable(); this.codecCustomizers = codecCustomizers.getIfAvailable(); this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizer.getIfAvailable(); this.viewResolvers = viewResolvers.getIfAvailable(); >>>>>>> this.argumentResolvers = resolvers; this.codecCustomizers = codecCustomizers; this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizer.getIfAvailable(); this.viewResolvers = viewResolvers; <<<<<<< this.codecCustomizers.orderedStream() .forEach((customizer) -> customizer.customize(configurer)); ======= if (this.codecCustomizers != null) { this.codecCustomizers.forEach((customizer) -> customizer.customize(configurer)); } >>>>>>> this.codecCustomizers.orderedStream().forEach((customizer) -> customizer.customize(configurer)); <<<<<<< configureResourceCaching(registration); ======= if (cachePeriod != null) { registration.setCacheControl(CacheControl.maxAge(cachePeriod.toMillis(), TimeUnit.MILLISECONDS)); } >>>>>>> configureResourceCaching(registration); <<<<<<< ResourceHandlerRegistration registration = registry .addResourceHandler(staticPathPattern).addResourceLocations( this.resourceProperties.getStaticLocations()); configureResourceCaching(registration); ======= ResourceHandlerRegistration registration = registry.addResourceHandler(staticPathPattern) .addResourceLocations(this.resourceProperties.getStaticLocations()); if (cachePeriod != null) { registration.setCacheControl(CacheControl.maxAge(cachePeriod.toMillis(), TimeUnit.MILLISECONDS)); } >>>>>>> ResourceHandlerRegistration registration = registry.addResourceHandler(staticPathPattern) .addResourceLocations(this.resourceProperties.getStaticLocations()); configureResourceCaching(registration); <<<<<<< ======= interface ResourceHandlerRegistrationCustomizer { void customize(ResourceHandlerRegistration registration); } private static class ResourceChainResourceHandlerRegistrationCustomizer implements ResourceHandlerRegistrationCustomizer { @Autowired private ResourceProperties resourceProperties = new ResourceProperties(); @Override public void customize(ResourceHandlerRegistration registration) { ResourceProperties.Chain properties = this.resourceProperties.getChain(); configureResourceChain(properties, registration.resourceChain(properties.isCache())); } private void configureResourceChain(ResourceProperties.Chain properties, ResourceChainRegistration chain) { ResourceProperties.Strategy strategy = properties.getStrategy(); if (strategy.getFixed().isEnabled() || strategy.getContent().isEnabled()) { chain.addResolver(getVersionResourceResolver(strategy)); } if (properties.isGzipped()) { chain.addResolver(new GzipResourceResolver()); } if (properties.isHtmlApplicationCache()) { chain.addTransformer(new AppCacheManifestTransformer()); } } private ResourceResolver getVersionResourceResolver(ResourceProperties.Strategy properties) { VersionResourceResolver resolver = new VersionResourceResolver(); if (properties.getFixed().isEnabled()) { String version = properties.getFixed().getVersion(); String[] paths = properties.getFixed().getPaths(); resolver.addFixedVersionStrategy(version, paths); } if (properties.getContent().isEnabled()) { String[] paths = properties.getContent().getPaths(); resolver.addContentVersionStrategy(paths); } return resolver; } } >>>>>>>
<<<<<<< private List<String> simpleList = new ArrayList<>(); ======= private String rawSensitiveAddresses = "http://user:password@localhost:8080,http://user2:password2@localhost:8082"; >>>>>>> private List<String> simpleList = new ArrayList<>(); private String rawSensitiveAddresses = "http://user:password@localhost:8080,http://user2:password2@localhost:8082";
<<<<<<< * @author Madhura Bhave * @author Brian Clozel * @see #run(Class, String[]) * @see #run(Class[], String[]) * @see #SpringApplication(Class...) ======= * @author Ethan Rubinson * @see #run(Object, String[]) * @see #run(Object[], String[]) * @see #SpringApplication(Object...) >>>>>>> * @author Madhura Bhave * @author Brian Clozel * @author Ethan Rubinson * @see #run(Class, String[]) * @see #run(Class[], String[]) * @see #SpringApplication(Class...) <<<<<<< private static final Set<String> SERVLET_ENVIRONMENT_SOURCE_NAMES; static { Set<String> names = new HashSet<>(); names.add(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME); names.add(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME); names.add(StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME); SERVLET_ENVIRONMENT_SOURCE_NAMES = Collections.unmodifiableSet(names); } ======= >>>>>>> <<<<<<< bindToSpringApplication(environment); if (isWebEnvironment(environment) && this.webApplicationType == WebApplicationType.NONE) { environment = convertToStandardEnvironment(environment); ======= if (!this.webEnvironment) { environment = new EnvironmentConverter(getClassLoader()) .convertToStandardEnvironmentIfNecessary(environment); >>>>>>> bindToSpringApplication(environment); if (this.webApplicationType == WebApplicationType.NONE) { environment = new EnvironmentConverter(getClassLoader()) .convertToStandardEnvironmentIfNecessary(environment); <<<<<<< private boolean isWebEnvironment(ConfigurableEnvironment environment) { try { Class<?> webEnvironmentClass = ClassUtils .forName(CONFIGURABLE_WEB_ENVIRONMENT_CLASS, getClassLoader()); return (webEnvironmentClass.isInstance(environment)); } catch (Throwable ex) { return false; } } private ConfigurableEnvironment convertToStandardEnvironment( ConfigurableEnvironment environment) { StandardEnvironment result = new StandardEnvironment(); removeAllPropertySources(result.getPropertySources()); result.setActiveProfiles(environment.getActiveProfiles()); for (PropertySource<?> propertySource : environment.getPropertySources()) { if (!SERVLET_ENVIRONMENT_SOURCE_NAMES.contains(propertySource.getName())) { result.getPropertySources().addLast(propertySource); } } return result; } private void removeAllPropertySources(MutablePropertySources propertySources) { Set<String> names = new HashSet<>(); for (PropertySource<?> propertySource : propertySources) { names.add(propertySource.getName()); } for (String name : names) { propertySources.remove(name); } } ======= >>>>>>>
<<<<<<< void testHealth() { ResponseEntity<String> entity = this.restTemplate .withBasicAuth("user", getPassword()) ======= public void testHealth() { ResponseEntity<String> entity = this.restTemplate.withBasicAuth("user", getPassword()) >>>>>>> void testHealth() { ResponseEntity<String> entity = this.restTemplate.withBasicAuth("user", getPassword())
<<<<<<< void setConnectionTimeoutAsZero() { setupConnectionTimeout(Duration.ZERO); ======= public void setServerConnectionTimeoutAsZero() { setupServerConnectionTimeout(Duration.ZERO); >>>>>>> void setServerConnectionTimeoutAsZero() { setupServerConnectionTimeout(Duration.ZERO); <<<<<<< void setConnectionTimeoutAsMinusOne() { setupConnectionTimeout(Duration.ofNanos(-1)); ======= public void setServerConnectionTimeoutAsMinusOne() { setupServerConnectionTimeout(Duration.ofNanos(-1)); >>>>>>> void setServerConnectionTimeoutAsMinusOne() { setupServerConnectionTimeout(Duration.ofNanos(-1)); <<<<<<< void setConnectionTimeout() { ======= public void setServerConnectionTimeout() { setupServerConnectionTimeout(Duration.ofSeconds(1)); NettyReactiveWebServerFactory factory = mock(NettyReactiveWebServerFactory.class); this.customizer.customize(factory); verifyConnectionTimeout(factory, 1000); } @Test public void setConnectionTimeout() { >>>>>>> void setServerConnectionTimeout() { setupServerConnectionTimeout(Duration.ofSeconds(1)); NettyReactiveWebServerFactory factory = mock(NettyReactiveWebServerFactory.class); this.customizer.customize(factory); verifyConnectionTimeout(factory, 1000); } @Test void setConnectionTimeout() {
<<<<<<< ======= this.configurationCustomizers = configurationCustomizers; this.queuesConfiguration = queuesConfiguration.orderedStream().collect(Collectors.toList()); this.topicsConfiguration = topicsConfiguration.orderedStream().collect(Collectors.toList()); >>>>>>> <<<<<<< public EmbeddedJMS artemisServer( org.apache.activemq.artemis.core.config.Configuration configuration, JMSConfiguration jmsConfiguration, ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers) { ======= public EmbeddedJMS artemisServer(org.apache.activemq.artemis.core.config.Configuration configuration, JMSConfiguration jmsConfiguration) { >>>>>>> public EmbeddedJMS artemisServer(org.apache.activemq.artemis.core.config.Configuration configuration, JMSConfiguration jmsConfiguration, ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers) { <<<<<<< ======= private void customize(org.apache.activemq.artemis.core.config.Configuration configuration) { this.configurationCustomizers.orderedStream().forEach((customizer) -> customizer.customize(configuration)); } >>>>>>>
<<<<<<< @Testcontainers @ContextConfiguration( initializers = DataNeo4jTestWithIncludeFilterIntegrationTests.Initializer.class) ======= @RunWith(SpringRunner.class) @ContextConfiguration(initializers = DataNeo4jTestWithIncludeFilterIntegrationTests.Initializer.class) >>>>>>> @Testcontainers @ContextConfiguration(initializers = DataNeo4jTestWithIncludeFilterIntegrationTests.Initializer.class)
<<<<<<< private Preferences preferences; ======= private CategoryTreeBox categoryTreeBox; >>>>>>> private CategoryTreeBox categoryTreeBox; private Preferences preferences; <<<<<<< setDetailNode(categoryTree); // Load last selected category in TreeView. categoryTree.setSelectedCategoryById(preferences.getInt(SELECTED_CATEGORY, DEFAULT_CATEGORY)); TreeItem treeItem = (TreeItem) categoryTree.getSelectionModel().getSelectedItem(); setSelectedCategory((Category) treeItem.getValue()); ======= setDetailNode(categoryTreeBox); // Sets initial shown CategoryPane. setMasterNode(this.categories.get(INITIAL_CATEGORY).getCategoryPane()); setDividerPosition(DIVIDER_POSITION); >>>>>>> setDetailNode(categoryTreeBox); // Load last selected category in TreeView. categoryTree.setSelectedCategoryById(preferences.getInt(SELECTED_CATEGORY, DEFAULT_CATEGORY)); TreeItem treeItem = (TreeItem) categoryTree.getSelectionModel().getSelectedItem(); setSelectedCategory((Category) treeItem.getValue()); <<<<<<< (observable, oldValue, newValue) -> setSelectedCategory((Category) ((TreeItem) newValue).getValue()) ); } /** * @param category sets the selected Category to the MasterNode. */ private void setSelectedCategory(Category category) { setMasterNode(category.getCategoryPane()); // Sets the saved divider position. setDividerPosition(preferences.getDouble(DIVIDER_POSITION, DEFAULT_DIVIDER_POSITION)); } public Preferences getPreferences() { return preferences; ======= // Save the old divider position. When you set the new item, it resets the position. (observable, oldItem, newItem) -> { double dividerPosition = this.getDividerPosition(); // Replaces the old CategoryPane with the new one. if (newItem != null) { setMasterNode(((Category) ((TreeItem) newItem).getValue()).getCategoryPane()); } setDividerPosition(dividerPosition); // Sets the saved divider position. }); >>>>>>> (observable, oldValue, newValue) -> { if (newValue != null) { setSelectedCategory((Category) ((TreeItem) newValue).getValue()); } } ); } /** * @param category sets the selected Category to the MasterNode. */ private void setSelectedCategory(Category category) { setMasterNode(category.getCategoryPane()); // Sets the saved divider position. setDividerPosition(preferences.getDouble(DIVIDER_POSITION, DEFAULT_DIVIDER_POSITION)); } public Preferences getPreferences() { return preferences;
<<<<<<< import org.springframework.boot.test.util.EnvironmentTestUtils; ======= import org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener; import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.boot.test.OutputCapture; >>>>>>> import org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener; import org.springframework.boot.test.rule.OutputCapture; import org.springframework.boot.test.util.EnvironmentTestUtils; <<<<<<< import static org.assertj.core.api.Assertions.assertThat; ======= import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.contains; >>>>>>> import static org.assertj.core.api.Assertions.assertThat; <<<<<<< * @author Andy Wilkinson * @author Eddú Meléndez ======= * @author Andy Wilkinson >>>>>>> * @author Eddú Meléndez * @author Andy Wilkinson <<<<<<< @Rule public TemporaryFolder temp = new TemporaryFolder(); ======= @Rule public OutputCapture outputCapture = new OutputCapture(); >>>>>>> @Rule public TemporaryFolder temp = new TemporaryFolder(); @Rule public OutputCapture outputCapture = new OutputCapture(); <<<<<<< assertThat(log).isInstanceOf(CommonsLoggingLiquibaseLogger.class); ======= assertThat(log, instanceOf((CommonsLoggingLiquibaseLogger.class))); assertThat(this.outputCapture.toString(), not(contains(": liquibase:"))); >>>>>>> assertThat(log).isInstanceOf(CommonsLoggingLiquibaseLogger.class); assertThat(this.outputCapture.toString()).doesNotContain(": liquibase:");
<<<<<<< @Testcontainers @ContextConfiguration( initializers = DataNeo4jTestPropertiesIntegrationTests.Initializer.class) ======= @RunWith(SpringRunner.class) @ContextConfiguration(initializers = DataNeo4jTestPropertiesIntegrationTests.Initializer.class) >>>>>>> @Testcontainers @ContextConfiguration(initializers = DataNeo4jTestPropertiesIntegrationTests.Initializer.class)
<<<<<<< ).persistWindowState(true).saveSettings(true).debugHistoryMode(true).buttonsVisibility(true); // asciidoctor Documentation - end::setupPreferences[] ======= ).persistWindowState(false).saveSettings(true).debugHistoryMode(false).buttonsVisibility(true); >>>>>>> ).persistWindowState(false).saveSettings(true).debugHistoryMode(false).buttonsVisibility(true); // asciidoctor Documentation - end::setupPreferences[]
<<<<<<< void getNestedJarFile() throws Exception { try (JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile.getEntry("nested.jar"))) { assertThat(nestedJarFile.getComment()).isEqualTo("nested"); Enumeration<java.util.jar.JarEntry> entries = nestedJarFile.entries(); assertThat(entries.nextElement().getName()).isEqualTo("META-INF/"); assertThat(entries.nextElement().getName()).isEqualTo("META-INF/MANIFEST.MF"); assertThat(entries.nextElement().getName()).isEqualTo("3.dat"); assertThat(entries.nextElement().getName()).isEqualTo("4.dat"); assertThat(entries.nextElement().getName()).isEqualTo("\u00E4.dat"); assertThat(entries.hasMoreElements()).isFalse(); InputStream inputStream = nestedJarFile.getInputStream(nestedJarFile.getEntry("3.dat")); assertThat(inputStream.read()).isEqualTo(3); assertThat(inputStream.read()).isEqualTo(-1); URL url = nestedJarFile.getUrl(); assertThat(url.toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar!/"); JarURLConnection conn = (JarURLConnection) url.openConnection(); assertThat(conn.getJarFile()).isSameAs(nestedJarFile); assertThat(conn.getJarFileURL().toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar"); assertThat(conn.getInputStream()).isNotNull(); JarInputStream jarInputStream = new JarInputStream(conn.getInputStream()); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("3.dat"); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("4.dat"); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("\u00E4.dat"); jarInputStream.close(); assertThat(conn.getPermission()).isInstanceOf(FilePermission.class); FilePermission permission = (FilePermission) conn.getPermission(); assertThat(permission.getActions()).isEqualTo("read"); assertThat(permission.getName()).isEqualTo(this.rootJarFile.getPath()); } ======= public void getNestedJarFile() throws Exception { JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile.getEntry("nested.jar")); assertThat(nestedJarFile.getComment()).isEqualTo("nested"); Enumeration<java.util.jar.JarEntry> entries = nestedJarFile.entries(); assertThat(entries.nextElement().getName()).isEqualTo("META-INF/"); assertThat(entries.nextElement().getName()).isEqualTo("META-INF/MANIFEST.MF"); assertThat(entries.nextElement().getName()).isEqualTo("3.dat"); assertThat(entries.nextElement().getName()).isEqualTo("4.dat"); assertThat(entries.nextElement().getName()).isEqualTo("\u00E4.dat"); assertThat(entries.hasMoreElements()).isFalse(); InputStream inputStream = nestedJarFile.getInputStream(nestedJarFile.getEntry("3.dat")); assertThat(inputStream.read()).isEqualTo(3); assertThat(inputStream.read()).isEqualTo(-1); URL url = nestedJarFile.getUrl(); assertThat(url.toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar!/"); JarURLConnection conn = (JarURLConnection) url.openConnection(); assertThat(conn.getJarFile().getParent()).isSameAs(nestedJarFile); assertThat(conn.getJarFileURL().toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar"); assertThat(conn.getInputStream()).isNotNull(); JarInputStream jarInputStream = new JarInputStream(conn.getInputStream()); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("3.dat"); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("4.dat"); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("\u00E4.dat"); jarInputStream.close(); assertThat(conn.getPermission()).isInstanceOf(FilePermission.class); FilePermission permission = (FilePermission) conn.getPermission(); assertThat(permission.getActions()).isEqualTo("read"); assertThat(permission.getName()).isEqualTo(this.rootJarFile.getPath()); >>>>>>> void getNestedJarFile() throws Exception { try (JarFile nestedJarFile = this.jarFile.getNestedJarFile(this.jarFile.getEntry("nested.jar"))) { assertThat(nestedJarFile.getComment()).isEqualTo("nested"); Enumeration<java.util.jar.JarEntry> entries = nestedJarFile.entries(); assertThat(entries.nextElement().getName()).isEqualTo("META-INF/"); assertThat(entries.nextElement().getName()).isEqualTo("META-INF/MANIFEST.MF"); assertThat(entries.nextElement().getName()).isEqualTo("3.dat"); assertThat(entries.nextElement().getName()).isEqualTo("4.dat"); assertThat(entries.nextElement().getName()).isEqualTo("\u00E4.dat"); assertThat(entries.hasMoreElements()).isFalse(); InputStream inputStream = nestedJarFile.getInputStream(nestedJarFile.getEntry("3.dat")); assertThat(inputStream.read()).isEqualTo(3); assertThat(inputStream.read()).isEqualTo(-1); URL url = nestedJarFile.getUrl(); assertThat(url.toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar!/"); JarURLConnection conn = (JarURLConnection) url.openConnection(); assertThat(conn.getJarFile().getParent()).isSameAs(nestedJarFile); assertThat(conn.getJarFileURL().toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/nested.jar"); assertThat(conn.getInputStream()).isNotNull(); JarInputStream jarInputStream = new JarInputStream(conn.getInputStream()); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("3.dat"); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("4.dat"); assertThat(jarInputStream.getNextJarEntry().getName()).isEqualTo("\u00E4.dat"); jarInputStream.close(); assertThat(conn.getPermission()).isInstanceOf(FilePermission.class); FilePermission permission = (FilePermission) conn.getPermission(); assertThat(permission.getActions()).isEqualTo("read"); assertThat(permission.getName()).isEqualTo(this.rootJarFile.getPath()); } <<<<<<< URL url = nestedJarFile.getUrl(); assertThat(url.toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/d!/"); assertThat(((JarURLConnection) url.openConnection()).getJarFile()).isSameAs(nestedJarFile); } ======= URL url = nestedJarFile.getUrl(); assertThat(url.toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/d!/"); assertThat(((JarURLConnection) url.openConnection()).getJarFile().getParent()).isSameAs(nestedJarFile); >>>>>>> URL url = nestedJarFile.getUrl(); assertThat(url.toString()).isEqualTo("jar:" + this.rootJarFile.toURI() + "!/d!/"); assertThat(((JarURLConnection) url.openConnection()).getJarFile().getParent()).isSameAs(nestedJarFile); }
<<<<<<< @Test public void placeholderResolutionWithCustomLocation() throws Exception { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "fooValue:bar"); this.context.register(CustomConfigurationLocation.class); this.context.refresh(); assertThat(this.context.getBean(CustomConfigurationLocation.class).getFoo(), equalTo("bar")); } @Test public void placeholderResolutionWithUnmergedCustomLocation() throws Exception { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "fooValue:bar"); this.context.register(UnmergedCustomConfigurationLocation.class); this.context.refresh(); assertThat(this.context.getBean(UnmergedCustomConfigurationLocation.class) .getFoo(), equalTo("${fooValue}")); } ======= @Test public void configurationPropertiesWithFactoryBean() throws Exception { ConfigurationPropertiesWithFactoryBean.factoryBeanInit = false; this.context = new AnnotationConfigApplicationContext() { @Override protected void onRefresh() throws BeansException { assertFalse("Init too early", ConfigurationPropertiesWithFactoryBean.factoryBeanInit); super.onRefresh(); } }; this.context.register(ConfigurationPropertiesWithFactoryBean.class); GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(FactoryBeanTester.class); beanDefinition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE); this.context.registerBeanDefinition("test", beanDefinition); this.context.refresh(); assertTrue("No init", ConfigurationPropertiesWithFactoryBean.factoryBeanInit); } >>>>>>> @Test public void placeholderResolutionWithCustomLocation() throws Exception { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "fooValue:bar"); this.context.register(CustomConfigurationLocation.class); this.context.refresh(); assertThat(this.context.getBean(CustomConfigurationLocation.class).getFoo(), equalTo("bar")); } @Test public void placeholderResolutionWithUnmergedCustomLocation() throws Exception { this.context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, "fooValue:bar"); this.context.register(UnmergedCustomConfigurationLocation.class); this.context.refresh(); assertThat(this.context.getBean(UnmergedCustomConfigurationLocation.class) .getFoo(), equalTo("${fooValue}")); } @Test public void configurationPropertiesWithFactoryBean() throws Exception { ConfigurationPropertiesWithFactoryBean.factoryBeanInit = false; this.context = new AnnotationConfigApplicationContext() { @Override protected void onRefresh() throws BeansException { assertFalse("Init too early", ConfigurationPropertiesWithFactoryBean.factoryBeanInit); super.onRefresh(); } }; this.context.register(ConfigurationPropertiesWithFactoryBean.class); GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(FactoryBeanTester.class); beanDefinition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE); this.context.registerBeanDefinition("test", beanDefinition); this.context.refresh(); assertTrue("No init", ConfigurationPropertiesWithFactoryBean.factoryBeanInit); } <<<<<<< @EnableConfigurationProperties @ConfigurationProperties(locations = "custom-location.yml") public static class CustomConfigurationLocation { private String foo; public String getFoo() { return this.foo; } public void setFoo(String foo) { this.foo = foo; } } @EnableConfigurationProperties @ConfigurationProperties(locations = "custom-location.yml", merge = false) public static class UnmergedCustomConfigurationLocation { private String foo; public String getFoo() { return this.foo; } public void setFoo(String foo) { this.foo = foo; } } ======= @Configuration @EnableConfigurationProperties public static class ConfigurationPropertiesWithFactoryBean { public static boolean factoryBeanInit; } @SuppressWarnings("rawtypes") // Must be a raw type static class FactoryBeanTester implements FactoryBean, InitializingBean { @Override public Object getObject() throws Exception { return Object.class; } @Override public Class<?> getObjectType() { return null; } @Override public boolean isSingleton() { return true; } @Override public void afterPropertiesSet() throws Exception { ConfigurationPropertiesWithFactoryBean.factoryBeanInit = true; } } >>>>>>> @EnableConfigurationProperties @ConfigurationProperties(locations = "custom-location.yml") public static class CustomConfigurationLocation { private String foo; public String getFoo() { return this.foo; } public void setFoo(String foo) { this.foo = foo; } } @EnableConfigurationProperties @ConfigurationProperties(locations = "custom-location.yml", merge = false) public static class UnmergedCustomConfigurationLocation { private String foo; public String getFoo() { return this.foo; } public void setFoo(String foo) { this.foo = foo; } } @Configuration @EnableConfigurationProperties public static class ConfigurationPropertiesWithFactoryBean { public static boolean factoryBeanInit; } @SuppressWarnings("rawtypes") // Must be a raw type static class FactoryBeanTester implements FactoryBean, InitializingBean { @Override public Object getObject() throws Exception { return Object.class; } @Override public Class<?> getObjectType() { return null; } @Override public boolean isSingleton() { return true; } @Override public void afterPropertiesSet() throws Exception { ConfigurationPropertiesWithFactoryBean.factoryBeanInit = true; } }
<<<<<<< private static final AutoConfigurations AUTO_CONFIGURATIONS = AutoConfigurations.of( MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class); ======= private static final AutoConfigurations AUTO_CONFIGURATIONS = AutoConfigurations.of(MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class, RabbitMetricsAutoConfiguration.class, CacheMetricsAutoConfiguration.class, DataSourcePoolMetricsAutoConfiguration.class, RestTemplateMetricsAutoConfiguration.class, WebFluxMetricsAutoConfiguration.class, WebMvcMetricsAutoConfiguration.class); >>>>>>> private static final AutoConfigurations AUTO_CONFIGURATIONS = AutoConfigurations.of(MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class); <<<<<<< return (T) contextRunner .withPropertyValues("management.metrics.use-global-registry=false") ======= return contextRunner.withPropertyValues("management.metrics.use-global-registry=false") >>>>>>> return (T) contextRunner.withPropertyValues("management.metrics.use-global-registry=false")
<<<<<<< return map.entrySet().stream() .map((entry) -> mapper.apply(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); ======= return map.entrySet().stream().map((entry) -> mapper.apply(entry.getKey(), entry.getValue())) .collect(Collectors.toCollection(ArrayList::new)); >>>>>>> return map.entrySet().stream().map((entry) -> mapper.apply(entry.getKey(), entry.getValue())) .collect(Collectors.toList());
<<<<<<< void validateLoggersEndpoint() throws Exception { this.mvc.perform( get("/actuator/loggers/org.apache.coyote.http11.Http11NioProtocol") .header("Authorization", "Basic " + getBasicAuth())) .andExpect(status().isOk()) .andExpect(content().string(equalTo("{\"configuredLevel\":\"WARN\"," + "\"effectiveLevel\":\"WARN\"}"))); ======= public void validateLoggersEndpoint() throws Exception { this.mvc.perform(get("/actuator/loggers/org.apache.coyote.http11.Http11NioProtocol").header("Authorization", "Basic " + getBasicAuth())).andExpect(status().isOk()).andExpect( content().string(equalTo("{\"configuredLevel\":\"WARN\"," + "\"effectiveLevel\":\"WARN\"}"))); >>>>>>> void validateLoggersEndpoint() throws Exception { this.mvc.perform(get("/actuator/loggers/org.apache.coyote.http11.Http11NioProtocol").header("Authorization", "Basic " + getBasicAuth())).andExpect(status().isOk()).andExpect( content().string(equalTo("{\"configuredLevel\":\"WARN\"," + "\"effectiveLevel\":\"WARN\"}")));
<<<<<<< import java.util.Collections; ======= import java.util.regex.Matcher; import java.util.regex.Pattern; >>>>>>> import java.util.Collections; import java.util.regex.Matcher; import java.util.regex.Pattern; <<<<<<< void correctVersionOfJettyUsed() { assertThat(JettyEmbeddedErrorHandler.ERROR_PAGE_FOR_METHOD_AVAILABLE).isTrue(); ======= public void correctVersionOfJettyUsed() { String jettyVersion = ErrorHandler.class.getPackage().getImplementationVersion(); Matcher matcher = Pattern.compile("[0-9]+.[0-9]+.([0-9]+)[\\.-].*").matcher(jettyVersion); assertThat(matcher.find()).isTrue(); assertThat(Integer.valueOf(matcher.group(1))).isGreaterThan(19); >>>>>>> void correctVersionOfJettyUsed() { String jettyVersion = ErrorHandler.class.getPackage().getImplementationVersion(); Matcher matcher = Pattern.compile("[0-9]+.[0-9]+.([0-9]+)[\\.-].*").matcher(jettyVersion); assertThat(matcher.find()).isTrue(); assertThat(Integer.valueOf(matcher.group(1))).isGreaterThan(19);
<<<<<<< this.task.classpath(this.temp.newFile("one.jar"), this.temp.newFile("two.jar")); executeTask(); ======= this.task.classpath(jarFile("one.jar"), jarFile("two.jar")); this.task.execute(); >>>>>>> this.task.classpath(jarFile("one.jar"), jarFile("two.jar")); executeTask(); <<<<<<< this.task.classpath(this.temp.newFile("one.jar")); this.task .setClasspath(this.task.getProject().files(this.temp.newFile("two.jar"))); executeTask(); ======= this.task.classpath(jarFile("one.jar")); this.task.setClasspath(this.task.getProject().files(jarFile("two.jar"))); this.task.execute(); >>>>>>> this.task.classpath(jarFile("one.jar")); this.task.setClasspath(this.task.getProject().files(jarFile("two.jar"))); executeTask(); <<<<<<< this.task.classpath(this.temp.newFile("one.jar")); this.task.setClasspath(this.temp.newFile("two.jar")); executeTask(); ======= this.task.classpath(jarFile("one.jar")); this.task.setClasspath(jarFile("two.jar")); this.task.execute(); >>>>>>> this.task.classpath(jarFile("one.jar")); this.task.setClasspath(jarFile("two.jar")); executeTask();
<<<<<<< void testErrorWithResponseStatus() throws Exception { ======= public void testErrorWithNotFoundResponseStatus() throws Exception { >>>>>>> void testErrorWithNotFoundResponseStatus() throws Exception { <<<<<<< void testBindingExceptionForMachineClient() throws Exception { ======= public void testErrorWithNoContentResponseStatus() throws Exception { MvcResult result = this.mockMvc.perform(get("/noContent").accept("some/thing")) .andExpect(status().isNoContent()).andReturn(); MvcResult response = this.mockMvc.perform(new ErrorDispatcher(result, "/error")) .andExpect(status().isNoContent()).andReturn(); String content = response.getResponse().getContentAsString(); assertThat(content).isEmpty(); } @Test public void testBindingExceptionForMachineClient() throws Exception { >>>>>>> void testErrorWithNoContentResponseStatus() throws Exception { MvcResult result = this.mockMvc.perform(get("/noContent").accept("some/thing")) .andExpect(status().isNoContent()).andReturn(); MvcResult response = this.mockMvc.perform(new ErrorDispatcher(result, "/error")) .andExpect(status().isNoContent()).andReturn(); String content = response.getResponse().getContentAsString(); assertThat(content).isEmpty(); } @Test void testBindingExceptionForMachineClient() throws Exception { <<<<<<< public String getFoo() { return "foo"; } ======= @RequestMapping("/noContent") public void noContent() throws Exception { throw new NoContentException("Expected!"); } >>>>>>> @RequestMapping("/noContent") void noContent() throws Exception { throw new NoContentException("Expected!"); } public String getFoo() { return "foo"; }
<<<<<<< import static org.assertj.core.api.Assertions.assertThat; ======= import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.mockito.Mockito.mock; >>>>>>> import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock;
<<<<<<< ======= import com.dlsc.preferencesfx.PreferencesFx; import com.dlsc.preferencesfx.history.History; >>>>>>> import com.dlsc.preferencesfx.PreferencesFx; import com.dlsc.preferencesfx.history.History; <<<<<<< ======= model.saveSettings(); >>>>>>>
<<<<<<< @Configuration(proxyBeanMethods = false) @ServletComponentScan(basePackages = "org.springframework.boot.web.servlet.testcomponents") ======= @Configuration @ServletComponentScan( basePackages = "org.springframework.boot.web.servlet.testcomponents") >>>>>>> @Configuration(proxyBeanMethods = false) @ServletComponentScan( basePackages = "org.springframework.boot.web.servlet.testcomponents")
<<<<<<< protected final ConditionOutcome[] getOutcomes(String[] autoConfigurationClasses, AutoConfigurationMetadata autoConfigurationMetadata) { ConditionOutcome[] outcomes = new ConditionOutcome[autoConfigurationClasses.length]; for (int i = 0; i < outcomes.length; i++) { String autoConfigurationClass = autoConfigurationClasses[i]; if (autoConfigurationClass != null) { Set<String> onBeanTypes = autoConfigurationMetadata .getSet(autoConfigurationClass, "ConditionalOnBean"); outcomes[i] = getOutcome(onBeanTypes, ConditionalOnBean.class); if (outcomes[i] == null) { Set<String> onSingleCandidateTypes = autoConfigurationMetadata.getSet( autoConfigurationClass, "ConditionalOnSingleCandidate"); outcomes[i] = getOutcome(onSingleCandidateTypes, ConditionalOnSingleCandidate.class); } } } return outcomes; } private ConditionOutcome getOutcome(Set<String> requiredBeanTypes, Class<? extends Annotation> annotation) { List<String> missing = filter(requiredBeanTypes, ClassNameFilter.MISSING, getBeanClassLoader()); if (!missing.isEmpty()) { ConditionMessage message = ConditionMessage.forCondition(annotation) .didNotFind("required type", "required types") .items(Style.QUOTE, missing); return ConditionOutcome.noMatch(message); } return null; } @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ======= public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { >>>>>>> protected final ConditionOutcome[] getOutcomes(String[] autoConfigurationClasses, AutoConfigurationMetadata autoConfigurationMetadata) { ConditionOutcome[] outcomes = new ConditionOutcome[autoConfigurationClasses.length]; for (int i = 0; i < outcomes.length; i++) { String autoConfigurationClass = autoConfigurationClasses[i]; if (autoConfigurationClass != null) { Set<String> onBeanTypes = autoConfigurationMetadata.getSet(autoConfigurationClass, "ConditionalOnBean"); outcomes[i] = getOutcome(onBeanTypes, ConditionalOnBean.class); if (outcomes[i] == null) { Set<String> onSingleCandidateTypes = autoConfigurationMetadata.getSet(autoConfigurationClass, "ConditionalOnSingleCandidate"); outcomes[i] = getOutcome(onSingleCandidateTypes, ConditionalOnSingleCandidate.class); } } } return outcomes; } private ConditionOutcome getOutcome(Set<String> requiredBeanTypes, Class<? extends Annotation> annotation) { List<String> missing = filter(requiredBeanTypes, ClassNameFilter.MISSING, getBeanClassLoader()); if (!missing.isEmpty()) { ConditionMessage message = ConditionMessage.forCondition(annotation) .didNotFind("required type", "required types").items(Style.QUOTE, missing); return ConditionOutcome.noMatch(message); } return null; } @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { <<<<<<< matchMessage = matchMessage .andCondition(ConditionalOnSingleCandidate.class, spec) .found("a primary bean from beans") .items(Style.QUOTE, matchResult.getNamesOfAllMatches()); ======= matchMessage = matchMessage.andCondition(ConditionalOnSingleCandidate.class, spec) .found("a primary bean from beans").items(Style.QUOTE, matchResult.namesOfAllMatches); >>>>>>> matchMessage = matchMessage.andCondition(ConditionalOnSingleCandidate.class, spec) .found("a primary bean from beans").items(Style.QUOTE, matchResult.getNamesOfAllMatches()); <<<<<<< protected final MatchResult getMatchingBeans(ConditionContext context, BeanSearchSpec beans) { ======= private String createOnBeanNoMatchReason(MatchResult matchResult) { StringBuilder reason = new StringBuilder(); appendMessageForNoMatches(reason, matchResult.unmatchedAnnotations, "annotated with"); appendMessageForNoMatches(reason, matchResult.unmatchedTypes, "of type"); appendMessageForNoMatches(reason, matchResult.unmatchedNames, "named"); return reason.toString(); } private void appendMessageForNoMatches(StringBuilder reason, Collection<String> unmatched, String description) { if (!unmatched.isEmpty()) { if (reason.length() > 0) { reason.append(" and "); } reason.append("did not find any beans "); reason.append(description); reason.append(" "); reason.append(StringUtils.collectionToDelimitedString(unmatched, ", ")); } } private String createOnMissingBeanNoMatchReason(MatchResult matchResult) { StringBuilder reason = new StringBuilder(); appendMessageForMatches(reason, matchResult.matchedAnnotations, "annotated with"); appendMessageForMatches(reason, matchResult.matchedTypes, "of type"); if (!matchResult.matchedNames.isEmpty()) { if (reason.length() > 0) { reason.append(" and "); } reason.append("found beans named "); reason.append(StringUtils.collectionToDelimitedString(matchResult.matchedNames, ", ")); } return reason.toString(); } private void appendMessageForMatches(StringBuilder reason, Map<String, Collection<String>> matches, String description) { if (!matches.isEmpty()) { matches.forEach((key, value) -> { if (reason.length() > 0) { reason.append(" and "); } reason.append("found beans "); reason.append(description); reason.append(" '"); reason.append(key); reason.append("' "); reason.append(StringUtils.collectionToDelimitedString(value, ", ")); }); } } private MatchResult getMatchingBeans(ConditionContext context, BeanSearchSpec beans) { >>>>>>> protected final MatchResult getMatchingBeans(ConditionContext context, BeanSearchSpec beans) { <<<<<<< TypeExtractor typeExtractor = beans.getTypeExtractor(context.getClassLoader()); List<String> beansIgnoredByType = getNamesOfBeansIgnoredByType( beans.getIgnoredTypes(), typeExtractor, beanFactory, context, considerHierarchy); ======= List<String> beansIgnoredByType = getNamesOfBeansIgnoredByType(beans.getIgnoredTypes(), beanFactory, context, considerHierarchy); >>>>>>> TypeExtractor typeExtractor = beans.getTypeExtractor(context.getClassLoader()); List<String> beansIgnoredByType = getNamesOfBeansIgnoredByType(beans.getIgnoredTypes(), typeExtractor, beanFactory, context, considerHierarchy); <<<<<<< Collection<String> typeMatches = getBeanNamesForType(beanFactory, type, typeExtractor, context.getClassLoader(), considerHierarchy); ======= Collection<String> typeMatches = getBeanNamesForType(beanFactory, type, context.getClassLoader(), considerHierarchy); >>>>>>> Collection<String> typeMatches = getBeanNamesForType(beanFactory, type, typeExtractor, context.getClassLoader(), considerHierarchy); <<<<<<< private String[] getBeanNamesForAnnotation( ConfigurableListableBeanFactory beanFactory, String type, ClassLoader classLoader, boolean considerHierarchy) throws LinkageError { Set<String> names = new HashSet<>(); try { @SuppressWarnings("unchecked") Class<? extends Annotation> annotationType = (Class<? extends Annotation>) ClassUtils .forName(type, classLoader); collectBeanNamesForAnnotation(names, beanFactory, annotationType, considerHierarchy); } catch (ClassNotFoundException ex) { // Continue } return StringUtils.toStringArray(names); } private void collectBeanNamesForAnnotation(Set<String> names, ListableBeanFactory beanFactory, Class<? extends Annotation> annotationType, boolean considerHierarchy) { BeanTypeRegistry registry = BeanTypeRegistry.get(beanFactory); names.addAll(registry.getNamesForAnnotation(annotationType)); if (considerHierarchy) { BeanFactory parent = ((HierarchicalBeanFactory) beanFactory) .getParentBeanFactory(); if (parent instanceof ListableBeanFactory) { collectBeanNamesForAnnotation(names, (ListableBeanFactory) parent, annotationType, considerHierarchy); } } } private List<String> getNamesOfBeansIgnoredByType(List<String> ignoredTypes, TypeExtractor typeExtractor, ListableBeanFactory beanFactory, ConditionContext context, boolean considerHierarchy) { ======= private List<String> getNamesOfBeansIgnoredByType(List<String> ignoredTypes, ListableBeanFactory beanFactory, ConditionContext context, boolean considerHierarchy) { >>>>>>> private String[] getBeanNamesForAnnotation(ConfigurableListableBeanFactory beanFactory, String type, ClassLoader classLoader, boolean considerHierarchy) throws LinkageError { Set<String> names = new HashSet<>(); try { @SuppressWarnings("unchecked") Class<? extends Annotation> annotationType = (Class<? extends Annotation>) ClassUtils.forName(type, classLoader); collectBeanNamesForAnnotation(names, beanFactory, annotationType, considerHierarchy); } catch (ClassNotFoundException ex) { // Continue } return StringUtils.toStringArray(names); } private void collectBeanNamesForAnnotation(Set<String> names, ListableBeanFactory beanFactory, Class<? extends Annotation> annotationType, boolean considerHierarchy) { BeanTypeRegistry registry = BeanTypeRegistry.get(beanFactory); names.addAll(registry.getNamesForAnnotation(annotationType)); if (considerHierarchy) { BeanFactory parent = ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory(); if (parent instanceof ListableBeanFactory) { collectBeanNamesForAnnotation(names, (ListableBeanFactory) parent, annotationType, considerHierarchy); } } } private List<String> getNamesOfBeansIgnoredByType(List<String> ignoredTypes, TypeExtractor typeExtractor, ListableBeanFactory beanFactory, ConditionContext context, boolean considerHierarchy) { <<<<<<< beanNames.addAll(getBeanNamesForType(beanFactory, ignoredType, typeExtractor, context.getClassLoader(), considerHierarchy)); ======= beanNames .addAll(getBeanNamesForType(beanFactory, ignoredType, context.getClassLoader(), considerHierarchy)); >>>>>>> beanNames.addAll(getBeanNamesForType(beanFactory, ignoredType, typeExtractor, context.getClassLoader(), considerHierarchy)); <<<<<<< private Collection<String> getBeanNamesForType(ListableBeanFactory beanFactory, boolean considerHierarchy, Class<?> type, TypeExtractor typeExtractor) { Set<String> result = new LinkedHashSet<>(); collectBeanNamesForType(result, beanFactory, type, typeExtractor, considerHierarchy); return result; } private void collectBeanNamesForType(Set<String> result, ListableBeanFactory beanFactory, Class<?> type, TypeExtractor typeExtractor, boolean considerHierarchy) { BeanTypeRegistry registry = BeanTypeRegistry.get(beanFactory); result.addAll(registry.getNamesForType(type, typeExtractor)); ======= private void collectBeanNamesForType(Set<String> result, ListableBeanFactory beanFactory, Class<?> type, boolean considerHierarchy) { result.addAll(BeanTypeRegistry.get(beanFactory).getNamesForType(type)); >>>>>>> private Collection<String> getBeanNamesForType(ListableBeanFactory beanFactory, boolean considerHierarchy, Class<?> type, TypeExtractor typeExtractor) { Set<String> result = new LinkedHashSet<>(); collectBeanNamesForType(result, beanFactory, type, typeExtractor, considerHierarchy); return result; } private void collectBeanNamesForType(Set<String> result, ListableBeanFactory beanFactory, Class<?> type, TypeExtractor typeExtractor, boolean considerHierarchy) { BeanTypeRegistry registry = BeanTypeRegistry.get(beanFactory); result.addAll(registry.getNamesForType(type, typeExtractor)); <<<<<<< public BeanSearchSpec(ConditionContext context, AnnotatedTypeMetadata metadata, Class<?> annotationType) { this(context, metadata, annotationType, null); } public BeanSearchSpec(ConditionContext context, AnnotatedTypeMetadata metadata, Class<?> annotationType, Class<?> genericContainer) { ======= BeanSearchSpec(ConditionContext context, AnnotatedTypeMetadata metadata, Class<?> annotationType) { >>>>>>> public BeanSearchSpec(ConditionContext context, AnnotatedTypeMetadata metadata, Class<?> annotationType) { this(context, metadata, annotationType, null); } public BeanSearchSpec(ConditionContext context, AnnotatedTypeMetadata metadata, Class<?> annotationType, Class<?> genericContainer) { <<<<<<< collect(attributes, "parameterizedContainer", this.parameterizedContainers); this.strategy = (SearchStrategy) attributes.getFirst("search"); ======= this.strategy = (SearchStrategy) metadata.getAnnotationAttributes(annotationType.getName()).get("search"); >>>>>>> collect(attributes, "parameterizedContainer", this.parameterizedContainers); this.strategy = (SearchStrategy) attributes.getFirst("search"); <<<<<<< String message = getAnnotationName() + " did not specify a bean using type, name or annotation"; ======= String message = annotationName() + " did not specify a bean using type, name or annotation"; >>>>>>> String message = getAnnotationName() + " did not specify a bean using type, name or annotation"; <<<<<<< Class<?> returnType = getReturnType(context, metadata); ======= // We should be safe to load at this point since we are in the // REGISTER_BEAN phase Class<?> returnType = ClassUtils.forName(metadata.getReturnTypeName(), context.getClassLoader()); >>>>>>> Class<?> returnType = getReturnType(context, metadata);
<<<<<<< * @see LoggingSystem#get(ClassLoader) ======= * @author Andy Wilkinson >>>>>>> * @author Andy Wilkinson * @see LoggingSystem#get(ClassLoader) <<<<<<< ======= private static Class<?>[] EVENT_TYPES = { ApplicationStartedEvent.class, ApplicationEnvironmentPreparedEvent.class, ContextClosedEvent.class }; private static Class<?>[] SOURCE_TYPES = { SpringApplication.class, ApplicationContext.class }; >>>>>>> private static Class<?>[] EVENT_TYPES = { ApplicationStartedEvent.class, ApplicationEnvironmentPreparedEvent.class, ContextClosedEvent.class }; private static Class<?>[] SOURCE_TYPES = { SpringApplication.class, ApplicationContext.class }; <<<<<<< return ApplicationStartedEvent.class.isAssignableFrom(eventType) || ApplicationEnvironmentPreparedEvent.class.isAssignableFrom(eventType); ======= return isAssignableFrom(eventType, EVENT_TYPES); >>>>>>> return isAssignableFrom(eventType, EVENT_TYPES); <<<<<<< else if (event instanceof ApplicationEnvironmentPreparedEvent) { onApplicationPreparedEvent((ApplicationEnvironmentPreparedEvent) event); ======= else if (event instanceof ApplicationStartedEvent) { if (System.getProperty(PID_KEY) == null) { System.setProperty(PID_KEY, new ApplicationPid().toString()); } LoggingSystem loggingSystem = LoggingSystem.get(ClassUtils .getDefaultClassLoader()); loggingSystem.beforeInitialize(); >>>>>>> else if (event instanceof ApplicationEnvironmentPreparedEvent) { onApplicationPreparedEvent((ApplicationEnvironmentPreparedEvent) event); } else if (event instanceof ContextClosedEvent) { onContextClosedEvent(); } } private void onApplicationStartedEvent(ApplicationStartedEvent event) { this.loggingSystem = LoggingSystem.get(event.getSpringApplication() .getClassLoader()); this.loggingSystem.beforeInitialize(); } private void onApplicationPreparedEvent(ApplicationEnvironmentPreparedEvent event) { if (this.loggingSystem == null) { this.loggingSystem = LoggingSystem.get(event.getSpringApplication() .getClassLoader()); } initialize(event.getEnvironment(), event.getSpringApplication().getClassLoader()); } private void onContextClosedEvent() { if (this.loggingSystem != null) { this.loggingSystem.cleanUp(); } } /** * Initialize the logging system according to preferences expressed through the * {@link Environment} and the classpath. */ protected void initialize(ConfigurableEnvironment environment, ClassLoader classLoader) { if (System.getProperty(PID_KEY) == null) { System.setProperty(PID_KEY, new ApplicationPid().toString()); } initializeEarlyLoggingLevel(environment); initializeSystem(environment, this.loggingSystem); initializeFinalLoggingLevels(environment, this.loggingSystem); } private void initializeEarlyLoggingLevel(ConfigurableEnvironment environment) { if (this.parseArgs && this.springBootLogging == null) { if (environment.containsProperty("debug")) { this.springBootLogging = LogLevel.DEBUG; } if (environment.containsProperty("trace")) { this.springBootLogging = LogLevel.TRACE; } } } private void initializeSystem(ConfigurableEnvironment environment, LoggingSystem system) { LogFile logFile = LogFile.get(environment); String logConfig = environment.getProperty(CONFIG_PROPERTY); if (StringUtils.hasLength(logConfig)) { try { ResourceUtils.getURL(logConfig).openStream().close(); system.initialize(logConfig, logFile); } catch (Exception ex) { this.logger.warn("Logging environment value '" + logConfig + "' cannot be opened and will be ignored " + "(using default location instead)"); system.initialize(null, logFile); }
<<<<<<< void solrIsUp() throws Exception { ======= public void healthWhenSolrStatusUpAndBaseUrlPointsToRootReturnsUp() throws Exception { >>>>>>> void healthWhenSolrStatusUpAndBaseUrlPointsToRootReturnsUp() throws Exception { <<<<<<< void solrIsUpAndRequestFailed() throws Exception { ======= public void healthWhenSolrStatusDownAndBaseUrlPointsToRootReturnsDown() throws Exception { >>>>>>> void healthWhenSolrStatusDownAndBaseUrlPointsToRootReturnsDown() throws Exception { <<<<<<< void solrIsDown() throws Exception { ======= public void healthWhenSolrConnectionFailsReturnsDown() throws Exception { >>>>>>> void healthWhenSolrConnectionFailsReturnsDown() throws Exception {
<<<<<<< ======= // Only available in rabbitmq-java-client 5.4.0 + private static final boolean CAN_ENABLE_HOSTNAME_VERIFICATION = ReflectionUtils .findMethod(com.rabbitmq.client.ConnectionFactory.class, "enableHostnameVerification") != null; >>>>>>> <<<<<<< map.from(ssl::isValidateServerCertificate).to((validate) -> factory .setSkipServerCertificateValidation(!validate)); map.from(ssl::getVerifyHostname) .to(factory::setEnableHostnameVerification); ======= map.from(ssl::isValidateServerCertificate) .to((validate) -> factory.setSkipServerCertificateValidation(!validate)); map.from(ssl::getVerifyHostname).when(Objects::nonNull).to(factory::setEnableHostnameVerification); if (ssl.getVerifyHostname() == null && CAN_ENABLE_HOSTNAME_VERIFICATION) { factory.setEnableHostnameVerification(true); } >>>>>>> map.from(ssl::isValidateServerCertificate) .to((validate) -> factory.setSkipServerCertificateValidation(!validate)); map.from(ssl::getVerifyHostname).to(factory::setEnableHostnameVerification); <<<<<<< public RabbitTemplateConfiguration(RabbitProperties properties, ObjectProvider<MessageConverter> messageConverter, ObjectProvider<RabbitRetryTemplateCustomizer> retryTemplateCustomizers) { ======= public RabbitTemplateConfiguration(ObjectProvider<MessageConverter> messageConverter, RabbitProperties properties) { this.messageConverter = messageConverter; >>>>>>> public RabbitTemplateConfiguration(RabbitProperties properties, ObjectProvider<MessageConverter> messageConverter, ObjectProvider<RabbitRetryTemplateCustomizer> retryTemplateCustomizers) { <<<<<<< ======= private RetryTemplate createRetryTemplate(RabbitProperties.Retry properties) { PropertyMapper map = PropertyMapper.get(); RetryTemplate template = new RetryTemplate(); SimpleRetryPolicy policy = new SimpleRetryPolicy(); map.from(properties::getMaxAttempts).to(policy::setMaxAttempts); template.setRetryPolicy(policy); ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy(); map.from(properties::getInitialInterval).whenNonNull().as(Duration::toMillis) .to(backOffPolicy::setInitialInterval); map.from(properties::getMultiplier).to(backOffPolicy::setMultiplier); map.from(properties::getMaxInterval).whenNonNull().as(Duration::toMillis).to(backOffPolicy::setMaxInterval); template.setBackOffPolicy(backOffPolicy); return template; } >>>>>>>
<<<<<<< import org.junit.jupiter.api.Test; ======= import javax.net.ssl.SSLHandshakeException; import org.junit.Test; >>>>>>> import javax.net.ssl.SSLHandshakeException; import org.junit.jupiter.api.Test;
<<<<<<< public void mergingOfAdditionalProperty() throws Exception { ItemMetadata property = ItemMetadata.newProperty(null, "foo", "java.lang.String", AdditionalMetadata.class.getName(), null, null, null, null); writeAdditionalMetadata(property); ConfigurationMetadata metadata = compile(SimpleProperties.class); assertThat(metadata, containsProperty("simple.comparator")); assertThat(metadata, containsProperty("foo", String.class) .fromSource(AdditionalMetadata.class)); } ======= public void lombokInnerClassProperties() throws Exception { ConfigurationMetadata metadata = compile(LombokInnerClassProperties.class); assertThat(metadata, containsGroup("config").fromSource(LombokInnerClassProperties.class)); assertThat(metadata, containsGroup("config.first").ofType(LombokInnerClassProperties.Foo.class) .fromSource(LombokInnerClassProperties.class)); assertThat(metadata, containsProperty("config.first.name")); assertThat(metadata, containsProperty("config.first.bar.name")); assertThat(metadata, containsGroup("config.second", LombokInnerClassProperties.Foo.class) .fromSource(LombokInnerClassProperties.class)); assertThat(metadata, containsProperty("config.second.name")); assertThat(metadata, containsProperty("config.second.bar.name")); assertThat(metadata, containsGroup("config.third").ofType(SimpleLombokPojo.class) .fromSource(LombokInnerClassProperties.class)); // For some reason the annotation processor resolves a type for SimpleLombokPojo that // is resolved (compiled) and the source annotations are gone. Because we don't see the // @Data annotation anymore, no field is harvested. What is crazy is that a sample project // works fine so this seem to be related to the unit test environment for some reason. //assertThat(metadata, containsProperty("config.third.value")); assertThat(metadata, containsProperty("config.fourth")); assertThat(metadata, not(containsGroup("config.fourth"))); } @Test public void mergingOfAdditionalMetadata() throws Exception { File metaInfFolder = new File(this.compiler.getOutputLocation(), "META-INF"); metaInfFolder.mkdirs(); File additionalMetadataFile = new File(metaInfFolder, "additional-spring-configuration-metadata.json"); additionalMetadataFile.createNewFile(); >>>>>>> public void lombokInnerClassProperties() throws Exception { ConfigurationMetadata metadata = compile(LombokInnerClassProperties.class); assertThat(metadata, containsGroup("config").fromSource(LombokInnerClassProperties.class)); assertThat(metadata, containsGroup("config.first").ofType(LombokInnerClassProperties.Foo.class) .fromSource(LombokInnerClassProperties.class)); assertThat(metadata, containsProperty("config.first.name")); assertThat(metadata, containsProperty("config.first.bar.name")); assertThat(metadata, containsGroup("config.second", LombokInnerClassProperties.Foo.class) .fromSource(LombokInnerClassProperties.class)); assertThat(metadata, containsProperty("config.second.name")); assertThat(metadata, containsProperty("config.second.bar.name")); assertThat(metadata, containsGroup("config.third").ofType(SimpleLombokPojo.class) .fromSource(LombokInnerClassProperties.class)); // For some reason the annotation processor resolves a type for SimpleLombokPojo that // is resolved (compiled) and the source annotations are gone. Because we don't see the // @Data annotation anymore, no field is harvested. What is crazy is that a sample project // works fine so this seem to be related to the unit test environment for some reason. //assertThat(metadata, containsProperty("config.third.value")); assertThat(metadata, containsProperty("config.fourth")); assertThat(metadata, not(containsGroup("config.fourth"))); } @Test public void mergingOfAdditionalProperty() throws Exception { ItemMetadata property = ItemMetadata.newProperty(null, "foo", "java.lang.String", AdditionalMetadata.class.getName(), null, null, null, null); writeAdditionalMetadata(property); ConfigurationMetadata metadata = compile(SimpleProperties.class); assertThat(metadata, containsProperty("simple.comparator")); assertThat(metadata, containsProperty("foo", String.class) .fromSource(AdditionalMetadata.class)); }
<<<<<<< new DisableReferenceClearingContextCustomizer().customize(context); this.tomcatContextCustomizers .forEach((customizer) -> customizer.customize(context)); ======= this.tomcatContextCustomizers.forEach((customizer) -> customizer.customize(context)); >>>>>>> new DisableReferenceClearingContextCustomizer().customize(context); this.tomcatContextCustomizers.forEach((customizer) -> customizer.customize(context));
<<<<<<< public WebEndpointDiscoverer webEndpointDiscoverer( ParameterValueMapper parameterValueMapper, EndpointMediaTypes endpointMediaTypes, ObjectProvider<PathMapper> endpointPathMappers, ObjectProvider<OperationInvokerAdvisor> invokerAdvisors, ObjectProvider<EndpointFilter<ExposableWebEndpoint>> filters) { return new WebEndpointDiscoverer(this.applicationContext, parameterValueMapper, endpointMediaTypes, endpointPathMappers.orderedStream().collect(Collectors.toList()), invokerAdvisors.orderedStream().collect(Collectors.toList()), filters.orderedStream().collect(Collectors.toList())); ======= public WebEndpointDiscoverer webEndpointDiscoverer(ParameterValueMapper parameterValueMapper, EndpointMediaTypes endpointMediaTypes, PathMapper webEndpointPathMapper, ObjectProvider<Collection<OperationInvokerAdvisor>> invokerAdvisors, ObjectProvider<Collection<EndpointFilter<ExposableWebEndpoint>>> filters) { return new WebEndpointDiscoverer(this.applicationContext, parameterValueMapper, endpointMediaTypes, webEndpointPathMapper, invokerAdvisors.getIfAvailable(Collections::emptyList), filters.getIfAvailable(Collections::emptyList)); >>>>>>> public WebEndpointDiscoverer webEndpointDiscoverer(ParameterValueMapper parameterValueMapper, EndpointMediaTypes endpointMediaTypes, ObjectProvider<PathMapper> endpointPathMappers, ObjectProvider<OperationInvokerAdvisor> invokerAdvisors, ObjectProvider<EndpointFilter<ExposableWebEndpoint>> filters) { return new WebEndpointDiscoverer(this.applicationContext, parameterValueMapper, endpointMediaTypes, endpointPathMappers.orderedStream().collect(Collectors.toList()), invokerAdvisors.orderedStream().collect(Collectors.toList()), filters.orderedStream().collect(Collectors.toList())); <<<<<<< public ControllerEndpointDiscoverer controllerEndpointDiscoverer( ObjectProvider<PathMapper> endpointPathMappers, ======= public ControllerEndpointDiscoverer controllerEndpointDiscoverer(PathMapper webEndpointPathMapper, >>>>>>> public ControllerEndpointDiscoverer controllerEndpointDiscoverer(ObjectProvider<PathMapper> endpointPathMappers, <<<<<<< return new ControllerEndpointDiscoverer(this.applicationContext, endpointPathMappers.orderedStream().collect(Collectors.toList()), filters.getIfAvailable(Collections::emptyList)); ======= return new ControllerEndpointDiscoverer(this.applicationContext, webEndpointPathMapper, filters.getIfAvailable(Collections::emptyList)); >>>>>>> return new ControllerEndpointDiscoverer(this.applicationContext, endpointPathMappers.orderedStream().collect(Collectors.toList()), filters.getIfAvailable(Collections::emptyList)); <<<<<<< public ServletEndpointDiscoverer servletEndpointDiscoverer( ApplicationContext applicationContext, ObjectProvider<PathMapper> endpointPathMappers, ObjectProvider<EndpointFilter<ExposableServletEndpoint>> filters) { return new ServletEndpointDiscoverer(applicationContext, endpointPathMappers.orderedStream().collect(Collectors.toList()), filters.orderedStream().collect(Collectors.toList())); ======= public ServletEndpointDiscoverer servletEndpointDiscoverer(ApplicationContext applicationContext, PathMapper webEndpointPathMapper, ObjectProvider<Collection<EndpointFilter<ExposableServletEndpoint>>> filters) { return new ServletEndpointDiscoverer(applicationContext, webEndpointPathMapper, filters.getIfAvailable(Collections::emptyList)); >>>>>>> public ServletEndpointDiscoverer servletEndpointDiscoverer(ApplicationContext applicationContext, ObjectProvider<PathMapper> endpointPathMappers, ObjectProvider<EndpointFilter<ExposableServletEndpoint>> filters) { return new ServletEndpointDiscoverer(applicationContext, endpointPathMappers.orderedStream().collect(Collectors.toList()), filters.orderedStream().collect(Collectors.toList()));
<<<<<<< * Copyright 2012-2018 the original author or authors. ======= * Copyright 2012-2019 the original author or authors. >>>>>>> * Copyright 2012-2019 the original author or authors. <<<<<<< Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")) .withException(ex).build(); assertThat(health.getDetails()).containsOnly(entry("a", "b"), entry("error", "java.lang.RuntimeException: bang")); ======= Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")).withException(ex).build(); assertThat(health.getDetails().get("a")).isEqualTo("b"); assertThat(health.getDetails().get("error")).isEqualTo("java.lang.RuntimeException: bang"); >>>>>>> Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")).withException(ex).build(); assertThat(health.getDetails()).containsOnly(entry("a", "b"), entry("error", "java.lang.RuntimeException: bang")); <<<<<<< Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")) .withDetail("c", "d").build(); assertThat(health.getDetails()).containsOnly(entry("a", "b"), entry("c", "d")); } @Test public void withDetailsMap() { Map<String, Object> details = new LinkedHashMap<>(); details.put("a", "b"); details.put("c", "d"); Health health = Health.up().withDetails(details).build(); assertThat(health.getDetails()).containsOnly(entry("a", "b"), entry("c", "d")); } @Test public void withDetailsMapDuplicateKeys() { Map<String, Object> details = new LinkedHashMap<>(); details.put("c", "d"); details.put("a", "e"); Health health = Health.up().withDetail("a", "b").withDetails(details).build(); assertThat(health.getDetails()).containsOnly(entry("a", "e"), entry("c", "d")); } @Test public void withDetailsMultipleMaps() { Map<String, Object> details1 = new LinkedHashMap<>(); details1.put("a", "b"); details1.put("c", "d"); Map<String, Object> details2 = new LinkedHashMap<>(); details1.put("a", "e"); details1.put("1", "2"); Health health = Health.up().withDetails(details1).withDetails(details2).build(); assertThat(health.getDetails()).containsOnly(entry("a", "e"), entry("c", "d"), entry("1", "2")); ======= Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")).withDetail("c", "d").build(); assertThat(health.getDetails().get("a")).isEqualTo("b"); assertThat(health.getDetails().get("c")).isEqualTo("d"); >>>>>>> Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")).withDetail("c", "d").build(); assertThat(health.getDetails()).containsOnly(entry("a", "b"), entry("c", "d")); } @Test public void withDetailsMap() { Map<String, Object> details = new LinkedHashMap<>(); details.put("a", "b"); details.put("c", "d"); Health health = Health.up().withDetails(details).build(); assertThat(health.getDetails()).containsOnly(entry("a", "b"), entry("c", "d")); } @Test public void withDetailsMapDuplicateKeys() { Map<String, Object> details = new LinkedHashMap<>(); details.put("c", "d"); details.put("a", "e"); Health health = Health.up().withDetail("a", "b").withDetails(details).build(); assertThat(health.getDetails()).containsOnly(entry("a", "e"), entry("c", "d")); } @Test public void withDetailsMultipleMaps() { Map<String, Object> details1 = new LinkedHashMap<>(); details1.put("a", "b"); details1.put("c", "d"); Map<String, Object> details2 = new LinkedHashMap<>(); details1.put("a", "e"); details1.put("1", "2"); Health health = Health.up().withDetails(details1).withDetails(details2).build(); assertThat(health.getDetails()).containsOnly(entry("a", "e"), entry("c", "d"), entry("1", "2")); <<<<<<< assertThat(health.getDetails()) .containsOnly(entry("error", "java.lang.RuntimeException: bang")); ======= assertThat(health.getDetails().get("error")).isEqualTo("java.lang.RuntimeException: bang"); >>>>>>> assertThat(health.getDetails()).containsOnly(entry("error", "java.lang.RuntimeException: bang"));
<<<<<<< ======= beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(1, beanName); >>>>>>> <<<<<<< ======= definition.setFactoryBeanName(BEAN_NAME); definition.setFactoryMethodName("createMock"); definition.getConstructorArgumentValues().addIndexedArgumentValue(0, mockDefinition); >>>>>>> <<<<<<< private String getBeanName(ConfigurableListableBeanFactory beanFactory, BeanDefinitionRegistry registry, MockDefinition mockDefinition, RootBeanDefinition beanDefinition) { ======= /** * Factory method used by defined beans to actually create the mock. * @param mockDefinition the mock definition * @param name the bean name * @return the mock instance */ protected final Object createMock(MockDefinition mockDefinition, String name) { return mockDefinition.createMock(name + " bean"); } private String getBeanName(ConfigurableListableBeanFactory beanFactory, BeanDefinitionRegistry registry, MockDefinition mockDefinition, RootBeanDefinition beanDefinition) { >>>>>>> private String getBeanName(ConfigurableListableBeanFactory beanFactory, BeanDefinitionRegistry registry, MockDefinition mockDefinition, RootBeanDefinition beanDefinition) { <<<<<<< private Set<String> getExistingBeans(ConfigurableListableBeanFactory beanFactory, ResolvableType type, QualifierDefinition qualifier) { ======= private Set<String> findCandidateBeans(ConfigurableListableBeanFactory beanFactory, MockDefinition mockDefinition) { QualifierDefinition qualifier = mockDefinition.getQualifier(); >>>>>>> private Set<String> getExistingBeans(ConfigurableListableBeanFactory beanFactory, ResolvableType type, QualifierDefinition qualifier) { <<<<<<< for (String candidate : getExistingBeans(beanFactory, type)) { ======= for (String candidate : getExistingBeans(beanFactory, mockDefinition.getTypeToMock())) { >>>>>>> for (String candidate : getExistingBeans(beanFactory, type)) { <<<<<<< private Set<String> getExistingBeans(ConfigurableListableBeanFactory beanFactory, ResolvableType type) { Set<String> beans = new LinkedHashSet<>( Arrays.asList(beanFactory.getBeanNamesForType(type))); String typeName = type.resolve(Object.class).getName(); ======= private String[] getExistingBeans(ConfigurableListableBeanFactory beanFactory, ResolvableType type) { Set<String> beans = new LinkedHashSet<>(Arrays.asList(beanFactory.getBeanNamesForType(type))); String resolvedTypeName = type.resolve(Object.class).getName(); >>>>>>> private Set<String> getExistingBeans(ConfigurableListableBeanFactory beanFactory, ResolvableType type) { Set<String> beans = new LinkedHashSet<>(Arrays.asList(beanFactory.getBeanNamesForType(type))); String typeName = type.resolve(Object.class).getName(); <<<<<<< if (typeName.equals(beanDefinition.getAttribute(FACTORY_BEAN_OBJECT_TYPE))) { ======= if (resolvedTypeName.equals(beanDefinition.getAttribute(FACTORY_BEAN_OBJECT_TYPE))) { >>>>>>> if (typeName.equals(beanDefinition.getAttribute(FACTORY_BEAN_OBJECT_TYPE))) { <<<<<<< private void createSpy(BeanDefinitionRegistry registry, SpyDefinition spyDefinition, Field field) { RootBeanDefinition beanDefinition = new RootBeanDefinition( spyDefinition.getTypeToSpy().resolve()); String beanName = MockitoPostProcessor.beanNameGenerator .generateBeanName(beanDefinition, registry); ======= private void createSpy(BeanDefinitionRegistry registry, SpyDefinition definition, Field field) { RootBeanDefinition beanDefinition = new RootBeanDefinition(definition.getTypeToSpy().resolve()); String beanName = this.beanNameGenerator.generateBeanName(beanDefinition, registry); >>>>>>> private void createSpy(BeanDefinitionRegistry registry, SpyDefinition spyDefinition, Field field) { RootBeanDefinition beanDefinition = new RootBeanDefinition(spyDefinition.getTypeToSpy().resolve()); String beanName = MockitoPostProcessor.beanNameGenerator.generateBeanName(beanDefinition, registry); <<<<<<< throw new IllegalStateException( "Unable to register spy bean " + spyDefinition.getTypeToSpy(), ex); ======= throw new IllegalStateException("Unable to register spy bean " + definition.getTypeToSpy(), ex); >>>>>>> throw new IllegalStateException("Unable to register spy bean " + spyDefinition.getTypeToSpy(), ex); <<<<<<< private String determinePrimaryCandidate(BeanDefinitionRegistry registry, Collection<String> candidateBeanNames, ResolvableType type) { ======= private String determinePrimaryCandidate(BeanDefinitionRegistry registry, String[] candidateBeanNames, ResolvableType type) { >>>>>>> private String determinePrimaryCandidate(BeanDefinitionRegistry registry, Collection<String> candidateBeanNames, ResolvableType type) { <<<<<<< throw new NoUniqueBeanDefinitionException(type.resolve(), candidateBeanNames.size(), ======= throw new NoUniqueBeanDefinitionException(type.resolve(), candidateBeanNames.length, >>>>>>> throw new NoUniqueBeanDefinitionException(type.resolve(), candidateBeanNames.size(), <<<<<<< protected final Object createSpyIfNecessary(Object bean, String beanName) throws BeansException { ======= protected Object createSpyIfNecessary(Object bean, String beanName) throws BeansException { >>>>>>> protected final Object createSpyIfNecessary(Object bean, String beanName) throws BeansException { <<<<<<< public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException { return this.mockitoPostProcessor.createSpyIfNecessary(bean, beanName); ======= public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException { return createSpyIfNecessary(bean, beanName); >>>>>>> public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException { return this.mockitoPostProcessor.createSpyIfNecessary(bean, beanName);
<<<<<<< * Copyright 2012-2018 the original author or authors. ======= * Copyright 2012-2019 the original author or authors. >>>>>>> * Copyright 2012-2019 the original author or authors. <<<<<<< .withClassLoader(new FilteredClassLoader(EmbeddedDriver.class)) .withUserConfiguration(TestConfiguration.class) .withConfiguration(AutoConfigurations.of(Neo4jDataAutoConfiguration.class, TransactionAutoConfiguration.class)); ======= .withUserConfiguration(TestConfiguration.class).withConfiguration( AutoConfigurations.of(Neo4jDataAutoConfiguration.class, TransactionAutoConfiguration.class)); >>>>>>> .withClassLoader(new FilteredClassLoader(EmbeddedDriver.class)) .withUserConfiguration(TestConfiguration.class).withConfiguration( AutoConfigurations.of(Neo4jDataAutoConfiguration.class, TransactionAutoConfiguration.class)); <<<<<<< this.contextRunner .withPropertyValues("spring.data.neo4j.uri=http://localhost:8989") .run((context) -> { assertThat(context) .hasSingleBean(org.neo4j.ogm.config.Configuration.class); assertThat(context).hasSingleBean(SessionFactory.class); assertThat(context).hasSingleBean(Neo4jTransactionManager.class); assertThat(context).hasSingleBean(OpenSessionInViewInterceptor.class); assertThat(context).doesNotHaveBean(BookmarkManager.class); }); ======= this.contextRunner.withPropertyValues("spring.data.neo4j.uri=http://localhost:8989").run((context) -> { assertThat(context).hasSingleBean(org.neo4j.ogm.config.Configuration.class); assertThat(context).hasSingleBean(SessionFactory.class); assertThat(context).hasSingleBean(Neo4jTransactionManager.class); assertThat(context).hasSingleBean(OpenSessionInViewInterceptor.class); }); >>>>>>> this.contextRunner.withPropertyValues("spring.data.neo4j.uri=http://localhost:8989").run((context) -> { assertThat(context).hasSingleBean(org.neo4j.ogm.config.Configuration.class); assertThat(context).hasSingleBean(SessionFactory.class); assertThat(context).hasSingleBean(Neo4jTransactionManager.class); assertThat(context).hasSingleBean(OpenSessionInViewInterceptor.class); assertThat(context).doesNotHaveBean(BookmarkManager.class); }); <<<<<<< @Test public void providesARequestScopedBookmarkManagerIfNecessaryAndPossible() { this.contextRunner .withUserConfiguration(BookmarkManagementEnabledConfiguration.class) .run((context) -> { BeanDefinition bookmarkManagerBean = context.getBeanFactory() .getBeanDefinition("scopedTarget.bookmarkManager"); assertThat(bookmarkManagerBean.getScope()) .isEqualTo(WebApplicationContext.SCOPE_REQUEST); }); } @Test public void providesASingletonScopedBookmarkManagerIfNecessaryAndPossible() { new ApplicationContextRunner() .withClassLoader(new FilteredClassLoader(EmbeddedDriver.class)) .withUserConfiguration(TestConfiguration.class, BookmarkManagementEnabledConfiguration.class) .withConfiguration(AutoConfigurations.of(Neo4jDataAutoConfiguration.class, TransactionAutoConfiguration.class)) .run((context) -> { assertThat(context).hasSingleBean(BookmarkManager.class); assertThat(context.getBeanDefinitionNames()) .doesNotContain("scopedTarget.bookmarkManager"); }); } @Test public void doesNotProvideABookmarkManagerIfNotPossible() { this.contextRunner .withClassLoader( new FilteredClassLoader(Caffeine.class, EmbeddedDriver.class)) .withUserConfiguration(BookmarkManagementEnabledConfiguration.class) .run((context) -> assertThat(context) .doesNotHaveBean(BookmarkManager.class)); } private static void assertDomainTypesDiscovered(Neo4jMappingContext mappingContext, Class<?>... types) { ======= private static void assertDomainTypesDiscovered(Neo4jMappingContext mappingContext, Class<?>... types) { >>>>>>> @Test public void providesARequestScopedBookmarkManagerIfNecessaryAndPossible() { this.contextRunner.withUserConfiguration(BookmarkManagementEnabledConfiguration.class).run((context) -> { BeanDefinition bookmarkManagerBean = context.getBeanFactory() .getBeanDefinition("scopedTarget.bookmarkManager"); assertThat(bookmarkManagerBean.getScope()).isEqualTo(WebApplicationContext.SCOPE_REQUEST); }); } @Test public void providesASingletonScopedBookmarkManagerIfNecessaryAndPossible() { new ApplicationContextRunner().withClassLoader(new FilteredClassLoader(EmbeddedDriver.class)) .withUserConfiguration(TestConfiguration.class, BookmarkManagementEnabledConfiguration.class) .withConfiguration( AutoConfigurations.of(Neo4jDataAutoConfiguration.class, TransactionAutoConfiguration.class)) .run((context) -> { assertThat(context).hasSingleBean(BookmarkManager.class); assertThat(context.getBeanDefinitionNames()).doesNotContain("scopedTarget.bookmarkManager"); }); } @Test public void doesNotProvideABookmarkManagerIfNotPossible() { this.contextRunner.withClassLoader(new FilteredClassLoader(Caffeine.class, EmbeddedDriver.class)) .withUserConfiguration(BookmarkManagementEnabledConfiguration.class) .run((context) -> assertThat(context).doesNotHaveBean(BookmarkManager.class)); } private static void assertDomainTypesDiscovered(Neo4jMappingContext mappingContext, Class<?>... types) {
<<<<<<< * Copyright 2012-2018 the original author or authors. ======= * Copyright 2012-2019 the original author or authors. >>>>>>> * Copyright 2012-2019 the original author or authors. <<<<<<< given(this.one.health()) .willReturn(new Health.Builder().unknown().withDetail("1", "1").build()); given(this.two.health()) .willReturn(new Health.Builder().unknown().withDetail("2", "2").build()); ======= given(this.one.health()).willReturn(new Health.Builder().unknown().withDetail("1", "1").build()); given(this.two.health()).willReturn(new Health.Builder().unknown().withDetail("2", "2").build()); given(this.three.health()).willReturn(new Health.Builder().unknown().withDetail("3", "3").build()); >>>>>>> given(this.one.health()).willReturn(new Health.Builder().unknown().withDetail("1", "1").build()); given(this.two.health()).willReturn(new Health.Builder().unknown().withDetail("2", "2").build()); <<<<<<< ======= public void createWithIndicatorsAndAdd() { Map<String, HealthIndicator> indicators = new HashMap<>(); indicators.put("one", this.one); indicators.put("two", this.two); CompositeHealthIndicator composite = new CompositeHealthIndicator(this.healthAggregator, indicators); composite.addHealthIndicator("three", this.three); Health result = composite.health(); assertThat(result.getDetails()).hasSize(3); assertThat(result.getDetails()).containsEntry("one", new Health.Builder().unknown().withDetail("1", "1").build()); assertThat(result.getDetails()).containsEntry("two", new Health.Builder().unknown().withDetail("2", "2").build()); assertThat(result.getDetails()).containsEntry("three", new Health.Builder().unknown().withDetail("3", "3").build()); } @Test public void createWithoutAndAdd() { CompositeHealthIndicator composite = new CompositeHealthIndicator(this.healthAggregator); composite.addHealthIndicator("one", this.one); composite.addHealthIndicator("two", this.two); Health result = composite.health(); assertThat(result.getDetails().size()).isEqualTo(2); assertThat(result.getDetails()).containsEntry("one", new Health.Builder().unknown().withDetail("1", "1").build()); assertThat(result.getDetails()).containsEntry("two", new Health.Builder().unknown().withDetail("2", "2").build()); } @Test >>>>>>> <<<<<<< CompositeHealthIndicator innerComposite = new CompositeHealthIndicator( this.healthAggregator, indicators); CompositeHealthIndicator composite = new CompositeHealthIndicator( this.healthAggregator, Collections.singletonMap("db", innerComposite)); ======= CompositeHealthIndicator innerComposite = new CompositeHealthIndicator(this.healthAggregator, indicators); CompositeHealthIndicator composite = new CompositeHealthIndicator(this.healthAggregator); composite.addHealthIndicator("db", innerComposite); >>>>>>> CompositeHealthIndicator innerComposite = new CompositeHealthIndicator(this.healthAggregator, indicators); CompositeHealthIndicator composite = new CompositeHealthIndicator(this.healthAggregator, Collections.singletonMap("db", innerComposite));
<<<<<<< void testManagementAuthorizedAccess() { BasicAuthenticationInterceptor basicAuthInterceptor = new BasicAuthenticationInterceptor( "admin", "admin"); ======= public void testManagementAuthorizedAccess() { BasicAuthenticationInterceptor basicAuthInterceptor = new BasicAuthenticationInterceptor("admin", "admin"); >>>>>>> void testManagementAuthorizedAccess() { BasicAuthenticationInterceptor basicAuthInterceptor = new BasicAuthenticationInterceptor("admin", "admin");
<<<<<<< propertyMapper.from(this::determineMaxHttpHeaderSize).whenNonNull() .asInt(DataSize::toBytes).when(this::isPositive) .to((maxHttpHeaderSize) -> customizeMaxHttpHeaderSize(factory, maxHttpHeaderSize)); propertyMapper.from(tomcatProperties::getMaxSwallowSize).whenNonNull() .asInt(DataSize::toBytes) .to((maxSwallowSize) -> customizeMaxSwallowSize(factory, maxSwallowSize)); propertyMapper.from(tomcatProperties::getMaxHttpPostSize).asInt(DataSize::toBytes) .when((maxHttpPostSize) -> maxHttpPostSize != 0) .to((maxHttpPostSize) -> customizeMaxHttpPostSize(factory, maxHttpPostSize)); propertyMapper.from(tomcatProperties::getAccesslog) .when(ServerProperties.Tomcat.Accesslog::isEnabled) ======= propertyMapper.from(() -> determineMaxHttpHeaderSize()).when(this::isPositive) .to((maxHttpHeaderSize) -> customizeMaxHttpHeaderSize(factory, maxHttpHeaderSize)); propertyMapper.from(tomcatProperties::getMaxHttpPostSize).when((maxHttpPostSize) -> maxHttpPostSize != 0) .to((maxHttpPostSize) -> customizeMaxHttpPostSize(factory, maxHttpPostSize)); propertyMapper.from(tomcatProperties::getAccesslog).when(ServerProperties.Tomcat.Accesslog::isEnabled) >>>>>>> propertyMapper.from(this::determineMaxHttpHeaderSize).whenNonNull().asInt(DataSize::toBytes) .when(this::isPositive) .to((maxHttpHeaderSize) -> customizeMaxHttpHeaderSize(factory, maxHttpHeaderSize)); propertyMapper.from(tomcatProperties::getMaxSwallowSize).whenNonNull().asInt(DataSize::toBytes) .to((maxSwallowSize) -> customizeMaxSwallowSize(factory, maxSwallowSize)); propertyMapper.from(tomcatProperties::getMaxHttpPostSize).asInt(DataSize::toBytes) .when((maxHttpPostSize) -> maxHttpPostSize != 0) .to((maxHttpPostSize) -> customizeMaxHttpPostSize(factory, maxHttpPostSize)); propertyMapper.from(tomcatProperties::getAccesslog).when(ServerProperties.Tomcat.Accesslog::isEnabled) <<<<<<< @SuppressWarnings("deprecation") private DataSize determineMaxHttpHeaderSize() { return (this.serverProperties.getTomcat().getMaxHttpHeaderSize().toBytes() > 0) ? this.serverProperties.getTomcat().getMaxHttpHeaderSize() : this.serverProperties.getMaxHttpHeaderSize(); ======= private int determineMaxHttpHeaderSize() { return (this.serverProperties.getMaxHttpHeaderSize() > 0) ? this.serverProperties.getMaxHttpHeaderSize() : this.serverProperties.getTomcat().getMaxHttpHeaderSize(); >>>>>>> @SuppressWarnings("deprecation") private DataSize determineMaxHttpHeaderSize() { return (this.serverProperties.getTomcat().getMaxHttpHeaderSize().toBytes() > 0) ? this.serverProperties.getTomcat().getMaxHttpHeaderSize() : this.serverProperties.getMaxHttpHeaderSize(); <<<<<<< private void customizeMaxSwallowSize(ConfigurableTomcatWebServerFactory factory, int maxSwallowSize) { factory.addConnectorCustomizers((connector) -> { ProtocolHandler handler = connector.getProtocolHandler(); if (handler instanceof AbstractHttp11Protocol) { AbstractHttp11Protocol<?> protocol = (AbstractHttp11Protocol<?>) handler; protocol.setMaxSwallowSize(maxSwallowSize); } }); } private void customizeMaxHttpPostSize(ConfigurableTomcatWebServerFactory factory, int maxHttpPostSize) { factory.addConnectorCustomizers( (connector) -> connector.setMaxPostSize(maxHttpPostSize)); ======= private void customizeMaxHttpPostSize(ConfigurableTomcatWebServerFactory factory, int maxHttpPostSize) { factory.addConnectorCustomizers((connector) -> connector.setMaxPostSize(maxHttpPostSize)); >>>>>>> private void customizeMaxSwallowSize(ConfigurableTomcatWebServerFactory factory, int maxSwallowSize) { factory.addConnectorCustomizers((connector) -> { ProtocolHandler handler = connector.getProtocolHandler(); if (handler instanceof AbstractHttp11Protocol) { AbstractHttp11Protocol<?> protocol = (AbstractHttp11Protocol<?>) handler; protocol.setMaxSwallowSize(maxSwallowSize); } }); } private void customizeMaxHttpPostSize(ConfigurableTomcatWebServerFactory factory, int maxHttpPostSize) { factory.addConnectorCustomizers((connector) -> connector.setMaxPostSize(maxHttpPostSize)); <<<<<<< ServerProperties.Tomcat.Resource resource = this.serverProperties.getTomcat() .getResource(); ======= ServerProperties.Tomcat.Resource resource = this.serverProperties.getTomcat().getResource(); if (resource.getCacheTtl() == null) { return; } >>>>>>> ServerProperties.Tomcat.Resource resource = this.serverProperties.getTomcat().getResource();
<<<<<<< static class Example { ======= @Test public void bindWhenUsingNoUnboundElementsHandlerShouldBindIfUnboundNestedCollectionProperties() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("example.nested[0].string-value", "bar"); MockConfigurationPropertySource source2 = new MockConfigurationPropertySource(); source2.put("example.nested[0].string-value", "bar"); source2.put("example.nested[0].int-value", "2"); source2.put("example.nested[1].string-value", "baz"); source2.put("example.nested[1].other-nested.baz", "baz"); this.sources.add(source1); this.sources.add(source2); this.binder = new Binder(this.sources); NoUnboundElementsBindHandler handler = new NoUnboundElementsBindHandler(); ExampleWithNestedList bound = this.binder.bind("example", Bindable.of(ExampleWithNestedList.class), handler) .get(); assertThat(bound.getNested().get(0).getStringValue()).isEqualTo("bar"); } @Test public void bindWhenUsingNoUnboundElementsHandlerAndUnboundCollectionElementsWithInvalidPropertyShouldThrowException() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("example.nested[0].string-value", "bar"); MockConfigurationPropertySource source2 = new MockConfigurationPropertySource(); source2.put("example.nested[0].string-value", "bar"); source2.put("example.nested[1].int-value", "1"); source2.put("example.nested[1].invalid", "baz"); this.sources.add(source1); this.sources.add(source2); this.binder = new Binder(this.sources); assertThatExceptionOfType(BindException.class) .isThrownBy(() -> this.binder.bind("example", Bindable.of(ExampleWithNestedList.class), new NoUnboundElementsBindHandler())) .satisfies((ex) -> assertThat(ex.getCause().getMessage()) .contains("The elements [example.nested[1].invalid] were left unbound")); } public static class Example { >>>>>>> @Test void bindWhenUsingNoUnboundElementsHandlerShouldBindIfUnboundNestedCollectionProperties() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("example.nested[0].string-value", "bar"); MockConfigurationPropertySource source2 = new MockConfigurationPropertySource(); source2.put("example.nested[0].string-value", "bar"); source2.put("example.nested[0].int-value", "2"); source2.put("example.nested[1].string-value", "baz"); source2.put("example.nested[1].other-nested.baz", "baz"); this.sources.add(source1); this.sources.add(source2); this.binder = new Binder(this.sources); NoUnboundElementsBindHandler handler = new NoUnboundElementsBindHandler(); ExampleWithNestedList bound = this.binder.bind("example", Bindable.of(ExampleWithNestedList.class), handler) .get(); assertThat(bound.getNested().get(0).getStringValue()).isEqualTo("bar"); } @Test void bindWhenUsingNoUnboundElementsHandlerAndUnboundCollectionElementsWithInvalidPropertyShouldThrowException() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("example.nested[0].string-value", "bar"); MockConfigurationPropertySource source2 = new MockConfigurationPropertySource(); source2.put("example.nested[0].string-value", "bar"); source2.put("example.nested[1].int-value", "1"); source2.put("example.nested[1].invalid", "baz"); this.sources.add(source1); this.sources.add(source2); this.binder = new Binder(this.sources); assertThatExceptionOfType(BindException.class) .isThrownBy(() -> this.binder.bind("example", Bindable.of(ExampleWithNestedList.class), new NoUnboundElementsBindHandler())) .satisfies((ex) -> assertThat(ex.getCause().getMessage()) .contains("The elements [example.nested[1].invalid] were left unbound")); } static class Example {
<<<<<<< this.contextRunner.withUserConfiguration(BuilderCustomizerConfiguration.class) .run((context) -> { assertThat(context).hasSingleBean(RestClient.class); RestClient restClient = context.getBean(RestClient.class); assertThat(restClient).hasFieldOrPropertyWithValue("pathPrefix", "/test"); }); } @Test public void configureWithNoTimeoutsApplyDefaults() { this.contextRunner.run((context) -> { assertThat(context).hasSingleBean(RestClient.class); RestClient restClient = context.getBean(RestClient.class); assertTimeouts(restClient, Duration.ofMillis(RestClientBuilder.DEFAULT_CONNECT_TIMEOUT_MILLIS), Duration.ofMillis(RestClientBuilder.DEFAULT_SOCKET_TIMEOUT_MILLIS)); }); } @Test public void configureWithCustomTimeouts() { this.contextRunner .withPropertyValues("spring.elasticsearch.rest.connection-timeout=15s", "spring.elasticsearch.rest.read-timeout=1m") .run((context) -> { assertThat(context).hasSingleBean(RestClient.class); RestClient restClient = context.getBean(RestClient.class); assertTimeouts(restClient, Duration.ofSeconds(15), Duration.ofMinutes(1)); }); ======= this.contextRunner.withUserConfiguration(BuilderCustomizerConfiguration.class).run((context) -> { assertThat(context).hasSingleBean(RestClient.class); RestClient restClient = context.getBean(RestClient.class); Field field = ReflectionUtils.findField(RestClient.class, "maxRetryTimeoutMillis"); ReflectionUtils.makeAccessible(field); assertThat(ReflectionUtils.getField(field, restClient)).isEqualTo(42L); }); >>>>>>> this.contextRunner.withUserConfiguration(BuilderCustomizerConfiguration.class).run((context) -> { assertThat(context).hasSingleBean(RestClient.class); RestClient restClient = context.getBean(RestClient.class); assertThat(restClient).hasFieldOrPropertyWithValue("pathPrefix", "/test"); }); } @Test public void configureWithNoTimeoutsApplyDefaults() { this.contextRunner.run((context) -> { assertThat(context).hasSingleBean(RestClient.class); RestClient restClient = context.getBean(RestClient.class); assertTimeouts(restClient, Duration.ofMillis(RestClientBuilder.DEFAULT_CONNECT_TIMEOUT_MILLIS), Duration.ofMillis(RestClientBuilder.DEFAULT_SOCKET_TIMEOUT_MILLIS)); }); } @Test public void configureWithCustomTimeouts() { this.contextRunner.withPropertyValues("spring.elasticsearch.rest.connection-timeout=15s", "spring.elasticsearch.rest.read-timeout=1m").run((context) -> { assertThat(context).hasSingleBean(RestClient.class); RestClient restClient = context.getBean(RestClient.class); assertTimeouts(restClient, Duration.ofSeconds(15), Duration.ofMinutes(1)); }); <<<<<<< assertThat(client.get(getRequest, RequestOptions.DEFAULT).isExists()) .isTrue(); }); ======= assertThat(client.get(getRequest, RequestOptions.DEFAULT).isExists()).isTrue(); })); >>>>>>> assertThat(client.get(getRequest, RequestOptions.DEFAULT).isExists()).isTrue(); });
<<<<<<< ======= JCacheCacheConfiguration(CacheProperties cacheProperties, CacheManagerCustomizers customizers, ObjectProvider<javax.cache.configuration.Configuration<?, ?>> defaultCacheConfiguration, ObjectProvider<JCacheManagerCustomizer> cacheManagerCustomizers, ObjectProvider<JCachePropertiesCustomizer> cachePropertiesCustomizers) { this.cacheProperties = cacheProperties; this.customizers = customizers; this.defaultCacheConfiguration = defaultCacheConfiguration.getIfAvailable(); this.cacheManagerCustomizers = cacheManagerCustomizers; this.cachePropertiesCustomizers = cachePropertiesCustomizers; } >>>>>>> <<<<<<< private CacheManager createCacheManager(CacheProperties cacheProperties, ObjectProvider<JCachePropertiesCustomizer> cachePropertiesCustomizers) throws IOException { CachingProvider cachingProvider = getCachingProvider( cacheProperties.getJcache().getProvider()); Properties properties = createCacheManagerProperties(cachePropertiesCustomizers, cacheProperties); Resource configLocation = cacheProperties .resolveConfigLocation(cacheProperties.getJcache().getConfig()); ======= private CacheManager createCacheManager() throws IOException { CachingProvider cachingProvider = getCachingProvider(this.cacheProperties.getJcache().getProvider()); Properties properties = createCacheManagerProperties(); Resource configLocation = this.cacheProperties .resolveConfigLocation(this.cacheProperties.getJcache().getConfig()); >>>>>>> private CacheManager createCacheManager(CacheProperties cacheProperties, ObjectProvider<JCachePropertiesCustomizer> cachePropertiesCustomizers) throws IOException { CachingProvider cachingProvider = getCachingProvider(cacheProperties.getJcache().getProvider()); Properties properties = createCacheManagerProperties(cachePropertiesCustomizers, cacheProperties); Resource configLocation = cacheProperties.resolveConfigLocation(cacheProperties.getJcache().getConfig()); <<<<<<< cachePropertiesCustomizers.orderedStream().forEach( (customizer) -> customizer.customize(cacheProperties, properties)); ======= this.cachePropertiesCustomizers.orderedStream() .forEach((customizer) -> customizer.customize(this.cacheProperties, properties)); >>>>>>> cachePropertiesCustomizers.orderedStream() .forEach((customizer) -> customizer.customize(cacheProperties, properties)); <<<<<<< ======= private javax.cache.configuration.Configuration<?, ?> getDefaultCacheConfiguration() { if (this.defaultCacheConfiguration != null) { return this.defaultCacheConfiguration; } return new MutableConfiguration<>(); } private void customize(CacheManager cacheManager) { this.cacheManagerCustomizers.orderedStream().forEach((customizer) -> customizer.customize(cacheManager)); } >>>>>>>
<<<<<<< ======= private final ThymeleafProperties properties; private final Collection<ITemplateResolver> templateResolvers; private final ObjectProvider<IDialect> dialects; public ThymeleafDefaultConfiguration(ThymeleafProperties properties, Collection<ITemplateResolver> templateResolvers, ObjectProvider<IDialect> dialectsProvider) { this.properties = properties; this.templateResolvers = templateResolvers; this.dialects = dialectsProvider; } >>>>>>> <<<<<<< engine.setEnableSpringELCompiler(properties.isEnableSpringElCompiler()); engine.setRenderHiddenMarkersBeforeCheckboxes( properties.isRenderHiddenMarkersBeforeCheckboxes()); templateResolvers.orderedStream().forEach(engine::addTemplateResolver); dialects.orderedStream().forEach(engine::addDialect); ======= engine.setEnableSpringELCompiler(this.properties.isEnableSpringElCompiler()); engine.setRenderHiddenMarkersBeforeCheckboxes(this.properties.isRenderHiddenMarkersBeforeCheckboxes()); this.templateResolvers.forEach(engine::addTemplateResolver); this.dialects.orderedStream().forEach(engine::addDialect); >>>>>>> engine.setEnableSpringELCompiler(properties.isEnableSpringElCompiler()); engine.setRenderHiddenMarkersBeforeCheckboxes(properties.isRenderHiddenMarkersBeforeCheckboxes()); templateResolvers.orderedStream().forEach(engine::addTemplateResolver); dialects.orderedStream().forEach(engine::addDialect); <<<<<<< ======= private final ThymeleafProperties properties; private final SpringTemplateEngine templateEngine; ThymeleafViewResolverConfiguration(ThymeleafProperties properties, SpringTemplateEngine templateEngine) { this.properties = properties; this.templateEngine = templateEngine; } >>>>>>> <<<<<<< appendCharset(properties.getServlet().getContentType(), resolver.getCharacterEncoding())); resolver.setProducePartialOutputWhileProcessing( properties.getServlet().isProducePartialOutputWhileProcessing()); resolver.setExcludedViewNames(properties.getExcludedViewNames()); resolver.setViewNames(properties.getViewNames()); ======= appendCharset(this.properties.getServlet().getContentType(), resolver.getCharacterEncoding())); resolver.setProducePartialOutputWhileProcessing( this.properties.getServlet().isProducePartialOutputWhileProcessing()); resolver.setExcludedViewNames(this.properties.getExcludedViewNames()); resolver.setViewNames(this.properties.getViewNames()); >>>>>>> appendCharset(properties.getServlet().getContentType(), resolver.getCharacterEncoding())); resolver.setProducePartialOutputWhileProcessing( properties.getServlet().isProducePartialOutputWhileProcessing()); resolver.setExcludedViewNames(properties.getExcludedViewNames()); resolver.setViewNames(properties.getViewNames()); <<<<<<< ======= private final ThymeleafProperties properties; private final Collection<ITemplateResolver> templateResolvers; private final ObjectProvider<IDialect> dialects; ThymeleafReactiveConfiguration(ThymeleafProperties properties, Collection<ITemplateResolver> templateResolvers, ObjectProvider<IDialect> dialectsProvider) { this.properties = properties; this.templateResolvers = templateResolvers; this.dialects = dialectsProvider; } >>>>>>> <<<<<<< engine.setEnableSpringELCompiler(properties.isEnableSpringElCompiler()); engine.setRenderHiddenMarkersBeforeCheckboxes( properties.isRenderHiddenMarkersBeforeCheckboxes()); templateResolvers.orderedStream().forEach(engine::addTemplateResolver); dialects.orderedStream().forEach(engine::addDialect); ======= engine.setEnableSpringELCompiler(this.properties.isEnableSpringElCompiler()); engine.setRenderHiddenMarkersBeforeCheckboxes(this.properties.isRenderHiddenMarkersBeforeCheckboxes()); this.templateResolvers.forEach(engine::addTemplateResolver); this.dialects.orderedStream().forEach(engine::addDialect); >>>>>>> engine.setEnableSpringELCompiler(properties.isEnableSpringElCompiler()); engine.setRenderHiddenMarkersBeforeCheckboxes(properties.isRenderHiddenMarkersBeforeCheckboxes()); templateResolvers.orderedStream().forEach(engine::addTemplateResolver); dialects.orderedStream().forEach(engine::addDialect); <<<<<<< public ThymeleafReactiveViewResolver thymeleafViewResolver( ISpringWebFluxTemplateEngine templateEngine, ThymeleafProperties properties) { ======= public ThymeleafReactiveViewResolver thymeleafViewResolver(ISpringWebFluxTemplateEngine templateEngine) { >>>>>>> public ThymeleafReactiveViewResolver thymeleafViewResolver(ISpringWebFluxTemplateEngine templateEngine, ThymeleafProperties properties) {
<<<<<<< public void backsOffWithNoDataSourceBeanAndNoFlywayUrl() { this.contextRunner .run((context) -> assertThat(context).doesNotHaveBean(Flyway.class)); ======= public void noDataSource() { this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean(Flyway.class)); >>>>>>> public void backsOffWithNoDataSourceBeanAndNoFlywayUrl() { this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean(Flyway.class)); <<<<<<< .withPropertyValues( "spring.datasource.url:jdbc:hsqldb:mem:" + UUID.randomUUID(), "spring.flyway.user:sa") ======= .withPropertyValues("spring.datasource.url:jdbc:hsqldb:mem:normal", "spring.flyway.user:sa") >>>>>>> .withPropertyValues("spring.datasource.url:jdbc:hsqldb:mem:" + UUID.randomUUID(), "spring.flyway.user:sa") <<<<<<< assertThat(context).getFailure() .isInstanceOf(BeanCreationException.class); assertThat(context).getFailure() .hasMessageContaining("Cannot find migration scripts in"); ======= assertThat(context).getFailure().isInstanceOf(BeanCreationException.class); assertThat(context).getFailure().hasMessageContaining("Cannot find migrations location in"); >>>>>>> assertThat(context).getFailure().isInstanceOf(BeanCreationException.class); assertThat(context).getFailure().hasMessageContaining("Cannot find migration scripts in");
<<<<<<< TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.config=doesnotexist.xml"); assertThatIllegalStateException().isThrownBy(() -> { this.outputCapture.expect(containsString( "Logging system failed to initialize using configuration from 'doesnotexist.xml'")); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); }); ======= TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.config=doesnotexist.xml"); this.thrown.expect(IllegalStateException.class); this.outputCapture.expect( containsString("Logging system failed to initialize using configuration from 'doesnotexist.xml'")); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); >>>>>>> TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.config=doesnotexist.xml"); assertThatIllegalStateException().isThrownBy(() -> { this.outputCapture.expect( containsString("Logging system failed to initialize using configuration from 'doesnotexist.xml'")); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); }); <<<<<<< assertThatIllegalStateException().isThrownBy(() -> { this.outputCapture.expect(containsString( "Logging system failed to initialize using configuration from 'classpath:logback-broken.xml'")); this.outputCapture.expect(containsString("ConsolAppender")); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); }); ======= this.thrown.expect(IllegalStateException.class); this.outputCapture.expect(containsString( "Logging system failed to initialize using configuration from 'classpath:logback-broken.xml'")); this.outputCapture.expect(containsString("ConsolAppender")); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); >>>>>>> assertThatIllegalStateException().isThrownBy(() -> { this.outputCapture.expect(containsString( "Logging system failed to initialize using configuration from 'classpath:logback-broken.xml'")); this.outputCapture.expect(containsString("ConsolAppender")); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); }); <<<<<<< assertThat(this.outputCapture.toString()).doesNotContain("testatdebug") .contains("Cannot set level 'GARBAGE'"); ======= assertThat(this.outputCapture.toString()).doesNotContain("testatdebug").contains("Cannot set level: GARBAGE"); >>>>>>> assertThat(this.outputCapture.toString()).doesNotContain("testatdebug").contains("Cannot set level 'GARBAGE'");
<<<<<<< .run((context) -> assertThat(ReflectionTestUtils.getField( context.getBean(LayoutDialect.class), "sortingStrategy")) .isInstanceOf(GroupingRespectLayoutTitleStrategy.class)); ======= .run((context) -> assertThat( ReflectionTestUtils.getField(context.getBean(LayoutDialect.class), "sortingStrategy")) .isInstanceOf(GroupingStrategy.class)); >>>>>>> .run((context) -> assertThat( ReflectionTestUtils.getField(context.getBean(LayoutDialect.class), "sortingStrategy")) .isInstanceOf(GroupingRespectLayoutTitleStrategy.class));
<<<<<<< import static org.assertj.core.api.Assertions.contentOf; ======= import static org.assertj.core.api.Assertions.assertThatIllegalStateException; >>>>>>> import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.assertj.core.api.Assertions.contentOf;
<<<<<<< if (jarFile == null) { return Collections.<URL>emptyList(); } try { return getUrlsFromClassPathAttribute(jarFile.getManifest()); } catch (IOException ex) { throw new IllegalStateException( "Failed to read Class-Path attribute from manifest of jar " + url); ======= if (jarFile != null) { try { return getUrlsFromClassPathAttribute(url, jarFile.getManifest()); } catch (IOException ex) { throw new IllegalStateException( "Failed to read Class-Path attribute from manifest of jar " + url); } >>>>>>> if (jarFile == null) { return Collections.<URL>emptyList(); } try { return getUrlsFromClassPathAttribute(url, jarFile.getManifest()); } catch (IOException ex) { throw new IllegalStateException( "Failed to read Class-Path attribute from manifest of jar " + url); <<<<<<< private static List<URL> getUrlsFromClassPathAttribute(Manifest manifest) { String classPath = manifest.getMainAttributes() ======= private static List<URL> getUrlsFromClassPathAttribute(URL base, Manifest manifest) { List<URL> urls = new ArrayList<URL>(); String classPathAttribute = manifest.getMainAttributes() >>>>>>> private static List<URL> getUrlsFromClassPathAttribute(URL base, Manifest manifest) { String classPath = manifest.getMainAttributes() <<<<<<< if (!StringUtils.hasText(classPath)) { return Collections.emptyList(); } String[] entries = StringUtils.delimitedListToStringArray(classPath, " "); List<URL> urls = new ArrayList<URL>(entries.length); for (String entry : entries) { try { urls.add(new URL(entry)); } catch (MalformedURLException ex) { throw new IllegalStateException( "Class-Path attribute contains malformed URL", ex); ======= if (StringUtils.hasText(classPathAttribute)) { for (String entry : StringUtils.delimitedListToStringArray(classPathAttribute, " ")) { try { urls.add(new URL(base, entry)); } catch (MalformedURLException ex) { throw new IllegalStateException( "Class-Path attribute contains malformed URL", ex); } >>>>>>> if (!StringUtils.hasText(classPath)) { return Collections.emptyList(); } String[] entries = StringUtils.delimitedListToStringArray(classPath, " "); List<URL> urls = new ArrayList<URL>(entries.length); for (String entry : entries) { try { urls.add(new URL(base, entry)); } catch (MalformedURLException ex) { throw new IllegalStateException( "Class-Path attribute contains malformed URL", ex);
<<<<<<< protected final ConditionOutcome[] getOutcomes(String[] autoConfigurationClasses, ======= public boolean[] match(String[] autoConfigurationClasses, AutoConfigurationMetadata autoConfigurationMetadata) { ConditionEvaluationReport report = getConditionEvaluationReport(); ConditionOutcome[] outcomes = getOutcomes(autoConfigurationClasses, autoConfigurationMetadata); boolean[] match = new boolean[outcomes.length]; for (int i = 0; i < outcomes.length; i++) { match[i] = (outcomes[i] == null || outcomes[i].isMatch()); if (!match[i] && outcomes[i] != null) { logOutcome(autoConfigurationClasses[i], outcomes[i]); if (report != null) { report.recordConditionEvaluation(autoConfigurationClasses[i], this, outcomes[i]); } } } return match; } private ConditionEvaluationReport getConditionEvaluationReport() { if (this.beanFactory != null && this.beanFactory instanceof ConfigurableBeanFactory) { return ConditionEvaluationReport.get((ConfigurableListableBeanFactory) this.beanFactory); } return null; } private ConditionOutcome[] getOutcomes(String[] autoConfigurationClasses, >>>>>>> protected final ConditionOutcome[] getOutcomes(String[] autoConfigurationClasses, <<<<<<< OutcomesResolver firstHalfResolver = createOutcomesResolver( autoConfigurationClasses, 0, split, autoConfigurationMetadata); OutcomesResolver secondHalfResolver = new StandardOutcomesResolver( autoConfigurationClasses, split, autoConfigurationClasses.length, autoConfigurationMetadata, getBeanClassLoader()); ======= OutcomesResolver firstHalfResolver = createOutcomesResolver(autoConfigurationClasses, 0, split, autoConfigurationMetadata); OutcomesResolver secondHalfResolver = new StandardOutcomesResolver(autoConfigurationClasses, split, autoConfigurationClasses.length, autoConfigurationMetadata, this.beanClassLoader); >>>>>>> OutcomesResolver firstHalfResolver = createOutcomesResolver(autoConfigurationClasses, 0, split, autoConfigurationMetadata); OutcomesResolver secondHalfResolver = new StandardOutcomesResolver(autoConfigurationClasses, split, autoConfigurationClasses.length, autoConfigurationMetadata, getBeanClassLoader()); <<<<<<< private OutcomesResolver createOutcomesResolver(String[] autoConfigurationClasses, int start, int end, AutoConfigurationMetadata autoConfigurationMetadata) { OutcomesResolver outcomesResolver = new StandardOutcomesResolver( autoConfigurationClasses, start, end, autoConfigurationMetadata, getBeanClassLoader()); ======= private OutcomesResolver createOutcomesResolver(String[] autoConfigurationClasses, int start, int end, AutoConfigurationMetadata autoConfigurationMetadata) { OutcomesResolver outcomesResolver = new StandardOutcomesResolver(autoConfigurationClasses, start, end, autoConfigurationMetadata, this.beanClassLoader); >>>>>>> private OutcomesResolver createOutcomesResolver(String[] autoConfigurationClasses, int start, int end, AutoConfigurationMetadata autoConfigurationMetadata) { OutcomesResolver outcomesResolver = new StandardOutcomesResolver(autoConfigurationClasses, start, end, autoConfigurationMetadata, getBeanClassLoader()); <<<<<<< .found("required class", "required classes").items(Style.QUOTE, filter(onClasses, ClassNameFilter.PRESENT, classLoader)); ======= .found("required class", "required classes") .items(Style.QUOTE, getMatches(onClasses, MatchType.PRESENT, classLoader)); >>>>>>> .found("required class", "required classes") .items(Style.QUOTE, filter(onClasses, ClassNameFilter.PRESENT, classLoader)); <<<<<<< List<String> present = filter(onMissingClasses, ClassNameFilter.PRESENT, classLoader); ======= List<String> present = getMatches(onMissingClasses, MatchType.PRESENT, classLoader); >>>>>>> List<String> present = filter(onMissingClasses, ClassNameFilter.PRESENT, classLoader); <<<<<<< .didNotFind("unwanted class", "unwanted classes") .items(Style.QUOTE, filter(onMissingClasses, ClassNameFilter.MISSING, classLoader)); ======= .didNotFind("unwanted class", "unwanted classes") .items(Style.QUOTE, getMatches(onMissingClasses, MatchType.MISSING, classLoader)); >>>>>>> .didNotFind("unwanted class", "unwanted classes") .items(Style.QUOTE, filter(onMissingClasses, ClassNameFilter.MISSING, classLoader)); <<<<<<< ======= private List<String> getMatches(Collection<String> candidates, MatchType matchType, ClassLoader classLoader) { List<String> matches = new ArrayList<>(candidates.size()); for (String candidate : candidates) { if (matchType.matches(candidate, classLoader)) { matches.add(candidate); } } return matches; } @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { this.beanFactory = beanFactory; } @Override public void setBeanClassLoader(ClassLoader classLoader) { this.beanClassLoader = classLoader; } private enum MatchType { PRESENT { @Override public boolean matches(String className, ClassLoader classLoader) { return isPresent(className, classLoader); } }, MISSING { @Override public boolean matches(String className, ClassLoader classLoader) { return !isPresent(className, classLoader); } }; private static boolean isPresent(String className, ClassLoader classLoader) { if (classLoader == null) { classLoader = ClassUtils.getDefaultClassLoader(); } try { forName(className, classLoader); return true; } catch (Throwable ex) { return false; } } private static Class<?> forName(String className, ClassLoader classLoader) throws ClassNotFoundException { if (classLoader != null) { return classLoader.loadClass(className); } return Class.forName(className); } public abstract boolean matches(String className, ClassLoader classLoader); } >>>>>>> <<<<<<< if (autoConfigurationClass != null) { String candidates = autoConfigurationMetadata .get(autoConfigurationClass, "ConditionalOnClass"); if (candidates != null) { outcomes[i - start] = getOutcome(candidates); } ======= Set<String> candidates = autoConfigurationMetadata.getSet(autoConfigurationClass, "ConditionalOnClass"); if (candidates != null) { outcomes[i - start] = getOutcome(candidates); >>>>>>> if (autoConfigurationClass != null) { String candidates = autoConfigurationMetadata.get(autoConfigurationClass, "ConditionalOnClass"); if (candidates != null) { outcomes[i - start] = getOutcome(candidates); } <<<<<<< if (!candidates.contains(",")) { return getOutcome(candidates, this.beanClassLoader); } for (String candidate : StringUtils .commaDelimitedListToStringArray(candidates)) { ConditionOutcome outcome = getOutcome(candidate, this.beanClassLoader); if (outcome != null) { return outcome; } ======= List<String> missing = getMatches(candidates, MatchType.MISSING, this.beanClassLoader); if (!missing.isEmpty()) { return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnClass.class) .didNotFind("required class", "required classes").items(Style.QUOTE, missing)); >>>>>>> if (!candidates.contains(",")) { return getOutcome(candidates, this.beanClassLoader); } for (String candidate : StringUtils.commaDelimitedListToStringArray(candidates)) { ConditionOutcome outcome = getOutcome(candidate, this.beanClassLoader); if (outcome != null) { return outcome; }
<<<<<<< import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.web.server.PortInUseException; ======= import org.springframework.boot.testsupport.rule.OutputCapture; import org.springframework.boot.testsupport.web.servlet.ExampleServlet; import org.springframework.boot.web.server.Ssl; >>>>>>> import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.web.servlet.ExampleServlet; import org.springframework.boot.web.server.PortInUseException; import org.springframework.boot.web.server.Ssl; <<<<<<< ======= import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.ServletRegistrationBean; >>>>>>> import org.springframework.boot.web.servlet.ServletRegistrationBean;
<<<<<<< @SpringBootTest( classes = { ShutdownSampleActuatorApplicationTests.SecurityConfiguration.class, SampleActuatorApplication.class }, webEnvironment = WebEnvironment.RANDOM_PORT) class ShutdownSampleActuatorApplicationTests { ======= @RunWith(SpringRunner.class) @SpringBootTest(classes = { ShutdownSampleActuatorApplicationTests.SecurityConfiguration.class, SampleActuatorApplication.class }, webEnvironment = WebEnvironment.RANDOM_PORT) public class ShutdownSampleActuatorApplicationTests { >>>>>>> @SpringBootTest(classes = { ShutdownSampleActuatorApplicationTests.SecurityConfiguration.class, SampleActuatorApplication.class }, webEnvironment = WebEnvironment.RANDOM_PORT) class ShutdownSampleActuatorApplicationTests {
<<<<<<< getTask().providedClasspath(this.temp.newFile("one.jar"), this.temp.newFile("two.jar")); executeTask(); ======= getTask().providedClasspath(jarFile("one.jar"), jarFile("two.jar")); getTask().execute(); >>>>>>> getTask().providedClasspath(jarFile("one.jar"), jarFile("two.jar")); executeTask(); <<<<<<< getTask().providedClasspath(this.temp.newFile("one.jar")); getTask().setProvidedClasspath( getTask().getProject().files(this.temp.newFile("two.jar"))); executeTask(); ======= getTask().providedClasspath(jarFile("one.jar")); getTask().setProvidedClasspath(getTask().getProject().files(jarFile("two.jar"))); getTask().execute(); >>>>>>> getTask().providedClasspath(jarFile("one.jar")); getTask().setProvidedClasspath(getTask().getProject().files(jarFile("two.jar"))); executeTask(); <<<<<<< getTask().providedClasspath(this.temp.newFile("one.jar")); getTask().setProvidedClasspath(this.temp.newFile("two.jar")); executeTask(); ======= getTask().providedClasspath(jarFile("one.jar")); getTask().setProvidedClasspath(jarFile("two.jar")); getTask().execute(); >>>>>>> getTask().providedClasspath(jarFile("one.jar")); getTask().setProvidedClasspath(jarFile("two.jar")); executeTask(); <<<<<<< getTask().classpath(this.temp.newFile("library.jar")); getTask().providedClasspath(this.temp.newFile("provided-library.jar")); executeTask(); ======= getTask().classpath(jarFile("library.jar")); getTask().providedClasspath(jarFile("provided-library.jar")); getTask().execute(); >>>>>>> getTask().classpath(jarFile("library.jar")); getTask().providedClasspath(jarFile("provided-library.jar")); executeTask();
<<<<<<< void overrideTestRollbackOnUpdate() { ======= public void overrideDataSourceAndFallbackToEmbeddedProperties() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) .withPropertyValues("spring.liquibase.url:jdbc:hsqldb:mem:liquibase") .run(assertLiquibase((liquibase) -> { DataSource dataSource = liquibase.getDataSource(); assertThat(((HikariDataSource) dataSource).isClosed()).isTrue(); assertThat(((HikariDataSource) dataSource).getUsername()).isEqualTo("sa"); assertThat(((HikariDataSource) dataSource).getPassword()).isEqualTo(""); })); } @Test public void overrideUserAndFallbackToEmbeddedProperties() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) .withPropertyValues("spring.liquibase.user:sa").run(assertLiquibase((liquibase) -> { DataSource dataSource = liquibase.getDataSource(); assertThat(((HikariDataSource) dataSource).isClosed()).isTrue(); assertThat(((HikariDataSource) dataSource).getJdbcUrl()).startsWith("jdbc:h2:mem:"); })); } @Test public void overrideTestRollbackOnUpdate() { >>>>>>> void overrideDataSourceAndFallbackToEmbeddedProperties() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) .withPropertyValues("spring.liquibase.url:jdbc:hsqldb:mem:liquibase") .run(assertLiquibase((liquibase) -> { DataSource dataSource = liquibase.getDataSource(); assertThat(((HikariDataSource) dataSource).isClosed()).isTrue(); assertThat(((HikariDataSource) dataSource).getUsername()).isEqualTo("sa"); assertThat(((HikariDataSource) dataSource).getPassword()).isEqualTo(""); })); } @Test void overrideUserAndFallbackToEmbeddedProperties() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) .withPropertyValues("spring.liquibase.user:sa").run(assertLiquibase((liquibase) -> { DataSource dataSource = liquibase.getDataSource(); assertThat(((HikariDataSource) dataSource).isClosed()).isTrue(); assertThat(((HikariDataSource) dataSource).getJdbcUrl()).startsWith("jdbc:h2:mem:"); })); } @Test void overrideTestRollbackOnUpdate() {