Search in sources :

Example 16 with BuildConfiguration

use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.

the class BuildExecutionTest method testBuild.

@Test
public void testBuild() throws ExecutorException, TimeoutException, InterruptedException, BuildDriverException {
    BuildConfiguration buildConfiguration = configurationBuilder.build(1, "c1-java");
    Set<BuildExecutionStatusChangedEvent> statusChangedEvents = new HashSet<>();
    ObjectWrapper<BuildResult> buildExecutionResultWrapper = new ObjectWrapper<>();
    runBuild(buildConfiguration, statusChangedEvents, buildExecutionResultWrapper);
    List<BuildExecutionStatus> expectedStatuses = getBuildExecutionStatusesSuccess();
    // check build statuses
    checkBuildStatuses(statusChangedEvents, expectedStatuses);
    // check results
    BuildResult buildResult = buildExecutionResultWrapper.get();
    // check results: logs
    BuildDriverResult buildDriverResult = buildResult.getBuildDriverResult().get();
    String buildLog = buildDriverResult.getBuildLog();
    Assert.assertTrue("Invalid build log.", buildLog.contains("Finished: SUCCESS"));
    // check results: artifacts
    RepositoryManagerResult repositoryManagerResult = buildResult.getRepositoryManagerResult().get();
    Assert.assertTrue("Missing build artifacts.", repositoryManagerResult.getBuiltArtifacts().size() > 0);
    Assert.assertTrue("Missing build dependencies.", repositoryManagerResult.getDependencies().size() > 0);
    Artifact artifact = repositoryManagerResult.getBuiltArtifacts().iterator().next();
    Assert.assertTrue("Invalid built artifact in the result.", artifact.getIdentifier().startsWith(ArtifactBuilder.IDENTIFIER_PREFIX));
}
Also used : BuildDriverResult(org.jboss.pnc.spi.builddriver.BuildDriverResult) RepositoryManagerResult(org.jboss.pnc.spi.repositorymanager.RepositoryManagerResult) BuildExecutionStatus(org.jboss.pnc.enums.BuildExecutionStatus) Artifact(org.jboss.pnc.model.Artifact) BuildExecutionStatusChangedEvent(org.jboss.pnc.spi.events.BuildExecutionStatusChangedEvent) BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) BuildResult(org.jboss.pnc.spi.BuildResult) ObjectWrapper(org.jboss.pnc.common.util.ObjectWrapper) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 17 with BuildConfiguration

use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.

the class TestProjectConfigurationBuilder method buildFailingConfiguration.

public BuildConfiguration buildFailingConfiguration(int id, String name, BuildConfigurationSet buildConfigurationSet) {
    BuildConfiguration buildConfiguration = build(id, name, buildConfigurationSet);
    buildConfiguration.setBuildScript(FAIL);
    return buildConfiguration;
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration)

Example 18 with BuildConfiguration

use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.

the class TestProjectConfigurationBuilder method buildConfigurationWithTransitiveDependenciesThatFail.

public BuildConfiguration buildConfigurationWithTransitiveDependenciesThatFail(BuildConfigurationSet buildConfigurationSet) {
    BuildConfiguration buildConfiguration1 = build(1, "with-dependencies-1", buildConfigurationSet);
    BuildConfiguration buildConfiguration2 = build(2, "with-dependencies-2", buildConfigurationSet);
    BuildConfiguration buildConfiguration3 = buildFailingConfiguration(3, "with-dependencies-3", buildConfigurationSet);
    buildConfiguration1.addDependency(buildConfiguration2);
    buildConfiguration2.addDependency(buildConfiguration3);
    return buildConfiguration1;
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration)

Example 19 with BuildConfiguration

use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.

the class TestProjectConfigurationBuilder method buildConfigurationForCancelling.

public BuildConfiguration buildConfigurationForCancelling(BuildConfigurationSet buildConfigurationSet) {
    BuildConfiguration buildConfiguration1 = build(1, "with-dependency-1-on-2", buildConfigurationSet);
    BuildConfiguration buildConfiguration2 = build(2, "with-dependency-2-on-3", buildConfigurationSet);
    BuildConfiguration buildConfiguration3 = build(3, "not-dependent", buildConfigurationSet);
    // CANCEL script means, that the build waits for 1 sec and then completes itself, gives time to cancel
    buildConfiguration2.setBuildScript(CANCEL);
    buildConfiguration1.addDependency(buildConfiguration2);
    buildConfiguration2.addDependency(buildConfiguration3);
    return buildConfiguration1;
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration)

Example 20 with BuildConfiguration

use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.

the class TestProjectConfigurationBuilder method buildFailingWithDelayConfiguration.

public BuildConfiguration buildFailingWithDelayConfiguration(int id, String name, BuildConfigurationSet buildConfigurationSet) {
    BuildConfiguration buildConfiguration = build(id, name, buildConfigurationSet);
    buildConfiguration.setBuildScript(FAIL_WITH_DELAY);
    return buildConfiguration;
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration)

Aggregations

BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)65 Test (org.junit.Test)23 BuildConfigurationAudited (org.jboss.pnc.model.BuildConfigurationAudited)11 HashSet (java.util.HashSet)10 BuildRecord (org.jboss.pnc.model.BuildRecord)9 Project (org.jboss.pnc.model.Project)9 BuildOptions (org.jboss.pnc.spi.BuildOptions)9 BuildResult (org.jboss.pnc.spi.BuildResult)9 Logger (org.slf4j.Logger)9 LoggerFactory (org.slf4j.LoggerFactory)9 List (java.util.List)8 Set (java.util.Set)8 Inject (javax.inject.Inject)8 ObjectWrapper (org.jboss.pnc.common.util.ObjectWrapper)8 BuildConfigurationSet (org.jboss.pnc.model.BuildConfigurationSet)8 BuildExecutionStatusChangedEvent (org.jboss.pnc.spi.events.BuildExecutionStatusChangedEvent)8 IdRev (org.jboss.pnc.model.IdRev)7 BuildSetTask (org.jboss.pnc.spi.coordinator.BuildSetTask)7 BuildTask (org.jboss.pnc.spi.coordinator.BuildTask)7 Collectors (java.util.stream.Collectors)5