use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithChoiceParam.
public void _testSimpleCIEventTriggerWithChoiceParam(String properties, String body, String matchString) throws Exception {
WorkflowJob jobA = j.jenkins.createProject(WorkflowJob.class, "foo");
jobA.setDefinition(new CpsFlowDefinition("node('master') {\n echo \"mychoice is $mychoice\"\n}", true));
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("CI_MESSAGE", "", ""), new StringParameterDefinition("mychoice", "scott\ntom", "")));
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null))), jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, properties, body)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains(matchString, jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithTextArea.
public void _testSimpleCIEventTriggerWithTextArea(String body, String matchString) throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new Shell("echo CI_MESSAGE = \"$CI_MESSAGE\""));
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("CI_MESSAGE", "", "")));
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null))), jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, null, body)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains(matchString, jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribe.
public void _testSimpleCIEventSubscribe() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData(// null, "HELLO", "CI_TYPE = 'code-quality-checks-done'"
null, "HELLO", null)));
jobA.getBuildersList().add(new Shell("echo $HELLO"));
scheduleAwaitStep(jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "CI_STATUS = failed", "Hello World")));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("Hello World", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithPipelineWaitForMsg.
public void _testSimpleCIEventTriggerWithPipelineWaitForMsg() throws Exception {
WorkflowJob wait = j.jenkins.createProject(WorkflowJob.class, "wait");
wait.setDefinition(new CpsFlowDefinition("node('master') {\n def scott = waitForCIMessage providerName: '" + DEFAULT_PROVIDER_NAME + "', " + " selector: " + " \"CI_TYPE = 'code-quality-checks-done' and CI_STATUS = 'failed'\" \necho \"scott = \" + scott}", true));
scheduleAwaitStep(wait);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "CI_STATUS = failed", "Hello World")));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(wait.getLastBuild());
j.assertLogContains("Hello World", wait.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testDisabledWorkflowJobDoesNotGetTriggered.
public void _testDisabledWorkflowJobDoesNotGetTriggered() throws Exception {
WorkflowJob jobA = j.jenkins.createProject(WorkflowJob.class, "jobA");
jobA.setDefinition(new CpsFlowDefinition("echo \"CI_TYPE = ${env.CI_TYPE}\"", true));
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, "CI_TYPE = 'code-quality-checks-done' and CI_STATUS = 'failed'"))), jobA);
jobA.doDisable();
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "CI_STATUS = failed", null)));
j.buildAndAssertSuccess(jobB);
Thread.sleep(5000);
assertThat(jobA.getBuilds(), Matchers.iterableWithSize(0));
jobA.doEnable();
Thread.sleep(3000);
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("CI_TYPE = code-quality-checks-done", jobA.getLastBuild());
}
Aggregations