use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.
the class ProjectBuilder method buildProjectsAndWaitForUpdates.
private BuildSetTask buildProjectsAndWaitForUpdates(BuildConfigurationSet buildConfigurationSet, BuildCoordinator buildCoordinator, int nStatusUpdates, Consumer<BuildStatusChangedEvent> onStatusUpdate, List<BuildStatusChangedEvent> receivedStatuses, List<BuildSetStatusChangedEvent> receivedSetStatuses) throws InterruptedException, CoreException {
Consumer<BuildStatusChangedEvent> onStatusUpdateInternal = (statusUpdate) -> {
log.debug("Received status change event [" + (i++) + "]: {}.", statusUpdate);
receivedStatuses.add(statusUpdate);
onStatusUpdate.accept(statusUpdate);
};
final Semaphore semaphore = registerReleaseListenersAndAcquireSemaphore(onStatusUpdateInternal, nStatusUpdates);
final Semaphore buildSetSemaphore = registerBuildSetListeners(receivedSetStatuses, BUILD_SET_STATUS_UPDATES);
BuildOptions buildOptions = new BuildOptions();
buildOptions.setRebuildMode(RebuildMode.FORCE);
BuildSetTask buildSetTask = buildCoordinator.build(buildConfigurationSet, MockUser.newTestUser(1), buildOptions);
assertBuildStartedSuccessfully(buildSetTask);
log.info("Waiting to receive all {} status updates...", nStatusUpdates);
waitForStatusUpdates(nStatusUpdates, semaphore, "");
log.debug("All status updates should be received. Semaphore has {} free entries.", semaphore.availablePermits());
log.info("Waiting to receive all {} build set status updates...", BUILD_SET_STATUS_UPDATES);
waitForStatusUpdates(BUILD_SET_STATUS_UPDATES, buildSetSemaphore, "build set task: " + buildSetTask);
log.debug("All status updates should be received. Semaphore has {} free entries.", semaphore.availablePermits());
return buildSetTask;
}
use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.
the class ReadDependenciesTest method createDependenciesTestCase.
@Test
public void createDependenciesTestCase() throws DatastoreException {
BuildConfigurationSet buildConfigurationSet = configurationBuilder.buildConfigurationSet(1);
User user = User.Builder.newBuilder().id(1).username("test-user").build();
BuildSetTask buildSetTask = null;
try {
buildSetTask = createBuildSetTask(buildConfigurationSet, user);
} catch (CoreException e) {
Assert.fail(e.getMessage());
}
Assert.assertEquals("Missing build tasks in set.", 5, buildSetTask.getBuildTasks().size());
BuildTask buildTask2 = buildSetTask.getBuildTasks().stream().filter(task -> task.getBuildConfigurationAudited().getId().equals(2)).findFirst().get();
Assert.assertEquals("Wrong number of dependencies.", 2, buildTask2.getDependencies().size());
}
use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.
the class TestProjectConfigurationBuilder method buildConfigurationSetWithCycleDependency.
public BuildConfigurationSet buildConfigurationSetWithCycleDependency() {
BuildConfigurationSet buildConfigurationSet = new BuildConfigurationSet();
buildConfigurationSet.setName("test-cycle");
buildConfigurationWithCycleDependency(buildConfigurationSet);
return buildConfigurationSet;
}
use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.
the class TestProjectConfigurationBuilder method buildConfigurationSetWithFailedDependenciesAndDelay.
public BuildConfigurationSet buildConfigurationSetWithFailedDependenciesAndDelay(Integer configurationSetId) {
BuildConfigurationSet buildConfigurationSet = new BuildConfigurationSet();
buildConfigurationSet.setName("test-build-configuration-failed-deps");
buildConfigurationSet.setId(configurationSetId);
buildConfigurationWithTransitiveDependenciesThatFail(buildConfigurationSet);
return buildConfigurationSet;
}
use of org.jboss.pnc.model.BuildConfigurationSet in project pnc by project-ncl.
the class TestProjectConfigurationBuilder method buildConfigurationSet.
public BuildConfigurationSet buildConfigurationSet(Integer configurationSetId) {
BuildConfigurationSet buildConfigurationSet = new BuildConfigurationSet();
buildConfigurationSet.setName("test-build-configuration");
buildConfigurationSet.setId(configurationSetId);
buildConfigurationWithDependencies(buildConfigurationSet);
return buildConfigurationSet;
}
Aggregations