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"));
}
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);
}
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\"}"));
}
Aggregations