aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordecebals <decebal.suiu@gmail.com>2019-12-11 19:38:19 +0200
committerdecebals <decebal.suiu@gmail.com>2019-12-11 19:38:19 +0200
commitd359ad77ac654883db56cf9376df9b2a98c18ff9 (patch)
tree4f5d3fd2ab72ae1e8d57b35ce65d2f03630e4ad9
parenta80ea7adcfc86a7042ec0cf772c8821a36967127 (diff)
downloadpf4j-d359ad77ac654883db56cf9376df9b2a98c18ff9.tar.gz
pf4j-d359ad77ac654883db56cf9376df9b2a98c18ff9.zip
Add test (deleteJarPlugin) in DefaultPluginManagerTest that replicates the issue #355
-rw-r--r--pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java b/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
index 8cb9b27..ae51282 100644
--- a/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
+++ b/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
@@ -19,6 +19,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
+import org.pf4j.plugin.PluginJar;
import org.pf4j.plugin.PluginZip;
import java.io.IOException;
@@ -155,4 +156,38 @@ public class DefaultPluginManagerTest {
assertSame(PluginState.DISABLED, plugin.getPluginState());
}
+ @Test
+ public void deleteZipPlugin() throws Exception {
+ PluginZip pluginZip = new PluginZip.Builder(pluginsPath.resolve("my-plugin-1.2.3.zip"), "myPlugin")
+ .pluginVersion("1.2.3")
+ .build();
+
+ pluginManager.loadPlugin(pluginZip.path());
+ pluginManager.startPlugin(pluginZip.pluginId());
+
+ assertEquals(1, pluginManager.getPlugins().size());
+
+ boolean deleted = pluginManager.deletePlugin(pluginZip.pluginId());
+ assertTrue(deleted);
+
+ assertFalse(pluginZip.file().exists());
+ }
+
+ @Test
+ public void deleteJarPlugin() throws Exception {
+ PluginJar pluginJar = new PluginJar.Builder(pluginsPath.resolve("my-plugin-1.2.3.jar"), "myPlugin")
+ .pluginVersion("1.2.3")
+ .build();
+
+ pluginManager.loadPlugin(pluginJar.path());
+ pluginManager.startPlugin(pluginJar.pluginId());
+
+ assertEquals(1, pluginManager.getPlugins().size());
+
+ boolean deleted = pluginManager.deletePlugin(pluginJar.pluginId());
+ assertTrue(deleted);
+
+ assertFalse(pluginJar.file().exists());
+ }
+
}