Search in sources :

Example 1 with FileHelper

use of com.thoughtworks.go.plugin.FileHelper in project gocd by gocd.

the class MultipleExtensionPluginWithPluginManagerIntegrationTest method overrideProperties.

@BeforeAll
static void overrideProperties(@TempDir File rootDir) {
    temporaryFolder = new FileHelper(rootDir);
    bundleDir = temporaryFolder.newFolder("bundleDir");
    pluginWorkDir = temporaryFolder.newFolder("pluginDir");
    System.setProperty(PLUGIN_ACTIVATOR_JAR_PATH.propertyName(), "defaultFiles/go-plugin-activator.jar");
    System.setProperty(PLUGIN_WORK_DIR.propertyName(), bundleDir.getAbsolutePath());
    System.setProperty(PLUGIN_GO_PROVIDED_PATH.propertyName(), pluginWorkDir.getAbsolutePath());
    System.setProperty(PLUGIN_EXTERNAL_PROVIDED_PATH.propertyName(), pluginWorkDir.getAbsolutePath());
}
Also used : FileHelper(com.thoughtworks.go.plugin.FileHelper)

Example 2 with FileHelper

use of com.thoughtworks.go.plugin.FileHelper in project gocd by gocd.

the class DefaultPluginManagerIntegrationTest method overrideProperties.

@BeforeAll
static void overrideProperties(@TempDir File rootDir) {
    FileHelper temporaryFolder = new FileHelper(rootDir);
    bundleDir = temporaryFolder.newFolder("bundleDir");
    System.clearProperty("gocd.plugins.classloader.old");
    System.setProperty(PLUGIN_ACTIVATOR_JAR_PATH.propertyName(), "defaultFiles/go-plugin-activator.jar");
    System.setProperty(PLUGIN_WORK_DIR.propertyName(), bundleDir.getAbsolutePath());
}
Also used : FileHelper(com.thoughtworks.go.plugin.FileHelper) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with FileHelper

use of com.thoughtworks.go.plugin.FileHelper in project gocd by gocd.

the class PluginsZipTest method setUp.

