Search in sources :

Example 6 with MsgCheck

use of com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheckNoSquash.

public void _testSimpleCIEventTriggerWithCheckNoSquash() throws Exception {
    FreeStyleProject jobA = j.createFreeStyleProject();
    jobA.getBuildersList().add(new Shell("sleep 3;"));
    attachTrigger(new CIBuildTrigger(true, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), jobA);
    FreeStyleProject jobB = j.createFreeStyleProject();
    jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, null, MESSAGE_CHECK_CONTENT)));
    j.buildAndAssertSuccess(jobB);
    j.buildAndAssertSuccess(jobB);
    j.buildAndAssertSuccess(jobB);
    j.buildAndAssertSuccess(jobB);
    j.buildAndAssertSuccess(jobB);
    waitUntilScheduledBuildCompletes();
    assertThat(jobA.getLastBuild().getNumber(), is(equalTo(5)));
}
Also used : Shell(hudson.tasks.Shell) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) FreeStyleProject(hudson.model.FreeStyleProject) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)

Example 7 with MsgCheck

use of com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheck.

public void _testSimpleCIEventTriggerWithCheck() throws Exception {
    FreeStyleProject jobA = j.createFreeStyleProject();
    jobA.getBuildersList().add(new Shell("echo job ran"));
    attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), 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("echo job ran", jobA.getLastBuild());
}
Also used : Shell(hudson.tasks.Shell) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) FreeStyleProject(hudson.model.FreeStyleProject) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)

Example 8 with MsgCheck

use of com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheckOnPipelineJob.

public void _testSimpleCIEventTriggerWithCheckOnPipelineJob() throws Exception {
    WorkflowJob jobA = j.jenkins.createProject(WorkflowJob.class, "jobA");
    jobA.setDefinition(new CpsFlowDefinition("node('master') {\n sleep 10\n}", true));
    attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), 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());
}
Also used : CpsFlowDefinition(org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck) FreeStyleProject(hudson.model.FreeStyleProject)

Example 9 with MsgCheck

use of com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheckWithTopicOverride.

public void _testSimpleCIEventTriggerWithCheckWithTopicOverride() throws Exception {
    FreeStyleProject jobA = j.createFreeStyleProject();
    jobA.getBuildersList().add(new Shell("echo job ran"));
    attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData("otopic", null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), jobA);
    FreeStyleProject jobB = j.createFreeStyleProject();
    jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("otopic", null, null, MESSAGE_CHECK_CONTENT)));
    j.buildAndAssertSuccess(jobB);
    waitUntilScheduledBuildCompletes();
    j.assertBuildStatusSuccess(jobA.getLastBuild());
    j.assertLogContains("echo job ran", jobA.getLastBuild());
}
Also used : Shell(hudson.tasks.Shell) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) FreeStyleProject(hudson.model.FreeStyleProject) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)

Example 10 with MsgCheck

use of com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithMultipleTopics.

// TODO restart tests
public void _testSimpleCIEventTriggerWithMultipleTopics() throws Exception {
    FreeStyleProject jobA = j.createFreeStyleProject();
    attachTrigger(new CIBuildTrigger(false, Arrays.asList(getSubscriberProviderData("topic1", null, null, new MsgCheck("my-topic", "topic1")), getSubscriberProviderData("topic2", null, null, new MsgCheck("my-topic", "topic2")))), jobA);
    jobA.getBuildersList().add(new Shell("echo $CI_MESSAGE"));
    FreeStyleProject jobB = j.createFreeStyleProject();
    jobB.getBuildersList().add(new CIMessageBuilder(getPublisherProviderData("topic1", MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, null, "{ \"my-topic\" : \"topic1\" }")));
    j.buildAndAssertSuccess(jobB);
    waitUntilScheduledBuildCompletes();
    j.assertBuildStatusSuccess(jobA.getLastBuild());
    j.assertLogContains("topic1", jobA.getLastBuild());
    FreeStyleProject jobC = j.createFreeStyleProject();
    jobC.getBuildersList().add(new CIMessageBuilder(getPublisherProviderData("topic2", MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, null, "{ \"my-topic\" : \"topic2\" }")));
    j.buildAndAssertSuccess(jobC);
    waitUntilScheduledBuildCompletes();
    j.assertBuildStatusSuccess(jobA.getLastBuild());
    j.assertLogContains("topic2", jobA.getLastBuild());
}
Also used : Shell(hudson.tasks.Shell) CIMessageBuilder(com.redhat.jenkins.plugins.ci.CIMessageBuilder) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) FreeStyleProject(hudson.model.FreeStyleProject) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)

Aggregations

MsgCheck (com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)20 FreeStyleProject (hudson.model.FreeStyleProject)17 CIBuildTrigger (com.redhat.jenkins.plugins.ci.CIBuildTrigger)14 Shell (hudson.tasks.Shell)14 CIMessageNotifier (com.redhat.jenkins.plugins.ci.CIMessageNotifier)12 CIMessageSubscriberBuilder (com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder)4 CpsFlowDefinition (org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition)4 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)4 ParametersDefinitionProperty (hudson.model.ParametersDefinitionProperty)3 StringParameterDefinition (hudson.model.StringParameterDefinition)3 IOException (java.io.IOException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 CIEnvironmentContributingAction (com.redhat.jenkins.plugins.ci.CIEnvironmentContributingAction)2 CIMessageBuilder (com.redhat.jenkins.plugins.ci.CIMessageBuilder)2 FedmsgRelayContainer (com.redhat.jenkins.plugins.ci.integration.fixtures.FedmsgRelayContainer)2 MessagingProviderOverrides (com.redhat.jenkins.plugins.ci.messaging.MessagingProviderOverrides)2 FedmsgMessage (com.redhat.jenkins.plugins.ci.messaging.data.FedmsgMessage)2 FedMsgSubscriberProviderData (com.redhat.jenkins.plugins.ci.provider.data.FedMsgSubscriberProviderData)2 ProviderData (com.redhat.jenkins.plugins.ci.provider.data.ProviderData)2 EnvVars (hudson.EnvVars)2