Skip to content

Commit

Permalink
[fixed JENKINS-17229] Updated to baseline list
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgarnet committed Apr 2, 2013
1 parent 15ad9e5 commit 8a4a016
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -252,13 +252,13 @@
<dependency>
<groupId>net.praqma</groupId>
<artifactId>cool</artifactId>
<version>0.6.11</version>
<version>0.6.12-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>net.praqma</groupId>
<artifactId>cool</artifactId>
<version>0.6.11</version>
<version>0.6.12-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Expand Down
Expand Up @@ -279,7 +279,8 @@ public ClearCaseUCMConfiguration nextConfiguration( TaskListener listener, Clear
logger.debug(ConfigurationRotator.LOGGERNAME + "Wasn't fixed: " + config.getBaseline().getNormalizedName() );

try {
current = workspace.act( new GetBaselines( listener, config.getBaseline().getComponent(), config.getBaseline().getStream(), config.getPlevel(), 1, config.getBaseline() ) ).get( 0 ); //.get(0) newest baseline, they are sorted!
//current = workspace.act( new GetBaselines( listener, config.getBaseline().getComponent(), config.getBaseline().getStream(), config.getPlevel(), 1, config.getBaseline() ) ).get( 0 ); //.get(0) newest baseline, they are sorted!
current = workspace.act( new NextBaseline( config.getBaseline().getStream(), config.getBaseline().getComponent(), config.getPlevel(), config.getBaseline() ) );
if( oldest == null || current.getDate().before( oldest.getDate() ) ) {
logger.debug(ConfigurationRotator.LOGGERNAME + "Was older: " + current );
oldest = current;
Expand Down
@@ -0,0 +1,53 @@
package net.praqma.jenkins.configrotator.scm.clearcaseucm;

import hudson.FilePath;
import hudson.remoting.VirtualChannel;
import net.praqma.clearcase.exceptions.UnableToInitializeEntityException;
import net.praqma.clearcase.exceptions.UnableToListBaselinesException;
import net.praqma.clearcase.ucm.entities.Baseline;
import net.praqma.clearcase.ucm.entities.Component;
import net.praqma.clearcase.ucm.entities.Project;
import net.praqma.clearcase.ucm.entities.Stream;
import net.praqma.clearcase.ucm.utils.BaselineList;
import net.praqma.clearcase.ucm.utils.filters.AfterBaseline;
import net.praqma.clearcase.ucm.utils.filters.NoDeliver;
import net.praqma.clearcase.ucm.utils.filters.NoLabels;

import java.io.File;
import java.io.IOException;

/**
* @author cwolfgang
*/
public class NextBaseline implements FilePath.FileCallable<Baseline> {

private Stream stream;
private Component component;
private Project.PromotionLevel level;
private Baseline offset;

public NextBaseline( Stream stream, Component component, Project.PromotionLevel level, Baseline offset ) {
this.stream = stream;
this.component = component;
this.level = level;
this.offset = offset;
}

@Override
public Baseline invoke( File f, VirtualChannel channel ) throws IOException, InterruptedException {
BaselineList list = new BaselineList( stream, component, level ).
addFilter( new AfterBaseline( offset ) ).
addFilter( new NoDeliver() ).
addFilter( new NoLabels() ).
setSorting( new BaselineList.AscendingDateSort() ).
load().
setLimit( 1 );

try {
list.apply();
return list.get( 0 );
} catch( Exception e ) {
throw new IOException( e );
}
}
}
@@ -0,0 +1,24 @@
package net.praqma.jenkins.configrotator;

import net.praqma.jenkins.configrotator.scm.clearcaseucm.ClearCaseUCM;

/**
* @author cwolfgang
*/
public class ClearCaseUCMBuilder {

private ClearCaseUCM ccucm;
private String pvob;

public ClearCaseUCMBuilder( String pvob ) {
ccucm = new ClearCaseUCM( pvob );
this.pvob = pvob;
}

public ClearCaseUCMBuilder addBuilder() {
//ccucm.

return this;
}

}

0 comments on commit 8a4a016

Please sign in to comment.