use of com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration 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.PackageConfiguration in project gocd by gocd.
the class PackageMaterialPoller method buildPackageConfigurations.
private com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration buildPackageConfigurations(PackageDefinition packageDefinition) {
com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = new com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration();
populateConfiguration(packageDefinition.getConfiguration(), packageConfiguration);
return packageConfiguration;
}
use of com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration in project gocd by gocd.
the class JsonMessageHandler1_0Test method shouldBuildPackageConfigurationFromResponseBody.
@Test
public void shouldBuildPackageConfigurationFromResponseBody() throws Exception {
String responseBody = "{" + "\"key-one\":{}," + "\"key-two\":{\"default-value\":\"two\",\"part-of-identity\":true,\"secure\":true,\"required\":true,\"display-name\":\"display-two\",\"display-order\":\"1\"}," + "\"key-three\":{\"default-value\":\"three\",\"part-of-identity\":false,\"secure\":false,\"required\":false,\"display-name\":\"display-three\",\"display-order\":\"2\"}" + "}";
com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = messageHandler.responseMessageForPackageConfiguration(responseBody);
assertPropertyConfiguration((PackageMaterialProperty) packageConfiguration.get("key-one"), "key-one", null, true, true, false, "", 0);
assertPropertyConfiguration((PackageMaterialProperty) packageConfiguration.get("key-two"), "key-two", "two", true, true, true, "display-two", 1);
assertPropertyConfiguration((PackageMaterialProperty) packageConfiguration.get("key-three"), "key-three", "three", false, false, false, "display-three", 2);
}
use of com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration 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.PackageConfiguration in project gocd by gocd.
the class PackageMaterialPoller method latestModification.
@Override
public List<Modification> latestModification(final PackageMaterial material, File baseDir, SubprocessExecutionContext execCtx) {
PackageConfiguration packageConfiguration = buildPackageConfigurations(material.getPackageDefinition());
RepositoryConfiguration repositoryConfiguration = buildRepositoryConfigurations(material.getPackageDefinition().getRepository());
PackageRevision packageRevision = packageRepositoryExtension.getLatestRevision(material.getPluginId(), packageConfiguration, repositoryConfiguration);
return getModifications(packageRevision);
}
Aggregations