Package org.servicemix.ws.xmlbeans.rm.policy

Examples of org.servicemix.ws.xmlbeans.rm.policy.RMAssertionDocument$RMAssertion$AcknowledgementInterval


    /**
     * @param rma The rmAssertion to set.
     */
    public void setRMAssertion(RMAssertion rma) {
        if (null == rma) {
            rma = new RMAssertion();
            rma.setExponentialBackoff(new ExponentialBackoff());
        }
        BaseRetransmissionInterval bri = rma.getBaseRetransmissionInterval();
        if (null == bri) {
            bri = new BaseRetransmissionInterval();
View Full Code Here


     * @param rma the default value
     * @param message the message
     * @return the compatible RMAssertion
     */
    public static RMAssertion getRMAssertion(RMAssertion defaultValue, Message message) {       
        RMAssertion compatible = defaultValue;
        Collection<AssertionInfo> ais = collectRMAssertions(message.get(AssertionInfoMap.class));
        for (AssertionInfo ai : ais) {
            JaxbAssertion<RMAssertion> ja = getAssertion(ai);
            RMAssertion rma = ja.getData();
            compatible = null == defaultValue ? rma : intersect(compatible, rma);
        }
        return compatible;
    }
View Full Code Here

   
    public static RMAssertion intersect(RMAssertion a, RMAssertion b) {
        if (equals(a, b)) {
            return a;
        }
        RMAssertion compatible = new RMAssertion();
       
        // use maximum of inactivity timeout
       
        Long aval = null;
        if (null != a.getInactivityTimeout()) {
            aval = a.getInactivityTimeout().getMilliseconds();
        }
        Long bval = null;
        if (null != b.getInactivityTimeout()) {
            bval = b.getInactivityTimeout().getMilliseconds();           
        }
        if (null != aval || null != bval) {
            InactivityTimeout ia = new RMAssertion.InactivityTimeout();
            if (null != aval && null != bval) {
                ia.setMilliseconds(bval);
            } else {
                ia.setMilliseconds(aval != null ? aval : bval);
            }
            compatible.setInactivityTimeout(ia);
        }
       
        // use minimum of base retransmission interval
       
        aval = null;
        if (null != a.getBaseRetransmissionInterval()) {
            aval = a.getBaseRetransmissionInterval().getMilliseconds();
        }
        bval = null;
        if (null != b.getBaseRetransmissionInterval()) {
            bval = b.getBaseRetransmissionInterval().getMilliseconds();           
        }
        if (null != aval || null != bval) {
            BaseRetransmissionInterval bri = new RMAssertion.BaseRetransmissionInterval();
            if (null != aval && null != bval) {
                bri.setMilliseconds(bval);
            } else {
                bri.setMilliseconds(aval != null ? aval : bval);
            }
            compatible.setBaseRetransmissionInterval(bri);
        }
       
        // use minimum of acknowledgement interval
       
        aval = null;
        if (null != a.getAcknowledgementInterval()) {
            aval = a.getAcknowledgementInterval().getMilliseconds();
        }
        bval = null;
        if (null != b.getAcknowledgementInterval()) {
            bval = b.getAcknowledgementInterval().getMilliseconds();
        }
        if (null != aval || null != bval) {
            AcknowledgementInterval ai = new RMAssertion.AcknowledgementInterval();
            if (null != aval && null != bval) {
                ai.setMilliseconds(bval);
            } else {
                ai.setMilliseconds(aval != null ? aval : bval);
            }
            compatible.setAcknowledgementInterval(ai);
        }
   
        // backoff parameter
        if (null != a.getExponentialBackoff() || null != b.getExponentialBackoff()) {
            compatible.setExponentialBackoff(new RMAssertion.ExponentialBackoff());
        }
        return compatible;
    }
View Full Code Here

    public static RMConfiguration getRMConfiguration(RMConfiguration defaultValue, Message message) {
        RMConfiguration compatible = defaultValue;
        Collection<AssertionInfo> ais = collectRMAssertions(message.get(AssertionInfoMap.class));
        for (AssertionInfo ai : ais) {
            if (ai.getAssertion() instanceof JaxbAssertion<?>) {
                RMAssertion rma = (RMAssertion)((JaxbAssertion<?>)ai.getAssertion()).getData();
                compatible = intersect(rma, compatible);
            } else if (ai.getAssertion() instanceof PrimitiveAssertion) {
                PrimitiveAssertion assertion = (PrimitiveAssertion)ai.getAssertion();
                if (RM11Constants.WSRMP_NAMESPACE_URI.equals(assertion.getName().getNamespaceURI())) {
                    compatible = intersect(assertion, compatible);
View Full Code Here

        control = EasyMock.createNiceControl();
    }
   
    @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));   
    }
View Full Code Here

        assertTrue(RMPolicyUtilities.equals(a, b));   
    }
   
    @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());
