Skip to content

Commit

Permalink
[JENKINS-15776] Clearcase plugin does not update view if load rules are
Browse files Browse the repository at this point in the history
changed

Using Base Clearcase, if the view exists and a load rule has been added,
first a call to setcs -current is done to reevaluate config spec and
update existing load rules, then a call to update is done in order to
add the new load rule
  • Loading branch information
Vlatombe committed Nov 8, 2012
1 parent 91d2f16 commit 2e78a8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
Expand Up @@ -69,6 +69,13 @@ public boolean checkout(Launcher launcher, FilePath workspace, String viewTag) t
return false;
}
} else {
// Perform a full update of the view to reevaluate config spec
try {
getCleartool().setcs(viewPath, SetcsOption.CURRENT, null);
} catch (IOException e) {
launcher.getListener().fatalError(e.toString());
return false;
}
String[] addedLoadRules = loadRulesDelta.getAdded();
if (!ArrayUtils.isEmpty(addedLoadRules)) {
// Config spec haven't changed, but there are new load rules
Expand All @@ -78,14 +85,6 @@ public boolean checkout(Launcher launcher, FilePath workspace, String viewTag) t
launcher.getListener().fatalError(e.toString());
return false;
}
} else {
// Perform a full update of the view. to reevaluate config spec
try {
getCleartool().setcs(viewPath, SetcsOption.CURRENT, null);
} catch (IOException e) {
launcher.getListener().fatalError(e.toString());
return false;
}
}
}
updtFileName = getCleartool().getUpdtFileName();
Expand Down
Expand Up @@ -26,7 +26,6 @@

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.BuildListener;
import hudson.plugins.clearcase.AbstractWorkspaceTest;
Expand All @@ -36,8 +35,6 @@
import hudson.plugins.clearcase.ClearTool.SetcsOption;
import hudson.plugins.clearcase.ConfigSpec;

import java.util.List;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -247,8 +244,6 @@ public void testSecondTimeNewConfigSpec() throws Exception {
verify(cleartool).lscurrentview("viewpath");
verify(cleartool).catcs("viewname");
verify(cleartool).setcs("viewpath", SetcsOption.CONFIGSPEC, "configspec\nload /foo\n");
// anb0s: TODO: why setcs must be executed second time???
// verify(cleartool).setcs("viewpath", SetcsOption.CURRENT, null);
}

@Test
Expand All @@ -269,8 +264,7 @@ public void testSecondTimeNewLoadRule() throws Exception {
verify(cleartool).lscurrentview("viewpath");
verify(cleartool).catcs("viewname");
verify(cleartool).update("viewpath", new String[] { "/bar" });
// anb0s: TODO: why setcs must be executed after update???
// verify(cleartool).setcs("viewpath", SetcsOption.CURRENT, null);
verify(cleartool).setcs("viewpath", SetcsOption.CURRENT, null);
}

@Test
Expand All @@ -290,8 +284,6 @@ public void testSecondTimeRemovedLoadRule() throws Exception {
verify(cleartool).lscurrentview("viewpath");
verify(cleartool).catcs("viewname");
verify(cleartool).setcs("viewpath", SetcsOption.CONFIGSPEC, "configspec\nload /bar\n");
// anb0s: TODO: why setcs must be executed second time???
// verify(cleartool).setcs("viewpath", SetcsOption.CURRENT, null);
}

}

0 comments on commit 2e78a8c

Please sign in to comment.