Package org.apache.servicemix.nmr.core

Examples of org.apache.servicemix.nmr.core.ServiceMix


import junit.framework.TestCase;

public class IntegrationTest extends TestCase {

    public void testJbiComponent() throws Exception {
        ServiceMix smx = new ServiceMix();
        smx.init();
        ComponentRegistryImpl reg = new ComponentRegistryImpl();
        reg.setNmr(smx);

        Endpoint tep = new Endpoint() {
            private Channel channel;
            public void setChannel(Channel channel) {
                this.channel = channel;
            }
            public void process(Exchange exchange) {
                if (exchange.getStatus() == Status.Active) {
                    exchange.setStatus(Status.Done);
                    channel.send(exchange);
                }
            }
        };
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(Endpoint.SERVICE_NAME, new QName("target").toString());
        smx.getEndpointRegistry().register(tep, props);

        EIPComponent eip = new EIPComponent();
        WireTap ep = new WireTap();
        ep.setService(new QName("uri:foo", "bar"));
        ep.setEndpoint("ep");
        ep.setTarget(new ExchangeTarget());
        ep.getTarget().setService(new QName("target"));
        eip.setEndpoints(new EIPEndpoint[] { ep });
        eip.init(new ComponentContextImpl(reg, new SimpleComponentWrapper(eip),
                                          new HashMap<String, Object>()));
        eip.getLifeCycle().start();

        Channel channel = smx.createChannel();
        Exchange e = channel.createExchange(Pattern.InOnly);
        e.getIn().setBody("<hello/>");
        e.setTarget(smx.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, "{uri:foo}bar:ep")));
        channel.sendSync(e);
        if (e.getError() != null) {
            throw e.getError();
        }
        assertEquals(Status.Done, e.getStatus());
View Full Code Here


    protected NMR nmr;

    @Override
    protected void setUp() throws Exception {
        ServiceMix smx = new ServiceMix();
        smx.init();
        nmr = smx;
    }
View Full Code Here

        BusFactory.setDefaultBus(bus);
      CamelTransportFactory camelTransportFactory = (CamelTransportFactory) bus.getExtension(ConduitInitiatorManager.class)
          .getConduitInitiator(CamelTransportFactory.TRANSPORT_ID);
      camelTransportFactory.setCamelContext(camelContext);
      smxComponent = new ServiceMixComponent();
      nmr = new ServiceMix();
      ((ServiceMix)nmr).init();
      smxComponent.setNmr(nmr);
      camelContext.addComponent("smx", smxComponent);
        return camelContext;
    }
View Full Code Here

        BusFactory.setDefaultBus(bus);
      CamelTransportFactory camelTransportFactory = (CamelTransportFactory) bus.getExtension(ConduitInitiatorManager.class)
          .getConduitInitiator(CamelTransportFactory.TRANSPORT_ID);
      camelTransportFactory.setCamelContext(camelContext);
      smxComponent = new ServiceMixComponent();
      nmr = new ServiceMix();
      ((ServiceMix)nmr).init();
      smxComponent.setNmr(nmr);
      camelContext.addComponent("smx", smxComponent);
        return camelContext;
    }
View Full Code Here

      Bus bus = new SpringBusFactory().createBus();
      CamelTransportFactory camelTransportFactory = (CamelTransportFactory) bus.getExtension(ConduitInitiatorManager.class)
          .getConduitInitiator(CamelTransportFactory.TRANSPORT_ID);
      camelTransportFactory.setCamelContext(camelContext);
      smxComponent = new ServiceMixComponent();
      nmr = new ServiceMix();
      ((ServiceMix)nmr).init();
      smxComponent.setNmr(nmr);
      camelContext.addComponent("smx", smxComponent);
        return camelContext;
    }
View Full Code Here

        BusFactory.setDefaultBus(bus);
      CamelTransportFactory camelTransportFactory = (CamelTransportFactory) bus.getExtension(ConduitInitiatorManager.class)
          .getConduitInitiator(CamelTransportFactory.TRANSPORT_ID);
      camelTransportFactory.setCamelContext(camelContext);
      smxComponent = new ServiceMixComponent();
      nmr = new ServiceMix();
      ((ServiceMix)nmr).init();
      smxComponent.setNmr(nmr);
      camelContext.addComponent("smx", smxComponent);
        return camelContext;
    }
View Full Code Here

      Bus bus = BusFactory.getDefaultBus();
      CamelTransportFactory camelTransportFactory = (CamelTransportFactory) bus.getExtension(ConduitInitiatorManager.class)
          .getConduitInitiator(CamelTransportFactory.TRANSPORT_ID);
      camelTransportFactory.setCamelContext(camelContext);
      smxComponent = new ServiceMixComponent();
      nmr = new ServiceMix();
      ((ServiceMix)nmr).init();
      smxComponent.setNmr(nmr);
      camelContext.addComponent("smx", smxComponent);
        return camelContext;
    }
View Full Code Here

        Bus bus = BusFactory.getDefaultBus();
        CamelTransportFactory camelTransportFactory = (CamelTransportFactory) bus.getExtension(ConduitInitiatorManager.class)
            .getConduitInitiator(CamelTransportFactory.TRANSPORT_ID);
        camelTransportFactory.setCamelContext(camelContext);
        smxComponent = new ServiceMixComponent();
        nmr = new ServiceMix();
        ((ServiceMix)nmr).init();
        smxComponent.setNmr(nmr);
        camelContext.addComponent("smx", smxComponent);
        return camelContext;
    }
View Full Code Here

    }
   
    protected CamelContext createCamelContext() throws Exception {
        camelContext = SpringCamelContext.springCamelContext(applicationContext);
        smxComponent = new ServiceMixComponent();
        nmr = new ServiceMix();
        ((ServiceMix)nmr).init();
        smxComponent.setNmr(nmr);
        camelContext.addComponent("smx", smxComponent);
        return camelContext;
    }
View Full Code Here

    private ServiceMixComponent component;
    private Channel channel;

    @Override
    protected void setUp() throws Exception {
        nmr = new ServiceMix();
        nmr.setExecutorFactory(createExecutorFactory());
        nmr.init();
       
        nmr.getListenerRegistry().register(this, ServiceHelper.createMap());
View Full Code Here

TOP

Related Classes of org.apache.servicemix.nmr.core.ServiceMix

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.