Search in sources :

Example 11 with ObjectWrapper

use of org.jboss.pnc.common.util.ObjectWrapper in project pnc by project-ncl.

the class BuildExecutionTest method shouldNotContinueBuildOnMavenError.

@Test
public void shouldNotContinueBuildOnMavenError() throws ExecutorException, InterruptedException, TimeoutException {
    BuildConfiguration buildConfiguration = configurationBuilder.buildFailingConfiguration(3, "build-failed-on-maven", null);
    Set<BuildExecutionStatusChangedEvent> statusChangedEvents = new HashSet<>();
    ObjectWrapper<BuildResult> buildExecutionResultWrapper = new ObjectWrapper<>();
    runBuild(buildConfiguration, statusChangedEvents, buildExecutionResultWrapper);
    checkBuildStatuses(statusChangedEvents, Arrays.asList(DONE_WITH_ERRORS, BUILD_ENV_DESTROYED, BUILD_ENV_DESTROYING));
    assertNoState(statusChangedEvents, BuildExecutionStatus.COLLECTING_RESULTS_FROM_REPOSITORY_MANAGER);
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) BuildResult(org.jboss.pnc.spi.BuildResult) ObjectWrapper(org.jboss.pnc.common.util.ObjectWrapper) BuildExecutionStatusChangedEvent(org.jboss.pnc.spi.events.BuildExecutionStatusChangedEvent) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 12 with ObjectWrapper

use of org.jboss.pnc.common.util.ObjectWrapper in project pnc by project-ncl.

the class BuildCoordinationTest method registerCallback.

private ObjectWrapper<BuildSetStatus> registerCallback(BuildConfigurationSet buildConfigurationSet) {
    ObjectWrapper<BuildSetStatus> lastBuildSetStatus = new ObjectWrapper<>();
    Consumer<BuildSetStatusChangedEvent> onStatusUpdate = (statusChangedEvent) -> {
        if (statusChangedEvent.getNewStatus().isCompleted()) {
            lastBuildSetStatus.set(statusChangedEvent.getNewStatus());
        }
    };
    BuildSetCallBack buildSetCallBack = new BuildSetCallBack(buildConfigurationSet.getId(), onStatusUpdate);
    buildSetStatusNotifications.subscribe(buildSetCallBack);
    return lastBuildSetStatus;
}
Also used : BuildOptions(org.jboss.pnc.spi.BuildOptions) BuildConfigSetRecord(org.jboss.pnc.model.BuildConfigSetRecord) BuildSetStatus(org.jboss.pnc.spi.BuildSetStatus) Arquillian(org.jboss.arquillian.junit.Arquillian) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) RunWith(org.junit.runner.RunWith) LoggerFactory(org.slf4j.LoggerFactory) BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet) TimeoutException(java.util.concurrent.TimeoutException) WITH_DATASTORE(org.jboss.pnc.coordinator.test.BuildCoordinatorDeployments.Options.WITH_DATASTORE) BuildSetStatusNotifications(org.jboss.pnc.coordinator.notifications.buildSetTask.BuildSetStatusNotifications) RebuildMode(org.jboss.pnc.enums.RebuildMode) DatastoreMock(org.jboss.pnc.mock.datastore.DatastoreMock) Inject(javax.inject.Inject) HashSet(java.util.HashSet) BuildSetTask(org.jboss.pnc.spi.coordinator.BuildSetTask) BuildQueue(org.jboss.pnc.coordinator.builder.BuildQueue) Logger(org.slf4j.Logger) WITH_BPM(org.jboss.pnc.coordinator.test.BuildCoordinatorDeployments.Options.WITH_BPM) BuildCoordinator(org.jboss.pnc.spi.coordinator.BuildCoordinator) Collection(java.util.Collection) DatastoreException(org.jboss.pnc.spi.datastore.DatastoreException) Set(java.util.Set) Test(org.junit.Test) BuildRecord(org.jboss.pnc.model.BuildRecord) BuildStatus(org.jboss.pnc.enums.BuildStatus) Collectors(java.util.stream.Collectors) BuildSetCallBack(org.jboss.pnc.coordinator.notifications.buildSetTask.BuildSetCallBack) TestProjectConfigurationBuilder(org.jboss.pnc.mock.model.builders.TestProjectConfigurationBuilder) Consumer(java.util.function.Consumer) ObjectWrapper(org.jboss.pnc.common.util.ObjectWrapper) CoreException(org.jboss.pnc.spi.exception.CoreException) ChronoUnit(java.time.temporal.ChronoUnit) Assertions.fail(org.assertj.core.api.Assertions.fail) Deployment(org.jboss.arquillian.container.test.api.Deployment) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) TestEntitiesFactory(org.jboss.pnc.mock.model.builders.TestEntitiesFactory) BuildSetStatusChangedEvent(org.jboss.pnc.spi.events.BuildSetStatusChangedEvent) Optional(java.util.Optional) Assert(org.junit.Assert) Wait(org.jboss.pnc.test.util.Wait) BuildSetStatus(org.jboss.pnc.spi.BuildSetStatus) BuildSetCallBack(org.jboss.pnc.coordinator.notifications.buildSetTask.BuildSetCallBack) ObjectWrapper(org.jboss.pnc.common.util.ObjectWrapper) BuildSetStatusChangedEvent(org.jboss.pnc.spi.events.BuildSetStatusChangedEvent)

Aggregations

ObjectWrapper (org.jboss.pnc.common.util.ObjectWrapper)12 Test (org.junit.Test)10 HashSet (java.util.HashSet)9 BuildResult (org.jboss.pnc.spi.BuildResult)9 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)8 BuildExecutionStatusChangedEvent (org.jboss.pnc.spi.events.BuildExecutionStatusChangedEvent)8 LoggerFactory (org.slf4j.LoggerFactory)8 Consumer (java.util.function.Consumer)7 Logger (org.slf4j.Logger)7 Set (java.util.Set)6 Inject (javax.inject.Inject)6 BuildExecutionStatus (org.jboss.pnc.enums.BuildExecutionStatus)6 TestProjectConfigurationBuilder (org.jboss.pnc.mock.model.builders.TestProjectConfigurationBuilder)6 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)6 Deployment (org.jboss.arquillian.container.test.api.Deployment)5 Arquillian (org.jboss.arquillian.junit.Arquillian)5 RunWith (org.junit.runner.RunWith)5 Arrays (java.util.Arrays)4 List (java.util.List)4 TimeoutException (java.util.concurrent.TimeoutException)4