use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribeWithTopicOverride.
public void _testSimpleCIEventSubscribeWithTopicOverride() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData("otopic", "MESSAGE_CONTENT", "CI_TYPE = 'code-quality-checks-done'")));
jobA.getBuildersList().add(new Shell("echo $MESSAGE_CONTENT"));
scheduleAwaitStep(jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("otopic", MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, null, "This is my content")));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("This is my content", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithRegExpCheck.
public void _testSimpleCIEventTriggerWithRegExpCheck() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck("$.compose.compose_id", "Fedora-Atomic.+")))), jobA);
jobA.getBuildersList().add(new Shell("echo job ran"));
jobA.getBuildersList().add(new Shell("echo CI_MESSAGE = $CI_MESSAGE"));
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, null, "{ \"compose\": { \"compose_id\": \"Fedora-Atomic-25-20170105.0\" } }")));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("echo job ran", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribeWithCheckWithTopicOverride.
public void _testSimpleCIEventSubscribeWithCheckWithTopicOverride() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData("otopic", "MESSAGE_CONTENT", "CI_TYPE = 'code-quality-checks-done'", new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE))));
jobA.getBuildersList().add(new Shell("echo $MESSAGE_CONTENT"));
scheduleAwaitStep(jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("otopic", MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, null, MESSAGE_CHECK_CONTENT)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("catch me", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTrigger.
public void _testSimpleCIEventTrigger() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, "CI_TYPE = 'code-quality-checks-done' and CI_STATUS = 'failed'"))), jobA);
jobA.getBuildersList().add(new Shell("echo CI_TYPE = $CI_TYPE"));
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "CI_STATUS = failed", null)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("echo CI_TYPE = code-quality-checks-done", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheckWithPipelineWaitForMsg.
public void _testSimpleCIEventTriggerWithCheckWithPipelineWaitForMsg() throws Exception {
WorkflowJob wait = j.jenkins.createProject(WorkflowJob.class, "wait");
wait.setDefinition(new CpsFlowDefinition("node('master') {\n def scott = waitForCIMessage providerName: '" + DEFAULT_PROVIDER_NAME + "', " + " checks: [[field: '" + MESSAGE_CHECK_FIELD + "', expectedValue: '" + MESSAGE_CHECK_VALUE + "']]\n" + "}", true));
scheduleAwaitStep(wait);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, null, MESSAGE_CHECK_CONTENT)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(wait.getLastBuild());
j.assertLogContains("catch me", wait.getLastBuild());
}
Aggregations