Search in sources :

Example 1 with ActiveMqMessagingProvider

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

the class MigrationTest method testConfig.

@LocalData
@Test
public void testConfig() {
    assertEquals("config is not 1", 1, GlobalCIConfiguration.get().getConfigs().size());
    JMSMessagingProvider config = GlobalCIConfiguration.get().getConfigs().get(0);
    ActiveMqMessagingProvider aconfig = (ActiveMqMessagingProvider) config;
    String topic = aconfig.getTopic();
    assertEquals("topic is not TOM", "TOM", topic);
    AbstractProject<?, ?> triggerJob = (AbstractProject<?, ?>) j.getInstance().getItem("ci-trigger");
    CIBuildTrigger trigger = triggerJob.getTrigger(CIBuildTrigger.class);
    assertNotNull(trigger);
    CIBuildTrigger cibt = triggerJob.getTrigger(CIBuildTrigger.class);
    assertTrue(cibt.getProviders().get(0) instanceof ActiveMQSubscriberProviderData);
    assertNotNull(cibt.getProviders().get(0).getName());
    assertNotNull(cibt.getSelector());
    FreeStyleProject notifierJob = (FreeStyleProject) j.getInstance().getItem("ci-notifier");
    CIMessageBuilder builder = notifierJob.getBuildersList().get(CIMessageBuilder.class);
    assertNotNull(builder);
    assertNotNull(builder.getProviderName());
    assertNotNull(notifierJob.getPublishersList());
    CIMessageNotifier notifierPublisher = notifierJob.getPublishersList().get(CIMessageNotifier.class);
    assertNotNull(notifierPublisher.getProviderName());
    FreeStyleProject subscriberJob = (FreeStyleProject) j.getInstance().getItem("ci-message-subscriber");
    CIMessageSubscriberBuilder subscriberBuilder = subscriberJob.getBuildersList().get(CIMessageSubscriberBuilder.class);
    assertNotNull(subscriberBuilder);
    assertNotNull(subscriberBuilder.getProviderName());
    GlobalCIConfiguration newGlobalConfig = new GlobalCIConfiguration();
    JMSMessagingProvider config2 = newGlobalConfig.getConfigs().get(0);
    ActiveMqMessagingProvider aconfig2 = (ActiveMqMessagingProvider) config2;
    assertNotNull(aconfig2.getAuthenticationMethod());
}
Also used : ActiveMqMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider) ActiveMQSubscriberProviderData(com.redhat.jenkins.plugins.ci.provider.data.ActiveMQSubscriberProviderData) JMSMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.JMSMessagingProvider) AbstractProject(hudson.model.AbstractProject) FreeStyleProject(hudson.model.FreeStyleProject) LocalData(org.jvnet.hudson.test.recipes.LocalData) Test(org.junit.Test)

Example 2 with ActiveMqMessagingProvider

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

the class MigrationTest method testAlreadyMigratedConfig.

@LocalData
@Test
public void testAlreadyMigratedConfig() {
    assertEquals("config is not 1", 1, GlobalCIConfiguration.get().getConfigs().size());
    JMSMessagingProvider config = GlobalCIConfiguration.get().getConfigs().get(0);
    ActiveMqMessagingProvider aconfig = (ActiveMqMessagingProvider) config;
    String topic = aconfig.getTopic();
    assertEquals("topic is not CI", "CI", topic);
    assertTrue(aconfig.getTopicProvider() instanceof DefaultTopicProvider);
    AbstractProject<?, ?> triggerJob = (AbstractProject<?, ?>) j.getInstance().getItem("ci-trigger");
    CIBuildTrigger trigger = triggerJob.getTrigger(CIBuildTrigger.class);
    assertNotNull(trigger);
    assertNotNull(triggerJob.getTrigger(CIBuildTrigger.class).getProviderName());
    FreeStyleProject notifierJob = (FreeStyleProject) j.getInstance().getItem("ci-notifier");
    CIMessageBuilder builder = notifierJob.getBuildersList().get(CIMessageBuilder.class);
    assertNotNull(builder);
    assertNotNull(builder.getProviderName());
    assertNotNull(notifierJob.getPublishersList());
    CIMessageNotifier notifierPublisher = notifierJob.getPublishersList().get(CIMessageNotifier.class);
    assertNotNull(notifierPublisher.getProviderName());
    FreeStyleProject subscriberJob = (FreeStyleProject) j.getInstance().getItem("ci-message-subscriber");
    CIMessageSubscriberBuilder subscriberBuilder = subscriberJob.getBuildersList().get(CIMessageSubscriberBuilder.class);
    assertNotNull(subscriberBuilder);
    assertNotNull(subscriberBuilder.getProviderName());
}
Also used : ActiveMqMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider) JMSMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.JMSMessagingProvider) DefaultTopicProvider(com.redhat.jenkins.plugins.ci.messaging.topics.DefaultTopicProvider) AbstractProject(hudson.model.AbstractProject) FreeStyleProject(hudson.model.FreeStyleProject) LocalData(org.jvnet.hudson.test.recipes.LocalData) Test(org.junit.Test)

