aboutsummaryrefslogtreecommitdiffstats
path: root/pf4j/src/test
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2018-11-23 08:51:47 +0200
committerDecebal Suiu <decebal.suiu@gmail.com>2018-11-23 08:51:47 +0200
commit935a72415569fda0688d9321053b2d8a806fa971 (patch)
tree3ba7ab02862f8cfeca25539fb4ba813cc40132a1 /pf4j/src/test
parent3939e6d8e5f57e056b7a3e55c5cc4f977a44c189 (diff)
downloadpf4j-935a72415569fda0688d9321053b2d8a806fa971.tar.gz
pf4j-935a72415569fda0688d9321053b2d8a806fa971.zip
Fix #248
Diffstat (limited to 'pf4j/src/test')
-rw-r--r--pf4j/src/test/java/org/pf4j/LoadPluginsTest.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java b/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java
index cf7280f..8b6af11 100644
--- a/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java
+++ b/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java
@@ -92,7 +92,9 @@ public class LoadPluginsTest {
@Test
public void upgrade() throws Exception {
- new PluginZip.Builder(pluginsFolder.newFile("my-plugin-1.2.3.zip"), "myPlugin")
+ String pluginId = "myPlugin";
+
+ new PluginZip.Builder(pluginsFolder.newFile("my-plugin-1.2.3.zip"), pluginId)
.pluginVersion("1.2.3")
.build();
@@ -102,18 +104,19 @@ public class LoadPluginsTest {
assertEquals(1, pluginManager.getPlugins().size());
assertEquals(1, pluginManager.getStartedPlugins().size());
- PluginZip pluginZip2 = new PluginZip.Builder(pluginsFolder.newFile("my-plugin-2.0.0.ZIP"), "myPlugin")
+ PluginZip pluginZip2 = new PluginZip.Builder(pluginsFolder.newFile("my-plugin-2.0.0.ZIP"), pluginId)
.pluginVersion("2.0.0")
.build();
- assertEquals("1.2.3", pluginManager.getPlugin(pluginZip2.pluginId()).getDescriptor().getVersion());
+ assertEquals("1.2.3", pluginManager.getPlugin(pluginId).getDescriptor().getVersion());
- pluginManager.loadPlugins();
- pluginManager.startPlugin(pluginZip2.pluginId());
+ pluginManager.unloadPlugin(pluginId);
+ pluginManager.loadPlugin(pluginZip2.path()); // or `pluginManager.loadPlugins();`
+ pluginManager.startPlugin(pluginId);
assertEquals(1, pluginManager.getPlugins().size());
- assertEquals("2.0.0", pluginManager.getPlugin(pluginZip2.pluginId()).getDescriptor().getVersion());
- assertEquals("2.0.0", pluginManager.getStartedPlugins().get(1).getDescriptor().getVersion());
+ assertEquals("2.0.0", pluginManager.getPlugin(pluginId).getDescriptor().getVersion());
+ assertEquals("2.0.0", pluginManager.getStartedPlugins().get(0).getDescriptor().getVersion());
}
@Test