Examples of MockHandler


Examples of org.mockito.invocation.MockHandler

    }

    public <T> void resetMock(T mock) {
        InternalMockHandler oldHandler = (InternalMockHandler) getMockHandler(mock);
        MockCreationSettings settings = oldHandler.getMockSettings();
        MockHandler newHandler = new MockHandlerFactory().create(settings);

        mockMaker.resetMock(mock, newHandler, settings);
    }
View Full Code Here

Examples of org.switchyard.MockHandler

    @Test
    public void testInOutSuccess() throws Exception {
        final QName serviceName = new QName("inOutSuccess");

        // Provide the service
        MockHandler provider = new MockHandler().forwardInToOut();
        ServiceReference service = _domain.createInOutService(serviceName, provider);
       
        // Consume the service
        MockHandler consumer = new MockHandler();
        Exchange exchange = service.createExchange(consumer);
        exchange.send(exchange.createMessage());
       
        // wait, since this is async
        provider.waitForOKMessage();
        consumer.waitForOKMessage();
    }
View Full Code Here

Examples of org.switchyard.test.MockHandler

    @Test
    public void sendOneWayMessageThroughCamelToSwitchYardService() throws Exception {
        // remove the currently registered service for SimpleCamelService
        _testKit.removeService("SimpleCamelService");
        final MockHandler mockHandler = _testKit.registerInOnlyService("SimpleCamelService");
        final ProducerTemplate producerTemplate = _camelContext.createProducerTemplate();
       
        producerTemplate.sendBody("direct://input", "dummy payload");
        assertOneMessage(mockHandler, "dummy payload");
       
View Full Code Here

Examples of org.switchyard.test.MockHandler

    }

    @Ignore
    @Test
    public void startStop() throws Exception {
        final MockHandler mockHandler = _testKit.registerInOnlyService("SimpleCamelService");
        final ProducerTemplate producerTemplate = _camelContext.createProducerTemplate();

        producerTemplate.sendBody("direct://input", "dummy payload");
        assertOneMessage(mockHandler, "dummy payload");
View Full Code Here

Examples of org.switchyard.test.MockHandler

        // Provide a switchyard service
        CompositeModel composite = _puller.pull("/HelloSwitchYard.xml", getClass());
        CompositeServiceModel compositeService = composite.getServices().get(0);
        _config = (HttpBindingModel)compositeService.getBindings().get(0);
        _domain.registerService(_config.getServiceName(), new HelloWebServiceInterface(), new MockHandler().forwardInToOut());
        _domain.registerServiceReference(_config.getServiceName(), new HelloWebServiceInterface());

        // Service exposed as WS
        _httpInbound = new InboundHandler(_config, _domain);
        _httpInbound.start();
View Full Code Here

Examples of org.switchyard.test.MockHandler

        }
    }

    @Test
    public void authenticationMissing() throws Exception {
        MockHandler handler = new MockHandler();
        Exchange ex = _proxyConsumerService2.operation(METHOD_NAME).createExchange(handler);
        Message requestMsg = ex.createMessage().setContent(INPUT);
        ex.send(requestMsg);
        handler.waitForFaultMessage();
        String response = ex.getMessage().getContent(String.class);
        Assert.assertTrue(response.contains("407 Proxy Authentication Required"));
    }
View Full Code Here

Examples of org.switchyard.test.MockHandler

        // Provide a switchyard service
        CompositeModel composite = _puller.pull("/HelloSwitchYard.xml", getClass());
        CompositeServiceModel compositeService = composite.getServices().get(0);
        _config = (RESTEasyBindingModel)compositeService.getBindings().get(0);
        _domain.registerService(_config.getServiceName(), new HelloWebServiceInterface(), new MockHandler().forwardInToOut());
        _domain.registerServiceReference(_config.getServiceName(), new HelloWebServiceInterface());

        // Service exposed as WS
        _resteasyInbound = new InboundHandler(_config, _domain);
        _resteasyInbound.start();
View Full Code Here

Examples of org.switchyard.test.MockHandler

    private void sendAndAssertOneMessage() throws Exception, InterruptedException {
        final String payload = "dummy payload";
        // remove the currently registered service for SimpleCamelService
        _testKit.removeService("SimpleCamelService");
        final MockHandler simpleCamelService = _testKit.registerInOnlyService("SimpleCamelService");

        sendTextToQueue(payload, "testQueue");
        // Allow for the JMS Message to be processed.
        Thread.sleep(3000);

        final LinkedBlockingQueue<Exchange> recievedMessages = simpleCamelService.getMessages();
        assertThat(recievedMessages, is(notNullValue()));
        final Exchange recievedExchange = recievedMessages.iterator().next();
        assertThat(recievedExchange.getMessage().getContent(String.class), is(equalTo(payload)));
    }
View Full Code Here

Examples of org.switchyard.test.MockHandler

        _httpInbound.start();

        compositeService = composite.getServices().get(1);
        HttpBindingModel config2 = (HttpBindingModel)compositeService.getBindings().get(0);

        _domain.registerService(config2.getServiceName(), new InOnlyService(), new MockHandler());
        _domain.registerServiceReference(config2.getServiceName(), new HelloInterface());
        _httpInbound2 = new InboundHandler(config2, _domain);
        _httpInbound2.start();

        CompositeReferenceModel compositeReference = composite.getReferences().get(0);
View Full Code Here

Examples of org.switchyard.test.MockHandler

        Assert.assertEquals(INPUT, responseMsg.getContent());
    }

    @Test
    public void httpStatus() throws Exception {
        MockHandler handler = new MockHandler();
        Exchange ex = _consumerService.operation(METHOD_NAME).createExchange(handler);
        Message requestMsg = ex.createMessage().setContent(INPUT);
        requestMsg.getContext().setProperty("SomeRequestHeader", "BAR");
        ex.send(requestMsg);
        handler.waitForOKMessage();
        Assert.assertEquals(200, ex.getContext().getProperty(HttpContextMapper.HTTP_RESPONSE_STATUS).getValue());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.