Search in sources :

Example 1 with PackageConfiguration

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);
}
Also used : PackageMaterialRevision(com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialRevision) PackageRevision(com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision) PackageConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)

Example 2 with PackageConfiguration

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;
}
Also used : PackageConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration) PackageConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration)

Example 3 with 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);
}
Also used : PackageConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration) Test(org.junit.Test)

Example 4 with PackageConfiguration

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));
}
Also used : PackageConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration) PackageConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration) Test(org.junit.Test)

Example 5 with PackageConfiguration

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);
}
Also used : PackageRevision(com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision) PackageConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)

Aggregations

PackageConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration)7 RepositoryConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)4 PackageRevision (com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision)2 Test (org.junit.Test)2 PackageMaterialRevision (com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialRevision)1 PackageMaterialProperty (com.thoughtworks.go.plugin.api.material.packagerepository.PackageMaterialProperty)1 Before (org.junit.Before)1