Example 3 with ActiveMqMessagingProvider

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

the class MigrationTest method testUpgradeFromOnlyUserBaseAuth.

@LocalData
@Test
public void testUpgradeFromOnlyUserBaseAuth() {
    assertEquals("config is not 1", 1, GlobalCIConfiguration.get().getConfigs().size());
    JMSMessagingProvider config = GlobalCIConfiguration.get().getConfigs().get(0);
    ActiveMqMessagingProvider aconfig = (ActiveMqMessagingProvider) config;
    assertNotNull(aconfig.getAuthenticationMethod());
    assertTrue(aconfig.getAuthenticationMethod() instanceof UsernameAuthenticationMethod);
    UsernameAuthenticationMethod authMethod = (UsernameAuthenticationMethod) aconfig.getAuthenticationMethod();
    assertEquals("username should be scott", "scott", authMethod.getUsername());
    assertTrue(aconfig.getTopicProvider() instanceof DefaultTopicProvider);
    GlobalCIConfiguration newGlobalConfig = new GlobalCIConfiguration();
    JMSMessagingProvider config2 = newGlobalConfig.getConfigs().get(0);
    ActiveMqMessagingProvider aconfig2 = (ActiveMqMessagingProvider) config2;
    assertNotNull(aconfig2.getAuthenticationMethod());
}
Also used : ActiveMqMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider) JMSMessagingProvider(com.redhat.jenkins.plugins.ci.messaging.JMSMessagingProvider) DefaultTopicProvider(com.redhat.jenkins.plugins.ci.messaging.topics.DefaultTopicProvider) UsernameAuthenticationMethod(com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod) LocalData(org.jvnet.hudson.test.recipes.LocalData) Test(org.junit.Test)

Example 4 with ActiveMqMessagingProvider

use of com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider 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 5 with ActiveMqMessagingProvider

use of com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider 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)

Aggregations

ActiveMqMessagingProvider (com.redhat.jenkins.plugins.ci.messaging.ActiveMqMessagingProvider)9 UsernameAuthenticationMethod (com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod)6 JMSMessagingProvider (com.redhat.jenkins.plugins.ci.messaging.JMSMessagingProvider)5 DefaultTopicProvider (com.redhat.jenkins.plugins.ci.messaging.topics.DefaultTopicProvider)4 Test (org.junit.Test)4 GlobalCIConfiguration (com.redhat.jenkins.plugins.ci.GlobalCIConfiguration)3 Before (org.junit.Before)3 LocalData (org.jvnet.hudson.test.recipes.LocalData)3 FedMsgMessagingProvider (com.redhat.jenkins.plugins.ci.messaging.FedMsgMessagingProvider)2 ActiveMQSubscriberProviderData (com.redhat.jenkins.plugins.ci.provider.data.ActiveMQSubscriberProviderData)2 AbstractProject (hudson.model.AbstractProject)2 FreeStyleProject (hudson.model.FreeStyleProject)2 SSLCertificateAuthenticationMethod (com.redhat.jenkins.plugins.ci.authentication.rabbitmq.SSLCertificateAuthenticationMethod)1 ActiveMQContainer (com.redhat.jenkins.plugins.ci.integration.fixtures.ActiveMQContainer)1 RabbitMQMessagingProvider (com.redhat.jenkins.plugins.ci.messaging.RabbitMQMessagingProvider)1 FedMsgSubscriberProviderData (com.redhat.jenkins.plugins.ci.provider.data.FedMsgSubscriberProviderData)1 ConfiguredWithCode (io.jenkins.plugins.casc.misc.ConfiguredWithCode)1