Package org.easymock

Examples of org.easymock.IMocksControl


        InputStream is = getClass().getResourceAsStream("resources/spec/CreateSequenceResponse.xml");
        TestInputStreamContext istreamCtx = new TestInputStreamContext();
        istreamCtx.setInputStream(is);
        ct.setInputStreamMessageContext(istreamCtx);
       
        IMocksControl control = EasyMock.createNiceControl();
       
        RMHandler handler = control.createMock(RMHandler.class);
        RMProxy proxy = new RMProxy(handler);
        RMSource source = control.createMock(RMSource.class);
        SourcePolicyType sp = control.createMock(SourcePolicyType.class);
       
        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
        sid.setValue("s1");
     
        expect(handler.getBinding()).andReturn(binding);
        expect(handler.getTransport()).andReturn(ct)
        expect(source.getSourcePolicies()).andReturn(sp);
        expect(sp.getAcksTo()).andReturn(null);
        expect(sp.getSequenceExpiration()).andReturn(null);
        expect(sp.isIncludeOffer()).andReturn(false);
        expect(handler.getBinding()).andReturn(binding).times(2);
        // Moved to CreateSequenceResponse handling on RMServant
        //source.addSequence(EasyMock.isA(SourceSequence.class));
        //expectLastCall();
        //source.setCurrent((Identifier)EasyMock.isNull(), EasyMock.isA(SourceSequence.class));
        //expectLastCall();

        control.replay();
        proxy.createSequence(source,
                             getTo(),
                             RMUtils.createReference(Names.WSA_ANONYMOUS_ADDRESS),
                             ContextUtils.WSA_OBJECT_FACTORY.createRelatesToType());
        control.verify();
        assertTrue("expected send",  binding.isSent());
    }
View Full Code Here


        InputStream is = getClass().getResourceAsStream("resources/CreateSequenceResponseOfferAccepted.xml");
        TestInputStreamContext istreamCtx = new TestInputStreamContext();
        istreamCtx.setInputStream(is);
        ct.setInputStreamMessageContext(istreamCtx);
       
        IMocksControl control = EasyMock.createNiceControl();
       
        RMHandler handler = control.createMock(RMHandler.class);
        RMProxy proxy = new RMProxy(handler);
        RMSource source = control.createMock(RMSource.class);
        SourcePolicyType sp = control.createMock(SourcePolicyType.class);
       
        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
        sid.setValue("s1");
        Duration osd = DatatypeFactory.newInstance().newDuration("PT24H");
        assertNotNull(osd);
        Identifier offeredSid = RMUtils.getWSRMFactory().createIdentifier();
        offeredSid.setValue("s1Offer");
     
        expect(handler.getBinding()).andReturn(binding);
        expect(handler.getTransport()).andReturn(ct);
        expect(source.getSourcePolicies()).andReturn(sp);
        expect(sp.getAcksTo()).andReturn(null);
        expect(sp.getSequenceExpiration()).andReturn(null);
        expect(sp.isIncludeOffer()).andReturn(true);  
        expect(sp.getOfferedSequenceExpiration()).andReturn(null);
        expect(source.generateSequenceIdentifier()).andReturn(offeredSid);
        expect(handler.getBinding()).andReturn(binding).times(2);
        // Moved to CreateSequenceResponse handling on RMServant
        //source.addSequence(EasyMock.isA(SourceSequence.class));
        //expectLastCall();
        //source.setCurrent((Identifier)EasyMock.isNull(), EasyMock.isA(SourceSequence.class));
        //expectLastCall();       
        // Moved to CreateSequenceResponse handling on RMServant
        //expect(source.getHandler()).andReturn(handler);
        //expect(handler.getDestination()).andReturn(dest);
        //dest.addSequence(isA(DestinationSequence.class));

        control.replay();
        proxy.createSequence(source,
                             getTo(),
                             RMUtils.createReference(Names.WSA_ANONYMOUS_ADDRESS),
                             ContextUtils.WSA_OBJECT_FACTORY.createRelatesToType());
        control.verify();
        assertTrue("expected send",  binding.isSent());
    }
