diff --git a/tfs/src/main/java/hudson/plugins/tfs/TeamFoundationServerScm.java b/tfs/src/main/java/hudson/plugins/tfs/TeamFoundationServerScm.java index 601bdd290..f6f76581c 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/TeamFoundationServerScm.java +++ b/tfs/src/main/java/hudson/plugins/tfs/TeamFoundationServerScm.java @@ -91,7 +91,8 @@ public class TeamFoundationServerScm extends SCM { private String userName; private CredentialsConfigurer credentialsConfigurer; private boolean useUpdate; - + private boolean useOverwrite; + private TeamFoundationServerRepositoryBrowser repositoryBrowser; private transient String normalizedWorkspaceName; @@ -175,6 +176,15 @@ public void setUseUpdate(final boolean useUpdate) { this.useUpdate = useUpdate; } + public boolean isUseOverwrite() { + return useOverwrite; + } + + @DataBoundSetter + public void setUseOverwrite(final boolean useOverwrite) { + this.useOverwrite = useOverwrite; + } + public String getUserPassword() { return Secret.toString(password); } @@ -307,7 +317,7 @@ public boolean checkout(AbstractBuild build, Launcher launcher, FilePath w final Project project = server.getProject(projectPath); final int changeSet = recordWorkspaceChangesetVersion(build, listener, project, projectPath, singleVersionSpec); - CheckoutAction action = new CheckoutAction(workspaceConfiguration.getWorkspaceName(), workspaceConfiguration.getProjectPath(), workspaceConfiguration.getCloakedPaths(), workspaceConfiguration.getWorkfolder(), isUseUpdate()); + CheckoutAction action = new CheckoutAction(workspaceConfiguration.getWorkspaceName(), workspaceConfiguration.getProjectPath(), workspaceConfiguration.getCloakedPaths(), workspaceConfiguration.getWorkfolder(), isUseUpdate(), isUseOverwrite()); List list; if (StringUtils.isNotEmpty(singleVersionSpec)) { list = action.checkoutBySingleVersionSpec(server, workspaceFilePath, singleVersionSpec); diff --git a/tfs/src/main/java/hudson/plugins/tfs/actions/CheckoutAction.java b/tfs/src/main/java/hudson/plugins/tfs/actions/CheckoutAction.java index 5b4f13b1a..e92b426bc 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/actions/CheckoutAction.java +++ b/tfs/src/main/java/hudson/plugins/tfs/actions/CheckoutAction.java @@ -27,13 +27,15 @@ public class CheckoutAction { private final Collection cloakedPaths; private final String localFolder; private final boolean useUpdate; + private final boolean useOverwrite; - public CheckoutAction(String workspaceName, String projectPath, Collection cloakedPaths, String localFolder, boolean useUpdate) { + public CheckoutAction(String workspaceName, String projectPath, Collection cloakedPaths, String localFolder, boolean useUpdate, boolean useOverwrite) { this.workspaceName = workspaceName; this.projectPath = projectPath; this.cloakedPaths = cloakedPaths; this.localFolder = localFolder; this.useUpdate = useUpdate; + this.useOverwrite = useOverwrite; } public List checkout(Server server, FilePath workspacePath, Calendar lastBuildTimestamp, Calendar currentBuildTimestamp) throws IOException, InterruptedException, ParseException { @@ -57,7 +59,7 @@ public List checkout(final Server server, final FilePath workspacePat final String versionSpecString = RemoteChangesetVersionCommand.toString(currentBuildVersionSpec); final String normalizedFolder = determineCheckoutPath(workspacePath, localFolder); - project.getFiles(normalizedFolder, versionSpecString); + project.getFiles(normalizedFolder, versionSpecString, useOverwrite); if (lastBuildVersionSpec != null) { return project.getVCCHistory(lastBuildVersionSpec, currentBuildVersionSpec, true, Integer.MAX_VALUE); @@ -69,7 +71,7 @@ public List checkout(final Server server, final FilePath workspacePat public List checkoutBySingleVersionSpec(Server server, FilePath workspacePath, String singleVersionSpec) throws IOException, InterruptedException { Project project = getProject(server, workspacePath); final String normalizedFolder = determineCheckoutPath(workspacePath, localFolder); - project.getFiles(normalizedFolder, singleVersionSpec); + project.getFiles(normalizedFolder, singleVersionSpec, useOverwrite); return project.getDetailedHistory(singleVersionSpec); } diff --git a/tfs/src/main/java/hudson/plugins/tfs/commands/GetFilesToWorkFolderCommand.java b/tfs/src/main/java/hudson/plugins/tfs/commands/GetFilesToWorkFolderCommand.java index 3d2908121..3d5ceaa12 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/commands/GetFilesToWorkFolderCommand.java +++ b/tfs/src/main/java/hudson/plugins/tfs/commands/GetFilesToWorkFolderCommand.java @@ -21,20 +21,22 @@ public class GetFilesToWorkFolderCommand extends AbstractCallableCommand changesetPaths, * Gets all files from server. * @param localPath the local path to get all files into * @param versionSpec the version spec to use when getting the files + * @param useOverwrite if should overwrite changes */ - public void getFiles(String localPath, String versionSpec) { - GetFilesToWorkFolderCommand command = new GetFilesToWorkFolderCommand(server, localPath, versionSpec); + public void getFiles(String localPath, String versionSpec, boolean useOverwrite) { + GetFilesToWorkFolderCommand command = new GetFilesToWorkFolderCommand(server, localPath, versionSpec, useOverwrite); server.execute(command.getCallable()); } diff --git a/tfs/src/main/resources/hudson/plugins/tfs/TeamFoundationServerScm/config.jelly b/tfs/src/main/resources/hudson/plugins/tfs/TeamFoundationServerScm/config.jelly index 7ba3007eb..c5d0f9151 100644 --- a/tfs/src/main/resources/hudson/plugins/tfs/TeamFoundationServerScm/config.jelly +++ b/tfs/src/main/resources/hudson/plugins/tfs/TeamFoundationServerScm/config.jelly @@ -21,6 +21,10 @@ + + + + diff --git a/tfs/src/test/java/hudson/plugins/tfs/TeamFoundationServerScmTest.java b/tfs/src/test/java/hudson/plugins/tfs/TeamFoundationServerScmTest.java index b352cd5c0..390438498 100644 --- a/tfs/src/test/java/hudson/plugins/tfs/TeamFoundationServerScmTest.java +++ b/tfs/src/test/java/hudson/plugins/tfs/TeamFoundationServerScmTest.java @@ -88,6 +88,7 @@ public class TeamFoundationServerScmTest { " example\\tfsbuilder\n" + " \n" + " false\n" + + " false\n" + ""; final String actualUpgradedXml = serializer.toXML(tfsScmObject); diff --git a/tfs/src/test/java/hudson/plugins/tfs/actions/CheckoutActionTest.java b/tfs/src/test/java/hudson/plugins/tfs/actions/CheckoutActionTest.java index 8bd9b85f9..51a3173a6 100644 --- a/tfs/src/test/java/hudson/plugins/tfs/actions/CheckoutActionTest.java +++ b/tfs/src/test/java/hudson/plugins/tfs/actions/CheckoutActionTest.java @@ -69,10 +69,10 @@ public void assertFirstCheckoutBySingleVersionSpecNotUsingUpdate() throws Except when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); when(workspaces.getWorkspace("workspace")).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); verify(workspaces).newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class)); - verify(project).getFiles(isA(String.class), eq(MY_LABEL)); + verify(project).getFiles(isA(String.class), eq(MY_LABEL), eq(false)); verify(workspaces).deleteWorkspace(workspace); } @@ -84,10 +84,10 @@ public void assertFirstCheckoutNotUsingUpdate() throws Exception { when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); when(workspaces.getWorkspace("workspace")).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); verify(workspaces).newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class)); - verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z")); + verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z"), eq(false)); verify(workspaces).deleteWorkspace(workspace); } @@ -98,10 +98,10 @@ public void assertFirstCheckoutBySingleVersionSpecUsingUpdate() throws Exception when(workspaces.exists(new Workspace("workspace"))).thenReturn(false); when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); verify(workspaces).newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class)); - verify(project).getFiles(isA(String.class), eq(MY_LABEL)); + verify(project).getFiles(isA(String.class), eq(MY_LABEL), eq(false)); verify(workspaces, never()).deleteWorkspace(isA(Workspace.class)); } @@ -112,10 +112,10 @@ public void assertFirstCheckoutUsingUpdate() throws Exception { when(workspaces.exists(new Workspace("workspace"))).thenReturn(false); when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); verify(workspaces).newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class)); - verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z")); + verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z"), eq(false)); verify(workspaces, never()).deleteWorkspace(isA(Workspace.class)); } @@ -126,9 +126,9 @@ public void assertSecondCheckoutBySingleVersionSpecUsingUpdate() throws Exceptio when(workspaces.getWorkspace("workspace")).thenReturn(workspace); when(workspace.getComputer()).thenReturn("LocalComputer"); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); - verify(project).getFiles(isA(String.class), eq(MY_LABEL)); + verify(project).getFiles(isA(String.class), eq(MY_LABEL), eq(false)); verify(workspaces, never()).newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class)); verify(workspaces, never()).deleteWorkspace(isA(Workspace.class)); } @@ -140,9 +140,9 @@ public void assertSecondCheckoutUsingUpdate() throws Exception { when(workspaces.getWorkspace("workspace")).thenReturn(workspace); when(workspace.getComputer()).thenReturn("LocalComputer"); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); - verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z")); + verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z"), eq(false)); verify(workspaces, never()).newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class)); verify(workspaces, never()).deleteWorkspace(isA(Workspace.class)); } @@ -155,10 +155,10 @@ public void assertSecondCheckoutBySingleVersionSpecNotUsingUpdate() throws Excep when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); when(workspaces.getWorkspace("workspace")).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); verify(workspaces).newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class)); - verify(project).getFiles(isA(String.class), eq(MY_LABEL)); + verify(project).getFiles(isA(String.class), eq(MY_LABEL), eq(false)); verify(workspaces).deleteWorkspace(workspace); } @@ -170,10 +170,10 @@ public void assertSecondCheckoutNotUsingUpdate() throws Exception { when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); when(workspaces.getWorkspace("workspace")).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); verify(workspaces).newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class)); - verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z")); + verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z"), eq(false)); verify(workspaces).deleteWorkspace(workspace); } @@ -184,7 +184,7 @@ public void assertDetailedHistoryIsNotRetrievedInFirstBuildCheckingOutByLabel() when(workspaces.getWorkspace("workspace")).thenReturn(workspace); when(workspace.getComputer()).thenReturn("LocalComputer"); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); verify(project, never()).getDetailedHistory(isA(Calendar.class), isA(Calendar.class)); } @@ -196,7 +196,7 @@ public void assertDetailedHistoryIsNotRetrievedInFirstBuild() throws Exception { when(workspaces.getWorkspace("workspace")).thenReturn(workspace); when(workspace.getComputer()).thenReturn("LocalComputer"); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); verify(project, never()).getDetailedHistory(isA(Calendar.class), isA(Calendar.class)); } @@ -210,7 +210,7 @@ public void assertDetailedHistoryIsRetrievedInSecondBuildCheckingOutByLabel() th when(workspace.getComputer()).thenReturn("LocalComputer"); when(project.getDetailedHistory(isA(String.class))).thenReturn(list); - CheckoutAction action = new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true); + CheckoutAction action = new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false); List actualList = action.checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); assertSame("The list from the detailed history, was not the same as returned from checkout", list, actualList); @@ -226,7 +226,7 @@ public void assertDetailedHistoryIsRetrievedInSecondBuild() throws Exception { when(workspace.getComputer()).thenReturn("LocalComputer"); when(project.getVCCHistory(isA(VersionSpec.class), isA(VersionSpec.class), anyBoolean(), anyInt())).thenReturn(list); - CheckoutAction action = new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true); + CheckoutAction action = new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false); final Calendar startDate = Util.getCalendar(2008, 9, 24); final Calendar endDate = Util.getCalendar(2008, 10, 24); List actualList = action.checkout(server, hudsonWs, startDate, endDate); @@ -247,7 +247,7 @@ public void assertWorkFolderIsCleanedIfNotUsingUpdate() throws Exception { when(workspaces.exists(new Workspace("workspace"))).thenReturn(false); when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, "tfs-ws", false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, "tfs-ws", false, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); assertTrue("The local folder was removed", tfsWs.exists()); assertEquals("The local TFS folder was not cleaned", 0, tfsWs.list((FileFilter)null).size()); @@ -265,7 +265,7 @@ public void assertWorkFolderIsCleanedIfNotUsingUpdateCheckingOutByLabel() throws when(workspaces.exists(new Workspace("workspace"))).thenReturn(false); when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, "tfs-ws", false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, "tfs-ws", false, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); assertTrue("The local folder was removed", tfsWs.exists()); assertEquals("The local TFS folder was not cleaned", 0, tfsWs.list((FileFilter)null).size()); @@ -283,7 +283,7 @@ public void assertWorkspaceIsNotCleanedIfUsingUpdate() throws Exception { when(workspaces.getWorkspace("workspace")).thenReturn(workspace); when(workspace.getComputer()).thenReturn("LocalComputer"); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, "tfs-ws", true).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, "tfs-ws", true, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); assertTrue("The local folder was removed", tfsWs.exists()); assertEquals("The TFS workspace path was cleaned", 1, hudsonWs.list((FileFilter)null).size()); @@ -298,7 +298,7 @@ public void assertCheckoutBySingleVersionSpecDeletesWorkspaceAtStartIfNotUsingUp when(project.getProjectPath()).thenReturn("project"); when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); verify(server).getWorkspaces(); verify(workspaces, times(2)).exists("workspace"); @@ -318,7 +318,7 @@ public void assertCheckoutDeletesWorkspaceAtStartIfNotUsingUpdate() throws Excep when(project.getProjectPath()).thenReturn("project"); when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); verify(server).getWorkspaces(); verify(workspaces, times(2)).exists("workspace"); @@ -336,7 +336,7 @@ public void assertCheckoutDoesNotDeleteWorkspaceAtStartIfUsingUpdate() throws Ex when(workspaces.exists("workspace")).thenReturn(true).thenReturn(true); when(workspaces.getWorkspace("workspace")).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); verify(server).getWorkspaces(); verify(workspaces, times(2)).exists("workspace"); @@ -352,7 +352,7 @@ public void assertCheckoutBySingleVersionSpecDoesNotDeleteWorkspaceAtStartIfUsin when(workspaces.exists("workspace")).thenReturn(true).thenReturn(true); when(workspaces.getWorkspace("workspace")).thenReturn(workspace); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); verify(server).getWorkspaces(); verify(workspaces, times(2)).exists("workspace"); @@ -369,7 +369,7 @@ public void assertCheckoutDoesNotDeleteWorkspaceIfNotUsingUpdateAndThereIsNoWork when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); when(project.getProjectPath()).thenReturn("project"); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false, false).checkout(server, hudsonWs, null, Util.getCalendar(2009, 9, 24)); verify(server).getWorkspaces(); verify(workspaces, times(2)).exists("workspace"); @@ -386,7 +386,7 @@ public void assertCheckoutBySingleVersionSpecDoesNotDeleteWorkspaceIfNotUsingUpd when(workspaces.newWorkspace(eq("workspace"), eq("project"), eq(EMPTY_CLOAKED_PATHS_LIST), isA(String.class))).thenReturn(workspace); when(project.getProjectPath()).thenReturn("project"); - new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); + new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", false, false).checkoutBySingleVersionSpec(server, hudsonWs, MY_LABEL); verify(server).getWorkspaces(); verify(workspaces, times(2)).exists("workspace"); @@ -405,7 +405,7 @@ public void assertCheckoutOnlyRetrievesChangesToTheStartTimestampForCurrentBuild when(workspace.getComputer()).thenReturn("LocalComputer"); when(project.getVCCHistory(isA(VersionSpec.class), isA(VersionSpec.class), anyBoolean(), anyInt())).thenReturn(list); - CheckoutAction action = new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true); + CheckoutAction action = new CheckoutAction("workspace", "project", EMPTY_CLOAKED_PATHS_LIST, ".", true, false); final Calendar startDate = Util.getCalendar(2008, 9, 24); final Calendar endDate = Util.getCalendar(2009, 9, 24); List actualList = action.checkout(server, hudsonWs, startDate, endDate); @@ -418,7 +418,7 @@ public void assertCheckoutOnlyRetrievesChangesToTheStartTimestampForCurrentBuild argThat(new DateVersionSpecMatcher(endDateVersionSpec)), eq(true), anyInt()); - verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z")); + verify(project).getFiles(isA(String.class), eq("D2009-09-24T00:00:00Z"), eq(false)); } private static class DateVersionSpecMatcher extends CustomMatcher { diff --git a/tfs/src/test/java/hudson/plugins/tfs/commands/GetFilesToWorkFolderCommandTest.java b/tfs/src/test/java/hudson/plugins/tfs/commands/GetFilesToWorkFolderCommandTest.java index a0f0e7e3d..6cd0eda47 100644 --- a/tfs/src/test/java/hudson/plugins/tfs/commands/GetFilesToWorkFolderCommandTest.java +++ b/tfs/src/test/java/hudson/plugins/tfs/commands/GetFilesToWorkFolderCommandTest.java @@ -18,7 +18,7 @@ public class GetFilesToWorkFolderCommandTest extends AbstractCallableCommandTest when(vcc.queryWorkspace( isA(String.class), isA(String.class))).thenReturn(null); - final GetFilesToWorkFolderCommand command = new GetFilesToWorkFolderCommand(server, "c:/jenkins/jobs/newJob/workspace", "C618"); + final GetFilesToWorkFolderCommand command = new GetFilesToWorkFolderCommand(server, "c:/jenkins/jobs/newJob/workspace", "C618", false); final Callable callable = command.getCallable(); callable.call(); @@ -33,7 +33,7 @@ public class GetFilesToWorkFolderCommandTest extends AbstractCallableCommandTest final GetEvent getEvent = mock(GetEvent.class); final String pathToFile = "C:\\.jenkins\\jobs\\typical\\workspace\\TODO.txt"; when(getEvent.getTargetLocalItem()).thenReturn(pathToFile); - final GetFilesToWorkFolderCommand cut = new GetFilesToWorkFolderCommand(server, null, null, true); + final GetFilesToWorkFolderCommand cut = new GetFilesToWorkFolderCommand(server, null, null, false, true); cut.setLogger(new PrintStream(this.outputStream)); cut.onGet(getEvent); @@ -44,6 +44,6 @@ public class GetFilesToWorkFolderCommandTest extends AbstractCallableCommandTest } @Override protected AbstractCallableCommand createCommand(final ServerConfigurationProvider serverConfig) { - return new GetFilesToWorkFolderCommand(serverConfig, "workFolder", "versionSpec"); + return new GetFilesToWorkFolderCommand(serverConfig, "workFolder", "versionSpec", false); } }