mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
use nio api and added test for plugin directory check
This commit is contained in:
@@ -71,6 +71,7 @@ import static java.util.stream.Collectors.toList;
|
|||||||
*
|
*
|
||||||
* TODO don't mix nio and io
|
* TODO don't mix nio and io
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("squid:S3725") // performance is not critical, for this type of checks
|
||||||
public final class PluginProcessor
|
public final class PluginProcessor
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -202,7 +203,7 @@ public final class PluginProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Predicate<Path> isPluginDirectory() {
|
private Predicate<Path> isPluginDirectory() {
|
||||||
return dir -> new File(dir.resolve("META-INF/scm/plugin.xml").toString()).exists();
|
return dir -> Files.exists(dir.resolve(DIRECTORY_METAINF).resolve("scm").resolve("plugin.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -134,6 +134,16 @@ public class PluginProcessorTest
|
|||||||
assertThat(plugin.getId(), is(PLUGIN_A.id));
|
assertThat(plugin.getId(), is(PLUGIN_A.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldCollectPluginsAndDoNotFailOnNonPluginDirectories() throws IOException {
|
||||||
|
new File(pluginDirectory, "some-directory").mkdirs();
|
||||||
|
|
||||||
|
copySmp(PLUGIN_A);
|
||||||
|
PluginWrapper plugin = collectAndGetFirst();
|
||||||
|
|
||||||
|
assertThat(plugin.getId(), is(PLUGIN_A.id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user