Search in sources :

Example 1 with StaticThrottlePolicySignature

use of com.yahoo.container.jdisc.messagebus.SessionCache.StaticThrottlePolicySignature in project vespa by vespa-engine.

the class MbusSessionKeyTestCase method staticThrottlePolicySignature.

@Test
public final void staticThrottlePolicySignature() {
    final StaticThrottlePolicy base = new StaticThrottlePolicy();
    final StaticThrottlePolicy other = new StaticThrottlePolicy();
    other.setMaxPendingCount(500);
    other.setMaxPendingSize(500 * 1000 * 1000);
    base.setMaxPendingCount(1);
    base.setMaxPendingSize(1000);
    final StaticThrottlePolicySignature sigBase = new StaticThrottlePolicySignature(base);
    final StaticThrottlePolicySignature sigOther = new StaticThrottlePolicySignature(other);
    assertFalse("The policies are different, but signatures are equal.", sigBase.equals(sigOther));
    assertTrue("Sigs created from same policy evaluated as different.", sigBase.equals(new StaticThrottlePolicySignature(base)));
    other.setMaxPendingCount(1);
    other.setMaxPendingSize(1000);
    assertTrue("Sigs created from different policies with same settings evaluated as different.", sigBase.equals(new StaticThrottlePolicySignature(other)));
}
Also used : StaticThrottlePolicySignature(com.yahoo.container.jdisc.messagebus.SessionCache.StaticThrottlePolicySignature) StaticThrottlePolicy(com.yahoo.messagebus.StaticThrottlePolicy) Test(org.junit.Test)

Aggregations

StaticThrottlePolicySignature (com.yahoo.container.jdisc.messagebus.SessionCache.StaticThrottlePolicySignature)1 StaticThrottlePolicy (com.yahoo.messagebus.StaticThrottlePolicy)1 Test (org.junit.Test)1