Package org.apache.cxf.ws.rmp.v200502

Examples of org.apache.cxf.ws.rmp.v200502.RMAssertion


    /**
     * @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


        control = EasyMock.createNiceControl();
    }
   
    @Test
    public void testRMAssertionEquals() {
        RMAssertion a = new RMAssertion();
        assertTrue(RM10PolicyUtils.equals(a, a));
       
        RMAssertion b = new RMAssertion();
        assertTrue(RM10PolicyUtils.equals(a, b));
       
        InactivityTimeout iat = new RMAssertion.InactivityTimeout();
        iat.setMilliseconds(new Long(10));
        a.setInactivityTimeout(iat);
        assertTrue(!RM10PolicyUtils.equals(a, b));
        b.setInactivityTimeout(iat);
        assertTrue(RM10PolicyUtils.equals(a, b));
       
        ExponentialBackoff eb = new RMAssertion.ExponentialBackoff();
        a.setExponentialBackoff(eb);
        assertTrue(!RM10PolicyUtils.equals(a, b));
        b.setExponentialBackoff(eb);
        assertTrue(RM10PolicyUtils.equals(a, b));   
    }
View Full Code Here

        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());   
    }
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) {
            //REVISIT this class can't handle RMP200702 assertions, so guard against CCE
            if (ai.getAssertion() instanceof JaxbAssertion
                && ((JaxbAssertion<?>)ai.getAssertion()).getData() instanceof RMAssertion) {
                JaxbAssertion<RMAssertion> ja = getAssertion(ai);
                RMAssertion rma = (RMAssertion)ja.getData();
                compatible = null == defaultValue ? rma : intersect(compatible, rma);
            } else {
                LOG.warning("Ignoring unexpected assertion class: " + ai.getAssertion());
            }
        }
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

        assertNotNull(c.getExponentialBackoff());   
    }
   
    @Test
    public void testGetRMAssertion() {
        RMAssertion a = new RMAssertion();
        BaseRetransmissionInterval abri = new RMAssertion.BaseRetransmissionInterval();
        abri.setMilliseconds(new Long(3000));
        a.setBaseRetransmissionInterval(abri);
        a.setExponentialBackoff(new RMAssertion.ExponentialBackoff());
       
        Message message = control.createMock(Message.class);
        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(null);
        control.replay();
        assertSame(a, RM10PolicyUtils.getRMAssertion(a, message));
        control.verify();
       
        control.reset();
        AssertionInfoMap aim = control.createMock(AssertionInfoMap.class);
        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim);
        Collection<AssertionInfo> ais = new ArrayList<AssertionInfo>();
        EasyMock.expect(aim.get(RM10Constants.RMASSERTION_QNAME)).andReturn(ais);
        control.replay();
        assertSame(a, RM10PolicyUtils.getRMAssertion(a, 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);
        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim);
        EasyMock.expect(aim.get(RM10Constants.RMASSERTION_QNAME)).andReturn(ais);
        control.replay();
        RMAssertion c = RM10PolicyUtils.getRMAssertion(a, message);
        assertNull(c.getAcknowledgementInterval());
        assertNull(c.getInactivityTimeout());
        assertEquals(2000L, c.getBaseRetransmissionInterval().getMilliseconds().longValue());
        assertNotNull(c.getExponentialBackoff());  
        control.verify();
    }
View Full Code Here

    /**
     * @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

        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

        SpringBusFactory bf = new SpringBusFactory();
        bus = bf.createBus("/org/apache/cxf/systest/ws/rm/seqlength1.xml");
        // set the client retry interval much shorter than the slow processing delay
        RMManager manager = bus.getExtension(RMManager.class);
       
        AcknowledgementInterval ai
            = new org.apache.cxf.ws.rmp.v200502.ObjectFactory()
                .createRMAssertionAcknowledgementInterval();
        ai.setMilliseconds(new Long(5000));
        manager.getRMAssertion().setAcknowledgementInterval(ai);

        BusFactory.setDefaultBus(bus);
        GreeterService gs = new GreeterService();
        greeter = gs.getGreeterPort();
View Full Code Here

            // use a at-most-once server with sync ack processing
            Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/atmostonce.xml");
            BusFactory.setDefaultBus(bus);
            setBus(bus);
           
            AcknowledgementInterval ai
                = new org.apache.cxf.ws.rmp.v200502.ObjectFactory()
                    .createRMAssertionAcknowledgementInterval();
            ai.setMilliseconds(new Long(0));
            bus.getExtension(RMManager.class).getRMAssertion().setAcknowledgementInterval(ai);

            serverGreeter = new GreeterCounterImpl();
            String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
           
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.rmp.v200502.RMAssertion

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.