Package org.apache.servicemix.tck

Examples of org.apache.servicemix.tck.ReceiverComponent


        ep.setJmsProviderDestinationName("foo.bar.myqueue");
        ep.setDestinationStyle(AbstractJmsProcessor.STYLE_QUEUE);
        jms.setEndpoints(new JmsEndpoint[] {ep});
        container.activateComponent(jms, "servicemix-jms");

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

        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        DocumentFragment epr = URIResolver.createWSAEPR("jms://queue/foo.bar.myqueue?jms.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


        HttpComponent component = new HttpComponent();
        component.getConfiguration().setStreamingEnabled(streaming);
        container.activateComponent(component, "HTTPComponent");

        // Add a receiver component
        Receiver receiver = new ReceiverComponent();
        ActivationSpec asReceiver = new ActivationSpec("receiver", receiver);
        asReceiver.setService(new QName("http://http.servicemix.org/Test", "ConsumerInOnly"));
        container.activateComponent(asReceiver);

        // Add the http invoker
        HttpInvoker invoker = new HttpInvoker();
        invoker.setDefaultInOut(false);
        invoker.setUrl("http://localhost:8192/InOnly/");
        invoker.setMarshaler(new HttpSoapClientMarshaler(true));
        ActivationSpec asInvoker = new ActivationSpec("invoker", invoker);
        asInvoker.setService(new QName("urn:test", "invoker"));
        container.activateComponent(asInvoker);

        // Start container
        container.start();

        // Deploy SU
        URL url = getClass().getClassLoader().getResource("consumer/http.wsdl");
        File path = new File(new URI(url.toString()));
        path = path.getParentFile();
        component.getServiceUnitManager().deploy("consumer", path.getAbsolutePath());
        component.getServiceUnitManager().start("consumer");

        // Call it
        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        RobustInOnly in = client.createRobustInOnlyExchange();
        in.setService(new QName("urn:test", "invoker"));
        in.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(msg.getBytes())));

        long t0 = System.currentTimeMillis();
        client.sendSync(in);
        long t1 = System.currentTimeMillis();
        assertEquals(ExchangeStatus.DONE, in.getStatus());

        // Check we received the message
        receiver.getMessageList().assertMessagesReceived(1);

        return t1 - t0;
    }
View Full Code Here

        AuthorizationMap map = new DefaultAuthorizationMap(entries);
        SecuredBroker broker = new SecuredBroker(map);
        jbi.setBroker(broker);
        jbi.init();
       
        receiver = new ReceiverComponent();
        jbi.activateComponent(receiver, "receiver");

        jbi.start();
    }
View Full Code Here

            printNodes(containers);
        }
        long t1 = System.currentTimeMillis();
        System.err.println(t1 - t0);
        for (int i = 0; i < containers.length; i++) {
            containers[i].activateComponent(new ReceiverComponent(), "receiver");
        }
        for (int i = 0; i < containers.length; i++) {
            containers[i].stop();
            printNodes(containers);
        }
View Full Code Here

        AuthorizationMap map = new DefaultAuthorizationMap(entries);
        SecuredBroker broker = new SecuredBroker(map);
        jbi.setBroker(broker);
        jbi.init();
       
        receiver = new ReceiverComponent();
        jbi.activateComponent(receiver, "receiver");

        jbi.start();
    }
View Full Code Here

    protected void runSimpleTest(final boolean syncSend, final boolean syncReceive) throws Exception {
        final SenderComponent sender = new SenderComponent();
        sender.setResolver(new ServiceNameEndpointResolver(ReceiverComponent.SERVICE));
        final Receiver receiver;
        if (syncReceive) {
          receiver = new ReceiverComponent();
        } else {
          receiver = new AsyncReceiverPojo();
        }

        senderContainer.activateComponent(new ActivationSpec("sender", sender));
View Full Code Here

        ep.setJmsProviderDestinationName("foo.bar.myqueue");
        ep.setDestinationStyle(AbstractJmsProcessor.STYLE_QUEUE);
        jms.setEndpoints(new JmsEndpoint[] { ep });
        container.activateComponent(jms, "servicemix-jms");

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

        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        DocumentFragment epr = URIResolver.createWSAEPR("jms://queue/foo.bar.myqueue?jms.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());
        System.out.println(new SourceTransformer().contentToString(msg));
View Full Code Here

        jbi.setFlowName("st");
        jbi.setEmbedded(true);
        jbi.init();
        jbi.start();
        SenderComponent sender = new SenderComponent();
        ReceiverComponent receiver = new ReceiverComponent();
        jbi.activateComponent(sender, "sender");
        jbi.activateComponent(receiver, "receiver");
       
        JdbcAuditor auditor = new JdbcAuditor();
        auditor.setContainer(jbi);
View Full Code Here

        broker.stop();
    }
   
    public void testInOnly() throws Exception {
        final SenderComponent sender = new SenderComponent();
        final ReceiverComponent receiver =  new ReceiverComponent();
        sender.setResolver(new ServiceNameEndpointResolver(ReceiverComponent.SERVICE));

        senderContainer.activateComponent(new ActivationSpec("sender", sender));
        receiverContainer.activateComponent(new ActivationSpec("receiver", receiver));

        Thread.sleep(5000);

        sender.sendMessages(NUM_MESSAGES);
        Thread.sleep(3000);
        receiver.getMessageList().assertMessagesReceived(NUM_MESSAGES);
    }
View Full Code Here

        receiver.getMessageList().assertMessagesReceived(NUM_MESSAGES);
    }
   
    public void testTxInOnly() throws Exception {
        final SenderComponent sender = new SenderComponent();
        final ReceiverComponent receiver =  new ReceiverComponent();
        sender.setResolver(new ServiceNameEndpointResolver(ReceiverComponent.SERVICE));

        senderContainer.activateComponent(new ActivationSpec("sender", sender));
        receiverContainer.activateComponent(new ActivationSpec("receiver", receiver));

        Thread.sleep(5000);
       
      senderContainer.setAutoEnlistInTransaction(true);
        tt.execute(new TransactionCallback() {
        public Object doInTransaction(TransactionStatus status) {
                try {
                    sender.sendMessages(NUM_MESSAGES);
                } catch (JBIException e) {
                    throw new RuntimeJBIException(e);
                }
          return null;
        }
        });
      Thread.sleep(3000);
      receiver.getMessageList().assertMessagesReceived(NUM_MESSAGES);
    }
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.