use of com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribeWithCheck.
public void _testSimpleCIEventSubscribeWithCheck() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData(null, "HELLP", "", new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE))));
jobA.getBuildersList().add(new Shell("echo $HELLO"));
scheduleAwaitStep(jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, 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.CIMessageSubscriberBuilder in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribeWithNoParamOverride.
public void _testSimpleCIEventSubscribeWithNoParamOverride() throws Exception {
// Job parameters are NOT overridden when the subscribe build step is used.
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("PARAMETER", "original parameter value", "")));
jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData(null, "MESSAGE_CONTENT", "CI_TYPE = 'code-quality-checks-done'")));
jobA.getBuildersList().add(new Shell("echo $PARAMETER"));
jobA.getBuildersList().add(new Shell("echo $MESSAGE_CONTENT"));
scheduleAwaitStep(jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "PARAMETER = my parameter", "This is my content")));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("original parameter value", jobA.getLastBuild());
j.assertLogContains("This is my content", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribeWithTopicOverrideAndVariableTopic.
public void _testSimpleCIEventSubscribeWithTopicOverrideAndVariableTopic() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("MY_TOPIC", "my-topic", "")));
jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData("$MY_TOPIC", "HELLO", "CI_TYPE = 'code-quality-checks-done'")));
jobA.getBuildersList().add(new Shell("echo $HELLO"));
scheduleAwaitStep(jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("my-topic", 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.CIMessageSubscriberBuilder 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.CIMessageSubscriberBuilder in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribeWithCheckWithTopicOverrideAndVariableTopic.
public void _testSimpleCIEventSubscribeWithCheckWithTopicOverrideAndVariableTopic() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("MY_TOPIC", "my-topic", "")));
jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData("$MY_TOPIC", "HELLO", null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE))));
jobA.getBuildersList().add(new Shell("echo $HELLO"));
scheduleAwaitStep(jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("my-topic", null, null, MESSAGE_CHECK_CONTENT)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("catch me", jobA.getLastBuild());
}
Aggregations