Skip to content
Permalink
Browse files

[FIXED JENKINS-14141] Fix legacy mode disable and added unit test

  • Loading branch information
mc1arke committed Sep 5, 2012
1 parent d06257a commit d7a1ee21db9fb641d504d6d180c900f064624042
Showing with 21 additions and 1 deletion.
  1. +1 −1 src/main/java/hudson/scm/CVSSCM.java
  2. +20 −0 src/test/java/hudson/scm/CVSSCMTest.java
@@ -125,7 +125,7 @@ public CVSSCM(final List<CvsRepository> repositories, final boolean canUseUpdate
this.repositories = repositories.toArray(new CvsRepository[repositories.size()]);
this.canUseUpdate = canUseUpdate;
this.skipChangeLog = skipChangeLog;
flatten = !legacy && this.repositories.length == 1 && this.repositories[0].getRepositoryItems().length == 0 && this.repositories[0].getRepositoryItems()[0].getModules().length == 1 && "".equals(fixNull(this.repositories[0].getRepositoryItems()[0].getModules()[0].getLocalName()));
flatten = !legacy && this.repositories.length == 1 && this.repositories[0].getRepositoryItems().length == 1 && this.repositories[0].getRepositoryItems()[0].getModules().length == 1;
repositoryBrowser = browser;
this.pruneEmptyDirectories = pruneEmptyDirectories;
this.disableCvsQuiet = disableCvsQuiet;
@@ -8,7 +8,9 @@

import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
* @author Kohsuke Kawaguchi
@@ -107,4 +109,22 @@ public void testProjectExport() throws Exception {
new WebClient().goTo(p.getUrl() + "api/xml?depth=999",
"application/xml");
}

@Bug(14141)
public void testFlattenEnabled() {
List<CvsRepository> repositories = Arrays.asList(new CvsRepository("cvsroot", false, null,
Arrays.asList(new CvsRepositoryItem(new CvsRepositoryLocation.HeadRepositoryLocation(), new CvsModule[]{new CvsModule("remoteName", "localName")})), new ArrayList<ExcludedRegion>(), 3));
CVSSCM scm = new CVSSCM(repositories, false, false, null, false, false, false, false);
assertFalse(scm.isLegacy());

scm = new CVSSCM(repositories, false, true, null, false, false, false, false);
assertTrue(scm.isLegacy());

repositories = Arrays.asList(new CvsRepository("cvsroot", false, null,
Arrays.asList(new CvsRepositoryItem(new CvsRepositoryLocation.HeadRepositoryLocation(), new CvsModule[]{new CvsModule("remoteName", "localName"), new CvsModule("remoteName2", "localName2")})), new ArrayList<ExcludedRegion>(), 3));

scm = new CVSSCM(repositories, false, false, null, false, false, false, false);
assertTrue(scm.isLegacy());

}
}

0 comments on commit d7a1ee2

Please sign in to comment.
You can’t perform that action at this time.