Skip to content

Commit

Permalink
style: Remove whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
itsAkshayDubey committed Jul 20, 2024
1 parent 9c559d4 commit 4d366f8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,14 @@ LiveReloadServerEventListener liveReloadServerEventListener(OptionalLiveReloadSe
LiveReloadForAdditionalPaths liveReloadForAdditionalPaths(LiveReloadServer liveReloadServer,
DevToolsProperties properties, FileSystemWatcher fileSystemWatcher) {
return new LiveReloadForAdditionalPaths(liveReloadServer,
properties.getLivereload().getAdditionalPaths(),fileSystemWatcher);
properties.getLivereload().getAdditionalPaths(),fileSystemWatcher);
}

@Bean
FileSystemWatcher fileSystemWatcher(DevToolsProperties properties) {
return new FileSystemWatcher(true,
properties.getLivereload().getPollInterval(),
properties.getLivereload().getQuietPeriod()
);
FileSystemWatcher fileSystemWatcher(DevToolsProperties properties) {
return new FileSystemWatcher(true,
properties.getLivereload().getPollInterval(),
properties.getLivereload().getQuietPeriod());
}

}
Expand Down Expand Up @@ -233,27 +232,27 @@ public void onApplicationEvent(ClassPathChangedEvent event) {

}

static class LiveReloadForAdditionalPaths implements DisposableBean {
static class LiveReloadForAdditionalPaths implements DisposableBean {

private final FileSystemWatcher fileSystemWatcher;

@Override
public void destroy() throws Exception {
if(this.fileSystemWatcher!=null)
this.fileSystemWatcher.stop();
}
public void destroy() throws Exception {
if(this.fileSystemWatcher!=null)
this.fileSystemWatcher.stop();
}

public LiveReloadForAdditionalPaths( LiveReloadServer liveReloadServer, List<File> staticLocations, FileSystemWatcher fileSystemWatcher) {
this.fileSystemWatcher = fileSystemWatcher;
public LiveReloadForAdditionalPaths( LiveReloadServer liveReloadServer, List<File> staticLocations, FileSystemWatcher fileSystemWatcher) {
this.fileSystemWatcher = fileSystemWatcher;

for (File path : staticLocations) {
this.fileSystemWatcher.addSourceDirectory(path.getAbsoluteFile());
}
for (File path : staticLocations) {
this.fileSystemWatcher.addSourceDirectory(path.getAbsoluteFile());
}

this.fileSystemWatcher.addListener(__ -> liveReloadServer.triggerReload());
this.fileSystemWatcher.addListener(__ -> liveReloadServer.triggerReload());

this.fileSystemWatcher.start();
}
this.fileSystemWatcher.start();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,18 @@ void watchingAdditionalPaths() throws Exception {
}

@Test
void watchingAdditionalPathsForReload() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put("spring.devtools.livereload.additional-paths", "src/main/java,src/test/java");
this.context = getContext(() -> initializeAndRun(Config.class, properties));
LiveReloadForAdditionalPaths liveReloadForAdditionalPaths = this.context.getBean(LiveReloadForAdditionalPaths.class);
Object watcher = ReflectionTestUtils.getField(liveReloadForAdditionalPaths, "fileSystemWatcher");
@SuppressWarnings("unchecked")
Map<File, Object> directories = (Map<File, Object>) ReflectionTestUtils.getField(watcher, "directories");
assertThat(directories).hasSize(2)
.containsKey(new File("src/main/java").getAbsoluteFile())
.containsKey(new File("src/test/java").getAbsoluteFile());
}
void watchingAdditionalPathsForReload() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put("spring.devtools.livereload.additional-paths", "src/main/java,src/test/java");
this.context = getContext(() -> initializeAndRun(Config.class, properties));
LiveReloadForAdditionalPaths liveReloadForAdditionalPaths = this.context.getBean(LiveReloadForAdditionalPaths.class);
Object watcher = ReflectionTestUtils.getField(liveReloadForAdditionalPaths, "fileSystemWatcher");
@SuppressWarnings("unchecked")
Map<File, Object> directories = (Map<File, Object>) ReflectionTestUtils.getField(watcher, "directories");
assertThat(directories).hasSize(2)
.containsKey(new File("src/main/java").getAbsoluteFile())
.containsKey(new File("src/test/java").getAbsoluteFile());
}

@Test
void devToolsSwitchesJspServletToDevelopmentMode() throws Exception {
Expand Down

0 comments on commit 4d366f8

Please sign in to comment.