Commit bc76c87d authored by Phillip Webb's avatar Phillip Webb

Fix AnsiOutputApplicationListener package tangle

Relocate AnsiOutputApplicationListener to `context.embedded.config`
to fix package tangle.

See gh-1243
parent 630c1456
...@@ -14,19 +14,19 @@ ...@@ -14,19 +14,19 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.ansi; package org.springframework.boot.context.config;
import org.springframework.boot.ansi.AnsiOutput;
import org.springframework.boot.ansi.AnsiOutput.Enabled; import org.springframework.boot.ansi.AnsiOutput.Enabled;
import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.boot.context.config.ConfigFileApplicationListener;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
/** /**
* An {@link ApplicationListener} that configures {@link AnsiOutput} depending on the the * An {@link ApplicationListener} that configures {@link AnsiOutput} depending on the the
* value of the property <code>spring.output.ansi.enabled</code>. See * value of the property <code>spring.output.ansi.enabled</code>. See {@link Enabled} for
* {@link AnsiOutput.Enabled} for valid values. * valid values.
* *
* @author Raphael von der Grün * @author Raphael von der Grün
* @since 1.2.0 * @since 1.2.0
......
...@@ -14,10 +14,10 @@ org.springframework.boot.context.config.DelegatingApplicationContextInitializer ...@@ -14,10 +14,10 @@ org.springframework.boot.context.config.DelegatingApplicationContextInitializer
# Application Listeners # Application Listeners
org.springframework.context.ApplicationListener=\ org.springframework.context.ApplicationListener=\
org.springframework.boot.ansi.AnsiOutputApplicationListener,\
org.springframework.boot.builder.ParentContextCloserApplicationListener,\ org.springframework.boot.builder.ParentContextCloserApplicationListener,\
org.springframework.boot.cloudfoundry.VcapApplicationListener,\ org.springframework.boot.cloudfoundry.VcapApplicationListener,\
org.springframework.boot.context.FileEncodingApplicationListener,\ org.springframework.boot.context.FileEncodingApplicationListener,\
org.springframework.boot.context.config.AnsiOutputApplicationListener,\
org.springframework.boot.context.config.ConfigFileApplicationListener,\ org.springframework.boot.context.config.ConfigFileApplicationListener,\
org.springframework.boot.context.config.DelegatingApplicationListener,\ org.springframework.boot.context.config.DelegatingApplicationListener,\
org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener,\ org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener,\
......
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.ansi;
import org.springframework.boot.ansi.AnsiOutput.Enabled;
/**
* Public access to {@link AnsiOutput#getEnabled()} for other tests to use.
*
* @author Phillip Webb
*/
public class AnsiOutputEnabledValue {
public static Enabled get() {
return AnsiOutput.getEnabled();
}
}
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.ansi; package org.springframework.boot.context.embedded.config;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -23,7 +23,10 @@ import org.junit.After; ...@@ -23,7 +23,10 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.ansi.AnsiOutput;
import org.springframework.boot.ansi.AnsiOutput.Enabled; import org.springframework.boot.ansi.AnsiOutput.Enabled;
import org.springframework.boot.ansi.AnsiOutputEnabledValue;
import org.springframework.boot.context.config.AnsiOutputApplicationListener;
import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
...@@ -53,7 +56,7 @@ public class AnsiOutputApplicationListenerTests { ...@@ -53,7 +56,7 @@ public class AnsiOutputApplicationListenerTests {
props.put("spring.output.ansi.enabled", "ALWAYS"); props.put("spring.output.ansi.enabled", "ALWAYS");
application.setDefaultProperties(props); application.setDefaultProperties(props);
application.run(); application.run();
assertThat(AnsiOutput.getEnabled(), equalTo(Enabled.ALWAYS)); assertThat(AnsiOutputEnabledValue.get(), equalTo(Enabled.ALWAYS));
} }
@Test @Test
...@@ -64,7 +67,7 @@ public class AnsiOutputApplicationListenerTests { ...@@ -64,7 +67,7 @@ public class AnsiOutputApplicationListenerTests {
props.put("spring.output.ansi.enabled", "never"); props.put("spring.output.ansi.enabled", "never");
application.setDefaultProperties(props); application.setDefaultProperties(props);
application.run(); application.run();
assertThat(AnsiOutput.getEnabled(), equalTo(Enabled.NEVER)); assertThat(AnsiOutputEnabledValue.get(), equalTo(Enabled.NEVER));
} }
@Test @Test
...@@ -75,7 +78,7 @@ public class AnsiOutputApplicationListenerTests { ...@@ -75,7 +78,7 @@ public class AnsiOutputApplicationListenerTests {
application.setWebEnvironment(false); application.setWebEnvironment(false);
application.setEnvironment(environment); application.setEnvironment(environment);
application.run(); application.run();
assertThat(AnsiOutput.getEnabled(), equalTo(Enabled.NEVER)); assertThat(AnsiOutputEnabledValue.get(), equalTo(Enabled.NEVER));
} }
@Configuration @Configuration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment