Package org.apache.servicemix.tck

Examples of org.apache.servicemix.tck.ReceiverComponent


        e = DOMUtils.getFirstChildElement(e);
        assertEquals(new QName(SoapMarshaler.SOAP_11_URI, SoapMarshaler.FAULT), DOMUtil.getQName(e));
    }

    public void testSoapXml() throws Exception {
        ReceiverComponent echo = new ReceiverComponent();
        echo.setService(new QName("urn:test", "echo"));
        echo.setEndpoint("echo");
        container.activateComponent(echo, "echo");

        HttpEndpoint ep1 = createInOnlyEndpoint("ep1");
        ep1.setTargetService(new QName("urn:test", "echo"));
        ep1.setTargetEndpoint("echo");
        ep1.setLocationURI("http://localhost:8193/ep1/");
        ep1.setRoleAsString("consumer");
        ep1.setSoap(false);

        HttpEndpoint ep2 = createInOnlyEndpoint("ep2");
        ep2.setTargetService(new QName("urn:test", "http"));
        ep2.setTargetEndpoint("ep3");
        ep2.setLocationURI("http://localhost:8193/ep2/");
        ep2.setRoleAsString("consumer");
        ep2.setSoap(true);

        HttpEndpoint ep3 = createInOnlyEndpoint("ep3");
        ep3.setLocationURI("http://localhost:8193/ep1/");
        ep3.setRoleAsString("provider");
        ep3.setSoap(true);

        HttpComponent http = new HttpComponent();
        http.setEndpoints(new HttpEndpoint[] {ep1, ep2, ep3});
        container.activateComponent(http, "http1");

        container.start();

        PostMethod method = new PostMethod("http://localhost:8193/ep2/");
        method.setRequestEntity(new InputStreamRequestEntity(getClass().getResourceAsStream("request.xml")));
        new HttpClient().executeMethod(method);

        echo.getMessageList().assertMessagesReceived(1);
        List msgs = echo.getMessageList().flushMessages();
        NormalizedMessage msg = (NormalizedMessage) msgs.get(0);
        SourceTransformer st = new SourceTransformer();
        Element e = st.toDOMElement(msg);
        String strMsg = DOMUtil.asXML(e);
        logger.info(strMsg);
View Full Code Here


    protected SourceTransformer sourceTransformer = new SourceTransformer();

    protected void setUp() throws Exception {
        super.setUp();
       
        ReceiverComponent rec = new ReceiverComponent();
        rec.setService(new QName("receiver"));
        rec.setEndpoint("endpoint");
        container.activateComponent(rec, "receiver");
        receiver = rec;
       
        EchoComponent echo = new EchoComponent();
        echo.setService(new QName("echo"));
View Full Code Here

        httpReceiver.setSoap(true);

        httpComponent.setEndpoints(new HttpEndpoint[] { httpWSNBroker, httpReceiver });
        jbi.activateComponent(new ActivationSpec("servicemix-http", httpComponent));

        ReceiverComponent receiver = new ReceiverComponent();
        receiver.setService(new QName("receiver"));
        receiver.setEndpoint("endpoint");
        jbi.activateComponent(new ActivationSpec("receiver", receiver));

        EndpointReferenceType epr = new EndpointReferenceType();
        epr.setAddress(new AttributedURIType());
        epr.getAddress().setValue("http://localhost:8192/Receiver/?http.soap=true");
        wsnBroker.subscribe(epr, "myTopic", null);
        wsnBroker.notify("myTopic", parse("<hello>world</hello>"));

        receiver.getMessageList().assertMessagesReceived(1);
    }
View Full Code Here

        ep.setLocationURI("http://localhost:8192/");
        ep.setDefaultMep(MessageExchangeSupport.IN_ONLY);
        http.setEndpoints(new HttpEndpoint[] {ep});
        jbi.activateComponent(http, "servicemix-http");

        ReceiverComponent receiver = new ReceiverComponent();
        jbi.activateComponent(receiver, "receiver");

        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
        DocumentFragment epr = URIResolver.createWSAEPR("http://localhost:8192/?http.soap=true");
        ServiceEndpoint se = client.getContext().resolveEndpointReference(epr);
        assertNotNull(se);

        InOnly inonly = client.createInOnlyExchange();
        inonly.setEndpoint(se);
        inonly.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(inonly);

        assertEquals(ExchangeStatus.DONE, inonly.getStatus());
        receiver.getMessageList().assertMessagesReceived(1);
        List msgs = receiver.getMessageList().flushMessages();
        NormalizedMessage msg = (NormalizedMessage) msgs.get(0);
        Element elem = new SourceTransformer().toDOMElement(msg);
        assertEquals("http://www.w3.org/2003/05/soap-envelope", elem.getNamespaceURI());
        assertEquals("env:Envelope", elem.getNodeName());
        logger.info(new SourceTransformer().contentToString(msg));
View Full Code Here

        trigger.afterPropertiesSet();
        endpoint.setTrigger(trigger);
        quartz.setEndpoints(new QuartzEndpoint[] {endpoint });
        jbi.activateComponent(quartz, "servicemix-quartz");
       
        ReceiverComponent receiver = new ReceiverComponent(new QName("receiver"), "endpoint");
        jbi.activateComponent(receiver, "receiver");
       
        jbi.start();

        Thread.sleep(200);
        assertTrue(receiver.getMessageList().flushMessages().size() > 0);
       
        quartz.stop();
        receiver.getMessageList().flushMessages();
        Thread.sleep(200);
        assertEquals(0, receiver.getMessageList().flushMessages().size());
       
        quartz.start();
        Thread.sleep(200);
        assertTrue(receiver.getMessageList().flushMessages().size() > 0);

        jbi.shutDown();
    }
View Full Code Here

        ep.setLocationURI("http://localhost:8192/ep1/");
        ep.setDefaultMep(MessageExchangeSupport.IN_ONLY);
        http.setEndpoints(new HttpEndpointType[] {ep});
        container.activateComponent(http, "http");

        ReceiverComponent recv = new ReceiverComponent();
        recv.setService(new QName("urn:test", "recv"));
        container.activateComponent(recv, "recv");

        container.start();

        PostMethod post = new PostMethod("http://localhost:8192/ep1/");
        post.setRequestEntity(new StringRequestEntity("<hello>world</hello>"));
        new HttpClient().executeMethod(post);
        String res = post.getResponseBodyAsString();
        log.info(res);
        assertEquals("", res);
        if (post.getStatusCode() != 202) {
            throw new InvalidStatusResponseException(post.getStatusCode());
        }

        recv.getMessageList().assertMessagesReceived(1);
    }
View Full Code Here

        configurePattern(wireTap);
        activateComponent(wireTap, "wireTap");
    }
   
    public void testInOnly() throws Exception {
        ReceiverComponent target = activateReceiver("target");

        InOnly me = client.createInOnlyExchange();
        me.setService(new QName("wireTap"));
        me.getInMessage().setContent(createSource("<hello/>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.DONE, me.getStatus());
       
        target.getMessageList().assertMessagesReceived(1);
        inReceiver.getMessageList().assertMessagesReceived(1);
        outReceiver.getMessageList().assertMessagesReceived(0);
        faultReceiver.getMessageList().assertMessagesReceived(0);
       
        listener.assertExchangeCompleted();
View Full Code Here

       
        listener.assertExchangeCompleted();
    }
   
    public void testRobustInOnly() throws Exception {
        ReceiverComponent target = activateReceiver("target");

        RobustInOnly me = client.createRobustInOnlyExchange();
        me.setService(new QName("wireTap"));
        me.getInMessage().setContent(createSource("<hello/>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.DONE, me.getStatus());
       
        target.getMessageList().assertMessagesReceived(1);
        inReceiver.getMessageList().assertMessagesReceived(1);
        outReceiver.getMessageList().assertMessagesReceived(0);
        faultReceiver.getMessageList().assertMessagesReceived(0);
       
        listener.assertExchangeCompleted();
View Full Code Here

       
        listener.assertExchangeCompleted();
    }
   
    public void testInOptionalOutNoAnswer() throws Exception {
        activateComponent(new ReceiverComponent(), "target");

        InOptionalOut me = client.createInOptionalOutExchange();
        me.setService(new QName("wireTap"));
        me.getInMessage().setContent(createSource("<hello/>"));
        client.sendSync(me);
View Full Code Here

        endpoint.setPojo(new ComplexPojoImpl());
        endpoint.setServiceInterface(ComplexPojo.class.getName());
        component.setEndpoints(new Jsr181Endpoint[] {endpoint });
        container.activateComponent(component, "JSR181Component");
       
        ReceiverComponent receiver = new ReceiverComponent();
        container.activateComponent(receiver, "Receiver");
       
        container.start();

        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
View Full Code Here

TOP

Related Classes of org.apache.servicemix.tck.ReceiverComponent

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.