use of com.thoughtworks.go.plugin.FileHelper 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");
}
}
use of com.thoughtworks.go.plugin.FileHelper in project gocd by gocd.
the class DefaultPluginJarChangeListenerTest method setUp.
@BeforeEach
void setUp(@TempDir File rootDir) {
temporaryFolder = new FileHelper(rootDir);
bundleDir = temporaryFolder.newFolder("bundleDir");
pluginWorkDir = temporaryFolder.newFolder("pluginDir");
registry = mock(DefaultPluginRegistry.class);
osgiManifestGenerator = mock(GoPluginOSGiManifest.DefaultGoPluginOSGiManifestCreator.class);
pluginLoader = mock(PluginLoader.class);
goPluginBundleDescriptorBuilder = mock(GoPluginBundleDescriptorBuilder.class);
systemEnvironment = mock(SystemEnvironment.class);
when(systemEnvironment.get(PLUGIN_ACTIVATOR_JAR_PATH)).thenReturn("defaultFiles/go-plugin-activator.jar");
when(systemEnvironment.get(PLUGIN_WORK_DIR)).thenReturn(bundleDir.getAbsolutePath());
when(systemEnvironment.getOperatingSystemFamilyName()).thenReturn("Linux");
listener = new DefaultPluginJarChangeListener(registry, osgiManifestGenerator, pluginLoader, goPluginBundleDescriptorBuilder, systemEnvironment);
}
use of com.thoughtworks.go.plugin.FileHelper in project gocd by gocd.
the class DefaultPluginManagerTest method setUp.
@BeforeEach
void setUp(@TempDir File rootDir) {
FileHelper temporaryFolder = new FileHelper(rootDir);
bundleDir = temporaryFolder.newFolder("bundleDir");
File pluginExternalDir = temporaryFolder.newFolder("externalDir");
when(systemEnvironment.get(PLUGIN_WORK_DIR)).thenReturn(bundleDir.getAbsolutePath());
when(systemEnvironment.get(PLUGIN_EXTERNAL_PROVIDED_PATH)).thenReturn(pluginExternalDir.getAbsolutePath());
}
use of com.thoughtworks.go.plugin.FileHelper in project gocd by gocd.
the class GoPluginBundleDescriptorBuilderTest method setUp.
@BeforeEach
void setUp(@TempDir File rootDir) {
final FileHelper temporaryFolder = new FileHelper(rootDir);
pluginDirectory = temporaryFolder.newFolder("pluginDir");
bundleDirectory = temporaryFolder.newFolder("bundleDir");
goPluginBundleDescriptorBuilder = spy(new GoPluginBundleDescriptorBuilder());
}
Aggregations