Skip to content

Commit

Permalink
[JENKINS-16620] Added test for ANY
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgarnet committed Feb 5, 2013
1 parent d0a6112 commit 1be5686
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/main/java/net/praqma/hudson/scm/CCUCMScm.java
Expand Up @@ -189,7 +189,6 @@ public boolean checkout( AbstractBuild<?, ?> build, Launcher launcher, FilePath
try {
resolveBaseline( workspace, build.getProject(), action, listener );
} catch( CCUCMException e ) {
//e.printStackTrace(out);
logger.warning(e.getMessage());
/* If the promotion level is not set, ANY, use the last found Baseline */
if( plevel == null ) {
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/net/praqma/hudson/test/CCUCMRule.java
Expand Up @@ -90,6 +90,12 @@ public ProjectCreator setCreateBaseline( boolean createBaseline ) {
return this;
}

public ProjectCreator setPromotionLevel( PromotionLevel level ) {
this.promotionLevel = level;

return this;
}

public Project getProject() throws IOException {
logger.info( "Setting up build for self polling, recommend:" + recommend + ", tag:" + tag + ", description:" + description );

Expand Down
Expand Up @@ -2,6 +2,7 @@

import hudson.model.*;
import hudson.model.Project;
import hudson.scm.PollingResult;
import net.praqma.clearcase.test.junit.ClearCaseRule;
import net.praqma.clearcase.ucm.entities.*;
import net.praqma.hudson.test.BaseTestClass;
Expand All @@ -12,6 +13,8 @@
import org.junit.Rule;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

/**
* @author cwolfgang
* Date: 04-02-13
Expand All @@ -26,7 +29,7 @@ public class JENKINS16620 extends BaseTestClass {
public static DescriptionRule desc = new DescriptionRule();

@Test
@TestDescription( title = "JENKINS-16620", text = "Cancelled builds cannot be rebuild" )
@TestDescription( title = "JENKINS-16620", text = "Changed baselines cannot be rebuild" )
public void jenkins16620() throws Exception {
Project project = new CCUCMRule.ProjectCreator( "JENKINS-16620", "_System@" + ccenv.getPVob(), "one_int@" + ccenv.getPVob() ).getProject();

Expand All @@ -41,4 +44,22 @@ public void jenkins16620() throws Exception {
new SystemValidator( build2 ).validateBuild( Result.SUCCESS ).validate();
}

@Test
@TestDescription( title = "JENKINS-16620", text = "Changed baselines MUST NOT ABLE TO be rebuild on ANY" )
public void jenkins16620Any() throws Exception {
Project project = new CCUCMRule.ProjectCreator( "JENKINS-16620", "_System@" + ccenv.getPVob(), "one_int@" + ccenv.getPVob() ).setPromotionLevel( null ).getProject();

AbstractBuild build1 = new CCUCMRule.ProjectBuilder( project ).failBuild( true ).build();

new SystemValidator( build1 ).validateBuild( Result.SUCCESS ).validate();

Baseline bl = ccenv.context.baselines.get( "model-1" ).load();

bl.setPromotionLevel( net.praqma.clearcase.ucm.entities.Project.PromotionLevel.INITIAL );

PollingResult result = project.poll( jenkins.createTaskListener() );

assertTrue( result.hasChanges() );
}

}

0 comments on commit 1be5686

Please sign in to comment.