src/test/java/com/cloudbees/jenkins/support/impl/AbstractItemComponentTest.java
@Test
    public void addContentsFromJobWithIncludes() throws Exception {
        WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, JOB_NAME);
        p.setDefinition(new CpsFlowDefinition("node { echo 'test' }", true));
        WorkflowRun workflowRun = Optional.ofNullable(p.scheduleBuild2(0))
                .orElseThrow(AssertionFailedError::new)
                .waitForStart();
        j.waitForCompletion(workflowRun);

        j.waitUntilNoActivity();

        Map<String, String> output = SupportTestUtils.invokeComponentToMap(
                new AbstractItemDirectoryComponent("**/config.xml, **/build.xml", "", true, 10), p);

        String prefix = "items/" + JOB_NAME;
        assertTrue(output.containsKey(prefix + "/config.xml"));
        assertTrue(output.containsKey(prefix + "/builds/1/build.xml"));
        assertFalse(output.containsKey(prefix + "/builds/1/log"));
        assertFalse(output.containsKey(prefix + "/builds/1/workflow/2.xml"));
    }
/*
     * Test adding item directory content with includes patterns.
     */
Test adding item directory content with includes patterns.
Test adding item directory content with includes patterns .
@Test
    public void addContentsFromJobWithIncludes() throws Exception {
        WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, JOB_NAME);
        p.setDefinition(new CpsFlowDefinition("node { echo 'test' }", true));
        WorkflowRun workflowRun = Optional.ofNullable(p.scheduleBuild2(0))
                .orElseThrow(AssertionFailedError::new)
                .waitForStart();
        j.waitForCompletion(workflowRun);
        j.waitUntilNoActivity();
        Map<String, String> output = SupportTestUtils.invokeComponentToMap(
                new AbstractItemDirectoryComponent("**/config.xml, **/build.xml", "", true, 10), p);
        String prefix = "items/" + JOB_NAME;
        assertTrue(output.containsKey(prefix + "/config.xml"));
        assertTrue(output.containsKey(prefix + "/builds/1/build.xml"));
        assertFalse(output.containsKey(prefix + "/builds/1/log"));
        assertFalse(output.containsKey(prefix + "/builds/1/workflow/2.xml"));
    }
@ Test public void addContentsFromJobWithIncludes ( ) throws Exception { WorkflowJob p = j . jenkins . createProject ( WorkflowJob . class , JOB_NAME ) ; p . setDefinition ( new CpsFlowDefinition ( "node { echo 'test' }" , true ) ) ; WorkflowRun workflowRun = Optional . ofNullable ( p . scheduleBuild2 ( 0 ) ) . orElseThrow ( AssertionFailedError :: new ) . waitForStart ( ) ; j . waitForCompletion ( workflowRun ) ; j . waitUntilNoActivity ( ) ; Map < String , String > output = SupportTestUtils . invokeComponentToMap ( new AbstractItemDirectoryComponent ( "**/config.xml, **/build.xml" , "" , true , 10 ) , p ) ; String prefix = "items/" + JOB_NAME ; assertTrue ( output . containsKey ( prefix + "/config.xml" ) ) ; assertTrue ( output . containsKey ( prefix + "/builds/1/build.xml" ) ) ; assertFalse ( output . containsKey ( prefix + "/builds/1/log" ) ) ; assertFalse ( output . containsKey ( prefix + "/builds/1/workflow/2.xml" ) ) ; }
Test adding item directory content with includes patterns.
Test adding item directory content with includes patterns .