Rename ApplicationPidListener

Rename ApplicationPidListener to ApplicationPidFileWriter (keeping the
old class in a deprecated form)

Fixes gh-1673
This commit is contained in:
Phillip Webb
2014-10-08 21:30:35 -07:00
parent c7455040df
commit 77ccd9a80b
4 changed files with 142 additions and 109 deletions

View File

@@ -33,12 +33,12 @@ import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
/**
* Tests for {@link ApplicationPidListener}.
* Tests for {@link ApplicationPidFileWriter}.
*
* @author Jakub Kubrynski
* @author Dave Syer
*/
public class ApplicationPidListenerTests {
public class ApplicationPidFileWriterTests {
private static final ApplicationStartedEvent EVENT = new ApplicationStartedEvent(
new SpringApplication(), new String[] {});
@@ -50,13 +50,13 @@ public class ApplicationPidListenerTests {
@After
public void resetListener() {
System.clearProperty("PIDFILE");
ApplicationPidListener.reset();
ApplicationPidFileWriter.reset();
}
@Test
public void createPidFile() throws Exception {
File file = this.temporaryFolder.newFile();
ApplicationPidListener listener = new ApplicationPidListener(file);
ApplicationPidFileWriter listener = new ApplicationPidFileWriter(file);
listener.onApplicationEvent(EVENT);
assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString()));
}
@@ -65,7 +65,7 @@ public class ApplicationPidListenerTests {
public void overridePidFile() throws Exception {
File file = this.temporaryFolder.newFile();
System.setProperty("PIDFILE", this.temporaryFolder.newFile().getAbsolutePath());
ApplicationPidListener listener = new ApplicationPidListener(file);
ApplicationPidFileWriter listener = new ApplicationPidFileWriter(file);
listener.onApplicationEvent(EVENT);
assertThat(
FileCopyUtils.copyToString(new FileReader(System.getProperty("PIDFILE"))),