Search in sources :

Example 6 with BadgeSummaryAction

use of com.jenkinsci.plugins.badge.action.BadgeSummaryAction in project badge-plugin by jenkinsci.

the class CreateSummaryStepTest method createSummary_plain.

@Test
public void createSummary_plain() throws Exception {
    String text = randomUUID().toString();
    BadgeSummaryAction action = createSummary("summary.appendText('" + text + "')");
    assertEquals(text, action.getText());
}
Also used : BadgeSummaryAction(com.jenkinsci.plugins.badge.action.BadgeSummaryAction) Test(org.junit.Test)

Example 7 with BadgeSummaryAction

use of com.jenkinsci.plugins.badge.action.BadgeSummaryAction in project badge-plugin by jenkinsci.

the class RemoveSummariesStepTest method removeSummaries.

private void removeSummaries(String removeScript, String... remainingBadgeIds) throws Exception {
    String icon = randomUUID().toString();
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition("def summaryA = createSummary(id:'a', icon:\"" + icon + "\")\n" + "def summaryB = createSummary(id:'b', icon:\"" + icon + "\")\n" + removeScript, true));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    List<BadgeSummaryAction> summaryActions = b.getActions(BadgeSummaryAction.class);
    assertEquals(remainingBadgeIds.length, summaryActions.size());
    for (int i = 0; i < remainingBadgeIds.length; i++) {
        assertEquals(remainingBadgeIds[i], summaryActions.get(i).getId());
    }
}
Also used : CpsFlowDefinition(org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) WorkflowRun(org.jenkinsci.plugins.workflow.job.WorkflowRun) BadgeSummaryAction(com.jenkinsci.plugins.badge.action.BadgeSummaryAction)

Aggregations

BadgeSummaryAction (com.jenkinsci.plugins.badge.action.BadgeSummaryAction)7 Test (org.junit.Test)5 CpsFlowDefinition (org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition)3 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)3 WorkflowRun (org.jenkinsci.plugins.workflow.job.WorkflowRun)3