Search in sources :

Example 41 with PackageDefinition

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);
}
Also used : PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) Configuration(com.thoughtworks.go.domain.config.Configuration) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition)

Example 42 with 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));
}
Also used : PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) PackageRepository(com.thoughtworks.go.domain.packagerepository.PackageRepository) Test(org.junit.Test)

Example 43 with PackageDefinition

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));
}
Also used : Configuration(com.thoughtworks.go.domain.config.Configuration) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) PackageRepository(com.thoughtworks.go.domain.packagerepository.PackageRepository) Test(org.junit.Test)

Example 44 with PackageDefinition

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;
}
Also used : Configuration(com.thoughtworks.go.domain.config.Configuration) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) PackageRepository(com.thoughtworks.go.domain.packagerepository.PackageRepository)

Example 45 with PackageDefinition

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

Aggregations

PackageDefinition (com.thoughtworks.go.domain.packagerepository.PackageDefinition)69 Test (org.junit.Test)47 PackageRepository (com.thoughtworks.go.domain.packagerepository.PackageRepository)41 PackageRepositories (com.thoughtworks.go.domain.packagerepository.PackageRepositories)28 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)12 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)12 Configuration (com.thoughtworks.go.domain.config.Configuration)12 Packages (com.thoughtworks.go.domain.packagerepository.Packages)12 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)9 PackageMaterial (com.thoughtworks.go.config.materials.PackageMaterial)7 Serializable (java.io.Serializable)7 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)6 Before (org.junit.Before)6 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)4 RepositoryConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)4 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)3 SCM (com.thoughtworks.go.domain.scm.SCM)3 GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)3 Username (com.thoughtworks.go.server.domain.Username)3 Timestamp (java.sql.Timestamp)3