Package org.jboss.as.test.integration.osgi.xservice.api

Examples of org.jboss.as.test.integration.osgi.xservice.api.Echo


    static final Logger log = Logger.getLogger(TargetBundleActivator.class);

    @Override
    public void start(final BundleContext context) throws Exception {
        context.registerService(Echo.class.getName(), new Echo() {
            public String echo(String message) {
                log.infof("Echo: %s", message);
                return message;
            }
        }, null);
View Full Code Here


   @Override
   public void start(final BundleContext context) throws Exception
   {
      log.infof("Echo Loader: %s", Echo.class.getClassLoader());
      ServiceReference sref = context.getServiceReference(Echo.class.getName());
      Echo service = (Echo)context.getService(sref);
      String result = service.echo("hello world");
      context.registerService(StringBuffer.class.getName(), new StringBuffer(result), null);
   }
View Full Code Here

            try {
                Bundle bundle = getTargetBundle();
                bundle.start();
                BundleContext context = bundle.getBundleContext();
                ServiceReference sref = context.getServiceReference(Echo.class.getName());
                Echo service = (Echo) context.getService(sref);
                return service.echo(message);
            } catch (BundleException ex) {
                throw new IllegalStateException("Cannot invoke target service", ex);
            }
        }
    }
View Full Code Here

    @Test
    public void testTargetBundle() throws Exception {
        bundle.start();
        BundleContext context = bundle.getBundleContext();
        ServiceReference sref = context.getServiceReference(Echo.class.getName());
        Echo service = (Echo) context.getService(sref);
        assertEquals("foo", service.echo("foo"));
    }
View Full Code Here

    @Test
    public void testStatelessBean() throws Exception {
        deployer.deploy(EJB3_DEPLOYMENT_NAME);
        try {
            String jndiname = "java:global/ejb3-osgi/SimpleStatelessSessionBean!org.jboss.as.test.integration.osgi.ejb3.SimpleStatelessSessionBean";
            Echo service = (Echo) new InitialContext().lookup(jndiname);
            assertNotNull("StatelessBean not null", service);
            assertEquals("ejb3-osgi-target", service.echo(BUNDLE_SYMBOLICNAME));
            assertEquals("foo", service.echo("foo"));
        } finally {
            deployer.undeploy(EJB3_DEPLOYMENT_NAME);
        }
    }
View Full Code Here

      @Override
      public void start(StartContext context) throws StartException
      {
         BundleContext systemContext = injectedBundleContext.getValue();
         ServiceReference sref = systemContext.getServiceReference(Echo.class.getName());
         Echo service = (Echo)systemContext.getService(sref);
         service.echo("hello world");
      }
View Full Code Here

      }

      @Override
      public void start(StartContext context) throws StartException
      {
         Echo service = injectedService.getValue();
         service.echo("hello world");
      }
View Full Code Here

TOP

Related Classes of org.jboss.as.test.integration.osgi.xservice.api.Echo

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.