Search in sources :

Example 1 with DefaultPluginRegistry

use of com.thoughtworks.go.plugin.infra.plugininfo.DefaultPluginRegistry in project gocd by gocd.

the class FelixGoPluginOSGiFrameworkIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    TMP_DIR = new File("./tmp" + RANDOM.nextFloat());
    recreateDirectory(TMP_DIR);
    registry = new DefaultPluginRegistry();
    pluginOSGiFramework = new FelixGoPluginOSGiFramework(registry, new SystemEnvironment());
    pluginOSGiFramework.start();
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("descriptor-aware-test-plugin.osgi.jar")))) {
        descriptorBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "descriptor-plugin-bundle-dir");
    }
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("error-generating-descriptor-aware-test-plugin.osgi.jar")))) {
        errorGeneratingDescriptorBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "error-generating-descriptor-plugin-bundle-dir");
    }
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("exception-throwing-at-load-plugin.osgi.jar")))) {
        exceptionThrowingAtLoadDescriptorBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "exception-throwing-at-load-plugin-bundle-dir");
    }
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("valid-plugin-with-multiple-extensions.osgi.jar")))) {
        validMultipleExtensionPluginBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "valid-plugin-with-multiple-extensions");
    }
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ZipInputStream(java.util.zip.ZipInputStream) DefaultPluginRegistry(com.thoughtworks.go.plugin.infra.plugininfo.DefaultPluginRegistry) File(java.io.File) Before(org.junit.Before)

Example 2 with DefaultPluginRegistry

use of com.thoughtworks.go.plugin.infra.plugininfo.DefaultPluginRegistry in project gocd by gocd.

the class FelixGoPluginOSGiFrameworkIntegrationTest method setUp.

@BeforeEach
void setUp(@TempDir File rootDir) throws Exception {
    temporaryFolder = new FileHelper(rootDir);
    registry = new DefaultPluginRegistry();
    systemEnvironment = new SystemEnvironment();
    pluginOSGiFramework = new FelixGoPluginOSGiFramework(registry, systemEnvironment) {

        @Override
        protected HashMap<String, String> generateOSGiFrameworkConfig() {
            HashMap<String, String> config = super.generateOSGiFrameworkConfig();
            config.put(FelixConstants.RESOLVER_PARALLELISM, "1");
            return config;
        }
    };
    pluginOSGiFramework.start();
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("descriptor-aware-test-plugin.osgi.jar")))) {
        descriptorBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "descriptor-plugin-bundle-dir");
    }
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("error-generating-descriptor-aware-test-plugin.osgi.jar")))) {
        errorGeneratingDescriptorBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "error-generating-descriptor-plugin-bundle-dir");
    }
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("exception-throwing-at-load-plugin.osgi.jar")))) {
        exceptionThrowingAtLoadDescriptorBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "exception-throwing-at-load-plugin-bundle-dir");
    }
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("valid-plugin-with-multiple-extensions.osgi.jar")))) {
        validMultipleExtensionPluginBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "valid-plugin-with-multiple-extensions");
    }
    try (ZipInputStream zippedOSGiBundleFile = new ZipInputStream(FileUtils.openInputStream(pathOfFileInDefaultFiles("dumb.plugin.that.responds.with.classloader.name.osgi.jar")))) {
        pluginToTestClassloadPluginBundleDir = explodeBundleIntoDirectory(zippedOSGiBundleFile, "plugin-to-test-classloader");
    }
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ZipInputStream(java.util.zip.ZipInputStream) FileHelper(com.thoughtworks.go.plugin.FileHelper) DefaultPluginRegistry(com.thoughtworks.go.plugin.infra.plugininfo.DefaultPluginRegistry) HashMap(java.util.HashMap) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DefaultPluginRegistry (com.thoughtworks.go.plugin.infra.plugininfo.DefaultPluginRegistry)2 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)2 ZipInputStream (java.util.zip.ZipInputStream)2 FileHelper (com.thoughtworks.go.plugin.FileHelper)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1