View Full Code Here

        InputStream is = getClass().getResourceAsStream("resources/CreateSequenceResponseOfferAccepted.xml");
        TestInputStreamContext istreamCtx = new TestInputStreamContext();
        istreamCtx.setInputStream(is);
        ct.setInputStreamMessageContext(istreamCtx);
       
        IMocksControl control = EasyMock.createNiceControl();
       
        RMHandler handler = control.createMock(RMHandler.class);
        RMProxy proxy = new RMProxy(handler);
        RMSource source = control.createMock(RMSource.class);
        SourcePolicyType sp = control.createMock(SourcePolicyType.class);
        //RMDestination dest = control.createMock(RMDestination.class);
       
        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
        sid.setValue("s1");
        Duration osd = DatatypeFactory.newInstance().newDuration("PT24H");
        Identifier offeredSid = RMUtils.getWSRMFactory().createIdentifier();
        offeredSid.setValue("s1Offer");

        expect(handler.getBinding()).andReturn(binding)
        expect(source.getSourcePolicies()).andReturn(sp);
        expect(sp.getAcksTo()).andReturn(null);
        expect(sp.getSequenceExpiration()).andReturn(null);
        expect(sp.isIncludeOffer()).andReturn(true);  
        expect(sp.getOfferedSequenceExpiration()).andReturn(osd);
        expect(source.generateSequenceIdentifier()).andReturn(offeredSid);
        expect(handler.getBinding()).andReturn(binding).times(2);       
        // Moved to CreateSequenceResponse handling on RMServant
        //expect(source.getHandler()).andReturn(handler);
        //expect(handler.getDestination()).andReturn(dest);

        control.replay();
        proxy.createSequence(source,
                             getTo(),
                             RMUtils.createReference(Names.WSA_ANONYMOUS_ADDRESS),
                             ContextUtils.WSA_OBJECT_FACTORY.createRelatesToType());
        control.verify();
        assertTrue("expected send",  binding.isSent());
    }
View Full Code Here

   
   
    public void testTerminateSequenceOnClient() throws IOException, WSDLException, SequenceFault {
        TestSoapClientBinding binding = new TestSoapClientBinding(bus, epr);
       
        IMocksControl control = EasyMock.createNiceControl();
        RMHandler handler = control.createMock(RMHandler.class);

        handler.getBinding();
        EasyMock.expectLastCall().andReturn(binding).times(3);
        //handler.getTransport();
        //expectLastCall().andReturn(binding.getClientTransport());      
        handler.getClientBinding();
        EasyMock.expectLastCall().andReturn(binding).times(4);
       
        RMSource source = control.createMock(RMSource.class);
        handler.getSource();
        EasyMock.expectLastCall().andReturn(source);
        source.removeSequence(EasyMock.isA(SourceSequence.class));
        EasyMock.expectLastCall();
    

        control.replay();

        RMProxy proxy = new RMProxy(handler);

        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
        sid.setValue("TerminatedSequence");
        SourceSequence seq = new SourceSequence(sid, null, null);
       
        proxy.terminateSequence(seq);
       
        control.verify();
        assertTrue("expected send",  binding.isSent());
    }
View Full Code Here

    }
   
    public void testRequestAcknowledgement() throws IOException, WSDLException, SequenceFault {
        TestSoapClientBinding binding = new TestSoapClientBinding(bus, epr);
       
        IMocksControl control = EasyMock.createNiceControl();
        RMHandler handler = control.createMock(RMHandler.class);

        handler.getBinding();
        EasyMock.expectLastCall().andReturn(binding).times(3);
        //handler.getTransport();
        //expectLastCall().andReturn(binding.getClientTransport());
        handler.getClientBinding();
        EasyMock.expectLastCall().andReturn(binding).times(4);

        control.replay();

        RMProxy proxy = new RMProxy(handler);

        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
        sid.setValue("AckRequestedSequence");
        SourceSequence seq = new SourceSequence(sid, null, null);
        seq.setTarget(getTo());
       
        Collection<SourceSequence> seqs = new ArrayList<SourceSequence>();
        seqs.add(seq);
       
        proxy.requestAcknowledgment(seqs);
       
        control.verify();
        assertTrue("expected send",  binding.isSent());
    }
View Full Code Here

    }
   
    public void testLastMessage() throws IOException, WSDLException, SequenceFault {
        TestSoapClientBinding binding = new TestSoapClientBinding(bus, epr);
       
        IMocksControl control = EasyMock.createNiceControl();
        RMHandler handler = control.createMock(RMHandler.class);
    
        handler.getBinding();
        EasyMock.expectLastCall().andReturn(binding).times(3);
        //handler.getTransport();
        //expectLastCall().andReturn(binding.getClientTransport());
        handler.getClientBinding();
        EasyMock.expectLastCall().andReturn(binding).times(4);

        control.replay();

        RMProxy proxy = new RMProxy(handler);

        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
        sid.setValue("LastMessageSequence");
        SourceSequence seq = new SourceSequence(sid, null, null);       
        seq.setTarget(getTo());
        proxy.lastMessage(seq);
       
        control.verify();
        assertTrue("expected send",  binding.isSent());
    }
