Search in sources :

Example 1 with Result

use of hudson.model.Result in project hudson-2.x by hudson.

the class MatrixProjectTest method testSetTouchStoneResultConditionDifferentValues.

@Test
public void testSetTouchStoneResultConditionDifferentValues() throws IOException {
    Result parentResultCondition = Result.SUCCESS;
    Result childResultCondition = Result.FAILURE;
    MatrixProject parentProject = new MatrixProjectMock("parent");
    parentProject.setTouchStoneResultCondition(parentResultCondition);
    MatrixProject childProject1 = new MatrixProjectMock("child1");
    childProject1.setCascadingProject(parentProject);
    childProject1.setTouchStoneResultCondition(childResultCondition);
    assertEquals(childProject1.getTouchStoneResultCondition(), childResultCondition);
}
Also used : Result(hudson.model.Result) Test(org.junit.Test)

Example 2 with Result

use of hudson.model.Result in project hudson-2.x by hudson.

the class ArtifactArchiver method prebuild.

@Override
public boolean prebuild(AbstractBuild<?, ?> build, BuildListener listener) {
    if (latestOnly) {
        AbstractBuild<?, ?> b = build.getProject().getLastCompletedBuild();
        Result bestResultSoFar = Result.NOT_BUILT;
        while (b != null) {
            if (b.getResult().isBetterThan(bestResultSoFar)) {
                bestResultSoFar = b.getResult();
            } else {
                // remove old artifacts
                File ad = b.getArtifactsDir();
                if (ad.exists()) {
                    listener.getLogger().println(Messages.ArtifactArchiver_DeletingOld(b.getDisplayName()));
                    try {
                        Util.deleteRecursive(ad);
                    } catch (IOException e) {
                        e.printStackTrace(listener.error(e.getMessage()));
                    }
                }
            }
            b = b.getPreviousBuild();
        }
    }
    return true;
}
Also used : IOException(java.io.IOException) File(java.io.File) Result(hudson.model.Result)

Example 3 with Result

use of hudson.model.Result in project hudson-2.x by hudson.

the class MatrixProjectTest method testGetTouchStoneResultConditionParentValue.

@Test
public void testGetTouchStoneResultConditionParentValue() throws IOException {
    Result parentResultCondition = Result.SUCCESS;
    MatrixProject parentProject = new MatrixProjectMock("parent");
    parentProject.setTouchStoneResultCondition(parentResultCondition);
    MatrixProject childProject1 = new MatrixProjectMock("child1");
    childProject1.setCascadingProject(parentProject);
    assertEquals(childProject1.getTouchStoneResultCondition(), parentResultCondition);
}
Also used : Result(hudson.model.Result) Test(org.junit.Test)

Example 4 with Result

use of hudson.model.Result in project hudson-2.x by hudson.

the class MatrixProjectTest method testSetTouchStoneResultConditionParentNull.

@Test
public void testSetTouchStoneResultConditionParentNull() throws IOException {
    Result childResultCondition = Result.FAILURE;
    MatrixProject childProject1 = new MatrixProjectMock("child1");
    childProject1.setTouchStoneResultCondition(childResultCondition);
    assertEquals(childProject1.getTouchStoneResultCondition(), childResultCondition);
}
Also used : Result(hudson.model.Result) Test(org.junit.Test)

Example 5 with Result

use of hudson.model.Result in project hudson-2.x by hudson.

the class MatrixProjectTest method testSetTouchStoneResultConditionTheSameValues.

@Test
public void testSetTouchStoneResultConditionTheSameValues() throws IOException {
    Result parentResultCondition = Result.SUCCESS;
    MatrixProject parentProject = new MatrixProjectMock("parent");
    parentProject.setTouchStoneResultCondition(parentResultCondition);
    MatrixProject childProject1 = new MatrixProjectMock("child1");
    childProject1.setCascadingProject(parentProject);
    childProject1.setTouchStoneResultCondition(parentResultCondition);
    assertEquals(childProject1.getTouchStoneResultCondition(), parentResultCondition);
}
Also used : Result(hudson.model.Result) Test(org.junit.Test)

Aggregations

Result (hudson.model.Result)9 Test (org.junit.Test)5 AbstractBuild (hudson.model.AbstractBuild)2 EnvVars (hudson.EnvVars)1 AbstractProject (hudson.model.AbstractProject)1 PromotionBadge (hudson.plugins.promoted_builds.PromotionBadge)1 File (java.io.File)1 IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1 WorkflowRun (org.jenkinsci.plugins.workflow.job.WorkflowRun)1