src/test/java/com/cloudbees/jenkins/support/impl/AbstractItemComponentTest.java
@Test
    public void addContentsFromFreestyle() throws Exception {
        MockFolder f = j.createFolder(FOLDER_NAME);
        FreeStyleProject p = f.createProject(FreeStyleProject.class, JOB_NAME);
        j.waitForCompletion(Optional.ofNullable(p.scheduleBuild2(0))
                .orElseThrow(AssertionFailedError::new).waitForStart());
        j.waitUntilNoActivity();

        Map<String, String> output = SupportTestUtils.invokeComponentToMap(new AbstractItemDirectoryComponent(), p);

        String prefix = "items/" + FOLDER_NAME + "/jobs/" + JOB_NAME;
        assertTrue(output.containsKey(prefix + "/config.xml"));
        assertTrue(output.containsKey(prefix + "/builds/1/build.xml"));
        assertTrue(output.containsKey(prefix + "/builds/1/log"));
        assertThat(output.get(prefix + "/config.xml"), containsString("<project>"));
    }
/*
     * Test adding item directory content with defaults for a freestyle job.
     */
Test adding item directory content with defaults for a freestyle job.
Test adding item directory content with defaults for a freestyle job .
@Test
    public void addContentsFromFreestyle() throws Exception {
        MockFolder f = j.createFolder(FOLDER_NAME);
        FreeStyleProject p = f.createProject(FreeStyleProject.class, JOB_NAME);
        j.waitForCompletion(Optional.ofNullable(p.scheduleBuild2(0))
                .orElseThrow(AssertionFailedError::new).waitForStart());
        j.waitUntilNoActivity();
        Map<String, String> output = SupportTestUtils.invokeComponentToMap(new AbstractItemDirectoryComponent(), p);
        String prefix = "items/" + FOLDER_NAME + "/jobs/" + JOB_NAME;
        assertTrue(output.containsKey(prefix + "/config.xml"));
        assertTrue(output.containsKey(prefix + "/builds/1/build.xml"));
        assertTrue(output.containsKey(prefix + "/builds/1/log"));
        assertThat(output.get(prefix + "/config.xml"), containsString("<project>"));
    }
@ Test public void addContentsFromFreestyle ( ) throws Exception { MockFolder f = j . createFolder ( FOLDER_NAME ) ; FreeStyleProject p = f . createProject ( FreeStyleProject . class , JOB_NAME ) ; j . waitForCompletion ( Optional . ofNullable ( p . scheduleBuild2 ( 0 ) ) . orElseThrow ( AssertionFailedError :: new ) . waitForStart ( ) ) ; j . waitUntilNoActivity ( ) ; Map < String , String > output = SupportTestUtils . invokeComponentToMap ( new AbstractItemDirectoryComponent ( ) , p ) ; String prefix = "items/" + FOLDER_NAME + "/jobs/" + JOB_NAME ; assertTrue ( output . containsKey ( prefix + "/config.xml" ) ) ; assertTrue ( output . containsKey ( prefix + "/builds/1/build.xml" ) ) ; assertTrue ( output . containsKey ( prefix + "/builds/1/log" ) ) ; assertThat ( output . get ( prefix + "/config.xml" ) , containsString ( "<project>" ) ) ; }
Test adding item directory content with defaults for a freestyle job.
Test adding item directory content with defaults for a freestyle job .