Skip to content

Commit

Permalink
[JENKINS-17830] Updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgarnet committed May 7, 2013
1 parent 90de886 commit cfc873d
Showing 1 changed file with 19 additions and 1 deletion.
@@ -1,6 +1,8 @@
package net.praqma.jenkins.configrotator.functional.scm.clearcase;

import hudson.FilePath;
import hudson.model.AbstractBuild;
import hudson.model.FreeStyleProject;
import hudson.model.Result;
import net.praqma.clearcase.test.junit.ClearCaseRule;
import net.praqma.jenkins.configrotator.ConfigRotatorProject;
Expand Down Expand Up @@ -37,30 +39,46 @@ public class JENKINS17830 {
public static ConfigRotatorRule2 crrule = new ConfigRotatorRule2( JENKINS17830.class );

@Test
public void test() throws IOException {
public void test() throws IOException, InterruptedException {
ProjectBuilder builder = new ProjectBuilder( new ClearCaseUCM( ccenv.getPVob() ) ).setName( "config-spec" );
ConfigRotatorProject project = builder.getProject();
project.addTarget( new ClearCaseUCMTarget( "a-baseline-1@" + ccenv.getPVob() + ", INITIAL, false" ) ).
addTarget( new ClearCaseUCMTarget( "b-baseline-1@" + ccenv.getPVob() + ", INITIAL, false" ) );

AbstractBuild<?, ?> build = crrule.buildProject( project.getJenkinsProject(), false, null );

FilePath path = new FilePath( project.getJenkinsProject().getLastBuiltOn().getWorkspaceFor( (FreeStyleProject)project.getJenkinsProject() ), "view/" + ccenv.getUniqueName() );
listPath( path );

SystemValidator<ClearCaseUCMTarget> val = new SystemValidator<ClearCaseUCMTarget>( build );
val.checkExpectedResult( Result.SUCCESS ).
checkAction( true ).
checkTargets( new ClearCaseUCMTarget( "a-baseline-1@" + ccenv.getPVob() + ", INITIAL, false" ), new ClearCaseUCMTarget( "b-baseline-1@" + ccenv.getPVob() + ", INITIAL, false" ) ).
addElementToPathCheck( path, new SystemValidator.Element( "Server", true ) ).
addElementToPathCheck( path, new SystemValidator.Element( "Client", true ) ).
checkCompatability( true ).
validate();

project.reconfigure().addTarget( new ClearCaseUCMTarget( "a-baseline-1@" + ccenv.getPVob() + ", INITIAL, false" ) );

AbstractBuild<?, ?> build2 = crrule.buildProject( project.getJenkinsProject(), false, null );

listPath( path );

SystemValidator<ClearCaseUCMTarget> val2 = new SystemValidator<ClearCaseUCMTarget>( build2 );
val2.checkExpectedResult( Result.SUCCESS ).
checkAction( true ).
checkTargets( new ClearCaseUCMTarget( "a-baseline-1@" + ccenv.getPVob() + ", INITIAL, false" ) ).
addElementToPathCheck( path, new SystemValidator.Element( "Server", true ) ).
addElementToPathCheck( path, new SystemValidator.Element( "Client", false ) ).
checkCompatability( true ).
validate();
}

protected void listPath( FilePath path ) throws IOException, InterruptedException {
logger.info( "Listing " + path + "(" + path.exists() + ")" );
for( FilePath f : path.list() ) {
logger.info( " * " + f );
}
}
}

0 comments on commit cfc873d

Please sign in to comment.