Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-16636] Updated test and added ANY test
  • Loading branch information
wolfgarnet committed Feb 5, 2013
1 parent 585b28e commit e1555bf
Showing 1 changed file with 25 additions and 5 deletions.
Expand Up @@ -4,6 +4,7 @@
import hudson.model.Project;
import hudson.model.Result;
import hudson.scm.PollingResult;
import net.praqma.clearcase.test.annotations.ClearCaseUniqueVobName;
import net.praqma.clearcase.test.junit.ClearCaseRule;
import net.praqma.clearcase.ucm.entities.Baseline;
import net.praqma.hudson.test.BaseTestClass;
Expand Down Expand Up @@ -33,15 +34,34 @@ public class JENKINS16636 extends BaseTestClass {

@Test
@TestDescription( title = "JENKINS-16636", text = "No new baseline found --> But the job builds anyway" )
@ClearCaseUniqueVobName( name = "NORMAL" )
public void jenkins16636() throws Exception {
Project project = new CCUCMRule.ProjectCreator( "JENKINS-16636", "_System@" + ccenv.getPVob(), "one_int@" + ccenv.getPVob() ).setType( child ).getProject();
Project project = new CCUCMRule.ProjectCreator( "JENKINS-16636", "_System@" + ccenv.getPVob(), "one_int@" + ccenv.getPVob() ).getProject();

/* We need a first job to be able to poll! */
new CCUCMRule.ProjectBuilder( project ).build();
/* First build must be a success, because there is a valid baseline.
* This build is done because we need a previous action object */
AbstractBuild build1 = new CCUCMRule.ProjectBuilder( project ).build();
new SystemValidator( build1 ).validateBuild( Result.SUCCESS ).validate();

PollingResult result = project.poll( jenkins.createTaskListener() );
/* Because there are no new baselines, the build must fail */
AbstractBuild build2 = new CCUCMRule.ProjectBuilder( project ).build();
new SystemValidator( build2 ).validateBuild( Result.FAILURE ).validate();
}

@Test
@TestDescription( title = "JENKINS-16636", text = "No new baseline found --> But the job builds anyway" )
@ClearCaseUniqueVobName( name = "ANY" )
public void jenkins16636Any() throws Exception {
Project project = new CCUCMRule.ProjectCreator( "JENKINS-16636-any", "_System@" + ccenv.getPVob(), "one_int@" + ccenv.getPVob() ).setPromotionLevel( null ).getProject();

/* First build must be a success, because there is a valid baseline.
* This build is done because we need a previous action object */
AbstractBuild build1 = new CCUCMRule.ProjectBuilder( project ).build();
new SystemValidator( build1 ).validateBuild( Result.SUCCESS ).validate();

assertFalse( result.hasChanges() );
/* Because we have ANY promotion level, the build must NOT fail */
AbstractBuild build2 = new CCUCMRule.ProjectBuilder( project ).build();
new SystemValidator( build2 ).validateBuild( Result.SUCCESS ).validate();
}


Expand Down

0 comments on commit e1555bf

Please sign in to comment.