@BeforeEach
void setUp(@TempDir File rootDir) throws Exception {
    temporaryFolder = new FileHelper(rootDir);
    pluginManager = mock(PluginManager.class);
    temporaryFolder.newFolder();
    systemEnvironment = mock(SystemEnvironment.class);
    bundledPluginsDir = temporaryFolder.newFolder("plugins-bundled");
    expectedZipPath = temporaryFolder.newFile("go-plugins-all.zip").getAbsolutePath();
    externalPluginsDir = temporaryFolder.newFolder("plugins-external");
    when(systemEnvironment.get(PLUGIN_GO_PROVIDED_PATH)).thenReturn(bundledPluginsDir.getAbsolutePath());
    when(systemEnvironment.get(PLUGIN_EXTERNAL_PROVIDED_PATH)).thenReturn(externalPluginsDir.getAbsolutePath());
    when(systemEnvironment.get(ALL_PLUGINS_ZIP_PATH)).thenReturn(expectedZipPath);
    pluginsZip = spy(new PluginsZip(systemEnvironment, pluginManager));
    File bundledTask1Jar = createPluginFile(this.bundledPluginsDir, "bundled-task-1.jar", "Bundled1");
    File bundledAuth2Jar = createPluginFile(this.bundledPluginsDir, "bundled-auth-2.jar", "Bundled2");
    File bundledscm3Jar = createPluginFile(this.bundledPluginsDir, "bundled-scm-3.jar", "Bundled3");
    File bundledPackageMaterialJar = createPluginFile(this.bundledPluginsDir, "bundled-package-material-4.jar", "Bundled4");
    File externalTask1Jar = createPluginFile(externalPluginsDir, "external-task-1.jar", "External1");
    File externalElastic1Jar = createPluginFile(externalPluginsDir, "external-elastic-agent-2.jar", "External2");
    File externalscm3Jar = createPluginFile(externalPluginsDir, "external-scm-3.jar", "External3");
    File externalPackageMaterialJar = createPluginFile(externalPluginsDir, "external-package-material-4.jar", "External3");
    bundledTaskPlugin = new GoPluginBundleDescriptor(getPluginDescriptor("bundled-task-1", bundledTask1Jar, true));
    GoPluginBundleDescriptor bundledAuthPlugin = new GoPluginBundleDescriptor(getPluginDescriptor("bundled-auth-2", bundledAuth2Jar, true));
    GoPluginBundleDescriptor bundledSCMPlugin = new GoPluginBundleDescriptor(getPluginDescriptor("bundled-scm-3", bundledscm3Jar, true));
    GoPluginBundleDescriptor bundledPackageMaterialPlugin = new GoPluginBundleDescriptor(getPluginDescriptor("bundled-package-material-4", bundledPackageMaterialJar, true));
    externalTaskPlugin = new GoPluginBundleDescriptor(getPluginDescriptor("external-task-1", externalTask1Jar, false));
    externalElasticAgentPlugin = new GoPluginBundleDescriptor(getPluginDescriptor("external-elastic-agent-2", externalElastic1Jar, false));
    GoPluginBundleDescriptor externalSCMPlugin = new GoPluginBundleDescriptor(getPluginDescriptor("external-scm-3", externalscm3Jar, false));
    GoPluginBundleDescriptor externalPackageMaterialPlugin = new GoPluginBundleDescriptor(getPluginDescriptor("external-package-material-4", externalPackageMaterialJar, false));
    when(pluginManager.plugins()).thenReturn(List.of(bundledTaskPlugin.descriptors().get(0), bundledAuthPlugin.descriptors().get(0), bundledSCMPlugin.descriptors().get(0), bundledPackageMaterialPlugin.descriptors().get(0), externalTaskPlugin.descriptors().get(0), externalElasticAgentPlugin.descriptors().get(0), externalSCMPlugin.descriptors().get(0), externalPackageMaterialPlugin.descriptors().get(0)));
    when(pluginManager.isPluginOfType("task", "bundled-task-1")).thenReturn(true);
    when(pluginManager.isPluginOfType("task", "external-task-1")).thenReturn(true);
    when(pluginManager.isPluginOfType("package-repository", "bundled-package-material-4")).thenReturn(true);
    when(pluginManager.isPluginOfType("scm", "bundled-scm-3")).thenReturn(true);
    when(pluginManager.isPluginOfType("scm", "external-scm-3")).thenReturn(true);
    when(pluginManager.isPluginOfType("package-repository", "external-package-material-4")).thenReturn(true);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) FileHelper(com.thoughtworks.go.plugin.FileHelper) GoPluginBundleDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginBundleDescriptor) File(java.io.File) ZipFile(java.util.zip.ZipFile) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with FileHelper

use of com.thoughtworks.go.plugin.FileHelper in project gocd by gocd.

the class AbstractDefaultPluginJarLocationMonitorTest method setUp.

@BeforeEach
void setUp(@TempDir File tempFolder) throws Exception {
    this.tempFolder = new FileHelper(tempFolder);
    pluginWorkDir = this.tempFolder.newFolder("plugin-work-dir");
}
Also used : FileHelper(com.thoughtworks.go.plugin.FileHelper) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with FileHelper

use of com.thoughtworks.go.plugin.FileHelper in project gocd by gocd.

the class GoPluginOSGiManifestTest method setUp.

@BeforeEach
void setUp(@TempDir File rootDir) throws Exception {
    final FileHelper temporaryFolder = new FileHelper(rootDir);
    tmpDir = temporaryFolder.newFolder();
    bundleLocation = createPluginBundle("test-plugin-bundle");
    manifestFile = new File(bundleLocation, "META-INF/MANIFEST.MF");
    bundleDependencyDir = new File(bundleLocation, "lib");
    goPluginOSGiManifestGenerator = new GoPluginOSGiManifest.DefaultGoPluginOSGiManifestCreator();
}
Also used : FileHelper(com.thoughtworks.go.plugin.FileHelper) File(java.io.File) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

FileHelper (com.thoughtworks.go.plugin.FileHelper)9 BeforeEach (org.junit.jupiter.api.BeforeEach)7 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)3 File (java.io.File)3 PluginLoader (com.thoughtworks.go.plugin.infra.PluginLoader)1 PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)1 DefaultPluginRegistry (com.thoughtworks.go.plugin.infra.plugininfo.DefaultPluginRegistry)1 GoPluginBundleDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginBundleDescriptor)1 HashMap (java.util.HashMap)1 ZipFile (java.util.zip.ZipFile)1 ZipInputStream (java.util.zip.ZipInputStream)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1