use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class GoConfigMaterialsTest method getPackageMaterialConfigWithAutoUpdateFalse.
private PackageMaterialConfig getPackageMaterialConfigWithAutoUpdateFalse() {
PackageDefinition packageDefinition = new PackageDefinition("packageWithAutoUpdateFalse", "DLF Package", new Configuration());
packageDefinition.setRepository(PackageRepositoryMother.create("DLF"));
packageDefinition.setAutoUpdate(false);
return new PackageMaterialConfig(new CaseInsensitiveString("JamesBond"), "packageWithAutoUpdateFalse", packageDefinition);
}
use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class GoConfigGraphWalkerTest method shouldNotWalkFieldsWhichAreTaggedWithIgnoreTraversal.
@Test
public void shouldNotWalkFieldsWhichAreTaggedWithIgnoreTraversal() {
PackageRepository repository = mock(PackageRepository.class);
PackageDefinition packageDefinition = new PackageDefinition();
packageDefinition.setRepository(repository);
new GoConfigGraphWalker(packageDefinition).walk(new GoConfigGraphWalker.Handler() {
@Override
public void handle(Validatable validatable, ValidationContext ctx) {
validatable.validate(ctx);
}
});
verify(repository, never()).validate(any(ValidationContext.class));
}
use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class PackageMaterialConfigTest method shouldCheckEquals.
@Test
public void shouldCheckEquals() throws Exception {
PackageRepository repository = PackageRepositoryMother.create("repo-id", "repo-name", "pluginid", "version", new Configuration(ConfigurationPropertyMother.create("k1", false, "v1")));
PackageDefinition packageDefinition = PackageDefinitionMother.create("p-id", "package-name", new Configuration(ConfigurationPropertyMother.create("k2", false, "v2")), repository);
PackageMaterialConfig p1 = new PackageMaterialConfig();
p1.setPackageDefinition(packageDefinition);
PackageMaterialConfig p2 = new PackageMaterialConfig();
p2.setPackageDefinition(packageDefinition);
assertThat(p1.equals(p2), is(true));
p1 = new PackageMaterialConfig();
p2 = new PackageMaterialConfig();
assertThat(p1.equals(p2), is(true));
p2.setPackageDefinition(packageDefinition);
assertThat(p1.equals(p2), is(false));
p1.setPackageDefinition(packageDefinition);
p2 = new PackageMaterialConfig();
assertThat(p1.equals(p2), is(false));
assertThat(p1.equals(null), is(false));
}
use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class MaterialConfigsMother method packageMaterialConfig.
public static PackageMaterialConfig packageMaterialConfig(String repoName, String packageName) {
PackageMaterialConfig material = new PackageMaterialConfig("p-id");
PackageRepository repository = PackageRepositoryMother.create("repo-id", repoName, "pluginid", "version", new Configuration(ConfigurationPropertyMother.create("k1", false, "repo-v1"), ConfigurationPropertyMother.create("k2", false, "repo-v2")));
PackageDefinition packageDefinition = PackageDefinitionMother.create("p-id", packageName, new Configuration(ConfigurationPropertyMother.create("k3", false, "package-v1")), repository);
material.setPackageDefinition(packageDefinition);
repository.getPackages().add(packageDefinition);
return material;
}
use of com.thoughtworks.go.domain.packagerepository.PackageDefinition 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"));
}
Aggregations