Package hudson.maven

Examples of hudson.maven.MavenModuleSet$DescriptorImpl


     * Creates a empty Maven project with the given name.
     *
     * @see #configureDefaultMaven()
     */
    protected MavenModuleSet createMavenProject(String name) throws IOException {
        MavenModuleSet mavenModuleSet = hudson.createProject(MavenModuleSet.class,name);
        mavenModuleSet.setRunHeadless( true );
        return mavenModuleSet;
    }
View Full Code Here


        return ((MavenModule)tr.owner.getProject()).getModuleName().toString();
    }

    @Override
    public MavenBuild resolveChild(Child child) {
        MavenModuleSet mms = (MavenModuleSet) owner.getProject();
        MavenModule m = mms.getModule(child.name);
        if(m!=null)
            return m.getBuildByNumber(child.build);
        return null;
    }
View Full Code Here

* @author Kohsuke Kawaguchi
*/
public class SurefireArchiverTest extends HudsonTestCase {
    public void testSerialization() throws Exception {
        configureDefaultMaven();
        MavenModuleSet m = createMavenProject();
        m.setScm(new ExtractResourceSCM(getClass().getResource("../maven-surefire-unstable.zip")));
        m.setGoals("install");

        MavenModuleSetBuild b = m.scheduleBuild2(0).get();
        assertBuildStatus(Result.UNSTABLE, b);


        MavenBuild mb = b.getModuleLastBuilds().values().iterator().next();
        boolean foundFactory=false,foundSurefire=false;
View Full Code Here

        String recipient = "you <you@sun.com>";
        Mailbox yourInbox = Mailbox.get(new InternetAddress(recipient));
        yourInbox.clear();

        configureDefaultMaven();
        MavenModuleSet mms = createMavenProject();
        mms.setGoals("test");
        mms.setScm(new ExtractResourceSCM(getClass().getResource("/hudson/maven/maven-multimodule-unit-failure.zip")));
        assertBuildStatus(Result.UNSTABLE, mms.scheduleBuild2(0).get());

        MavenMailer m = new MavenMailer();
        m.recipients = recipient;
        m.perModuleEmail = perModuleEamil;
        mms.getReporters().add(m);

        mms.scheduleBuild2(0).get();

        Address[] senders = yourInbox.get(0).getFrom();
        assertEquals(1, senders.length);
        assertEquals("me <me@sun.com>", senders[0].toString());
View Full Code Here

    }

    private void doMavenTriggerTest(boolean evenWhenUnstable) throws Exception {
        FreeStyleProject dp = createDownstreamProject();
        configureDefaultMaven();
        MavenModuleSet m = createMavenProject();
        m.getPublishersList().add(new BuildTrigger("downstream", evenWhenUnstable));
        if (!evenWhenUnstable) {
            // Configure for UNSTABLE
            m.setGoals("clean test");
            m.setScm(new ExtractResourceSCM(getClass().getResource("maven-test-failure.zip")));
        } // otherwise do nothing which gets FAILURE
        // First build should not trigger downstream project
        MavenModuleSetBuild b = m.scheduleBuild2(0).get();
        assertNoDownstreamBuild(dp, b);

        if (evenWhenUnstable) {
            // Configure for UNSTABLE
            m.setGoals("clean test");
            m.setScm(new ExtractResourceSCM(getClass().getResource("maven-test-failure.zip")));
        } else {
            // Configure for SUCCESS
            m.setGoals("clean");
            m.setScm(new ExtractResourceSCM(getClass().getResource("maven-empty.zip")));
        }
        // Next build should trigger downstream project
        b = m.scheduleBuild2(0).get();
        assertDownstreamBuild(dp, b);
    }
View Full Code Here

    public void testNativeMaven() throws Exception {
        MavenInstallation maven = configureDefaultMaven();
        String mavenPath = maven.getHome();
        Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG", NO_PROPERTIES));

        MavenModuleSet project = createMavenProject();
        project.setScm(new ExtractResourceSCM(getClass().getResource(
                "/simple-projects.zip")));
        project.setAssignedLabel(slave.getSelfLabel());
        project.setJDK(hudson.getJDK("default"));

        project.setMaven("maven");
        project.setGoals("clean");

        Run build = project.scheduleBuild2(0).get();
        assertBuildStatus(Result.FAILURE, build);

        ToolLocationNodeProperty property = new ToolLocationNodeProperty(
                new ToolLocationNodeProperty.ToolLocation(hudson.getDescriptorByType(MavenInstallation.DescriptorImpl.class), "maven", mavenPath));
        slave.getNodeProperties().add(property);

        build = project.scheduleBuild2(0).get();
        System.out.println(build.getLog());
        assertBuildStatus(Result.SUCCESS, build);

    }
View Full Code Here

        Jenkins.getInstance().setNodes(Jenkins.getInstance().getNodes());
        Assert.assertNotNull(Jenkins.getInstance().toComputer());
    }
   
    private MavenModuleSet createSimpleMavenProject() throws Exception {
        MavenModuleSet project = createMavenProject();
        MavenInstallation mi = configureMaven3();
        project.setScm(new ExtractResourceSCM(getClass().getResource(
                "/simple-projects.zip")));
        project.setMaven(mi.getName());
        project.setGoals("validate");
        return project;
    }
View Full Code Here

        Jenkins.getInstance().setNodes(Jenkins.getInstance().getNodes());
        Assert.assertNull(Jenkins.getInstance().toComputer());
    }
   
    public void testMaven() throws Exception {
        MavenModuleSet m = createSimpleMavenProject();
       
        assertGetEnvironmentCallOutsideBuildWorks(m);
    }
View Full Code Here

    /**
     * Upstream/downstream relationship lost.
     */
    public void testBuildChains() throws Exception {
        FreeStyleProject up = createFreeStyleProject("up");
        MavenModuleSet dp = createMavenProject("dp");

        // designate 'dp' as the downstream in 'up'
        WebClient webClient = new WebClient();
        HtmlPage page = webClient.getPage(up,"configure");

View Full Code Here

     * Verifies that the error message and stacktrace from a failed junit test actually render properly.
     */
    @Bug(4257)
    public void testMavenErrorMsgAndStacktraceRender() throws Exception {
  configureDefaultMaven();
  MavenModuleSet m = createMavenProject("maven-render-test");
  m.setScm(new ExtractResourceSCM(m.getClass().getResource("maven-test-failure-findbugs.zip")));
  m.setGoals("clean test");

  MavenModuleSetBuild b = assertBuildStatus(Result.UNSTABLE, m.scheduleBuild2(0).get());
  MavenBuild modBuild = (MavenBuild)b.getModuleLastBuilds().get(m.getModule("test:test"));
  TestResult tr = modBuild.getAction(SurefireReport.class).getResult();
        assertEquals(1,tr.getFailedTests().size());
        CaseResult cr = tr.getFailedTests().get(0);
        assertEquals("test.AppTest",cr.getClassName());
        assertEquals("testApp",cr.getName());
View Full Code Here

TOP

Related Classes of hudson.maven.MavenModuleSet$DescriptorImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.