Search in sources :

Example 1 with GlobalCIConfiguration

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

the class AmqMessagingPluginIntegrationTest method setUp.

@Before
public void setUp() throws IOException, InterruptedException {
    // Can be moved to @BeforeClass, BUT there are tests that stops the container on purpose - breaks subsequent tests.
    amq = docker.create();
    String brokerUrl = amq.getBroker();
    Thread.sleep(3000);
    GlobalCIConfiguration gcc = GlobalCIConfiguration.get();
    gcc.setConfigs(Collections.singletonList(new ActiveMqMessagingProvider(DEFAULT_PROVIDER_NAME, brokerUrl, false, DEFAULT_TOPIC_NAME, null, new UsernameAuthenticationMethod("admin", Secret.fromString("redhat")))));
// TODO test connection
}
Also used : ActiveMqMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider) UsernameAuthenticationMethod(com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod) GlobalCIConfiguration(com.redhat.jenkins.plugins.ci.GlobalCIConfiguration) Before(org.junit.Before)

Example 2 with GlobalCIConfiguration

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

the class AmqMessagingPluginLockdownIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    ActiveMQContainer amq = docker.create();
    GlobalCIConfiguration gcc = GlobalCIConfiguration.get();
    gcc.setConfigs(Collections.singletonList(new ActiveMqMessagingProvider("name", createFailoverUrl(amq.getBroker()), true, "CI", null, new UsernameAuthenticationMethod("admin", Secret.fromString("redhat")))));
    String adminUser = "admin";
    String user = "user";
    configureSecurity(adminUser, user);
// TODO test connection. WebClient? Rest?
}
Also used : ActiveMqMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider) ActiveMQContainer(com.redhat.jenkins.plugins.ci.integration.fixtures.ActiveMQContainer) UsernameAuthenticationMethod(com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod) GlobalCIConfiguration(com.redhat.jenkins.plugins.ci.GlobalCIConfiguration) Before(org.junit.Before)

Example 3 with GlobalCIConfiguration

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

the class AmqMessagingPluginWithFailoverIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    amq = docker.create();
    GlobalCIConfiguration gcc = GlobalCIConfiguration.get();
    gcc.setConfigs(Collections.singletonList(new ActiveMqMessagingProvider(SharedMessagingPluginIntegrationTest.DEFAULT_PROVIDER_NAME, createFailoverUrl(amq.getBroker()), true, "CI", null, new UsernameAuthenticationMethod("admin", Secret.fromString("redhat")))));
// TODO test connection. WebClient? Rest?
}
Also used : ActiveMqMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider) UsernameAuthenticationMethod(com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod) GlobalCIConfiguration(com.redhat.jenkins.plugins.ci.GlobalCIConfiguration) Before(org.junit.Before)

Example 4 with GlobalCIConfiguration

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

the class MessageUtils method sendMessage.

public static SendResult sendMessage(Run<?, ?> build, TaskListener listener, ProviderData pdata) {
    String startMessage = "Sending message for job '" + build.getParent().getName() + "'.";
    log.info(startMessage);
    listener.getLogger().println(startMessage);
    GlobalCIConfiguration config = GlobalCIConfiguration.get();
    JMSMessagingWorker worker = config.getProvider(pdata.getName()).createWorker(pdata, build.getParent().getName());
    SendResult sendResult = worker.sendMessage(build, listener, pdata);
    String completedMessage = "Sent successfully with messageId: " + sendResult.getMessageId();
    log.info(completedMessage);
    listener.getLogger().println(completedMessage);
    return sendResult;
}
Also used : JMSMessagingWorker(com.redhat.jenkins.plugins.ci.messaging.JMSMessagingWorker) SendResult(com.redhat.jenkins.plugins.ci.messaging.data.SendResult) GlobalCIConfiguration(com.redhat.jenkins.plugins.ci.GlobalCIConfiguration)

Aggregations

GlobalCIConfiguration (com.redhat.jenkins.plugins.ci.GlobalCIConfiguration)4 UsernameAuthenticationMethod (com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod)3 ActiveMqMessagingProvider (com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider)3 Before (org.junit.Before)3 ActiveMQContainer (com.redhat.jenkins.plugins.ci.integration.fixtures.ActiveMQContainer)1 JMSMessagingWorker (com.redhat.jenkins.plugins.ci.messaging.JMSMessagingWorker)1 SendResult (com.redhat.jenkins.plugins.ci.messaging.data.SendResult)1