use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.
the class BuildCoordinationTest method buildConfigSetRecordShouldBeMarkedSuccessWhenAllBuildsAreSuccess.
@Test
public void buildConfigSetRecordShouldBeMarkedSuccessWhenAllBuildsAreSuccess() throws CoreException, TimeoutException, InterruptedException {
BuildConfigurationSet buildConfigurationSet = TestEntitiesFactory.newBuildConfigurationSet();
testProjectConfigurationBuilder.buildConfigurationWithDependencies(buildConfigurationSet);
ObjectWrapper<BuildSetStatus> lastBuildSetStatus = registerCallback(buildConfigurationSet);
BuildOptions buildOptions = new BuildOptions();
buildOptions.setRebuildMode(RebuildMode.FORCE);
BuildSetTask buildSetTask = buildCoordinator.build(buildConfigurationSet, TestEntitiesFactory.newUser(), buildOptions);
Wait.forCondition(lastBuildSetStatus::isSet, 5, ChronoUnit.SECONDS);
// check the result
Assert.assertEquals(BuildSetStatus.DONE, lastBuildSetStatus.get());
Optional<BuildConfigSetRecord> maybeSetRecord = buildSetTask.getBuildConfigSetRecord();
assertThat(maybeSetRecord.isPresent()).isTrue();
Assert.assertEquals(BuildStatus.SUCCESS, maybeSetRecord.get().getStatus());
assertEmptyQueue();
}
use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.
the class BuildCoordinationTest method shouldBuildSetWithOneConfiguration.
@Test
public void shouldBuildSetWithOneConfiguration() throws CoreException, TimeoutException, InterruptedException {
BuildConfigurationSet buildConfigurationSet = TestEntitiesFactory.newBuildConfigurationSet();
testProjectConfigurationBuilder.build(223, "Project-223", buildConfigurationSet);
ObjectWrapper<BuildSetStatus> lastBuildSetStatus = registerCallback(buildConfigurationSet);
BuildOptions buildOptions = new BuildOptions();
buildOptions.setRebuildMode(RebuildMode.IMPLICIT_DEPENDENCY_CHECK);
BuildSetTask buildSetTask = buildCoordinator.build(buildConfigurationSet, TestEntitiesFactory.newUser(), buildOptions);
Wait.forCondition(lastBuildSetStatus::isSet, 5, ChronoUnit.SECONDS);
// check the result
Assert.assertEquals(BuildSetStatus.DONE, lastBuildSetStatus.get());
Optional<BuildConfigSetRecord> maybeSetRecord = buildSetTask.getBuildConfigSetRecord();
assertThat(maybeSetRecord.isPresent()).isTrue();
Assert.assertEquals(BuildStatus.SUCCESS, maybeSetRecord.get().getStatus());
assertEmptyQueue();
}
use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.
the class ProjectBuilder method buildProject.
BuildTask buildProject(BuildConfiguration buildConfiguration, BuildCoordinator buildCoordinator, Consumer<BuildStatusChangedEvent> onStatusUpdate, BuildOptions buildOptions) throws BuildConflictException, InterruptedException, CoreException {
log.debug("Building project {}", buildConfiguration.getName());
List<BuildStatusChangedEvent> receivedStatuses = new CopyOnWriteArrayList<>();
Consumer<BuildStatusChangedEvent> onStatusUpdateInternal = (statusUpdate) -> {
receivedStatuses.add(statusUpdate);
onStatusUpdate.accept(statusUpdate);
};
// Defines a number of callbacks, which are executed after buildStatus update
final Semaphore semaphore = registerReleaseListenersAndAcquireSemaphore(onStatusUpdateInternal, N_STATUS_UPDATES_PER_TASK);
BuildSetTask taskSet = buildCoordinator.build(buildConfiguration, MockUser.newTestUser(1), buildOptions);
Set<BuildTask> buildTasks = taskSet.getBuildTasks();
assertThat(buildTasks).hasSize(1);
BuildTask buildTask = buildTasks.iterator().next();
log.info("Started build task {}", buildTask);
assertBuildStartedSuccessfully(buildTask);
waitForStatusUpdates(N_STATUS_UPDATES_PER_TASK, semaphore, "");
return buildTask;
}
use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.
the class ReadDependenciesTest method createBuildSetTask.
public BuildSetTask createBuildSetTask(BuildConfigurationSet buildConfigurationSet, User user) throws CoreException {
BuildTasksInitializer buildTasksInitializer = new BuildTasksInitializer(datastoreAdapter, 1L);
AtomicInteger atomicInteger = new AtomicInteger(1);
BuildOptions buildOptions = new BuildOptions();
buildOptions.setRebuildMode(RebuildMode.FORCE);
return buildTasksInitializer.createBuildSetTask(buildConfigurationSet, user, buildOptions, () -> Sequence.nextBase32Id(), buildQueue.getUnfinishedTasks());
}
use of org.jboss.pnc.spi.BuildOptions in project pnc by project-ncl.
the class DefaultBuildCoordinatorTest method mockBuildTask.
private BuildTask mockBuildTask() {
BuildConfiguration buildConfiguration = new BuildConfiguration();
buildConfiguration.setId(12);
buildConfiguration.setProject(new Project());
buildConfiguration.setRepositoryConfiguration(RepositoryConfigurationMock.newTestRepository());
buildConfiguration.setBuildEnvironment(BuildEnvironmentMock.newTest());
BuildOptions buildOptions = new BuildOptions(false, true, false, false, RebuildMode.IMPLICIT_DEPENDENCY_CHECK, AlignmentPreference.PREFER_PERSISTENT);
BuildTask buildTask = BuildTask.build(BuildConfigurationAudited.fromBuildConfiguration(buildConfiguration, 13), buildOptions, MockUser.newTestUser(1), "1", null, new Date(), null, "context-id", Optional.empty());
buildTask.setStatus(BuildCoordinationStatus.DONE);
return buildTask;
}
Aggregations