From 02c52acbd05e4ccea00b98c84318f44eefc1a66d Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Sat, 9 Jan 2021 18:45:20 +0200 Subject: [PATCH] Externalize some useful classes from testing (#415) --- pf4j/pom.xml | 12 +++++++ .../org/pf4j/AbstractExtensionFinderTest.java | 14 ++++---- .../org/pf4j/AbstractPluginManagerTest.java | 4 +-- .../CompoundPluginDescriptorFinderTest.java | 6 ++-- .../org/pf4j/DefaultExtensionFactoryTest.java | 4 +-- .../org/pf4j/DefaultPluginFactoryTest.java | 6 ++-- .../org/pf4j/DefaultPluginManagerTest.java | 4 +-- .../org/pf4j/DefaultPluginRepositoryTest.java | 2 +- .../java/org/pf4j/JarPluginManagerTest.java | 8 ++--- .../org/pf4j/LegacyExtensionFinderTest.java | 6 ++-- .../LoadPluginsFromMultipleRootsTest.java | 2 +- .../test/java/org/pf4j/LoadPluginsTest.java | 2 +- .../ManifestPluginDescriptorFinderTest.java | 2 +- .../java/org/pf4j/PluginClassLoaderTest.java | 32 +++++++++---------- .../PropertiesPluginDescriptorFinderTest.java | 4 +-- .../pf4j/SingletonExtensionFactoryTest.java | 4 +-- .../AnotherFailTestPlugin.java | 5 ++- .../{plugin => test}/ClassDataProvider.java | 2 +- .../DefaultClassDataProvider.java | 2 +- .../{plugin => test}/FailTestExtension.java | 5 ++- .../pf4j/{plugin => test}/FailTestPlugin.java | 5 ++- .../org/pf4j/{plugin => test}/PluginJar.java | 2 +- .../org/pf4j/{plugin => test}/PluginZip.java | 2 +- .../pf4j/{plugin => test}/TestExtension.java | 4 ++- .../{plugin => test}/TestExtensionPoint.java | 4 ++- .../org/pf4j/{plugin => test}/TestPlugin.java | 7 +++- .../test/java/org/pf4j/test/package-info.java | 6 ++++ .../java/org/pf4j/util/FileUtilsTest.java | 2 +- 28 files changed, 97 insertions(+), 61 deletions(-) rename pf4j/src/test/java/org/pf4j/{plugin => test}/AnotherFailTestPlugin.java (81%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/ClassDataProvider.java (98%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/DefaultClassDataProvider.java (98%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/FailTestExtension.java (83%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/FailTestPlugin.java (84%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/PluginJar.java (99%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/PluginZip.java (99%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/TestExtension.java (89%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/TestExtensionPoint.java (87%) rename pf4j/src/test/java/org/pf4j/{plugin => test}/TestPlugin.java (74%) create mode 100644 pf4j/src/test/java/org/pf4j/test/package-info.java diff --git a/pf4j/pom.xml b/pf4j/pom.xml index 2266775..06f016f 100644 --- a/pf4j/pom.xml +++ b/pf4j/pom.xml @@ -66,6 +66,18 @@ + + + + test-jar + + + + org/pf4j/test/* + + + + diff --git a/pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java b/pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java index e841189..83796ab 100644 --- a/pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java +++ b/pf4j/src/test/java/org/pf4j/AbstractExtensionFinderTest.java @@ -22,8 +22,8 @@ import java.util.Comparator; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.pf4j.plugin.FailTestPlugin; -import org.pf4j.plugin.TestExtensionPoint; +import org.pf4j.test.FailTestPlugin; +import org.pf4j.test.TestExtensionPoint; import javax.tools.JavaFileObject; import java.io.IOException; @@ -113,8 +113,8 @@ public class AbstractExtensionFinderTest { Map> entries = new LinkedHashMap<>(); Set bucket = new HashSet<>(); - bucket.add("org.pf4j.plugin.TestExtension"); - bucket.add("org.pf4j.plugin.FailTestExtension"); + bucket.add("org.pf4j.test.TestExtension"); + bucket.add("org.pf4j.test.FailTestExtension"); entries.put(null, bucket); return entries; @@ -138,11 +138,11 @@ public class AbstractExtensionFinderTest { Map> entries = new LinkedHashMap<>(); Set bucket = new HashSet<>(); - bucket.add("org.pf4j.plugin.TestExtension"); - bucket.add("org.pf4j.plugin.FailTestExtension"); + bucket.add("org.pf4j.test.TestExtension"); + bucket.add("org.pf4j.test.FailTestExtension"); entries.put("plugin1", bucket); bucket = new HashSet<>(); - bucket.add("org.pf4j.plugin.TestExtension"); + bucket.add("org.pf4j.test.TestExtension"); entries.put("plugin2", bucket); return entries; diff --git a/pf4j/src/test/java/org/pf4j/AbstractPluginManagerTest.java b/pf4j/src/test/java/org/pf4j/AbstractPluginManagerTest.java index 784d1f9..f1824f7 100644 --- a/pf4j/src/test/java/org/pf4j/AbstractPluginManagerTest.java +++ b/pf4j/src/test/java/org/pf4j/AbstractPluginManagerTest.java @@ -16,8 +16,8 @@ package org.pf4j; import org.junit.jupiter.api.Test; -import org.pf4j.plugin.TestExtension; -import org.pf4j.plugin.TestExtensionPoint; +import org.pf4j.test.TestExtension; +import org.pf4j.test.TestExtensionPoint; import java.util.ArrayList; import java.util.List; diff --git a/pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java b/pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java index c16839e..f80c19e 100644 --- a/pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java +++ b/pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java @@ -17,9 +17,9 @@ package org.pf4j; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.pf4j.plugin.PluginJar; -import org.pf4j.plugin.PluginZip; -import org.pf4j.plugin.TestPlugin; +import org.pf4j.test.PluginJar; +import org.pf4j.test.PluginZip; +import org.pf4j.test.TestPlugin; import java.io.FileOutputStream; import java.io.IOException; diff --git a/pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java b/pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java index 150828f..9d73b5e 100644 --- a/pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java +++ b/pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java @@ -18,8 +18,8 @@ package org.pf4j; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.pf4j.plugin.FailTestExtension; -import org.pf4j.plugin.TestExtension; +import org.pf4j.test.FailTestExtension; +import org.pf4j.test.TestExtension; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/pf4j/src/test/java/org/pf4j/DefaultPluginFactoryTest.java b/pf4j/src/test/java/org/pf4j/DefaultPluginFactoryTest.java index eccfca2..3107083 100644 --- a/pf4j/src/test/java/org/pf4j/DefaultPluginFactoryTest.java +++ b/pf4j/src/test/java/org/pf4j/DefaultPluginFactoryTest.java @@ -16,9 +16,9 @@ package org.pf4j; import org.junit.jupiter.api.Test; -import org.pf4j.plugin.AnotherFailTestPlugin; -import org.pf4j.plugin.FailTestPlugin; -import org.pf4j.plugin.TestPlugin; +import org.pf4j.test.AnotherFailTestPlugin; +import org.pf4j.test.FailTestPlugin; +import org.pf4j.test.TestPlugin; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java b/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java index ae51282..fab1a02 100644 --- a/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java +++ b/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java @@ -19,8 +19,8 @@ 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 org.pf4j.test.PluginJar; +import org.pf4j.test.PluginZip; import java.io.IOException; import java.nio.file.Files; diff --git a/pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java b/pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java index b8ffd7c..c11938d 100644 --- a/pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java +++ b/pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java @@ -18,7 +18,7 @@ package org.pf4j; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.pf4j.plugin.PluginZip; +import org.pf4j.test.PluginZip; import org.pf4j.util.FileUtils; import java.io.IOException; diff --git a/pf4j/src/test/java/org/pf4j/JarPluginManagerTest.java b/pf4j/src/test/java/org/pf4j/JarPluginManagerTest.java index 4eb2872..0e16f75 100644 --- a/pf4j/src/test/java/org/pf4j/JarPluginManagerTest.java +++ b/pf4j/src/test/java/org/pf4j/JarPluginManagerTest.java @@ -19,10 +19,10 @@ 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.TestExtension; -import org.pf4j.plugin.TestExtensionPoint; -import org.pf4j.plugin.TestPlugin; +import org.pf4j.test.PluginJar; +import org.pf4j.test.TestExtension; +import org.pf4j.test.TestExtensionPoint; +import org.pf4j.test.TestPlugin; import java.io.IOException; import java.nio.file.Path; diff --git a/pf4j/src/test/java/org/pf4j/LegacyExtensionFinderTest.java b/pf4j/src/test/java/org/pf4j/LegacyExtensionFinderTest.java index 8f5a727..bde5417 100644 --- a/pf4j/src/test/java/org/pf4j/LegacyExtensionFinderTest.java +++ b/pf4j/src/test/java/org/pf4j/LegacyExtensionFinderTest.java @@ -18,9 +18,9 @@ package org.pf4j; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.io.TempDir; -import org.pf4j.plugin.PluginJar; -import org.pf4j.plugin.TestExtension; -import org.pf4j.plugin.TestPlugin; +import org.pf4j.test.PluginJar; +import org.pf4j.test.TestExtension; +import org.pf4j.test.TestPlugin; import java.nio.file.Path; import java.util.Map; diff --git a/pf4j/src/test/java/org/pf4j/LoadPluginsFromMultipleRootsTest.java b/pf4j/src/test/java/org/pf4j/LoadPluginsFromMultipleRootsTest.java index 2117a62..9396f15 100644 --- a/pf4j/src/test/java/org/pf4j/LoadPluginsFromMultipleRootsTest.java +++ b/pf4j/src/test/java/org/pf4j/LoadPluginsFromMultipleRootsTest.java @@ -18,7 +18,7 @@ package org.pf4j; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.pf4j.plugin.PluginZip; +import org.pf4j.test.PluginZip; import org.pf4j.util.FileUtils; import java.io.IOException; diff --git a/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java b/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java index ef2376b..189bd0a 100644 --- a/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java +++ b/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java @@ -18,7 +18,7 @@ package org.pf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.pf4j.plugin.PluginZip; +import org.pf4j.test.PluginZip; import java.nio.file.Files; import java.nio.file.Path; diff --git a/pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java b/pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java index 468f2fb..079d8e2 100644 --- a/pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java +++ b/pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java @@ -18,7 +18,7 @@ package org.pf4j; 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.test.PluginJar; import java.io.FileOutputStream; import java.io.IOException; diff --git a/pf4j/src/test/java/org/pf4j/PluginClassLoaderTest.java b/pf4j/src/test/java/org/pf4j/PluginClassLoaderTest.java index b0316c7..fb75f27 100644 --- a/pf4j/src/test/java/org/pf4j/PluginClassLoaderTest.java +++ b/pf4j/src/test/java/org/pf4j/PluginClassLoaderTest.java @@ -20,7 +20,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.pf4j.plugin.PluginZip; +import org.pf4j.test.PluginZip; import org.pf4j.util.FileUtils; import java.io.File; @@ -49,7 +49,7 @@ public class PluginClassLoaderTest { private PluginClassLoader parentLastPluginClassLoader; private PluginClassLoader parentFirstPluginClassLoader; - + private PluginClassLoader parentLastPluginDependencyClassLoader; private PluginClassLoader parentFirstPluginDependencyClassLoader; @@ -95,7 +95,7 @@ public class PluginClassLoaderTest { pluginDependencyDescriptor.setProvider("Me"); pluginDependencyDescriptor.setRequires("5.0.0"); - + Path pluginDependencyPath = pluginsPath.resolve(pluginDependencyDescriptor.getPluginId() + "-" + pluginDependencyDescriptor.getVersion() + ".zip"); PluginZip pluginDependencyZip = new PluginZip.Builder(pluginDependencyPath, pluginDependencyDescriptor.getPluginId()) .pluginVersion(pluginDependencyDescriptor.getVersion()) @@ -110,11 +110,11 @@ public class PluginClassLoaderTest { parentLastPluginDependencyClassLoader = new PluginClassLoader(pluginManager, pluginDependencyDescriptor, PluginClassLoaderTest.class.getClassLoader()); parentFirstPluginDependencyClassLoader = new PluginClassLoader(pluginManagerParentFirst, pluginDependencyDescriptor, PluginClassLoaderTest.class.getClassLoader(), true); - + pluginManager.addClassLoader(pluginDependencyDescriptor.getPluginId(), parentLastPluginDependencyClassLoader); pluginManagerParentFirst.addClassLoader(pluginDependencyDescriptor.getPluginId(), parentFirstPluginDependencyClassLoader); - - + + for (String classesDirectory : pluginDependencyClasspath.getClassesDirectories()) { File classesDirectoryFile = pluginDependencyZip.unzippedPath().resolve(classesDirectory).toFile(); parentLastPluginDependencyClassLoader.addFile(classesDirectoryFile); @@ -129,7 +129,7 @@ public class PluginClassLoaderTest { parentFirstPluginDependencyClassLoader.addFile(jar); } } - + pluginDescriptor = new DefaultPluginDescriptor(); pluginDescriptor.setPluginId("myPlugin"); pluginDescriptor.setPluginVersion("1.2.3"); @@ -155,7 +155,7 @@ public class PluginClassLoaderTest { pluginManager.addClassLoader(pluginDescriptor.getPluginId(), parentLastPluginClassLoader); pluginManagerParentFirst.addClassLoader(pluginDescriptor.getPluginId(), parentFirstPluginClassLoader); - + for (String classesDirectory : pluginClasspath.getClassesDirectories()) { File classesDirectoryFile = pluginZip.unzippedPath().resolve(classesDirectory).toFile(); parentLastPluginClassLoader.addFile(classesDirectoryFile); @@ -196,7 +196,7 @@ public class PluginClassLoaderTest { URL resource = parentLastPluginClassLoader.getResource("META-INF/file-only-in-parent"); assertFirstLine("parent", resource); } - + @Test void parentFirstGetResourceExistsInParent() throws IOException, URISyntaxException { URL resource = parentFirstPluginClassLoader.getResource("META-INF/file-only-in-parent"); @@ -214,7 +214,7 @@ public class PluginClassLoaderTest { URL resource = parentFirstPluginClassLoader.getResource("META-INF/plugin-file"); assertFirstLine("plugin", resource); } - + @Test void parentLastGetResourceExistsOnlyInDependnecy() throws IOException, URISyntaxException { URL resource = parentLastPluginClassLoader.getResource("META-INF/dependency-file"); @@ -238,13 +238,13 @@ public class PluginClassLoaderTest { URL resource = parentFirstPluginClassLoader.getResource("META-INF/file-in-both-parent-and-plugin"); assertFirstLine("parent", resource); } - + @Test void parentLastGetResourceExistsInParentAndDependencyAndPlugin() throws URISyntaxException, IOException { URL resource = parentLastPluginClassLoader.getResource("META-INF/file-in-both-parent-and-dependency-and-plugin"); assertFirstLine("plugin", resource); } - + @Test void parentFirstGetResourceExistsInParentAndDependencyAndPlugin() throws URISyntaxException, IOException { URL resource = parentFirstPluginClassLoader.getResource("META-INF/file-in-both-parent-and-dependency-and-plugin"); @@ -284,7 +284,7 @@ public class PluginClassLoaderTest { Enumeration resources = parentFirstPluginClassLoader.getResources("META-INF/dependency-file"); assertNumberOfResourcesAndFirstLineOfFirstElement(1, "dependency", resources); } - + @Test void parentLastGetResourcesExistsOnlyInPlugin() throws IOException, URISyntaxException { Enumeration resources = parentLastPluginClassLoader.getResources("META-INF/plugin-file"); @@ -308,7 +308,7 @@ public class PluginClassLoaderTest { Enumeration resources = parentFirstPluginClassLoader.getResources("META-INF/file-in-both-parent-and-plugin"); assertNumberOfResourcesAndFirstLineOfFirstElement(2, "parent", resources); } - + @Test void parentLastGetResourcesExistsInParentAndDependencyAndPlugin() throws URISyntaxException, IOException { Enumeration resources = parentLastPluginClassLoader.getResources("META-INF/file-in-both-parent-and-dependency-and-plugin"); @@ -333,9 +333,9 @@ public class PluginClassLoaderTest { URL firstResource = list.get(0); assertEquals(expectedFirstLine, Files.readAllLines(Paths.get(firstResource.toURI())).get(0)); } - + class TestPluginManager extends DefaultPluginManager { - + public TestPluginManager(Path pluginsPath) { super(pluginsPath); } diff --git a/pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java b/pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java index bc91a7f..4d73a4f 100644 --- a/pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java +++ b/pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java @@ -18,8 +18,8 @@ package org.pf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.pf4j.plugin.PluginZip; -import org.pf4j.plugin.TestPlugin; +import org.pf4j.test.PluginZip; +import org.pf4j.test.TestPlugin; import java.io.FileOutputStream; import java.io.IOException; diff --git a/pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java b/pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java index ac8a3c5..1044034 100644 --- a/pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java +++ b/pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java @@ -16,8 +16,8 @@ package org.pf4j; import org.junit.jupiter.api.Test; -import org.pf4j.plugin.FailTestExtension; -import org.pf4j.plugin.TestExtension; +import org.pf4j.test.FailTestExtension; +import org.pf4j.test.TestExtension; import java.io.File; import java.net.MalformedURLException; diff --git a/pf4j/src/test/java/org/pf4j/plugin/AnotherFailTestPlugin.java b/pf4j/src/test/java/org/pf4j/test/AnotherFailTestPlugin.java similarity index 81% rename from pf4j/src/test/java/org/pf4j/plugin/AnotherFailTestPlugin.java rename to pf4j/src/test/java/org/pf4j/test/AnotherFailTestPlugin.java index b45f343..d97b32c 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/AnotherFailTestPlugin.java +++ b/pf4j/src/test/java/org/pf4j/test/AnotherFailTestPlugin.java @@ -13,11 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; import org.pf4j.Plugin; /** + * A wrong {@link org.pf4j.Plugin}. + * It's wrong because it doesn't contain a constructor with one parameter ({@link org.pf4j.PluginWrapper} as parameter type). + * * @author Mario Franco */ public class AnotherFailTestPlugin extends Plugin { diff --git a/pf4j/src/test/java/org/pf4j/plugin/ClassDataProvider.java b/pf4j/src/test/java/org/pf4j/test/ClassDataProvider.java similarity index 98% rename from pf4j/src/test/java/org/pf4j/plugin/ClassDataProvider.java rename to pf4j/src/test/java/org/pf4j/test/ClassDataProvider.java index ff55967..cc5a984 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/ClassDataProvider.java +++ b/pf4j/src/test/java/org/pf4j/test/ClassDataProvider.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; /** * Defines the interface for classes that know to supply class data for a class name. diff --git a/pf4j/src/test/java/org/pf4j/plugin/DefaultClassDataProvider.java b/pf4j/src/test/java/org/pf4j/test/DefaultClassDataProvider.java similarity index 98% rename from pf4j/src/test/java/org/pf4j/plugin/DefaultClassDataProvider.java rename to pf4j/src/test/java/org/pf4j/test/DefaultClassDataProvider.java index ef0eaf9..6a203aa 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/DefaultClassDataProvider.java +++ b/pf4j/src/test/java/org/pf4j/test/DefaultClassDataProvider.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/pf4j/src/test/java/org/pf4j/plugin/FailTestExtension.java b/pf4j/src/test/java/org/pf4j/test/FailTestExtension.java similarity index 83% rename from pf4j/src/test/java/org/pf4j/plugin/FailTestExtension.java rename to pf4j/src/test/java/org/pf4j/test/FailTestExtension.java index 13b51ee..1ce2aa8 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/FailTestExtension.java +++ b/pf4j/src/test/java/org/pf4j/test/FailTestExtension.java @@ -13,11 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; import org.pf4j.Extension; /** + * A wrong {@link org.pf4j.Extension}. + * It's wrong because it doesn't contain a constructor with empty parameters (or only the default constructor). + * * @author Mario Franco */ @Extension diff --git a/pf4j/src/test/java/org/pf4j/plugin/FailTestPlugin.java b/pf4j/src/test/java/org/pf4j/test/FailTestPlugin.java similarity index 84% rename from pf4j/src/test/java/org/pf4j/plugin/FailTestPlugin.java rename to pf4j/src/test/java/org/pf4j/test/FailTestPlugin.java index fab11c9..3a1824f 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/FailTestPlugin.java +++ b/pf4j/src/test/java/org/pf4j/test/FailTestPlugin.java @@ -13,9 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; /** + * A wrong {@link org.pf4j.Plugin}. + * It's wrong because it doesn't extends {@link org.pf4j.Plugin}. + * * @author Mario Franco */ public class FailTestPlugin { diff --git a/pf4j/src/test/java/org/pf4j/plugin/PluginJar.java b/pf4j/src/test/java/org/pf4j/test/PluginJar.java similarity index 99% rename from pf4j/src/test/java/org/pf4j/plugin/PluginJar.java rename to pf4j/src/test/java/org/pf4j/test/PluginJar.java index 4a08e20..034b10f 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/PluginJar.java +++ b/pf4j/src/test/java/org/pf4j/test/PluginJar.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; import org.pf4j.ManifestPluginDescriptorFinder; diff --git a/pf4j/src/test/java/org/pf4j/plugin/PluginZip.java b/pf4j/src/test/java/org/pf4j/test/PluginZip.java similarity index 99% rename from pf4j/src/test/java/org/pf4j/plugin/PluginZip.java rename to pf4j/src/test/java/org/pf4j/test/PluginZip.java index c2da257..5dd2291 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/PluginZip.java +++ b/pf4j/src/test/java/org/pf4j/test/PluginZip.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; import org.pf4j.PropertiesPluginDescriptorFinder; diff --git a/pf4j/src/test/java/org/pf4j/plugin/TestExtension.java b/pf4j/src/test/java/org/pf4j/test/TestExtension.java similarity index 89% rename from pf4j/src/test/java/org/pf4j/plugin/TestExtension.java rename to pf4j/src/test/java/org/pf4j/test/TestExtension.java index 83bc0b5..ec67b14 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/TestExtension.java +++ b/pf4j/src/test/java/org/pf4j/test/TestExtension.java @@ -13,11 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; import org.pf4j.Extension; /** + * A simple {@link Extension}. It implements {@link TestExtensionPoint}. + * * @author Mario Franco */ @Extension diff --git a/pf4j/src/test/java/org/pf4j/plugin/TestExtensionPoint.java b/pf4j/src/test/java/org/pf4j/test/TestExtensionPoint.java similarity index 87% rename from pf4j/src/test/java/org/pf4j/plugin/TestExtensionPoint.java rename to pf4j/src/test/java/org/pf4j/test/TestExtensionPoint.java index d29a7ab..3849c92 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/TestExtensionPoint.java +++ b/pf4j/src/test/java/org/pf4j/test/TestExtensionPoint.java @@ -13,11 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; import org.pf4j.ExtensionPoint; /** + * A simple {@link ExtensionPoint} that contains one method ({@link #saySomething()}). + * * @author Mario Franco */ public interface TestExtensionPoint extends ExtensionPoint { diff --git a/pf4j/src/test/java/org/pf4j/plugin/TestPlugin.java b/pf4j/src/test/java/org/pf4j/test/TestPlugin.java similarity index 74% rename from pf4j/src/test/java/org/pf4j/plugin/TestPlugin.java rename to pf4j/src/test/java/org/pf4j/test/TestPlugin.java index f094808..bab85b3 100644 --- a/pf4j/src/test/java/org/pf4j/plugin/TestPlugin.java +++ b/pf4j/src/test/java/org/pf4j/test/TestPlugin.java @@ -13,12 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.pf4j.plugin; +package org.pf4j.test; import org.pf4j.Plugin; import org.pf4j.PluginWrapper; /** + * A simple {@link Plugin}. + * + * In real applications you don't need to create a plugin like this if you are not interested in lifecycle events. + * {@codes PF4J} will automatically create a plugin similar to this (empty / dummy) if no class plugin is specified. + * * @author Mario Franco */ public class TestPlugin extends Plugin { diff --git a/pf4j/src/test/java/org/pf4j/test/package-info.java b/pf4j/src/test/java/org/pf4j/test/package-info.java new file mode 100644 index 0000000..bdd5723 --- /dev/null +++ b/pf4j/src/test/java/org/pf4j/test/package-info.java @@ -0,0 +1,6 @@ +/** + * Classes used to test different aspects of PF4J (plugins, extensions points, extensions). + * + * @author Decebal Suiu + */ +package org.pf4j.test; diff --git a/pf4j/src/test/java/org/pf4j/util/FileUtilsTest.java b/pf4j/src/test/java/org/pf4j/util/FileUtilsTest.java index 7bf06c6..050b3f1 100644 --- a/pf4j/src/test/java/org/pf4j/util/FileUtilsTest.java +++ b/pf4j/src/test/java/org/pf4j/util/FileUtilsTest.java @@ -17,7 +17,7 @@ package org.pf4j.util; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.pf4j.plugin.PluginZip; +import org.pf4j.test.PluginZip; import java.nio.file.Files; import java.nio.file.Path; -- 2.39.5