use of com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration in project gocd by gocd.
the class PackageMaterialMetadataLoader method fetchRepositoryAndPackageMetaData.
void fetchRepositoryAndPackageMetaData(GoPluginDescriptor pluginDescriptor) {
try {
RepositoryConfiguration repositoryConfiguration = packageRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id());
com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = packageRepositoryExtension.getPackageConfiguration(pluginDescriptor.id());
if (repositoryConfiguration == null) {
throw new RuntimeException(format("Plugin[%s] returned null repository configuration", pluginDescriptor.id()));
}
if (packageConfiguration == null) {
throw new RuntimeException(format("Plugin[%s] returned null package configuration", pluginDescriptor.id()));
}
repositoryMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(repositoryConfiguration));
packageMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(packageConfiguration));
} catch (GoPluginFrameworkException e) {
LOGGER.error("Failed to fetch package metadata for plugin : {}", pluginDescriptor.id(), e);
}
}
use of com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration in project gocd by gocd.
the class PackageDefinitionService method buildRepositoryConfigurations.
private RepositoryConfiguration buildRepositoryConfigurations(PackageRepository packageRepository) {
RepositoryConfiguration repositoryConfiguration = new RepositoryConfiguration();
populateConfiguration(packageRepository.getConfiguration(), repositoryConfiguration);
return repositoryConfiguration;
}
use of com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration in project gocd by gocd.
the class PackageMaterialPoller method modificationsSince.
@Override
public List<Modification> modificationsSince(final PackageMaterial material, File baseDir, final Revision revision, SubprocessExecutionContext execCtx) {
PackageMaterialRevision packageMaterialRevision = (PackageMaterialRevision) revision;
PackageRevision previouslyKnownRevision = new PackageRevision(packageMaterialRevision.getRevision(), packageMaterialRevision.getTimestamp(), null, packageMaterialRevision.getData());
PackageConfiguration packageConfiguration = buildPackageConfigurations(material.getPackageDefinition());
RepositoryConfiguration repositoryConfiguration = buildRepositoryConfigurations(material.getPackageDefinition().getRepository());
PackageRevision packageRevision = packageRepositoryExtension.latestModificationSince(material.getPluginId(), packageConfiguration, repositoryConfiguration, previouslyKnownRevision);
return getModifications(packageRevision);
}
use of com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration in project gocd by gocd.
the class PackageMaterialMetadataLoaderTest method shouldFetchPackageMetadataForPluginsWhichImplementPackageRepositoryMaterialExtensionPoint.
@Test
public void shouldFetchPackageMetadataForPluginsWhichImplementPackageRepositoryMaterialExtensionPoint() {
RepositoryConfiguration expectedRepoConfigurations = new RepositoryConfiguration();
com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration expectedPackageConfigurations = new PackageConfiguration();
when(packageRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id())).thenReturn(expectedRepoConfigurations);
when(packageRepositoryExtension.getPackageConfiguration(pluginDescriptor.id())).thenReturn(expectedPackageConfigurations);
metadataLoader.fetchRepositoryAndPackageMetaData(pluginDescriptor);
assertThat(RepositoryMetadataStore.getInstance().getMetadata(pluginDescriptor.id()).getRepositoryConfiguration(), is(expectedRepoConfigurations));
assertThat(PackageMetadataStore.getInstance().getMetadata(pluginDescriptor.id()).getPackageConfiguration(), is(expectedPackageConfigurations));
}
use of com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration in project gocd by gocd.
the class PackageMaterialPluginInfoBuilderTest method setUp.
@BeforeEach
public void setUp() throws Exception {
extension = mock(PackageRepositoryExtension.class);
com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageSettings = new com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration();
packageSettings.add(new PackageMaterialProperty("username", null).with(Property.REQUIRED, true).with(Property.SECURE, false).with(Property.PART_OF_IDENTITY, false).with(Property.DISPLAY_NAME, "foo").with(Property.DISPLAY_ORDER, 1));
packageSettings.add(new PackageMaterialProperty("password", null).with(Property.REQUIRED, true).with(Property.SECURE, true).with(Property.DISPLAY_ORDER, 2));
RepositoryConfiguration repoSettings = new RepositoryConfiguration();
repoSettings.add(new PackageMaterialProperty("foo", null).with(Property.REQUIRED, true).with(Property.SECURE, false).with(Property.DISPLAY_ORDER, 1));
repoSettings.add(new PackageMaterialProperty("bar", null).with(Property.REQUIRED, true).with(Property.SECURE, true).with(Property.DISPLAY_ORDER, 2));
when(extension.getPackageConfiguration("plugin1")).thenReturn(packageSettings);
when(extension.getRepositoryConfiguration("plugin1")).thenReturn(repoSettings);
when(extension.getPluginSettingsView("plugin1")).thenReturn("some-html");
PluginSettingsConfiguration pluginSettingsConfiguration = new PluginSettingsConfiguration();
pluginSettingsConfiguration.add(new PluginSettingsProperty("k1", null).with(Property.REQUIRED, true).with(Property.SECURE, false).with(Property.DISPLAY_ORDER, 3));
when(extension.getPluginSettingsConfiguration("plugin1")).thenReturn(pluginSettingsConfiguration);
}
Aggregations