@Test void shouldNormalizePath() { WarningsPluginConfiguration configuration = createConfiguration(); configuration.setSourceDirectories( Arrays.asList(new SourceDirectory("/absolute/unix"), new SourceDirectory("C:\\absolute\\windows"))); String relativeUnix = "relative/unix"; String relativeWindows = "relative\\windows"; String absoluteUnix = "/absolute/unix"; String absoluteWindows = "C:\\absolute\\windows"; String absoluteWindowsNormalized = "C:/absolute/windows"; assertThat(get(configuration, relativeUnix)).isEqualTo(getWorkspaceChild(relativeUnix)); assertThat(get(configuration, relativeWindows)).isEqualTo(getWorkspaceChild(relativeWindows)); assertThat(get(configuration, absoluteUnix)).isEqualTo(absoluteUnix); assertThat(get(configuration, absoluteWindows)).isEqualTo(normalize(absoluteWindows)); assertThat(get(configuration, absoluteWindowsNormalized)).isEqualTo(absoluteWindowsNormalized); }
@DataBoundSetter public void setSourceDirectories(final List<SourceDirectory> sourceDirectories) { this.sourceDirectories = new ArrayList<>(sourceDirectories); normalizedSourceDirectories = sourceDirectories.stream() .map(SourceDirectory::getPath) .map(PATH_UTIL::getAbsolutePath) .collect(Collectors.toSet()); save(); }
WarningsPluginConfiguration extends GlobalConfigurationItem { @DataBoundSetter public void setSourceDirectories(final List<SourceDirectory> sourceDirectories) { this.sourceDirectories = new ArrayList<>(sourceDirectories); normalizedSourceDirectories = sourceDirectories.stream() .map(SourceDirectory::getPath) .map(PATH_UTIL::getAbsolutePath) .collect(Collectors.toSet()); save(); } }
WarningsPluginConfiguration extends GlobalConfigurationItem { @DataBoundSetter public void setSourceDirectories(final List<SourceDirectory> sourceDirectories) { this.sourceDirectories = new ArrayList<>(sourceDirectories); normalizedSourceDirectories = sourceDirectories.stream() .map(SourceDirectory::getPath) .map(PATH_UTIL::getAbsolutePath) .collect(Collectors.toSet()); save(); } WarningsPluginConfiguration(); @VisibleForTesting  WarningsPluginConfiguration(final GlobalConfigurationFacade facade); }
WarningsPluginConfiguration extends GlobalConfigurationItem { @DataBoundSetter public void setSourceDirectories(final List<SourceDirectory> sourceDirectories) { this.sourceDirectories = new ArrayList<>(sourceDirectories); normalizedSourceDirectories = sourceDirectories.stream() .map(SourceDirectory::getPath) .map(PATH_UTIL::getAbsolutePath) .collect(Collectors.toSet()); save(); } WarningsPluginConfiguration(); @VisibleForTesting  WarningsPluginConfiguration(final GlobalConfigurationFacade facade); static WarningsPluginConfiguration getInstance(); List<SourceDirectory> getSourceDirectories(); @DataBoundSetter void setSourceDirectories(final List<SourceDirectory> sourceDirectories); FilePath getPermittedSourceDirectory(final FilePath workspace, final String sourceDirectory); }
WarningsPluginConfiguration extends GlobalConfigurationItem { @DataBoundSetter public void setSourceDirectories(final List<SourceDirectory> sourceDirectories) { this.sourceDirectories = new ArrayList<>(sourceDirectories); normalizedSourceDirectories = sourceDirectories.stream() .map(SourceDirectory::getPath) .map(PATH_UTIL::getAbsolutePath) .collect(Collectors.toSet()); save(); } WarningsPluginConfiguration(); @VisibleForTesting  WarningsPluginConfiguration(final GlobalConfigurationFacade facade); static WarningsPluginConfiguration getInstance(); List<SourceDirectory> getSourceDirectories(); @DataBoundSetter void setSourceDirectories(final List<SourceDirectory> sourceDirectories); FilePath getPermittedSourceDirectory(final FilePath workspace, final String sourceDirectory);  }