assertTrue(RM10PolicyUtils.equals(a, b));
}
@Test
public void testIntersect() {
RMAssertion a = new RMAssertion();
RMAssertion b = new RMAssertion();
assertSame(a, RM10PolicyUtils.intersect(a, b));
InactivityTimeout aiat = new RMAssertion.InactivityTimeout();
aiat.setMilliseconds(new Long(3600000));
a.setInactivityTimeout(aiat);
InactivityTimeout biat = new RMAssertion.InactivityTimeout();
biat.setMilliseconds(new Long(7200000));
b.setInactivityTimeout(biat);
RMAssertion c = RM10PolicyUtils.intersect(a, b);
assertEquals(7200000L, c.getInactivityTimeout().getMilliseconds().longValue());
assertNull(c.getBaseRetransmissionInterval());
assertNull(c.getAcknowledgementInterval());
assertNull(c.getExponentialBackoff());
BaseRetransmissionInterval abri = new RMAssertion.BaseRetransmissionInterval();
abri.setMilliseconds(new Long(10000));
a.setBaseRetransmissionInterval(abri);
BaseRetransmissionInterval bbri = new RMAssertion.BaseRetransmissionInterval();
bbri.setMilliseconds(new Long(20000));
b.setBaseRetransmissionInterval(bbri);
c = RM10PolicyUtils.intersect(a, b);
assertEquals(7200000L, c.getInactivityTimeout().getMilliseconds().longValue());
assertEquals(20000L, c.getBaseRetransmissionInterval().getMilliseconds().longValue());
assertNull(c.getAcknowledgementInterval());
assertNull(c.getExponentialBackoff());
AcknowledgementInterval aai = new RMAssertion.AcknowledgementInterval();
aai.setMilliseconds(new Long(2000));
a.setAcknowledgementInterval(aai);
c = RM10PolicyUtils.intersect(a, b);
assertEquals(7200000L, c.getInactivityTimeout().getMilliseconds().longValue());
assertEquals(20000L, c.getBaseRetransmissionInterval().getMilliseconds().longValue());
assertEquals(2000L, c.getAcknowledgementInterval().getMilliseconds().longValue());
assertNull(c.getExponentialBackoff());
b.setExponentialBackoff(new RMAssertion.ExponentialBackoff());
c = RM10PolicyUtils.intersect(a, b);
assertEquals(7200000L, c.getInactivityTimeout().getMilliseconds().longValue());
assertEquals(20000L, c.getBaseRetransmissionInterval().getMilliseconds().longValue());
assertEquals(2000L, c.getAcknowledgementInterval().getMilliseconds().longValue());
assertNotNull(c.getExponentialBackoff());
}