Search in sources :

Example 1 with CIMessageSubscriberBuilder

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());
}
Also used : Shell(hudson.tasks.Shell) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIMessageSubscriberBuilder(com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder) FreeStyleProject(hudson.model.FreeStyleProject) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)

Example 2 with CIMessageSubscriberBuilder

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());
}
Also used : Shell(hudson.tasks.Shell) StringParameterDefinition(hudson.model.StringParameterDefinition) ParametersDefinitionProperty(hudson.model.ParametersDefinitionProperty) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIMessageSubscriberBuilder(com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder) FreeStyleProject(hudson.model.FreeStyleProject)

Example 3 with CIMessageSubscriberBuilder

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());
}
Also used : Shell(hudson.tasks.Shell) StringParameterDefinition(hudson.model.StringParameterDefinition) ParametersDefinitionProperty(hudson.model.ParametersDefinitionProperty) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIMessageSubscriberBuilder(com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder) FreeStyleProject(hudson.model.FreeStyleProject)

Example 4 with CIMessageSubscriberBuilder

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());
}
Also used : Shell(hudson.tasks.Shell) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIMessageSubscriberBuilder(com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder) FreeStyleProject(hudson.model.FreeStyleProject)

Example 5 with CIMessageSubscriberBuilder

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());
}
Also used : Shell(hudson.tasks.Shell) StringParameterDefinition(hudson.model.StringParameterDefinition) ParametersDefinitionProperty(hudson.model.ParametersDefinitionProperty) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIMessageSubscriberBuilder(com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder) FreeStyleProject(hudson.model.FreeStyleProject) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)

Aggregations

CIMessageNotifier (com.redhat.jenkins.plugins.ci.CIMessageNotifier)8 CIMessageSubscriberBuilder (com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder)8 FreeStyleProject (hudson.model.FreeStyleProject)7 Shell (hudson.tasks.Shell)7 MsgCheck (com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)3 ParametersDefinitionProperty (hudson.model.ParametersDefinitionProperty)3 StringParameterDefinition (hudson.model.StringParameterDefinition)3 CIMessageBuilder (com.redhat.jenkins.plugins.ci.CIMessageBuilder)1 Initializer (hudson.init.Initializer)1 MatrixProject (hudson.matrix.MatrixProject)1 AbstractProject (hudson.model.AbstractProject)1 BuildableItemWithBuildWrappers (hudson.model.BuildableItemWithBuildWrappers)1 Job (hudson.model.Job)1 Project (hudson.model.Project)1 Jenkins (jenkins.model.Jenkins)1