View Full Code Here

        assertTrue("expected send",  binding.isSent());
    }
   
    public void testAcknowledge() throws IOException, WSDLException, SequenceFault {
        TestSoapClientBinding binding = new TestSoapClientBinding(bus, epr);
        IMocksControl control = EasyMock.createNiceControl();
        RMHandler handler = control.createMock(RMHandler.class);
        RMDestination dest = control.createMock(RMDestination.class);
        RMAssertionType rma = control.createMock(RMAssertionType.class);

        dest.getRMAssertion();
        expectLastCall().andReturn(rma).times(2);
        rma.getAcknowledgementInterval();
        expectLastCall().andReturn(null).times(2);
        dest.getAcksPolicy();
        expectLastCall().andReturn(null).times(2);
       
        handler.getBinding();
        EasyMock.expectLastCall().andReturn(binding).times(3);
        //handler.getTransport();
        //expectLastCall().andReturn(transport);      
        handler.getClientBinding();
        EasyMock.expectLastCall().andReturn(binding).times(2);
                                                   
        control.replay();
       
        RMProxy proxy = new RMProxy(handler);

        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
        sid.setValue("Acknowledge");
        DestinationSequence seq = new DestinationSequence(sid,
                                    RMUtils.createReference("http://localhost:9999/decoupled"), dest);
        seq.acknowledge(BigInteger.ONE);
        seq.acknowledge(BigInteger.TEN);      
        proxy.acknowledge(seq);
       
        control.verify();
        assertTrue("expected send",  binding.isSent());
    }
View Full Code Here

        InputStream is = getClass().getResourceAsStream("resources/spec/SequenceInfoResponse.xml");
        TestInputStreamContext istreamCtx = new TestInputStreamContext();
        istreamCtx.setInputStream(is);
        ct.setInputStreamMessageContext(istreamCtx);
       
        IMocksControl control = EasyMock.createNiceControl();
        RMHandler handler = control.createMock(RMHandler.class);
        handler.getBinding();
        EasyMock.expectLastCall().andReturn(binding).times(3);
        //handler.getTransport();
        //expectLastCall().andReturn(ct);      
        handler.getClientBinding();
        EasyMock.expectLastCall().andReturn(binding).times(4);
       
        RMSource source = control.createMock(RMSource.class);
        handler.getSource();
        EasyMock.expectLastCall().andReturn(source);
        source.removeSequence(EasyMock.isA(SourceSequence.class));
        EasyMock.expectLastCall();

        control.replay();

        RMProxy service = new RMProxy(handler);

        Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
        sid.setValue("TerminatedSequence");
        SourceSequence seq = new SourceSequence(sid, null, null);
       
        service.terminateSequence(seq);
       
        control.verify();
        assertTrue("expected send",  binding.isSent());
    }   
View Full Code Here

        EasyMock.verify(listener1);
    }
   
    public void testMultipleListeners() {
      
        IMocksControl ctrl = EasyMock.createStrictControl();
       
        BusLifeCycleListener listener1 = ctrl.createMock(BusLifeCycleListener.class);
        BusLifeCycleListener listener2 = ctrl.createMock(BusLifeCycleListener.class);
        CeltixBusLifeCycleManager mgr = new CeltixBusLifeCycleManager();

        mgr.registerLifeCycleListener(listener1);
        mgr.registerLifeCycleListener(listener2);
       
        ctrl.reset();
        listener1.initComplete();
        listener2.initComplete();
        ctrl.replay();
        mgr.initComplete();
        ctrl.verify();
       
        ctrl.reset();
        listener1.preShutdown();
        listener2.preShutdown();
        ctrl.replay();
        mgr.preShutdown();
        ctrl.verify();
       
        ctrl.reset();
        listener1.postShutdown();
        listener2.postShutdown();
        ctrl.replay();
        mgr.postShutdown();
        ctrl.verify();
    }
View Full Code Here

        ctrl.verify();
    }
   
    public void testDeregistration() {
       
        IMocksControl ctrl = EasyMock.createStrictControl();
       
        BusLifeCycleListener listener1 = ctrl.createMock(BusLifeCycleListener.class);
        BusLifeCycleListener listener2 = ctrl.createMock(BusLifeCycleListener.class);
        CeltixBusLifeCycleManager mgr = new CeltixBusLifeCycleManager();

        mgr.registerLifeCycleListener(listener2);
        mgr.registerLifeCycleListener(listener1);
        mgr.unregisterLifeCycleListener(listener2);
       
        ctrl.reset();
        listener1.initComplete();
        ctrl.replay();
        mgr.initComplete();
        ctrl.verify();
       
        ctrl.reset();
        listener1.preShutdown();
        ctrl.replay();
        mgr.preShutdown();
        ctrl.verify();
       
        ctrl.reset();
        listener1.postShutdown();
        ctrl.replay();
        mgr.postShutdown();
        ctrl.verify();
    }
View Full Code Here

TOP

Related Classes of org.easymock.IMocksControl

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.