Search in sources :

Example 11 with BuildOptions

use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.

the class ExpliciteDependenciesTest method shouldBuildAOnModifiedB.

@Test
public void shouldBuildAOnModifiedB() throws TimeoutException, InterruptedException {
    // when
    insertNewBuildRecords(b);
    BuildOptions buildOptions = new BuildOptions();
    buildOptions.setRebuildMode(RebuildMode.EXPLICIT_DEPENDENCY_CHECK);
    build(a, buildOptions);
    // then
    expectBuilt(a);
}
Also used : BuildOptions(org.jboss.pnc.spi.BuildOptions) Test(org.junit.Test)

Example 12 with BuildOptions

use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.

the class ExpliciteDependenciesTest method shouldNotBuildAOnModifiedC.

@Test
public void shouldNotBuildAOnModifiedC() throws TimeoutException, InterruptedException {
    // when
    insertNewBuildRecords(c);
    BuildOptions buildOptions = new BuildOptions();
    buildOptions.setRebuildMode(RebuildMode.EXPLICIT_DEPENDENCY_CHECK);
    build(a, buildOptions);
    // then
    expectBuilt();
}
Also used : BuildOptions(org.jboss.pnc.spi.BuildOptions) Test(org.junit.Test)

Example 13 with BuildOptions

use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.

the class SkippingBuiltConfigsTest method shouldTriggerTheSameBuildConfigurationWithNewRevision.

@Test
public void shouldTriggerTheSameBuildConfigurationWithNewRevision() throws Exception {
    coordinator.start();
    buildRecordRepository.clear();
    // given
    BuildConfiguration testConfiguration = config("shouldRejectBCWithNewRevision");
    BuildOptions buildOptions = new BuildOptions();
    buildOptions.setBuildDependencies(false);
    // when
    coordinator.build(testConfiguration, user, buildOptions);
    BuildConfiguration updatedConfiguration = updateConfiguration(testConfiguration);
    BuildSetTask buildSetTask;
    boolean rejected = false;
    try {
        buildSetTask = coordinator.build(updatedConfiguration, user, buildOptions);
    } catch (BuildConflictException e) {
        rejected = true;
    }
    // then
    Assert.assertFalse("The task was rejected.", rejected);
    waitForEmptyBuildQueue();
    assertThat(getNonRejectedBuildRecords().size()).isEqualTo(2);
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) BuildOptions(org.jboss.pnc.spi.BuildOptions) BuildSetTask(org.jboss.pnc.spi.coordinator.BuildSetTask) BuildConflictException(org.jboss.pnc.spi.exception.BuildConflictException) Test(org.junit.Test)

Example 14 with BuildOptions

use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.

the class SkippingBuiltConfigsTest method shouldRerunTheSameBuildConfigurationSetIfRebuildAllIsSpecified.

@Test
public void shouldRerunTheSameBuildConfigurationSetIfRebuildAllIsSpecified() throws Exception {
    // when
    BuildOptions buildOptions = new BuildOptions();
    buildOptions.setRebuildMode(RebuildMode.FORCE);
    // first build
    coordinator.build(configSet, user, buildOptions);
    waitForEmptyBuildQueue();
    // forced rebuild build
    coordinator.build(configSet, user, buildOptions);
    waitForEmptyBuildQueue();
    // then
    List<BuildRecord> buildRecords = getNonRejectedBuildRecords();
    logRecords(buildRecords);
    assertThat(buildRecords.size()).isEqualTo(2 * configSet.getBuildConfigurations().size());
}
Also used : BuildOptions(org.jboss.pnc.spi.BuildOptions) BuildRecord(org.jboss.pnc.model.BuildRecord) Test(org.junit.Test)

Example 15 with BuildOptions

use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.

the class SkippingBuiltConfigsTest method shouldNotBuildTheSameBuildConfigurationTwice.

@Test
public void shouldNotBuildTheSameBuildConfigurationTwice() throws Exception {
    coordinator.start();
    buildRecordRepository.clear();
    // given
    BuildConfiguration testConfiguration = config("shouldNotBuildTheSameBuildConfigurationTwice");
    BuildOptions buildOptions = new BuildOptions();
    buildOptions.setBuildDependencies(false);
    // when
    coordinator.build(testConfiguration, user, buildOptions);
    waitForEmptyBuildQueue();
    coordinator.build(testConfiguration, user, buildOptions);
    waitForEmptyBuildQueue();
    // then
    // there should be one non build
    assertThat(getNonRejectedBuildRecords().size()).isEqualTo(1);
    // there should be stored one NO_REBUILD_REQUIRED
    List<BuildRecord> collectNoRebuildRequired = buildRecordRepository.queryAll().stream().filter(r -> r.getStatus() == BuildStatus.NO_REBUILD_REQUIRED).collect(Collectors.toList());
    assertThat(collectNoRebuildRequired.size()).isEqualTo(1);
    assertThat(collectNoRebuildRequired.iterator().next().getNoRebuildCause()).isNotNull();
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BuildOptions(org.jboss.pnc.spi.BuildOptions) BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) Logger(org.slf4j.Logger) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) DatastoreException(org.jboss.pnc.spi.datastore.DatastoreException) LoggerFactory(org.slf4j.LoggerFactory) BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) BuildRecord(org.jboss.pnc.model.BuildRecord) Mockito.spy(org.mockito.Mockito.spy) RebuildMode(org.jboss.pnc.enums.RebuildMode) Collectors(java.util.stream.Collectors) BuildStatus(org.jboss.pnc.enums.BuildStatus) ArrayList(java.util.ArrayList) List(java.util.List) ConfigurationParseException(org.jboss.pnc.common.json.ConfigurationParseException) BuildSetTask(org.jboss.pnc.spi.coordinator.BuildSetTask) Assert(org.junit.Assert) BuildConflictException(org.jboss.pnc.spi.exception.BuildConflictException) BuildConfigurationRepositoryMock(org.jboss.pnc.mock.repository.BuildConfigurationRepositoryMock) Before(org.junit.Before) BuildOptions(org.jboss.pnc.spi.BuildOptions) BuildRecord(org.jboss.pnc.model.BuildRecord) Test(org.junit.Test)

Aggregations

BuildOptions (org.jboss.pnc.spi.BuildOptions)35 Test (org.junit.Test)21 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)11 BuildSetTask (org.jboss.pnc.spi.coordinator.BuildSetTask)10 BuildConfigurationSet (org.jboss.pnc.model.BuildConfigurationSet)9 BuildTask (org.jboss.pnc.spi.coordinator.BuildTask)9 BuildRecord (org.jboss.pnc.model.BuildRecord)8 BuildConfigSetRecord (org.jboss.pnc.model.BuildConfigSetRecord)5 BuildSetStatus (org.jboss.pnc.spi.BuildSetStatus)5 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)4 BuildStatus (org.jboss.pnc.enums.BuildStatus)4 DatastoreMock (org.jboss.pnc.mock.datastore.DatastoreMock)4 TestProjectConfigurationBuilder (org.jboss.pnc.mock.model.builders.TestProjectConfigurationBuilder)4 BuildCoordinator (org.jboss.pnc.spi.coordinator.BuildCoordinator)4 BuildStatusChangedEvent (org.jboss.pnc.spi.events.BuildStatusChangedEvent)4 BuildConflictException (org.jboss.pnc.spi.exception.BuildConflictException)4 CoreException (org.jboss.pnc.spi.exception.CoreException)4 Collections (java.util.Collections)3 Date (java.util.Date)3 List (java.util.List)3