Package org.apache.servicemix.jsr181

Examples of org.apache.servicemix.jsr181.Jsr181SpringTest


    protected List<Provides> getProvides(Endpoint endpoint) {
        // We need to generate the dummy component to register the services
        Jsr181Endpoint jsr181Endpoint = (Jsr181Endpoint) endpoint;
        try {
            Jsr181Component componentDummy = new Jsr181Component();
            componentDummy.setEndpoints(new Jsr181Endpoint[] {jsr181Endpoint });
            componentDummy.getLifeCycle().init(new DummyComponentContext());
        } catch (Exception e) {
            throw new RuntimeException("Unable to register JSR-181 service, " + e.getMessage(), e);
        }
        return super.getProvides(endpoint);
    }
View Full Code Here


    }
   
    public void testProxy() throws Exception {
        container.start();

        Jsr181Component component1 = new Jsr181Component();
        Jsr181Endpoint endpoint1 = new Jsr181Endpoint();
        endpoint1.setPojo(new EchoService());
        component1.setEndpoints(new Jsr181Endpoint[] {endpoint1 });
        container.activateComponent(component1, "JSR181Component-1");
       
        Jsr181Component component2 = new Jsr181Component();
        Jsr181Endpoint endpoint2 = new Jsr181Endpoint();
        endpoint2.setPojo(new ProxyPojoService());
        endpoint2.setServiceInterface(ProxyPojo.class.getName());
        component2.setEndpoints(new Jsr181Endpoint[] {endpoint2 });
        container.activateComponent(component2, "JSR181Component-2");
       
        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        InOut me = client.createInOutExchange();
        me.setInterfaceName(new QName("http://xfire.jsr181.servicemix.apache.org", "ProxyPojoPortType"));
View Full Code Here

  protected List getProvides(Endpoint endpoint) {
    // We need to generate the dummy component to register the services
    Jsr181Endpoint jsr181Endpoint = (Jsr181Endpoint) endpoint;
    try {
      Jsr181Component componentDummy = new Jsr181Component();
      componentDummy.setEndpoints(new Jsr181Endpoint[] { jsr181Endpoint });
      componentDummy.getLifeCycle().init(new DummyComponentContext());
    } catch (Exception e) {
      throw new RuntimeException("Unable to register JSR-181 service, " + e.getMessage(), e);
    }
    return super.getProvides(endpoint);
  }
View Full Code Here

    }
   
    public void testProxy() throws Exception {
        container.start();

        Jsr181Component component1 = new Jsr181Component();
        Jsr181Endpoint endpoint1 = new Jsr181Endpoint();
        endpoint1.setPojo(new EchoService());
        component1.setEndpoints(new Jsr181Endpoint[] { endpoint1 });
        container.activateComponent(component1, "JSR181Component-1");
       
        Jsr181Component component2 = new Jsr181Component();
        Jsr181Endpoint endpoint2 = new Jsr181Endpoint();
        endpoint2.setPojo(new ProxyPojoService());
        endpoint2.setServiceInterface(ProxyPojo.class.getName());
        component2.setEndpoints(new Jsr181Endpoint[] { endpoint2 });
        container.activateComponent(component2, "JSR181Component-2");
       
        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        InOut me = client.createInOutExchange();
        me.setInterfaceName(new QName("http://xfire.jsr181.servicemix.apache.org", "ProxyPojoPortType"));
View Full Code Here

    public void testOrder() throws Exception {
      BasicConfigurator.configure(new ConsoleAppender());
    Logger.getRootLogger().setLevel(Level.DEBUG);
      container.start();
     
        Jsr181Component component = new Jsr181Component();

        // Create an xfire endpoint for our pojo order service
        Jsr181Endpoint orderEndpoint = new Jsr181Endpoint();
        orderEndpoint.setPojo(new OrderServiceImpl());
        orderEndpoint.setServiceInterface(OrderService.class.getCanonicalName());

        component.setEndpoints(new Jsr181Endpoint[] { orderEndpoint });
        container.activateComponent(component, "JSR181Component");

        System.out.println(orderEndpoint.getServiceInterface());
        System.out.println(orderEndpoint.getInterfaceName());
        System.out.println(orderEndpoint.getEndpoint());
View Full Code Here

            container.shutDown();
        }
    }
   
    public void testCommonsAnnotations() throws Exception {
        Jsr181Component component = new Jsr181Component();
        container.activateComponent(component, "JSR181Component");

        // Start container
        container.start();
       
        // Deploy SU
        component.getServiceUnitManager().deploy("su", getServiceUnitPath("good1"));
        component.getServiceUnitManager().init("su", getServiceUnitPath("good1"));
        component.getServiceUnitManager().start("su");
       
        assertNotNull(EchoService.instance);
        assertNotNull(EchoService.instance.getContext());
       
        // Call it
View Full Code Here

        }
    }
   
   
    public void testWithoutAnnotations() throws Exception {
        Jsr181Component component = new Jsr181Component();
        container.activateComponent(component, "JSR181Component");

        // Start container
        container.start();
       
        // Deploy SU
        component.getServiceUnitManager().deploy("good2", getServiceUnitPath("good2"));
        component.getServiceUnitManager().init("good2", getServiceUnitPath("good2"));
        component.getServiceUnitManager().start("good2");
       
        assertNotNull(EchoService.instance);
        assertNotNull(EchoService.instance.getContext());
       
        // Call it
View Full Code Here

            logger.info(new SourceTransformer().toString(me.getOutMessage().getContent()));
        }
    }
   
    public void testDeployUndeploy() throws Exception {
        Jsr181Component component = new Jsr181Component();
        container.activateComponent(component, "JSR181Component");
        component.getServiceUnitManager().deploy("d/u", getServiceUnitPath("good1"));
        component.getServiceUnitManager().shutDown("d/u");
        component.getServiceUnitManager().undeploy("d/u", getServiceUnitPath("good1"));
        component.getServiceUnitManager().deploy("d/u", getServiceUnitPath("good1"));
        component.getServiceUnitManager().start("d/u");
        component.getServiceUnitManager().stop("d/u");
        component.getServiceUnitManager().shutDown("d/u");
    }
View Full Code Here

        component.getServiceUnitManager().stop("d/u");
        component.getServiceUnitManager().shutDown("d/u");
    }
   
    public void testNoPojoNoClass() throws Exception {
        Jsr181Component component = new Jsr181Component();
        container.activateComponent(component, "JSR181Component");
        try {
            component.getServiceUnitManager().deploy("bad1", getServiceUnitPath("bad1"));
            fail("Expected an exception");
        } catch (Exception e) {
            // ok
            logger.info(e.getMessage());
        }
View Full Code Here

            logger.info(e.getMessage());
        }
    }
   
    public void testNoEndpoints() throws Exception {
        Jsr181Component component = new Jsr181Component();
        container.activateComponent(component, "JSR181Component");
        try {
            component.getServiceUnitManager().deploy("bad2", getServiceUnitPath("bad2"));
            fail("Expected an exception");
        } catch (Exception e) {
            // ok
            logger.info(e.getMessage());
        }
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jsr181.Jsr181SpringTest

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.