View Full Code Here

        control.replay();
        assertSame(cfg, RMPolicyUtilities.getRMConfiguration(cfg, message));
        control.verify();
       
        control.reset();
        RMAssertion b = new RMAssertion();
        BaseRetransmissionInterval bbri = new RMAssertion.BaseRetransmissionInterval();
        bbri.setMilliseconds(new Long(2000));
        b.setBaseRetransmissionInterval(bbri);
        JaxbAssertion<RMAssertion> assertion = new JaxbAssertion<RMAssertion>();
        assertion.setName(RM10Constants.RMASSERTION_QNAME);
        assertion.setData(b);
        AssertionInfo ai = new AssertionInfo(assertion);
        ais.add(ai);
View Full Code Here

                msg.setMessageNumber(st.getMessageNumber());
            }
            store.persistIncoming(this, msg);
        }
       
        RMAssertion rma = RM10PolicyUtils.getRMAssertion(destination.getManager().getRMAssertion(), message);
        long acknowledgementInterval = 0;
        AcknowledgementInterval ai = rma.getAcknowledgementInterval();
        if (null != ai) {
            Long val = ai.getMilliseconds();
            if (null != val) {
                acknowledgementInterval = val.longValue();
            }
        }
       
        scheduleAcknowledgement(acknowledgementInterval);
      
        long inactivityTimeout = 0;
        InactivityTimeout iat = rma.getInactivityTimeout();
        if (null != iat) {
            Long val = iat.getMilliseconds();
            if (null != val) {
                inactivityTimeout = val.longValue();
            }
View Full Code Here

        assertNotNull("RMAssertion is not set.", manager.getRMAssertion());
        assertNotNull("sourcePolicy is not set.", manager.getSourcePolicy());
        assertNotNull("destinationPolicy is not set.", manager.getDestinationPolicy());
        assertNotNull("deliveryAssirance is not set.", manager.getDeliveryAssurance());
       
        RMAssertion rma = manager.getRMAssertion();
        assertTrue(rma.isSetExponentialBackoff());
        assertEquals(3000L, rma.getBaseRetransmissionInterval().getMilliseconds().longValue());
        assertTrue(!rma.isSetAcknowledgementInterval());
        assertTrue(!rma.isSetInactivityTimeout());  
       
        SourcePolicyType sp = manager.getSourcePolicy();
        assertEquals(0L, sp.getSequenceExpiration().getTimeInMillis(new Date()));
        assertEquals(0L, sp.getOfferedSequenceExpiration().getTimeInMillis(new Date()));
        assertNull(sp.getAcksTo());
View Full Code Here

                msg.setMessageNumber(st.getMessageNumber());
            }
            store.persistIncoming(this, msg);
        }
       
        RMAssertion rma = RM10PolicyUtils.getRMAssertion(destination.getManager().getRMAssertion(), message);
        long acknowledgementInterval = 0;
        AcknowledgementInterval ai = rma.getAcknowledgementInterval();
        if (null != ai) {
            Long val = ai.getMilliseconds();
            if (null != val) {
                acknowledgementInterval = val.longValue();
            }
        }
       
        scheduleAcknowledgement(acknowledgementInterval);
      
        long inactivityTimeout = 0;
        InactivityTimeout iat = rma.getInactivityTimeout();
        if (null != iat) {
            Long val = iat.getMilliseconds();
            if (null != val) {
                inactivityTimeout = val.longValue();
            }
View Full Code Here

TOP

Related Classes of org.servicemix.ws.xmlbeans.rm.policy.RMAssertionDocument$RMAssertion$AcknowledgementInterval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.