diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index 2e07631398..f8ce0f112c 100644 --- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -1,7 +1,7 @@ /* * The MIT License * - * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Erik Ramfelt + * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Erik Ramfelt, Yahoo! Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -51,6 +51,7 @@ import hudson.model.TaskListener; import hudson.model.UpdateCenter; import hudson.model.AbstractProject; import hudson.model.Node.Mode; +import hudson.scm.SubversionSCM; import hudson.slaves.CommandLauncher; import hudson.slaves.DumbSlave; import hudson.slaves.RetentionStrategy; @@ -59,6 +60,7 @@ import hudson.tasks.Maven; import hudson.tasks.Ant; import hudson.tasks.Ant.AntInstallation; import hudson.tasks.Maven.MavenInstallation; +import hudson.util.NullStream; import hudson.util.ProcessTreeKiller; import hudson.util.StreamTaskListener; import hudson.util.jna.GNUCLibrary; @@ -68,6 +70,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; +import java.io.PrintWriter; import java.lang.annotation.Annotation; import java.lang.ref.WeakReference; import java.lang.reflect.Method; @@ -113,6 +116,7 @@ import org.mortbay.jetty.webapp.WebAppContext; import org.mortbay.jetty.webapp.WebXmlConfiguration; import org.mozilla.javascript.Context; import org.mozilla.javascript.ContextFactory; +import org.tmatesoft.svn.core.SVNException; import org.w3c.css.sac.CSSException; import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.ErrorHandler; @@ -290,6 +294,14 @@ public abstract class HudsonTestCase extends TestCase { return realm; } + /** + * Sets guest credentials to access java.net Subversion repo. + */ + protected void setJavaNetCredential() throws SVNException, IOException { + // set the credential to access svn.dev.java.net + hudson.getDescriptorByType(SubversionSCM.DescriptorImpl.class).postCredential("https://svn.dev.java.net/svn/hudson/","guest","",null,new PrintWriter(new NullStream())); + } + /** * Locates Maven2 and configure that as the only Maven in the system. */ diff --git a/test/src/test/java/hudson/scm/SubversionSCMTest.java b/test/src/test/java/hudson/scm/SubversionSCMTest.java index 83a3d265f9..c92fee3fe9 100644 --- a/test/src/test/java/hudson/scm/SubversionSCMTest.java +++ b/test/src/test/java/hudson/scm/SubversionSCMTest.java @@ -1,7 +1,7 @@ /* * The MIT License * - * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Bruce Chapman + * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Bruce Chapman, Yahoo! Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -54,12 +54,6 @@ import org.tmatesoft.svn.core.SVNException; * @author Kohsuke Kawaguchi */ public class SubversionSCMTest extends HudsonTestCase { - - private void setJavaNetCredential() throws SVNException, IOException { - // set the credential to access svn.dev.java.net - hudson.getDescriptorByType(SubversionSCM.DescriptorImpl.class).postCredential("https://svn.dev.java.net/svn/hudson/","guest","",null,new PrintWriter(new NullStream())); - } - @PresetData(ANONYMOUS_READONLY) @Bug(2380) public void testTaggingPermission() throws Exception { diff --git a/test/src/test/java/hudson/tasks/junit/CaseResultTest.java b/test/src/test/java/hudson/tasks/junit/CaseResultTest.java index 702d14d431..e748d8ba88 100644 --- a/test/src/test/java/hudson/tasks/junit/CaseResultTest.java +++ b/test/src/test/java/hudson/tasks/junit/CaseResultTest.java @@ -1,3 +1,26 @@ +/* + * The MIT License + * + * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Yahoo! Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package hudson.tasks.junit; import hudson.maven.MavenModuleSet; @@ -15,10 +38,11 @@ public class CaseResultTest extends HudsonTestCase { * Verifies that Hudson can capture the stdout/stderr output from Maven surefire. */ public void testSurefireOutput() throws Exception { + setJavaNetCredential(); configureDefaultMaven(); MavenModuleSet p = createMavenProject(); - p.setScm(new SubversionSCM("https://www.dev.java.net/svn/hudson/trunk/hudson/test-projects/junit-failure@16411")); + p.setScm(new SubversionSCM("https://svn.dev.java.net/svn/hudson/trunk/hudson/test-projects/junit-failure@16411")); MavenModuleSetBuild b = assertBuildStatus(UNSTABLE,p.scheduleBuild2(0).get()); AbstractTestResultAction t = b.getTestResultAction(); assertSame(1,t.getFailCount());