Java Code Examples for org.apache.activemq.artemis.core.config.Configuration#getAddressesSettings()

The following examples show how to use org.apache.activemq.artemis.core.config.Configuration#getAddressesSettings() . 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: LargeMessageQueueAutoCreationTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void extraServerConfig(Configuration serverConfig) {
   serverConfig.setJournalType(JournalType.NIO);
   Map<String, AddressSettings> map = serverConfig.getAddressesSettings();
   Map.Entry<String, AddressSettings> entry = map.entrySet().iterator().next();
   AddressSettings settings = entry.getValue();
   settings.setAutoCreateQueues(true);
}
 
Example 2
Source File: QueueAutoCreationTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureAddressPolicy(ActiveMQServer server) {
   Configuration serverConfig = server.getConfiguration();
   serverConfig.setJournalType(JournalType.NIO);
   Map<String, AddressSettings> map = serverConfig.getAddressesSettings();
   if (map.size() == 0) {
      AddressSettings as = new AddressSettings();
      map.put("#", as);
   }
   Map.Entry<String, AddressSettings> entry = map.entrySet().iterator().next();
   AddressSettings settings = entry.getValue();
   settings.setAutoCreateQueues(true);
   instanceLog.debug("server cofg, isauto? " + entry.getValue().isAutoCreateQueues());
}
 
Example 3
Source File: AmqpSenderRoutingTypeTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureAddressPolicy(ActiveMQServer server) {
   Configuration serverConfig = server.getConfiguration();
   serverConfig.setJournalType(JournalType.NIO);
   Map<String, AddressSettings> map = serverConfig.getAddressesSettings();
   if (map.size() == 0) {
      AddressSettings as = new AddressSettings();
      as.setDefaultAddressRoutingType(RoutingType.ANYCAST);
      map.put("#", as);
   }
}
 
Example 4
Source File: OpenWireTestBase.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@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");
}
 
Example 5
Source File: ProducerFlowControlSendFailTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
protected void extraServerConfig(Configuration serverConfig) {
   String match = "#";
   Map<String, AddressSettings> asMap = serverConfig.getAddressesSettings();
   asMap.get(match).setMaxSizeBytes(1).setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL);
}
 
Example 6
Source File: ProducerAutoCreateQueueTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
protected void extraServerConfig(Configuration serverConfig) {
   String match = "#";
   Map<String, AddressSettings> asMap = serverConfig.getAddressesSettings();
   asMap.get(match).setAutoCreateAddresses(true).setAutoCreateQueues(true);
}
 
Example 7
Source File: ProducerBlockingTtlTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
protected void extraServerConfig(Configuration serverConfig) {
   String match = "#";
   Map<String, AddressSettings> asMap = serverConfig.getAddressesSettings();
   asMap.get(match).setMaxSizeBytes(1).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
}
 
Example 8
Source File: ProducerFlowControlBaseTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
protected void extraServerConfig(Configuration serverConfig) {
   String match = "#";
   Map<String, AddressSettings> asMap = serverConfig.getAddressesSettings();
   asMap.get(match).setMaxSizeBytes(1).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
}