Package org.easymock.classextension

Examples of org.easymock.classextension.IMocksControl


        store.removeDestinationSequence(sid2);
      
    }
   
    public void testCreateDeleteMessages() throws IOException, SQLException  {
        IMocksControl control = EasyMock.createNiceControl();
        RMMessage msg = control.createMock(RMMessage.class);
        Identifier sid1 = RMUtils.getWSRMFactory().createIdentifier();
        sid1.setValue("sequence1");
        EasyMock.expect(msg.getMessageNr()).andReturn(BigInteger.ONE).times(2);
        InputStream is = new ByteArrayInputStream(new byte[89]);
        EasyMock.expect(msg.getContextAsStream()).andReturn(is).times(2);
       
        control.replay();
        store.beginTransaction();
        store.storeMessage(sid1, msg, true);
        store.storeMessage(sid1, msg, false);
        store.commit();
        control.verify();
       
        control.reset();
        EasyMock.expect(msg.getMessageNr()).andReturn(BigInteger.ONE);
        EasyMock.expect(msg.getContextAsStream()).andReturn(is);
       
        control.replay();
        store.beginTransaction();
        try {
            store.storeMessage(sid1, msg, true);
        } catch (SQLException ex) {
            assertEquals("23505", ex.getSQLState());
        }
        store.abort();
        control.verify();
       
        control.reset();
        EasyMock.expect(msg.getMessageNr()).andReturn(BigInteger.TEN).times(2);
        EasyMock.expect(msg.getContextAsStream()).andReturn(is).times(2);
       
        control.replay();
        store.beginTransaction();
        store.storeMessage(sid1, msg, true);
        store.storeMessage(sid1, msg, false);
        store.commit();
        control.verify();
       
        Collection<BigInteger> messageNrs = new ArrayList<BigInteger>();
        messageNrs.add(BigInteger.ZERO);
        messageNrs.add(BigInteger.TEN);
        messageNrs.add(BigInteger.ONE);
View Full Code Here


        sid1.setValue("sequence2");
        store.removeMessages(sid2, messageNrs, true);
    }
   
    public void testUpdateDestinationSequence() throws SQLException, IOException {
        IMocksControl control = EasyMock.createNiceControl();
        RMDestinationSequence seq = control.createMock(RMDestinationSequence.class);
        Identifier sid1 = RMUtils.getWSRMFactory().createIdentifier();
        sid1.setValue("sequence1");
        EndpointReferenceType epr = RMUtils.createReference(Names.WSA_ANONYMOUS_ADDRESS);
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
        EasyMock.expect(seq.getAcksTo()).andReturn(epr);       
        EasyMock.expect(seq.getEndpointIdentifier()).andReturn(SERVER_ENDPOINT_ID);
       
        control.replay();
        store.createDestinationSequence(seq);  
        control.verify();
       
        control.reset();
        EasyMock.expect(seq.getLastMessageNr()).andReturn(null);
        InputStream is = new ByteArrayInputStream(new byte[32]);
        EasyMock.expect(seq.getAcknowledgmentAsStream()).andReturn(is);       
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
       
        control.replay();
        store.beginTransaction();
        store.updateDestinationSequence(seq);
        store.abort();
       
        control.reset();
        EasyMock.expect(seq.getLastMessageNr()).andReturn(BigInteger.TEN);
        EasyMock.expect(seq.getAcknowledgmentAsStream()).andReturn(is);       
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
       
        control.replay();
        store.beginTransaction();
        store.updateDestinationSequence(seq);
        store.abort();
       
        store.removeDestinationSequence(sid1);
View Full Code Here

       
        store.removeDestinationSequence(sid1);
    }
   
    public void testUpdateSourceSequence() throws SQLException {
        IMocksControl control = EasyMock.createNiceControl();
        RMSourceSequence seq = control.createMock(RMSourceSequence.class);
        Identifier sid1 = RMUtils.getWSRMFactory().createIdentifier();
        sid1.setValue("sequence1");
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
        EasyMock.expect(seq.getExpiry()).andReturn(null);
        EasyMock.expect(seq.getOfferingSequenceIdentifier()).andReturn(null);
        EasyMock.expect(seq.getEndpointIdentifier()).andReturn(CLIENT_ENDPOINT_ID);
       
        control.replay();
        store.createSourceSequence(seq);  
        control.verify();       
       
        control.reset();
        EasyMock.expect(seq.getCurrentMessageNr()).andReturn(BigInteger.ONE);
        EasyMock.expect(seq.isLastMessage()).andReturn(false);
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);  
       
        control.replay();
        store.beginTransaction();
        store.updateSourceSequence(seq);
        store.abort();
       
        control.reset();
        EasyMock.expect(seq.getCurrentMessageNr()).andReturn(BigInteger.TEN);
        EasyMock.expect(seq.isLastMessage()).andReturn(true)
        EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
       
        control.replay();
        store.beginTransaction();
        store.updateSourceSequence(seq);
        store.abort();
       
        store.removeSourceSequence(sid1);
