assertFalse(p.poll(r.createTaskListener()).hasChanges()); p.poll(r.createTaskListener()).hasChanges()); p.poll(r.createTaskListener()).hasChanges());
assertFalse(p.poll(r.createTaskListener()).hasChanges()); p.poll(r.createTaskListener()).hasChanges()); p.poll(r.createTaskListener()).hasChanges());
assertFalse(p.poll(r.createTaskListener()).hasChanges()); p.poll(r.createTaskListener()).hasChanges()); p.poll(r.createTaskListener()).hasChanges());
@Test @Ignore("TODO use docker-fixtures for a reproducible test case") public void excludeByUser() throws Exception { FreeStyleProject p = r.createFreeStyleProject( "testExcludeByUser" ); p.setScm(new SubversionSCM( Arrays.asList( new ModuleLocation( "https://svn.jenkins-ci.org/trunk/hudson/test-projects/testSubversionExclusions@19438", null )), new UpdateUpdater(), null, "", "dty", "", "", null) ); // Do a build to force the creation of the workspace. This works around // pollChanges returning true when the workspace does not exist. p.scheduleBuild2(0).get(); boolean foundChanges = p.poll(r.createTaskListener()).hasChanges(); assertFalse("Polling found changes that should have been ignored", foundChanges); }
/** * Test that multiple repository URLs are all polled. */ @Issue("JENKINS-3168") @Test public void pollMultipleRepositories() throws Exception { // fetch the current workspaces FreeStyleProject p = r.createFreeStyleProject(); String svnBase = "file://" + new CopyExisting(getClass().getResource("/svn-repo.zip")).allocate().toURI().toURL().getPath(); SubversionSCM scm = new SubversionSCM( Arrays.asList(new ModuleLocation(svnBase + "trunk", null), new ModuleLocation(svnBase + "branches", null)), new CheckoutUpdater(), null, null, null, null, null, null); p.setScm(scm); p.scheduleBuild2(0, new Cause.UserIdCause()).get(); // as a baseline, this shouldn't detect any change TaskListener listener = r.createTaskListener(); assertFalse(p.poll(listener).hasChanges()); createCommit(scm,"branches/foo"); assertTrue("any change in any of the repository should be detected",p.poll(listener).hasChanges()); assertFalse("no change since the last polling",p.poll(listener).hasChanges()); createCommit(scm,"trunk/foo"); assertTrue("another change in the repo should be detected separately",p.poll(listener).hasChanges()); }
commitWorkingCopy("meta only"); boolean foundChanges = p.poll(r.createTaskListener()).hasChanges(); assertFalse("Property only changes commit should have been ignored.", foundChanges); commitWorkingCopy("meta + add"); foundChanges = p.poll(r.createTaskListener()).hasChanges(); assertTrue("Non Property only changes (adds) commit should not be ignored.", foundChanges); commitWorkingCopy("meta + files"); foundChanges = p.poll(r.createTaskListener()).hasChanges(); assertTrue("Non Property only changes (modify) commit should not be ignored.", foundChanges); commitWorkingCopy("files"); foundChanges = p.poll(r.createTaskListener()).hasChanges(); assertTrue("Non Property only changes commit should not be ignored.", foundChanges); commitWorkingCopy("meta only"); foundChanges = p.poll(r.createTaskListener()).hasChanges(); assertFalse("Property only changes commit should be ignored.", foundChanges);
/** * This test aims to verify that the environment variables (from Global Properties section) are available in SCM * Polling. */ @Ignore("TODO org.tmatesoft.svn.core.SVNException: svn: E175002: PROPFIND of '/trunk/jenkins/test-projects/model-maven-project': 405 Method Not Allowed (https://svn.jenkins-ci.org)") @Issue("JENKINS-31067") @Test public void pollingWithEnvVars() throws Exception { jenkins.getInstance().getGlobalNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("BRANCH", "trunk"))); FreeStyleProject project = jenkins.createFreeStyleProject(); project.setScm(new SubversionSCM(REPO_URL)); jenkins.assertBuildStatusSuccess(project.scheduleBuild2(0).get()); TaskListener listener = jenkins.createTaskListener(); PollingResult poll = project.poll(listener); assertFalse(poll.hasChanges()); } }
/** * This test aims to verify that the variables defined in the "Properties Content" field, are availables in SCM Polling. */ @Ignore("TODO org.tmatesoft.svn.core.SVNException: svn: E175002: PROPFIND of '/trunk/hudson/test-projects/trivial-maven': 405 Method Not Allowed (https://svn.jenkins-ci.org)") @Issue("JENKINS-29340") @Test public void pollingWithEnvInject() throws Exception { FreeStyleProject project = jenkins.createFreeStyleProject(); EnvInjectJobPropertyInfo jobPropertyInfo = new EnvInjectJobPropertyInfo(null, "REPO=trivial-maven", null, null, null, false); EnvInjectJobProperty envInjectJobProperty = new EnvInjectJobProperty(); envInjectJobProperty.setOn(true); envInjectJobProperty.setInfo(jobPropertyInfo); project.addProperty(envInjectJobProperty); project.setScm(new SubversionSCM(REPO_URL)); TaskListener listener = jenkins.createTaskListener(); PollingResult poll = project.poll(listener); // If true means that parameters have been replaced correctly and we have a valid repository URL. assertTrue(poll.hasChanges()); jenkins.assertBuildStatusSuccess(project.scheduleBuild2(0).get()); } }
@Issue("JENKINS-22568") @Test @Ignore("TODO use docker-fixtures for a reproducible test case") public void pollingWithChoiceParametersWithOutCurlyBraces() throws Exception { FreeStyleProject p = r.createFreeStyleProject(); String repo = "https://svn.jenkins-ci.org/"; String path = "trunk/hudson/test-projects/trivial-maven/src/test/java/test"; p.setScm(new SubversionSCM("${REPO}" + path)); ParametersDefinitionProperty property = new ParametersDefinitionProperty(new ChoiceParameterDefinition("REPO", new String[] {repo, "test"}, "")); p.addProperty(property); FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(new StringParameterValue("REPO", repo))).get(); r.assertBuildStatus(Result.SUCCESS,b); assertTrue(b.getWorkspace().child("AppTest.java").exists()); // as a baseline, this shouldn't detect any change TaskListener listener = r.createTaskListener(); PollingResult poll = p.poll(listener); assertFalse("Polling shouldn't have any changes.", poll.hasChanges()); }
@Issue("JENKINS-22568") @Test @Ignore("TODO use docker-fixtures for a reproducible test case") public void pollingWithDefaultParametersWithOutCurlyBraces() throws Exception { FreeStyleProject p = r.createFreeStyleProject(); String repo = "https://svn.jenkins-ci.org"; String path = "/trunk/hudson/test-projects/trivial-ant/"; p.setScm(new SubversionSCM("$REPO" + path)); ParametersDefinitionProperty property = new ParametersDefinitionProperty(new StringParameterDefinition("REPO", repo)); p.addProperty(property); FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(new StringParameterValue("REPO", repo))).get(); r.assertBuildStatus(Result.SUCCESS,b); assertTrue(b.getWorkspace().child("build.xml").exists()); // as a baseline, this shouldn't detect any change TaskListener listener = r.createTaskListener(); PollingResult poll = p.poll(listener); assertFalse("Polling shouldn't have any changes.", poll.hasChanges()); }
@Issue("JENKINS-22568") @Test @Ignore("TODO use docker-fixtures for a reproducible test case") public void pollingWithDefaultParametersWithCurlyBraces() throws Exception { FreeStyleProject p = r.createFreeStyleProject(); String repo = "https://svn.jenkins-ci.org/"; String path = "trunk/hudson/test-projects/trivial-ant/"; p.setScm(new SubversionSCM("${REPO}" + path)); ParametersDefinitionProperty property = new ParametersDefinitionProperty(new StringParameterDefinition("REPO", repo)); p.addProperty(property); FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(new StringParameterValue("REPO", repo))).get(); r.assertBuildStatus(Result.SUCCESS,b); assertTrue(b.getWorkspace().child("build.xml").exists()); // as a baseline, this shouldn't detect any change TaskListener listener = r.createTaskListener(); PollingResult poll = p.poll(listener); assertFalse("Polling shouldn't have any changes.", poll.hasChanges()); }
/** * {@link SubversionSCM#pollChanges(AbstractProject , Launcher , FilePath, TaskListener)} should notice * if the workspace and the current configuration is inconsistent and schedule a new build. */ @Email("http://www.nabble.com/Proper-way-to-switch---relocate-SVN-tree---tt21173306.html") @Test public void pollingAfterRelocation() throws Exception { // fetch the current workspace FreeStyleProject p = r.createFreeStyleProject(); p.setScm(loadSvnRepo()); p.scheduleBuild2(0, new Cause.UserIdCause()).get(); // as a baseline, this shouldn't detect any change TaskListener listener = r.createTaskListener(); assertFalse(p.poll(listener).hasChanges()); // now switch the repository to a new one. // this time the polling should indicate that we need a new build p.setScm(loadSvnRepo()); assertTrue(p.poll(listener).hasChanges()); // build it once again to switch p.scheduleBuild2(0, new Cause.UserIdCause()).get(); // then no more change should be detected assertFalse(p.poll(listener).hasChanges()); }