mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
refactor plugin backend + fix tests
This commit is contained in:
@@ -71,7 +71,7 @@ public class PluginTreeTest
|
||||
{
|
||||
PluginCondition condition = new PluginCondition("999",
|
||||
new ArrayList<String>(), "hit");
|
||||
Plugin plugin = new Plugin(2, createInfo("a", "b", "1"), null, condition,
|
||||
Plugin plugin = new Plugin(2, createInfo("a", "1"), null, condition,
|
||||
false, null);
|
||||
ExplodedSmp smp = createSmp(plugin);
|
||||
|
||||
@@ -102,7 +102,7 @@ public class PluginTreeTest
|
||||
List<ExplodedSmp> smps = createSmps("a", "b", "c");
|
||||
List<String> nodes = unwrapIds(new PluginTree(smps).getRootNodes());
|
||||
|
||||
assertThat(nodes, containsInAnyOrder("a:a", "b:b", "c:c"));
|
||||
assertThat(nodes, containsInAnyOrder("a", "b", "c"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +114,7 @@ public class PluginTreeTest
|
||||
@Test(expected = PluginException.class)
|
||||
public void testScmVersion() throws IOException
|
||||
{
|
||||
Plugin plugin = new Plugin(1, createInfo("a", "b", "1"), null, null, false,
|
||||
Plugin plugin = new Plugin(1, createInfo("a", "1"), null, null, false,
|
||||
null);
|
||||
ExplodedSmp smp = createSmp(plugin);
|
||||
|
||||
@@ -141,34 +141,32 @@ public class PluginTreeTest
|
||||
PluginTree tree = new PluginTree(smps);
|
||||
List<PluginNode> rootNodes = tree.getRootNodes();
|
||||
|
||||
assertThat(unwrapIds(rootNodes), containsInAnyOrder("a:a"));
|
||||
assertThat(unwrapIds(rootNodes), containsInAnyOrder("a"));
|
||||
|
||||
PluginNode a = rootNodes.get(0);
|
||||
|
||||
assertThat(unwrapIds(a.getChildren()), containsInAnyOrder("b:b", "c:c"));
|
||||
assertThat(unwrapIds(a.getChildren()), containsInAnyOrder("b", "c"));
|
||||
|
||||
PluginNode b = a.getChild("b:b");
|
||||
PluginNode b = a.getChild("b");
|
||||
|
||||
assertThat(unwrapIds(b.getChildren()), containsInAnyOrder("c:c"));
|
||||
assertThat(unwrapIds(b.getChildren()), containsInAnyOrder("c"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param groupId
|
||||
* @param artifactId
|
||||
* @param name
|
||||
* @param version
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private PluginInformation createInfo(String groupId, String artifactId,
|
||||
private PluginInformation createInfo(String name,
|
||||
String version)
|
||||
{
|
||||
PluginInformation info = new PluginInformation();
|
||||
|
||||
info.setGroupId(groupId);
|
||||
info.setArtifactId(artifactId);
|
||||
info.setName(name);
|
||||
info.setVersion(version);
|
||||
|
||||
return info;
|
||||
@@ -201,7 +199,7 @@ public class PluginTreeTest
|
||||
*/
|
||||
private ExplodedSmp createSmp(String name) throws IOException
|
||||
{
|
||||
return createSmp(new Plugin(2, createInfo(name, name, "1.0.0"), null, null,
|
||||
return createSmp(new Plugin(2, createInfo(name, "1.0.0"), null, null,
|
||||
false, null));
|
||||
}
|
||||
|
||||
@@ -224,10 +222,10 @@ public class PluginTreeTest
|
||||
|
||||
for (String d : dependencies)
|
||||
{
|
||||
dependencySet.add(d.concat(":").concat(d));
|
||||
dependencySet.add(d);
|
||||
}
|
||||
|
||||
Plugin plugin = new Plugin(2, createInfo(name, name, "1"), null, null,
|
||||
Plugin plugin = new Plugin(2, createInfo(name, "1"), null, null,
|
||||
false, dependencySet);
|
||||
|
||||
return createSmp(plugin);
|
||||
|
||||
Reference in New Issue
Block a user