View Full Code Here

        assertTrue(phs3 == handlers.get(9));
        assertTrue(sh1 == handlers.get(10));    
    }
   
    public void testConfigureSystemHandlers() {
        IMocksControl control = EasyMock.createControl();
        TestBinding b = new TestBinding();
        SystemHandlerChainType shc = null;
        Configuration c = control.createMock(Configuration.class);
        expect(c.getObject("systemHandlerChain")).andReturn(shc);
        control.replay();
       
        b.configureSystemHandlers(c);
        assertEquals(0, b.getPreLogicalSystemHandlers().size());
        assertEquals(0, b.getPostLogicalSystemHandlers().size());
        assertEquals(0, b.getPreProtocolSystemHandlers().size());
        assertEquals(0, b.getPreProtocolSystemHandlers().size());
       
        control.verify();
        control.reset();
       
        shc = new ObjectFactory().createSystemHandlerChainType();
        c = control.createMock(Configuration.class);
        expect(c.getObject("systemHandlerChain")).andReturn(shc);
        control.replay();
       
        b.configureSystemHandlers(c);
        assertEquals(0, b.getPreLogicalSystemHandlers().size());
        assertEquals(0, b.getPostLogicalSystemHandlers().size());
        assertEquals(0, b.getPreProtocolSystemHandlers().size());
        assertEquals(0, b.getPreProtocolSystemHandlers().size());
       
        control.verify();
        control.reset();
       
        shc = createSystemHandlerChain();
        c = control.createMock(Configuration.class);
        expect(c.getObject("systemHandlerChain")).andReturn(shc);
        control.replay();
       
        b.configureSystemHandlers(c);
        assertEquals(2, b.getPreLogicalSystemHandlers().size());
        assertEquals(1, b.getPostLogicalSystemHandlers().size());
        assertEquals(1, b.getPreProtocolSystemHandlers().size());
        assertEquals(2, b.getPostProtocolSystemHandlers().size());
       
        control.verify();      
    }
View Full Code Here

       
        control.verify();      
    }
   
    public void testInjectSystemHandlers() {
        IMocksControl control = EasyMock.createControl();
        TestBinding b = new TestBinding();
        SystemHandlerChainType shc = createSystemHandlerChain();
        Configuration c = control.createMock(Configuration.class);
        expect(c.getObject("systemHandlerChain")).andReturn(shc);
        ResourceInjector ri = control.createMock(ResourceInjector.class);
        ri.inject(EasyMock.isA(SystemHandler.class));
        EasyMock.expectLastCall().times(6);
        control.replay();
       
        b.configureSystemHandlers(c);
        b.injectSystemHandlers(ri);
       
        control.verify();
    }
View Full Code Here

        java.util.Properties props = System.getProperties();
        props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
        props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
        props.put("yoko.orb.id", "Yoko-Server-Binding");
        orb = ORB.init(new String[0], props);
        IMocksControl control = EasyMock.createNiceControl();
        message = control.createMock(Message.class);
    }
View Full Code Here

       
    }*/
       
    public void testInvoke() throws Exception {
        CorbaDSIServant dsiServant = new CorbaDSIServant();       
        IMocksControl control = EasyMock.createNiceControl();
        ServerRequest request = EasyMock.createMock(ServerRequest.class);
        Message msg = EasyMock.createMock(Message.class);            
        String opName = "greetMe";
        EasyMock.expect(request.operation()).andReturn(opName);                       
        MessageObserver incomingObserver = new TestObserver();              
        dsiServant.setObserver(incomingObserver);
       
        control.replay();
        dsiServant.invoke(request);
        control.verify();       
    }
View Full Code Here

        endpointInfo = service.getServiceInfo().getEndpoint(new QName(ns, portName));
  
    }
   
    public void testCreateBinding() throws Exception {
        IMocksControl control = EasyMock.createNiceControl();
        BindingInfo bindingInfo = control.createMock(BindingInfo.class);

        CorbaBinding binding = (CorbaBinding)factory.createBinding(bindingInfo);
        assertNotNull(binding);
        assertTrue(CorbaBinding.class.isInstance(binding));       
        List<Interceptor> inInterceptors = binding.getInInterceptors();
View Full Code Here

        intents.put("A", new AbstractFeature() {});
        intents.put("SOAP", new AbstractFeature() {});
        final IntentMap intentMap = new IntentMap();
        intentMap.setIntents(intents);
       
        IMocksControl control = EasyMock.createNiceControl();
        BundleContext dswContext = control.createMock(BundleContext.class);
        BundleContext callingContext = control.createMock(BundleContext.class);       
        List<AbstractFeature> features = new ArrayList<AbstractFeature>();
        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
        control.replay();

        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
        AbstractPojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
            @Override
            IntentMap getIntentMap(BundleContext callingContext) {
View Full Code Here

        intents.put("confidentiality.message", new AbstractFeature() {});
        intents.put("transactionality", new AbstractFeature() {});
        final IntentMap intentMap = new IntentMap();
        intentMap.setIntents(intents);
       
        IMocksControl control = EasyMock.createNiceControl();
        BundleContext dswContext = control.createMock(BundleContext.class);
        BundleContext callingContext = control.createMock(BundleContext.class);       
        List<AbstractFeature> features = new ArrayList<AbstractFeature>();
        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
        control.replay();

        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
            @Override
            IntentMap getIntentMap(BundleContext callingContext) {
View Full Code Here

TOP

Related Classes of org.easymock.classextension.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.