Search in sources :

Example 1 with InactivityTimeout

use of org.apache.cxf.ws.rmp.v200502.RMAssertion.InactivityTimeout in project cxf by apache.

the class PolicyUtilsTest method testRMAssertionEquals.

@Test
public void testRMAssertionEquals() {
    RMAssertion a = new RMAssertion();
    assertTrue(RMPolicyUtilities.equals(a, a));
    RMAssertion b = new RMAssertion();
    assertTrue(RMPolicyUtilities.equals(a, b));
    InactivityTimeout iat = new RMAssertion.InactivityTimeout();
    iat.setMilliseconds(new Long(10));
    a.setInactivityTimeout(iat);
    assertTrue(!RMPolicyUtilities.equals(a, b));
    b.setInactivityTimeout(iat);
    assertTrue(RMPolicyUtilities.equals(a, b));
    ExponentialBackoff eb = new RMAssertion.ExponentialBackoff();
    a.setExponentialBackoff(eb);
    assertTrue(!RMPolicyUtilities.equals(a, b));
    b.setExponentialBackoff(eb);
    assertTrue(RMPolicyUtilities.equals(a, b));
}
Also used : RMAssertion(org.apache.cxf.ws.rmp.v200502.RMAssertion) InactivityTimeout(org.apache.cxf.ws.rmp.v200502.RMAssertion.InactivityTimeout) ExponentialBackoff(org.apache.cxf.ws.rmp.v200502.RMAssertion.ExponentialBackoff) Test(org.junit.Test)

Example 2 with InactivityTimeout

use of org.apache.cxf.ws.rmp.v200502.RMAssertion.InactivityTimeout in project cxf by apache.

the class PolicyUtilsTest method testIntersect.

@Test
public void testIntersect() {
    RMAssertion rma = new RMAssertion();
    RMConfiguration cfg0 = new RMConfiguration();
    assertTrue(RMPolicyUtilities.equals(cfg0, RMPolicyUtilities.intersect(rma, cfg0)));
    InactivityTimeout aiat = new RMAssertion.InactivityTimeout();
    aiat.setMilliseconds(new Long(7200000));
    rma.setInactivityTimeout(aiat);
    cfg0.setInactivityTimeout(new Long(3600000));
    RMConfiguration cfg1 = RMPolicyUtilities.intersect(rma, cfg0);
    assertEquals(7200000L, cfg1.getInactivityTimeout().longValue());
    assertNull(cfg1.getBaseRetransmissionInterval());
    assertNull(cfg1.getAcknowledgementInterval());
    assertFalse(cfg1.isExponentialBackoff());
    BaseRetransmissionInterval abri = new RMAssertion.BaseRetransmissionInterval();
    abri.setMilliseconds(new Long(20000));
    rma.setBaseRetransmissionInterval(abri);
    cfg0.setBaseRetransmissionInterval(new Long(10000));
    cfg1 = RMPolicyUtilities.intersect(rma, cfg0);
    assertEquals(7200000L, cfg1.getInactivityTimeout().longValue());
    assertEquals(20000L, cfg1.getBaseRetransmissionInterval().longValue());
    assertNull(cfg1.getAcknowledgementInterval());
    assertFalse(cfg1.isExponentialBackoff());
    AcknowledgementInterval aai = new RMAssertion.AcknowledgementInterval();
    aai.setMilliseconds(new Long(2000));
    rma.setAcknowledgementInterval(aai);
    cfg1 = RMPolicyUtilities.intersect(rma, cfg0);
    assertEquals(7200000L, cfg1.getInactivityTimeout().longValue());
    assertEquals(20000L, cfg1.getBaseRetransmissionInterval().longValue());
    assertEquals(2000L, cfg1.getAcknowledgementInterval().longValue());
    assertFalse(cfg1.isExponentialBackoff());
    cfg0.setExponentialBackoff(true);
    cfg1 = RMPolicyUtilities.intersect(rma, cfg0);
    assertEquals(7200000L, cfg1.getInactivityTimeout().longValue());
    assertEquals(20000L, cfg1.getBaseRetransmissionInterval().longValue());
    assertEquals(2000L, cfg1.getAcknowledgementInterval().longValue());
    assertTrue(cfg1.isExponentialBackoff());
}
Also used : RMAssertion(org.apache.cxf.ws.rmp.v200502.RMAssertion) AcknowledgementInterval(org.apache.cxf.ws.rmp.v200502.RMAssertion.AcknowledgementInterval) BaseRetransmissionInterval(org.apache.cxf.ws.rmp.v200502.RMAssertion.BaseRetransmissionInterval) RMConfiguration(org.apache.cxf.ws.rm.RMConfiguration) InactivityTimeout(org.apache.cxf.ws.rmp.v200502.RMAssertion.InactivityTimeout) Test(org.junit.Test)

Aggregations

RMAssertion (org.apache.cxf.ws.rmp.v200502.RMAssertion)2 InactivityTimeout (org.apache.cxf.ws.rmp.v200502.RMAssertion.InactivityTimeout)2 Test (org.junit.Test)2 RMConfiguration (org.apache.cxf.ws.rm.RMConfiguration)1 AcknowledgementInterval (org.apache.cxf.ws.rmp.v200502.RMAssertion.AcknowledgementInterval)1 BaseRetransmissionInterval (org.apache.cxf.ws.rmp.v200502.RMAssertion.BaseRetransmissionInterval)1 ExponentialBackoff (org.apache.cxf.ws.rmp.v200502.RMAssertion.ExponentialBackoff)1