|
25 | 25 | */ |
26 | 26 | package hudson.scm; |
27 | 27 |
|
28 | | -import static hudson.scm.SubversionSCM.compareSVNAuthentications; |
29 | | -import static org.jvnet.hudson.test.recipes.PresetData.DataSet.ANONYMOUS_READONLY; |
30 | | - |
31 | 28 | import com.cloudbees.plugins.credentials.Credentials; |
32 | 29 | import com.cloudbees.plugins.credentials.CredentialsScope; |
33 | 30 | import com.cloudbees.plugins.credentials.SystemCredentialsProvider; |
34 | 31 | import com.cloudbees.plugins.credentials.domains.Domain; |
35 | 32 | import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl; |
| 33 | +import com.gargoylesoftware.htmlunit.*; |
| 34 | +import com.gargoylesoftware.htmlunit.html.HtmlAnchor; |
| 35 | +import com.gargoylesoftware.htmlunit.html.HtmlForm; |
| 36 | +import com.gargoylesoftware.htmlunit.html.HtmlPage; |
| 37 | +import hudson.EnvVars; |
36 | 38 | import hudson.FilePath; |
37 | 39 | import hudson.Launcher; |
38 | 40 | import hudson.Proc; |
39 | | -import hudson.model.BuildListener; |
40 | | -import hudson.model.FreeStyleBuild; |
41 | | -import hudson.model.Item; |
42 | | -import hudson.model.Result; |
43 | | -import hudson.model.TaskListener; |
44 | | -import hudson.model.AbstractBuild; |
45 | | -import hudson.model.AbstractProject; |
46 | | -import hudson.model.Cause; |
47 | | -import hudson.model.FreeStyleProject; |
48 | | -import hudson.model.ParametersAction; |
49 | | -import hudson.model.Run; |
50 | | -import hudson.model.StringParameterValue; |
| 41 | +import hudson.model.*; |
51 | 42 | import hudson.scm.ChangeLogSet.Entry; |
52 | 43 | import hudson.scm.SubversionSCM.ModuleLocation; |
53 | 44 | import hudson.scm.browsers.Sventon; |
54 | | -import hudson.scm.subversion.CheckoutUpdater; |
55 | | -import hudson.scm.subversion.UpdateUpdater; |
56 | | -import hudson.scm.subversion.UpdateWithCleanUpdater; |
57 | | -import hudson.scm.subversion.UpdateWithRevertUpdater; |
58 | | -import hudson.scm.subversion.WorkspaceUpdater; |
| 45 | +import hudson.scm.subversion.*; |
59 | 46 | import hudson.slaves.DumbSlave; |
60 | 47 | import hudson.triggers.SCMTrigger; |
61 | 48 | import hudson.util.FormValidation; |
62 | 49 | import hudson.util.StreamTaskListener; |
63 | | - |
64 | | -import java.io.BufferedReader; |
65 | | -import java.io.File; |
66 | | -import java.io.FileReader; |
67 | | -import java.io.IOException; |
68 | | -import java.io.PrintWriter; |
69 | | -import java.net.MalformedURLException; |
70 | | -import java.net.URL; |
71 | | -import java.nio.charset.Charset; |
72 | | -import java.util.ArrayList; |
73 | | -import java.util.Arrays; |
74 | | -import java.util.Collection; |
75 | | -import java.util.Collections; |
76 | | -import java.util.Date; |
77 | | -import java.util.List; |
78 | | -import java.util.concurrent.Callable; |
79 | | -import java.util.concurrent.ExecutionException; |
80 | | -import java.util.concurrent.Future; |
81 | | - |
82 | 50 | import org.dom4j.Document; |
83 | 51 | import org.dom4j.io.DOMReader; |
84 | 52 | import org.junit.Test; |
85 | | -import org.jvnet.hudson.test.Bug; |
86 | | -import org.jvnet.hudson.test.Email; |
| 53 | +import org.jvnet.hudson.test.*; |
87 | 54 | import org.jvnet.hudson.test.HudsonHomeLoader.CopyExisting; |
88 | | -import org.jvnet.hudson.test.TestBuilder; |
89 | | -import org.jvnet.hudson.test.Url; |
90 | | -import org.jvnet.hudson.test.CaptureEnvironmentBuilder; |
91 | 55 | import org.jvnet.hudson.test.recipes.PresetData; |
92 | | -import org.tmatesoft.svn.core.SVNCancelException; |
93 | | -import org.tmatesoft.svn.core.SVNDepth; |
94 | | -import org.tmatesoft.svn.core.SVNErrorCode; |
95 | | -import org.tmatesoft.svn.core.SVNErrorMessage; |
96 | | -import org.tmatesoft.svn.core.SVNException; |
97 | | -import org.tmatesoft.svn.core.SVNPropertyValue; |
98 | | -import org.tmatesoft.svn.core.SVNURL; |
99 | | -import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; |
100 | | -import org.tmatesoft.svn.core.auth.SVNAuthentication; |
101 | | -import org.tmatesoft.svn.core.auth.SVNPasswordAuthentication; |
102 | | -import org.tmatesoft.svn.core.auth.SVNSSHAuthentication; |
103 | | -import org.tmatesoft.svn.core.auth.SVNSSLAuthentication; |
104 | | -import org.tmatesoft.svn.core.auth.SVNUserNameAuthentication; |
| 56 | +import org.tmatesoft.svn.core.*; |
| 57 | +import org.tmatesoft.svn.core.auth.*; |
105 | 58 | import org.tmatesoft.svn.core.internal.wc.admin.SVNAdminAreaFactory; |
106 | 59 | import org.tmatesoft.svn.core.io.SVNRepository; |
107 | 60 | import org.tmatesoft.svn.core.io.SVNRepositoryFactory; |
|
110 | 63 | import org.tmatesoft.svn.core.wc.SVNStatus; |
111 | 64 | import org.tmatesoft.svn.core.wc.SVNWCUtil; |
112 | 65 |
|
113 | | -import com.gargoylesoftware.htmlunit.ElementNotFoundException; |
114 | | -import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; |
115 | | -import com.gargoylesoftware.htmlunit.HttpMethod; |
116 | | -import com.gargoylesoftware.htmlunit.WebConnection; |
117 | | -import com.gargoylesoftware.htmlunit.WebRequestSettings; |
118 | | -import com.gargoylesoftware.htmlunit.WebResponse; |
119 | | -import com.gargoylesoftware.htmlunit.html.HtmlAnchor; |
120 | | -import com.gargoylesoftware.htmlunit.html.HtmlForm; |
121 | | -import com.gargoylesoftware.htmlunit.html.HtmlPage; |
122 | | -import hudson.EnvVars; |
123 | | -import hudson.model.EnvironmentContributor; |
124 | | -import hudson.model.TopLevelItem; |
| 66 | +import java.io.*; |
| 67 | +import java.net.MalformedURLException; |
| 68 | +import java.net.URL; |
| 69 | +import java.nio.charset.Charset; |
| 70 | +import java.util.*; |
| 71 | +import java.util.concurrent.Callable; |
| 72 | +import java.util.concurrent.ExecutionException; |
| 73 | +import java.util.concurrent.Future; |
| 74 | + |
| 75 | +import static hudson.scm.SubversionSCM.compareSVNAuthentications; |
| 76 | +import static org.jvnet.hudson.test.recipes.PresetData.DataSet.ANONYMOUS_READONLY; |
125 | 77 |
|
126 | 78 | /** |
127 | 79 | * @author Kohsuke Kawaguchi |
@@ -344,6 +296,73 @@ public void testRevisionParameter() throws Exception { |
344 | 296 | assertBuildStatus(Result.SUCCESS,b); |
345 | 297 | } |
346 | 298 |
|
| 299 | + @Bug(22568) |
| 300 | + public void testPollingWithDefaultParametersWithCurlyBraces() throws Exception { |
| 301 | + FreeStyleProject p = createFreeStyleProject(); |
| 302 | + |
| 303 | + String url = "http://svn.codehaus.org/sxc/tags/sxc-0.5/sxc-core/src/test/java/com/envoisolutions/sxc/builder/"; |
| 304 | + p.setScm(new SubversionSCM("${REPO}" + url.substring(10))); |
| 305 | + String var = url.substring(0, 10); |
| 306 | + ParametersDefinitionProperty property = new ParametersDefinitionProperty(new StringParameterDefinition("REPO", var)); |
| 307 | + p.addProperty(property); |
| 308 | + |
| 309 | + FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause(), |
| 310 | + new ParametersAction(new StringParameterValue("REPO", var))).get(); |
| 311 | + |
| 312 | + assertBuildStatus(Result.SUCCESS,b); |
| 313 | + assertTrue(b.getWorkspace().child("Node.java").exists()); |
| 314 | + |
| 315 | + // as a baseline, this shouldn't detect any change |
| 316 | + TaskListener listener = createTaskListener(); |
| 317 | + PollingResult poll = p.poll(listener); |
| 318 | + assertFalse("Polling shouldn't have any changes.", poll.hasChanges()); |
| 319 | + } |
| 320 | + |
| 321 | + @Bug(22568) |
| 322 | + public void testPollingWithDefaultParametersWithOutCurlyBraces() throws Exception { |
| 323 | + FreeStyleProject p = createFreeStyleProject(); |
| 324 | + |
| 325 | + String url = "http://svn.codehaus.org/sxc/tags/sxc-0.5/sxc-core/src/test/java/com/envoisolutions/sxc/builder/"; |
| 326 | + p.setScm(new SubversionSCM("$REPO" + url.substring(10))); |
| 327 | + String var = url.substring(0, 10); |
| 328 | + ParametersDefinitionProperty property = new ParametersDefinitionProperty(new StringParameterDefinition("REPO", var)); |
| 329 | + p.addProperty(property); |
| 330 | + |
| 331 | + FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause(), |
| 332 | + new ParametersAction(new StringParameterValue("REPO", var))).get(); |
| 333 | + |
| 334 | + assertBuildStatus(Result.SUCCESS,b); |
| 335 | + assertTrue(b.getWorkspace().child("Node.java").exists()); |
| 336 | + |
| 337 | + // as a baseline, this shouldn't detect any change |
| 338 | + TaskListener listener = createTaskListener(); |
| 339 | + PollingResult poll = p.poll(listener); |
| 340 | + assertFalse("Polling shouldn't have any changes.", poll.hasChanges()); |
| 341 | + } |
| 342 | + |
| 343 | + @Bug(22568) |
| 344 | + public void testPollingWithChoiceParametersWithOutCurlyBraces() throws Exception { |
| 345 | + FreeStyleProject p = createFreeStyleProject(); |
| 346 | + |
| 347 | + String url = "http://svn.codehaus.org/sxc/tags/sxc-0.5/sxc-core/src/test/java/com/envoisolutions/sxc/builder/"; |
| 348 | + p.setScm(new SubversionSCM("${REPO}" + url.substring(10))); |
| 349 | + String var = url.substring(0, 10); |
| 350 | + ParametersDefinitionProperty property = new ParametersDefinitionProperty(new ChoiceParameterDefinition("REPO", new String[] {var, "test"}, "")); |
| 351 | + p.addProperty(property); |
| 352 | + |
| 353 | + FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause(), |
| 354 | + new ParametersAction(new StringParameterValue("REPO", var))).get(); |
| 355 | + |
| 356 | + assertBuildStatus(Result.SUCCESS,b); |
| 357 | + assertTrue(b.getWorkspace().child("Node.java").exists()); |
| 358 | + |
| 359 | + // as a baseline, this shouldn't detect any change |
| 360 | + TaskListener listener = createTaskListener(); |
| 361 | + PollingResult poll = p.poll(listener); |
| 362 | + assertFalse("Polling shouldn't have any changes.", poll.hasChanges()); |
| 363 | + } |
| 364 | + |
| 365 | + |
347 | 366 | public void testRevisionParameterFolding() throws Exception { |
348 | 367 | FreeStyleProject p = createFreeStyleProject(); |
349 | 368 | String url = "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant"; |
|
0 commit comments