Search in sources :

Example 6 with BuildConfigurationSet

use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.

the class TestProjectConfigurationBuilder method buildConfigurationSetForCancel.

public BuildConfigurationSet buildConfigurationSetForCancel(Integer configurationSetId) {
    BuildConfigurationSet buildConfigurationSet = new BuildConfigurationSet();
    buildConfigurationSet.setName("test-build-cancel-configuration");
    buildConfigurationSet.setId(configurationSetId);
    buildConfigurationForCancelling(buildConfigurationSet);
    return buildConfigurationSet;
}
Also used : BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet)

Example 7 with BuildConfigurationSet

use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.

the class TestProjectConfigurationBuilder method buildConfigurationSetWithFailedDependencies.

public BuildConfigurationSet buildConfigurationSetWithFailedDependencies(Integer configurationSetId) {
    BuildConfigurationSet buildConfigurationSet = new BuildConfigurationSet();
    buildConfigurationSet.setName("test-build-configuration-failed-deps");
    buildConfigurationSet.setId(configurationSetId);
    buildConfigurationWithDependenciesThatFail(buildConfigurationSet);
    return buildConfigurationSet;
}
Also used : BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet)

Example 8 with BuildConfigurationSet

use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.

the class GroupConfigurationProviderTest method fill.

@Before
public void fill() {
    final BuildConfigurationSet a = prepareBuildConfigSet("Wu-tang clan", false);
    final BuildConfigurationSet b = prepareBuildConfigSet("Ain't nothing", false);
    final BuildConfigurationSet c = prepareBuildConfigSet("To frick with!", false);
    List<BuildConfigurationSet> configs = new ArrayList<>(Arrays.asList(new BuildConfigurationSet[] { a, b, c, bcs }));
    fillRepository(configs);
}
Also used : BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Example 9 with BuildConfigurationSet

use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.

the class BuildConfigurationProviderImpl method restoreRevision.

@Override
public Optional<BuildConfiguration> restoreRevision(String id, int rev) {
    IdRev idRev = new IdRev(Integer.valueOf(id), rev);
    BuildConfigurationAudited buildConfigurationAudited = buildConfigurationAuditedRepository.queryById(idRev);
    org.jboss.pnc.model.BuildConfiguration originalBC = repository.queryById(Integer.valueOf(id));
    org.jboss.pnc.model.User user = userService.currentUser();
    if (buildConfigurationAudited == null || originalBC == null) {
        return Optional.empty();
    }
    originalBC.setName(buildConfigurationAudited.getName());
    originalBC.setBuildScript(buildConfigurationAudited.getBuildScript());
    originalBC.setRepositoryConfiguration(buildConfigurationAudited.getRepositoryConfiguration());
    originalBC.setScmRevision(buildConfigurationAudited.getScmRevision());
    originalBC.setBuildType(buildConfigurationAudited.getBuildType());
    originalBC.setBuildEnvironment(buildConfigurationAudited.getBuildEnvironment());
    originalBC.setGenericParameters(buildConfigurationAudited.getGenericParameters());
    originalBC.setLastModificationUser(user);
    org.jboss.pnc.model.BuildConfiguration newBc = repository.save(originalBC);
    newBc.getBuildConfigurationSets().forEach(BuildConfigurationSet::getId);
    newBc.getDependencies().forEach(org.jboss.pnc.model.BuildConfiguration::getId);
    repository.flushAndRefresh(newBc);
    return Optional.of(mapper.toDTO(newBc));
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited) BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet) IdRev(org.jboss.pnc.model.IdRev)

Example 10 with BuildConfigurationSet

use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.

the class GroupConfigurationProviderImpl method validateBeforeUpdating.

@Override
protected void validateBeforeUpdating(Integer id, GroupConfiguration restEntity) {
    super.validateBeforeUpdating(id, restEntity);
    BuildConfigurationSet dbEntity = findInDB(id);
    if (dbEntity.isArchived()) {
        throw new RepositoryViolationException("The Group Config " + id + " is already deleted.");
    }
}
Also used : BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet) RepositoryViolationException(org.jboss.pnc.facade.validation.RepositoryViolationException)

Aggregations

BuildConfigurationSet (org.jboss.pnc.model.BuildConfigurationSet)29 BuildSetTask (org.jboss.pnc.spi.coordinator.BuildSetTask)11 Test (org.junit.Test)11 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)8 BuildOptions (org.jboss.pnc.spi.BuildOptions)8 BuildSetStatus (org.jboss.pnc.spi.BuildSetStatus)5 BuildTask (org.jboss.pnc.spi.coordinator.BuildTask)5 CoreException (org.jboss.pnc.spi.exception.CoreException)5 Inject (javax.inject.Inject)4 BuildConfigSetRecord (org.jboss.pnc.model.BuildConfigSetRecord)4 BuildCoordinator (org.jboss.pnc.spi.coordinator.BuildCoordinator)4 Logger (org.slf4j.Logger)4 LoggerFactory (org.slf4j.LoggerFactory)4 HashSet (java.util.HashSet)3 List (java.util.List)3 Set (java.util.Set)3 Consumer (java.util.function.Consumer)3 BuildStatus (org.jboss.pnc.enums.BuildStatus)3 BuildSetStatusChangedEvent (org.jboss.pnc.spi.events.BuildSetStatusChangedEvent)3 ArrayList (java.util.ArrayList)2