Package hudson.model

Examples of hudson.model.FreeStyleProject


   
    public void testGetSuggestionsHasBothNamesAndDisplayNames() throws Exception {
        final String projectName = "project name";
        final String displayName = "display name";

        FreeStyleProject project1 = createFreeStyleProject(projectName);
        project1.setDisplayName(displayName);
       
        WebClient wc = new WebClient();
        Page result = wc.goTo("search/suggest?query=name", "application/javascript");
        Assert.assertNotNull(result);
        assertGoodStatus(result);
View Full Code Here


        assertEquals(1,isp.installers.size());
        assertNotNull(isp.installers.get(MavenInstaller.class));
    }

    public void testSensitiveParameters() throws Exception {
        FreeStyleProject project = createFreeStyleProject();
        ParametersDefinitionProperty pdb = new ParametersDefinitionProperty(
                new StringParameterDefinition("string", "defaultValue", "string description"),
                new PasswordParameterDefinition("password", "12345", "password description"),
                new StringParameterDefinition("string2", "Value2", "string description")
        );
        project.addProperty(pdb);
        project.setScm(new ExtractResourceSCM(getClass().getResource("maven-empty.zip")));
        project.getBuildersList().add(new Maven("clean package",null));

        FreeStyleBuild build = project.scheduleBuild2(0).get();
        @SuppressWarnings("deprecation")
        String buildLog = build.getLog();
        assertNotNull(buildLog);
  System.out.println(buildLog);
        assertFalse(buildLog.contains("-Dpassword=12345"));
View Full Code Here

/**
* @author Kohsuke Kawaguchi
*/
public class UrlAnnotatorTest extends HudsonTestCase {
    public void test1() throws Exception {
        FreeStyleProject p = createFreeStyleProject();
        p.getBuildersList().add(new TestBuilder() {
            @Override
            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
                listener.getLogger().println("http://www.sun.com/");
                listener.getLogger().println("<http://www.kohsuke.org/>");
                listener.getLogger().println("<a href='http://www.oracle.com/'>");
View Full Code Here

     * Make sure that SCMTrigger doesn't trigger another build when a build has just started,
     * but not yet completed its SCM update.
     */
    @Bug(2671)
    public void testSimultaneousPollAndBuild() throws Exception {
        FreeStyleProject p = createFreeStyleProject();

        // used to coordinate polling and check out
        final OneShotEvent checkoutStarted = new OneShotEvent();

        p.setScm(new TestSCM(checkoutStarted));

        Future<FreeStyleBuild> build = p.scheduleBuild2(0, new Cause.UserCause());
        checkoutStarted.block();
        assertFalse("SCM-poll after build has started should wait until that build finishes SCM-update", p.pollSCMChanges(StreamTaskListener.fromStdout()));
        build.get()// let mock build finish
    }
View Full Code Here

     */
    @Bug(7649)
    public void testMultiplePollingOneBuildAction() throws Exception {
        final OneShotEvent buildStarted = new OneShotEvent();
        final OneShotEvent buildShouldComplete = new OneShotEvent();
        FreeStyleProject p = createFreeStyleProject();
        // Make build sleep a while so it blocks new builds
        p.getBuildersList().add(new TestBuilder() {
            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
                buildStarted.signal();
                buildShouldComplete.block();
                return true;
            }
        });

        SCMTrigger t = new SCMTrigger("@daily");
        t.start(p,true);
        p.addTrigger(t);

        // Start one build to block others
        assertTrue(p.scheduleBuild(new UserCause()));
        buildStarted.block(); // wait for the build to really start

        // Schedule a new build, and trigger it many ways while it sits in queue
        Future<FreeStyleBuild> fb = p.scheduleBuild2(0, new UserCause());
        assertNotNull(fb);
        assertFalse(p.scheduleBuild(new SCMTriggerCause("First poll")));
        assertFalse(p.scheduleBuild(new SCMTriggerCause("Second poll")));
        assertFalse(p.scheduleBuild(new SCMTriggerCause("Third poll")));

        // Wait for 2nd build to finish
        buildShouldComplete.signal();
        FreeStyleBuild build = fb.get();

View Full Code Here

public class Operation2174Test extends HudsonTestCase {
    /**
     * 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");

        HtmlForm form = page.getFormByName("config");

        // configure downstream build
        up.getPublishersList().add(new BuildTrigger("dp",false));
        configRoundtrip(up);

        // verify that the relationship is set up
        BuildTrigger trigger = up.getPublishersList().get(BuildTrigger.class);
        assertEquals(trigger.getChildProjects(up), Collections.singletonList(dp));

        // now go ahead and edit the downstream
        configRoundtrip(dp);

        // verify that the relationship is set up
        trigger = up.getPublishersList().get(BuildTrigger.class);
        assertNotNull(trigger);
        assertEquals(trigger.getChildProjects(up), Collections.singletonList(dp));
    }
View Full Code Here

   * Checks if the MatrixProject adds and Triggers downstream Projects via
   * the DependencyGraph
   */
  public void testMatrixProjectTriggersDependencies() throws Exception {
    MatrixProject matrixProject = createMatrixProject();
    FreeStyleProject freestyleProject = createFreeStyleProject();
    matrixProject.getPublishersList().add(new BuildTrigger(freestyleProject.getName(), false));
   
    hudson.rebuildDependencyGraph();
   
    buildAndAssertSuccess(matrixProject);
    waitUntilNoActivity();
   
    RunList<FreeStyleBuild> builds = freestyleProject.getBuilds();
    assertEquals("There should only be one FreestyleBuild", 1, builds.size());
    FreeStyleBuild build = builds.iterator().next();
    assertEquals(Result.SUCCESS, build.getResult());
    List<AbstractProject> downstream = hudson.getDependencyGraph().getDownstream(matrixProject);
    assertTrue(downstream.contains(freestyleProject));   
View Full Code Here

    /**
     * Performs a configuration round-trip testing for a builder.
     */
    protected <B extends Builder> B configRoundtrip(B before) throws Exception {
        FreeStyleProject p = createFreeStyleProject();
        p.getBuildersList().add(before);
        configRoundtrip((Item)p);
        return (B)p.getBuildersList().get(before.getClass());
    }
View Full Code Here

    /**
     * Performs a configuration round-trip testing for a publisher.
     */
    protected <P extends Publisher> P configRoundtrip(P before) throws Exception {
        FreeStyleProject p = createFreeStyleProject();
        p.getPublishersList().add(before);
        configRoundtrip((Item) p);
        return (P)p.getPublishersList().get(before.getClass());
    }
View Full Code Here

    public void test2() throws Exception {
        meat();
    }

    private void meat() throws IOException, InterruptedException, ExecutionException {
        FreeStyleProject project = createFreeStyleProject();
        if(System.getProperty("os.name").contains("Windows")) {
            project.getBuildersList().add(new BatchFile("echo hello"));
        } else {
            project.getBuildersList().add(new Shell("echo hello"));
        }

        FreeStyleBuild build = project.scheduleBuild2(0).get();
        System.out.println(build.getDisplayName()+" completed");

        String s = FileUtils.readFileToString(build.getLogFile());
        assertTrue(s,s.contains("echo hello"));
    }
View Full Code Here

TOP

Related Classes of hudson.model.FreeStyleProject

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.