Search in sources :

Example 6 with BuildOptions

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

the class ConfigurationsTest method dependsOnItselfConfigurationTestCase.

// TODO test is not run as expected exception is thrown
@Test(expected = PersistenceException.class)
// configurationBuilder.build...
@InSequence(10)
public void dependsOnItselfConfigurationTestCase() throws Exception {
    BuildConfiguration buildConfiguration = configurationBuilder.buildConfigurationWhichDependsOnItself();
    User user = User.Builder.newBuilder().id(1).build();
    BuildOptions buildOptions = new BuildOptions();
    buildOptions.setBuildDependencies(false);
    BuildSetTask taskSet = buildCoordinator.build(buildConfiguration, user, buildOptions);
    Set<BuildTask> buildTasks = taskSet.getBuildTasks();
    assertThat(buildTasks).hasSize(1);
    BuildTask buildTask = buildTasks.iterator().next();
    Assert.assertEquals(BuildCoordinationStatus.REJECTED, buildTask.getStatus());
    Assert.assertTrue("Invalid status description: " + buildTask.getStatusDescription(), buildTask.getStatusDescription().contains("itself"));
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) User(org.jboss.pnc.model.User) BuildTask(org.jboss.pnc.spi.coordinator.BuildTask) BuildOptions(org.jboss.pnc.spi.BuildOptions) BuildSetTask(org.jboss.pnc.spi.coordinator.BuildSetTask) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 7 with BuildOptions

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

the class ConfigurationsTest method cycleConfigurationTestCase.

// TODO test is not run as expected exception is thrown
@Test(expected = PersistenceException.class)
// configurationBuilder.build...
@InSequence(15)
public void cycleConfigurationTestCase() throws Exception {
    BuildConfigurationSet buildConfigurationSet = configurationBuilder.buildConfigurationSetWithCycleDependency();
    User user = User.Builder.newBuilder().id(1).build();
    BuildOptions buildOptions = new BuildOptions();
    buildOptions.setRebuildMode(RebuildMode.FORCE);
    BuildSetTask buildSetTask = buildCoordinator.build(buildConfigurationSet, user, buildOptions);
    Assert.assertEquals(BuildSetStatus.REJECTED, buildSetTask.getStatus());
    Assert.assertTrue("Invalid status description: " + buildSetTask.getStatusDescription(), buildSetTask.getStatusDescription().contains("Cycle dependencies found"));
}
Also used : BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet) User(org.jboss.pnc.model.User) BuildOptions(org.jboss.pnc.spi.BuildOptions) BuildSetTask(org.jboss.pnc.spi.coordinator.BuildSetTask) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 8 with BuildOptions

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

the class DatastoreAdapterTest method mockBuildTask.

private BuildTask mockBuildTask() {
    BuildConfiguration buildConfiguration = new BuildConfiguration();
    buildConfiguration.setId(12);
    buildConfiguration.setName("Configuration.");
    buildConfiguration.setProject(new Project());
    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), "123", null, new Date(), null, "context-id", Optional.empty());
    buildTask.setStatus(BuildCoordinationStatus.DONE);
    return buildTask;
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) Project(org.jboss.pnc.model.Project) BuildTask(org.jboss.pnc.spi.coordinator.BuildTask) BuildOptions(org.jboss.pnc.spi.BuildOptions) Date(java.util.Date)

Example 9 with BuildOptions

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

the class ExpliciteDependenciesTest method shouldBuildABCOnForceAWithDependencies.

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

Example 10 with BuildOptions

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

the class ExpliciteDependenciesTest method shouldBuildAOnModifiedCWhenImplicitDependencyCheck.

@Test
public void shouldBuildAOnModifiedCWhenImplicitDependencyCheck() throws TimeoutException, InterruptedException {
    // when
    insertNewBuildRecords(c);
    BuildOptions buildOptions = new BuildOptions();
    buildOptions.setBuildDependencies(false);
    buildOptions.setRebuildMode(RebuildMode.IMPLICIT_DEPENDENCY_CHECK);
    build(a, buildOptions);
    // then
    expectBuilt(a);
}
Also used : BuildOptions(org.jboss.pnc.spi.BuildOptions) 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