Search in sources :

Example 1 with AclRule

use of org.apache.qpid.server.security.access.plugins.AclRule in project qpid-broker-j by apache.

the class MessagingACLTest method configureACL.

private void configureACL(String... rules) throws Exception {
    EventLoggerProvider eventLoggerProvider = mock(EventLoggerProvider.class);
    EventLogger eventLogger = mock(EventLogger.class);
    when(eventLoggerProvider.getEventLogger()).thenReturn(eventLogger);
    List<AclRule> aclRules = new ArrayList<>();
    try (StringReader stringReader = new StringReader(Arrays.stream(rules).collect(Collectors.joining(LINE_SEPARATOR)))) {
        RuleSet ruleSet = AclFileParser.parse(stringReader, eventLoggerProvider);
        for (final Rule rule : ruleSet) {
            aclRules.add(rule.asAclRule());
        }
    }
    configureACL(aclRules.toArray(new AclRule[aclRules.size()]));
}
Also used : RuleSet(org.apache.qpid.server.security.access.config.RuleSet) EventLoggerProvider(org.apache.qpid.server.logging.EventLoggerProvider) EventLogger(org.apache.qpid.server.logging.EventLogger) ArrayList(java.util.ArrayList) StringReader(java.io.StringReader) AclRule(org.apache.qpid.server.security.access.plugins.AclRule) AclRule(org.apache.qpid.server.security.access.plugins.AclRule) Rule(org.apache.qpid.server.security.access.config.Rule)

Aggregations

StringReader (java.io.StringReader)1 ArrayList (java.util.ArrayList)1 EventLogger (org.apache.qpid.server.logging.EventLogger)1 EventLoggerProvider (org.apache.qpid.server.logging.EventLoggerProvider)1 Rule (org.apache.qpid.server.security.access.config.Rule)1 RuleSet (org.apache.qpid.server.security.access.config.RuleSet)1 AclRule (org.apache.qpid.server.security.access.plugins.AclRule)1