use of org.apache.activemq.artemis.core.settings.impl.ResourceLimitSettings in project activemq-artemis by apache.
the class ResourceLimitTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
ResourceLimitSettings resourceLimitSettings = new ResourceLimitSettings();
resourceLimitSettings.setMatch(SimpleString.toSimpleString("myUser"));
resourceLimitSettings.setMaxConnections(1);
resourceLimitSettings.setMaxQueues(1);
Configuration configuration = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)).addResourceLimitSettings(resourceLimitSettings).setSecurityEnabled(true);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
server.start();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("myUser", "password");
securityManager.getConfiguration().addRole("myUser", "arole");
Role role = new Role("arole", false, false, false, false, true, true, false, true, false, true);
Set<Role> roles = new HashSet<>();
roles.add(role);
server.getSecurityRepository().addMatch("#", roles);
}
use of org.apache.activemq.artemis.core.settings.impl.ResourceLimitSettings in project activemq-artemis by apache.
the class FileConfigurationParser method parseResourceLimitSettings.
/**
* @param node
* @return
*/
protected ResourceLimitSettings parseResourceLimitSettings(final Node node) {
ResourceLimitSettings resourceLimitSettings = new ResourceLimitSettings();
resourceLimitSettings.setMatch(SimpleString.toSimpleString(getAttributeValue(node, "match")));
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
final Node child = children.item(i);
final String name = child.getNodeName();
if (MAX_CONNECTIONS_NODE_NAME.equalsIgnoreCase(name)) {
resourceLimitSettings.setMaxConnections(XMLUtil.parseInt(child));
} else if (MAX_QUEUES_NODE_NAME.equalsIgnoreCase(name)) {
resourceLimitSettings.setMaxQueues(XMLUtil.parseInt(child));
}
}
return resourceLimitSettings;
}
Aggregations