Belatedly adding a test in MavenMultiModuleTest, adding MavenJellyTest to test maven-plugin's Jelly scripts

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21600 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
abayer committed 2009-09-10 22:38:57 +00:00
1 parent 8d98e3929a
commit e69a370619
2 files changed
+79 -2

No files matched your search

@@ -0,0 +1,42 @@
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, 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.maven;
import hudson.model.Hudson;
import hudson.remoting.Which;
import junit.framework.Test;
import junit.framework.TestCase;
import org.jvnet.hudson.test.JellyTestSuiteBuilder;
import java.io.File;
/**
* Runs Jelly checks on maven-plugin.
*
* @author Andrew Bayer
*/
public class MavenJellyTest extends TestCase {
public static Test suite() throws Exception {
return JellyTestSuiteBuilder.build(Which.jarFile(MavenModuleSet.class));
}
}
@@ -86,7 +86,8 @@ public class MavenMultiModuleTest extends HudsonTestCase {
ExtractChangeLogSet changeSet = (ExtractChangeLogSet) pBuild.getChangeSet();
assertFalse("ExtractChangeLogSet should not be empty.", changeSet.isEmptySet());
assertEquals("Parent build should have Result.UNSTABLE", pBuild.getResult(), Result.UNSTABLE);
for (MavenBuild modBuild : pBuild.getModuleLastBuilds().values()) {
if (modBuild.getParent().getModuleName().toString().equals("org.jvnet.hudson.main.test.multimod.incr:moduleA")) {
assertEquals("moduleA should have Result.UNSTABLE", modBuild.getResult(), Result.UNSTABLE);
@@ -98,7 +99,41 @@ public class MavenMultiModuleTest extends HudsonTestCase {
assertEquals("moduleC should have Result.SUCCESS", modBuild.getResult(), Result.SUCCESS);
}
if (modBuild.getParent().getModuleName().toString().equals("org.jvnet.hudson.main.test.multimod.incr:moduleD")) {
assertEquals("moduleC should have Result.NOT_BUILT", modBuild.getResult(), Result.NOT_BUILT);
assertEquals("moduleD should have Result.NOT_BUILT", modBuild.getResult(), Result.NOT_BUILT);
}
}
}
/**
* Test failures in a child module should lead to the parent being marked as unstable.
*/
@Bug(4378)
public void testMultiModWithTestFailuresMaven() throws Exception {
configureDefaultMaven("apache-maven-2.2.1");
MavenModuleSet m = createMavenProject();
m.getReporters().add(new TestReporter());
m.setScm(new ExtractResourceSCM(getClass().getResource("maven-multimod-incr.zip")));
assertBuildStatus(Result.UNSTABLE, m.scheduleBuild2(0).get());
MavenModuleSetBuild pBuild = m.getLastBuild();
assertEquals("Parent build should have Result.UNSTABLE", pBuild.getResult(), Result.UNSTABLE);
for (MavenBuild modBuild : pBuild.getModuleLastBuilds().values()) {
if (modBuild.getParent().getModuleName().toString().equals("org.jvnet.hudson.main.test.multimod.incr:moduleA")) {
assertEquals("moduleA should have Result.UNSTABLE", modBuild.getResult(), Result.UNSTABLE);
}
if (modBuild.getParent().getModuleName().toString().equals("org.jvnet.hudson.main.test.multimod.incr:moduleB")) {
assertEquals("moduleB should have Result.SUCCESS", modBuild.getResult(), Result.SUCCESS);
}
if (modBuild.getParent().getModuleName().toString().equals("org.jvnet.hudson.main.test.multimod.incr:moduleC")) {
assertEquals("moduleC should have Result.SUCCESS", modBuild.getResult(), Result.SUCCESS);
}
if (modBuild.getParent().getModuleName().toString().equals("org.jvnet.hudson.main.test.multimod.incr:moduleD")) {
assertEquals("moduleD should have Result.SUCCESS", modBuild.getResult(), Result.SUCCESS);
}
}