Search in sources :

Example 21 with PackageMaterial

use of com.thoughtworks.go.config.materials.PackageMaterial in project gocd by gocd.

the class MaterialServiceTest method shouldGetLatestModificationForPackageMaterial.

@Test
public void shouldGetLatestModificationForPackageMaterial() {
    PackageMaterial material = new PackageMaterial();
    PackageDefinition packageDefinition = create("id", "package", new Configuration(), PackageRepositoryMother.create("id", "name", "plugin-id", "plugin-version", new Configuration()));
    material.setPackageDefinition(packageDefinition);
    when(packageRepositoryExtension.getLatestRevision(eq("plugin-id"), any(PackageConfiguration.class), any(RepositoryConfiguration.class))).thenReturn(new PackageRevision("blah-123", new Date(), "user"));
    List<Modification> modifications = materialService.latestModification(material, null, null);
    assertThat(modifications.get(0).getRevision(), is("blah-123"));
}
Also used : SCMPropertyConfiguration(com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration) Configuration(com.thoughtworks.go.domain.config.Configuration) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration) PackageConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration) PackageMaterial(com.thoughtworks.go.config.materials.PackageMaterial) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) 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) Date(java.util.Date) Test(org.junit.Test)

Example 22 with PackageMaterial

use of com.thoughtworks.go.config.materials.PackageMaterial in project gocd by gocd.

the class PackageMaterialPollerTest method setup.

@Before
public void setup() {
    //setup material
    material = new PackageMaterial();
    PackageRepository packageRepository = PackageRepositoryMother.create("id", "name", "plugin-id", "plugin-version", new Configuration(ConfigurationPropertyMother.create("url", false, "http://some-url")));
    PackageDefinition packageDefinition = create("id", "package", new Configuration(ConfigurationPropertyMother.create("name", false, "go-agent"), ConfigurationPropertyMother.create("secure", true, "value")), packageRepository);
    material.setPackageDefinition(packageDefinition);
    packageRepositoryExtension = mock(PackageRepositoryExtension.class);
    poller = new com.thoughtworks.go.server.service.materials.PackageMaterialPoller(packageRepositoryExtension);
    packageConfiguration = ArgumentCaptor.forClass(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration.class);
    repositoryConfiguration = ArgumentCaptor.forClass(RepositoryConfiguration.class);
}
Also used : Configuration(com.thoughtworks.go.domain.config.Configuration) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration) PackageMaterial(com.thoughtworks.go.config.materials.PackageMaterial) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) PackageRepository(com.thoughtworks.go.domain.packagerepository.PackageRepository) PackageRepositoryExtension(com.thoughtworks.go.plugin.access.packagematerial.PackageRepositoryExtension) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration) Before(org.junit.Before)

Example 23 with PackageMaterial

use of com.thoughtworks.go.config.materials.PackageMaterial in project gocd by gocd.

the class PackageMaterialPollerTest method shouldPopulatePackageModificationComment_WithTrackbackUrlAndComment.

@Test
public void shouldPopulatePackageModificationComment_WithTrackbackUrlAndComment() throws Exception {
    PackageRevision packageRevision = new PackageRevision(null, null, null, "Built on host1", "http://google.com");
    PackageMaterial packageMaterial = MaterialsMother.packageMaterial();
    when(packageRepositoryExtension.getLatestRevision(eq(packageMaterial.getPluginId()), any(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration.class), any(RepositoryConfiguration.class))).thenReturn(packageRevision);
    List<Modification> modifications = poller.latestModification(packageMaterial, null, null);
    assertThat(modifications.get(0).getComment(), jsonEquals("{\"COMMENT\":\"Built on host1\",\"TRACKBACK_URL\":\"http://google.com\",\"TYPE\":\"PACKAGE_MATERIAL\"}"));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) PackageMaterial(com.thoughtworks.go.config.materials.PackageMaterial) PackageRevision(com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration) Test(org.junit.Test)

Aggregations

PackageMaterial (com.thoughtworks.go.config.materials.PackageMaterial)23 Test (org.junit.Test)18 PackageDefinition (com.thoughtworks.go.domain.packagerepository.PackageDefinition)6 RepositoryConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)5 File (java.io.File)5 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)4 MaterialInstance (com.thoughtworks.go.domain.MaterialInstance)4 Configuration (com.thoughtworks.go.domain.config.Configuration)4 Modification (com.thoughtworks.go.domain.materials.Modification)4 PackageRevision (com.thoughtworks.go.plugin.api.material.packagerepository.PackageRevision)4 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)3 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)3 Modifications (com.thoughtworks.go.domain.materials.Modifications)3 Date (java.util.Date)3 Materials (com.thoughtworks.go.config.materials.Materials)2 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)2 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)2 PackageMaterialRevision (com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialRevision)2 PackageRepository (com.thoughtworks.go.domain.packagerepository.PackageRepository)2 SCM (com.thoughtworks.go.domain.scm.SCM)2