Skip to content

Commit

Permalink
[JENKINS-17230] Updating prepare view
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgarnet committed Apr 11, 2013
1 parent 325e836 commit bd0fd34
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
Expand Up @@ -9,6 +9,7 @@
import java.io.PrintStream;
import java.util.List;

import net.praqma.clearcase.ConfigSpec;
import net.praqma.clearcase.Rebase;
import net.praqma.clearcase.exceptions.ClearCaseException;
import net.praqma.clearcase.exceptions.UnableToInitializeEntityException;
Expand Down Expand Up @@ -58,10 +59,18 @@ public SnapshotView invoke( File workspace, VirtualChannel channel ) throws IOEx
if( devStream.exists() ) {
out.println( ConfigurationRotator.LOGGERNAME + "Stream exists" );

try {
view = new GetView( viewroot, viewtag ).get();
} catch( ClearCaseException e ) {
throw new IOException( "Could not get view", e );
}

try {
out.println( ConfigurationRotator.LOGGERNAME + "Rebasing stream to " + devStream.getNormalizedName() );
//Rebase rebase = new Rebase( devStream, view, baselines );
new Rebase( devStream ).addBaselines( baselines ).dropFromStream().rebase( true );
//view.end();
new Rebase( devStream ).setViewTag( viewtag ).addBaselines( baselines ).dropFromStream().rebase( true );
//new Rebase( view ).addBaselines( baselines ).dropFromStream().rebase( true );
} catch( ClearCaseException e ) {
throw new IOException( "Could not load " + devStream, e );
}
Expand All @@ -71,7 +80,9 @@ public SnapshotView invoke( File workspace, VirtualChannel channel ) throws IOEx
out.println( ConfigurationRotator.LOGGERNAME + "View root: " + new File( workspace, "view" ) );
out.println( ConfigurationRotator.LOGGERNAME + "View tag : " + viewtag );
//view = ViewUtils.createView( devStream, "ALL", new File( workspace, "view" ), viewtag, true );
view = new GetView( new File( workspace, "view" ), viewtag ).get();

new ConfigSpec( viewroot ).addLoadRulesFromBaselines( baselines ).generate().appy();

new UpdateView( view ).swipe().overwrite().update();
} catch( ClearCaseException e ) {
throw new IOException( "Unable to create view", e );
Expand All @@ -91,7 +102,7 @@ public SnapshotView invoke( File workspace, VirtualChannel channel ) throws IOEx

try {
//view = ViewUtils.createView( devStream, "ALL", new File( workspace, "view" ), viewtag, true );
view = new GetView( new File( workspace, "view" ), viewtag ).setStream( devStream ).createIfAbsent().get();
view = new GetView( viewroot, viewtag ).setStream( devStream ).createIfAbsent().get();
new UpdateView( view ).setLoadRules( new SnapshotView.LoadRules( view, SnapshotView.Components.ALL ) ).generate().update();
} catch( ClearCaseException e ) {
throw new IOException( "Unable to create view", e );
Expand Down
Expand Up @@ -212,10 +212,12 @@ private void doCheckPaths() throws IOException, InterruptedException {
for( Element element : elements ) {
if( element.mustExist ) {
logger.info( "Path must have " + element );
assertTrue( "The path " + path + " does not have " + element, new FilePath( path, element.element ).exists() );
assertTrue( "The path " + path + " does not have1 " + element, new FilePath( path, element.element ).exists() );
//assertTrue( "The path " + path + " does not have2 " + element, new File( new File( path.toURI() ), element.element ).exists() );
} else {
logger.info( "Path must NOT have " + element );
assertFalse( "The path " + path + " does have " + element, !new FilePath( path, element.element ).exists() );
assertFalse( "The path " + path + " does have " + element, new FilePath( path, element.element ).exists() );
//assertFalse( "The path " + path + " does have " + element, new File( new File( path.toURI() ), element.element ).exists() );
}
}
}
Expand Down
Expand Up @@ -77,6 +77,8 @@ public void removeTarget() throws IOException, ExecutionException, InterruptedEx
/* Do the second build */
AbstractBuild<?, ?> build2 = crrule.buildProject( project.getJenkinsProject(), false, null );

listPath( path );

/* Verify second build */
SystemValidator<ClearCaseUCMTarget> val2 = new SystemValidator<ClearCaseUCMTarget>( build2 );
val2.checkExpectedResult( Result.SUCCESS ).
Expand Down

0 comments on commit bd0fd34

Please sign in to comment.