use of org.apache.qpid.server.user.connection.limits.config.RuleSet.Builder in project qpid-broker-j by apache.
the class RuleSetTest method testBuilder_AddNull.
@Test
public void testBuilder_AddNull() {
final Builder builder = RuleSet.newBuilder(LIMITER_NAME, Duration.ofMillis(2L));
builder.addRule(null);
builder.addRules(null);
final RuleSet ruleSet = builder.build();
assertNotNull(ruleSet);
final ConnectionSlot connection1 = ruleSet.register(newConnection());
assertNotNull(connection1);
final ConnectionSlot connection2 = ruleSet.register(newConnection());
assertNotNull(connection2);
connection1.free();
connection2.free();
}
use of org.apache.qpid.server.user.connection.limits.config.RuleSet.Builder in project qpid-broker-j by apache.
the class RuleSetTest method testUserConnectionCountLimit.
private void testUserConnectionCountLimit(Duration duration, Integer frequencyLimit) {
if (frequencyLimit != null && frequencyLimit < 3) {
frequencyLimit = 3;
}
final Builder builder = RuleSet.newBuilder(LIMITER_NAME, duration);
builder.addRule(Rule.newNonBlockingRule(RulePredicates.ALL_PORTS, TEST_USER, 2, null, duration));
builder.addRule(Rule.newNonBlockingRule(TEST_PORT, TEST_USER, 2, frequencyLimit, duration));
builder.addRule(Rule.newNonBlockingRule(TEST_PORT, OTHER_USER, 1, 1, duration));
builder.addRule(Rule.newNonBlockingRule(RulePredicates.ALL_PORTS, OTHER_GROUP, 1, 1, duration));
builder.addRule(Rule.newBlockingRule(RulePredicates.ALL_PORTS, RulePredicates.ALL_USERS));
testConnectionCountLimit2(builder.build());
testConnectionCountLimit2(builder.logAllMessages(true).build());
testConnectionCountLimit2(builder.logAllMessages(false).build());
}
Aggregations