Java Code Examples for org.apache.activemq.artemis.core.config.Configuration#setSecurityEnabled()
The following examples show how to use
org.apache.activemq.artemis.core.config.Configuration#setSecurityEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActiveMqArtemisFacade.java From apm-agent-java with Apache License 2.0 | 6 votes |
@Override public void prepareResources() throws Exception { Configuration configuration = new ConfigurationImpl(); HashSet<TransportConfiguration> transports = new HashSet<>(); transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName())); configuration.setAcceptorConfigurations(transports); configuration.setSecurityEnabled(false); File targetDir = new File(System.getProperty("user.dir") + "/target"); configuration.setBrokerInstance(targetDir); configuration.setPersistenceEnabled(false); activeMQServer = new ActiveMQServerImpl(configuration); activeMQServer.start(); connectionFactory = new ActiveMQConnectionFactory("vm://0"); }
Example 2
Source File: AMQPToJMSCoreTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false) .setAutoCreateAddresses(false) .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); }
Example 3
Source File: OpenwireAmqpResenderTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); factory = new ActiveMQConnectionFactory(OPENWIRE_URL); qpidFactory = new JmsConnectionFactory(AMQP_URL); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(true) .setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); server.start(); server.createQueue(new QueueConfiguration(QUEUE_ZERO_NAME).setRoutingType(RoutingType.ANYCAST).setDurable(false)); server.createQueue(new QueueConfiguration(QUEUE_ONE_NAME).setRoutingType(RoutingType.ANYCAST).setDurable(false)); }
Example 4
Source File: AMQPToStompTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false) .setAutoCreateAddresses(false) .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); }
Example 5
Source File: EmbeddedBroker.java From cxf with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { Configuration config = new ConfigurationImpl(); Set<TransportConfiguration> transports = new HashSet<>(); transports.add(new TransportConfiguration(NettyAcceptorFactory.class.getName())); transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName())); config.setAcceptorConfigurations(transports); config.setBrokerInstance(new File("target/artemis")); config.setPersistenceEnabled(false); config.setSecurityEnabled(false); config.setJMXManagementEnabled(false); EmbeddedActiveMQ server = new EmbeddedActiveMQ(); server.setConfiguration(config); server.start(); try { System.out.println("JMS broker ready ..."); Thread.sleep(125 * 60 * 1000); } finally { System.out.println("JMS broker exiting"); server.stop(); } System.exit(0); }
Example 6
Source File: CriticalCrashTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
Configuration createConfig(String folder) throws Exception { Configuration configuration = createDefaultConfig(true); configuration.setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory(folder + "/journal").setBindingsDirectory(folder + "/bindings").setPagingDirectory(folder + "/paging"). setLargeMessagesDirectory(folder + "/largemessage").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false); configuration.setSecurityEnabled(false); configuration.setPersistenceEnabled(true); return configuration; }
Example 7
Source File: ShutdownOnCriticalIOErrorMoveNextTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
Configuration createConfig(String folder) throws Exception { Configuration configuration = createDefaultConfig(true); configuration.setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory(folder + "/journal").setBindingsDirectory(folder + "/bindings").setPagingDirectory(folder + "/paging"). setLargeMessagesDirectory(folder + "/largemessage").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false); configuration.setSecurityEnabled(false); configuration.setPersistenceEnabled(true); return configuration; }
Example 8
Source File: AMQPToOpenwireTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); server.start(); server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); qpidfactory = new JmsConnectionFactory("amqp://localhost:61616"); }
Example 9
Source File: OpenWireToAMQPTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); server = createServer(true, true); Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); server.start(); coreQueue = new SimpleString(queueName); server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); qpidfactory = new JmsConnectionFactory("amqp://localhost:61616"); }
Example 10
Source File: Jms2ITest.java From java-specialagent with Apache License 2.0 | 4 votes |
public static void main(final String[] args) throws Exception { final HashSet<TransportConfiguration> transports = new HashSet<>(); transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName())); final Configuration configuration = new ConfigurationImpl(); configuration.setAcceptorConfigurations(transports); configuration.setSecurityEnabled(false); final File targetDir = new File(new File("").getAbsoluteFile(), "target"); configuration.setBrokerInstance(targetDir); final ActiveMQServer server = new ActiveMQServerImpl(configuration); server.start(); try (final ActiveMQJMSConnectionFactory connectionFactory = new ActiveMQJMSConnectionFactory("vm://0")) { final Connection connection = connectionFactory.createConnection(); connection.start(); try ( final JMSContext context = connectionFactory.createContext(); final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); ) { System.out.println("Session: " + session); final Destination destination = session.createQueue("TEST.FOO2"); final JMSProducer producer = context.createProducer(); System.out.println("PRODUCER: " + producer); final MessageConsumer consumer = session.createConsumer(destination); System.out.println("CONSUMER: " + consumer); final TextMessage message = session.createTextMessage("Hello world"); producer.send(destination, message); final TextMessage received = (TextMessage)consumer.receive(5000); System.out.println("RECEIVED: " + received.getText()); } } finally { server.stop(true); TestUtil.checkSpan(new ComponentSpanCount("java-jms", 2, true)); System.exit(0); } }
Example 11
Source File: OpenWireTestBase.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); server = this.createServer(realStore, true); Configuration serverConfig = server.getConfiguration(); Map<String, AddressSettings> addressSettingsMap = serverConfig.getAddressesSettings(); configureAddressSettings(addressSettingsMap); serverConfig.setSecurityEnabled(enableSecurity); extraServerConfig(serverConfig); if (enableSecurity) { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addRole("openwireSender", "sender"); securityManager.getConfiguration().addUser("openwireSender", "SeNdEr"); //sender cannot receive Role senderRole = new Role("sender", true, false, false, false, true, true, false, false, true, true); securityManager.getConfiguration().addRole("openwireReceiver", "receiver"); securityManager.getConfiguration().addUser("openwireReceiver", "ReCeIvEr"); //receiver cannot send Role receiverRole = new Role("receiver", false, true, false, false, true, true, false, true, false, false); securityManager.getConfiguration().addRole("openwireGuest", "guest"); securityManager.getConfiguration().addUser("openwireGuest", "GuEsT"); //guest cannot do anything Role guestRole = new Role("guest", false, false, false, false, false, false, false, false, false, false); securityManager.getConfiguration().addRole("openwireDestinationManager", "manager"); securityManager.getConfiguration().addUser("openwireDestinationManager", "DeStInAtIoN"); Role destRole = new Role("manager", false, false, false, false, true, true, false, false, true, false); Set<Role> roles = new HashSet<>(); roles.add(senderRole); roles.add(receiverRole); roles.add(guestRole); roles.add(destRole); server.getConfiguration().putSecurityRoles("#", roles); } mbeanServer = MBeanServerFactory.createMBeanServer(); server.setMBeanServer(mbeanServer); addServer(server); server.start(); coreCf = ActiveMQJMSClient.createConnectionFactory("vm://0?reconnectAttempts=-1","cf"); }