use of com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod 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());
}
use of com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod 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
}
use of com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod 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?
}
use of com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod 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?
}
use of com.redhat.jenkins.plugins.ci.authentication.activemq.UsernameAuthenticationMethod in project jms-messaging-plugin by jenkinsci.
the class JcascTest method load.
@Test
@ConfiguredWithCode("JcascTest/casc.yaml")
public void load() {
GlobalCIConfiguration gc = GlobalCIConfiguration.get();
FedMsgMessagingProvider fedMsg = (FedMsgMessagingProvider) gc.getProvider("Fedora messages");
assertEquals("org.fedora.bar", fedMsg.getTopic());
assertEquals("tcp://example.com:5678", fedMsg.getHubAddr());
assertEquals("tcp://example.com:6789", fedMsg.getPubAddr());
ActiveMqMessagingProvider amq = (ActiveMqMessagingProvider) gc.getProvider("Active MQ");
assertEquals("foo.com:4242", amq.getBroker());
assertEquals("active.mq.com", amq.getTopic());
assertThat(amq.getTopicProvider(), Matchers.instanceOf(DefaultTopicProvider.class));
assertEquals(false, amq.getUseQueues());
UsernameAuthenticationMethod amqam = (UsernameAuthenticationMethod) amq.getAuthenticationMethod();
assertEquals("foo", amqam.getUsername());
assertEquals("bar", amqam.getPassword().getPlainText());
RabbitMQMessagingProvider rmq = (RabbitMQMessagingProvider) gc.getProvider("Rabbit MQ");
assertEquals("ex", rmq.getExchange());
assertEquals("rabbitmq.example.com", rmq.getHostname());
assertEquals(4545, rmq.getPortNumber().intValue());
assertEquals("foo.bar", rmq.getQueue());
assertEquals("baz", rmq.getTopic());
assertEquals("rabbitvh.example.com", rmq.getVirtualHost());
SSLCertificateAuthenticationMethod rmqam = (SSLCertificateAuthenticationMethod) rmq.getAuthenticationMethod();
assertEquals("/tmp/key", rmqam.getKeystore());
assertEquals("/tmp/trust", rmqam.getTruststore());
assertEquals("keypwd", rmqam.getKeypwd().getPlainText());
assertEquals("trustpwd", rmqam.getTrustpwd().getPlainText());
}
Aggregations