- new String[] { HELLO_SERVICE_SPRING_WITH_REQS_XML },
- provided, required);
-
- HelloService helloObject = new HelloService("ladida");
- ProvidedInterface helloService =
- new DefaultProvidedInterface("hello", HelloService.class);
- helloService.publish(helloObject);
- system.getRequiredServices()[0].setProvider(helloService);
- system.start("Bla");
- ProvidedInterface started = system.getProvidedServices()[0];
-
- assertNotNull(started.getImplementation());
- assertTrue(started.getImplementation() instanceof BlaService);
- assertEquals("ladida",
- ((BlaService)started.getImplementation()).execute());
- system.stop();
+ new String[] { HELLO_SERVICE_SPRING_WITH_REQS_XML }, provided,
+ required);
+
+ HelloService helloObject = new HelloService("ladida");
+ ProvidedInterface helloService = new DefaultProvidedInterface("hello",
+ HelloService.class);
+ Scope scope = new DefaultScope(new ProvidedInterface[] { helloService });
+ scope.publishInterface(helloService, helloObject);
+ system.getRequiredInterfaces()[0].setProvider(helloService);
+ Scope runtime = system.start(scope);
+ ProvidedInterface started = runtime.getProvidedInterfaces()[0];
+
+ Object impl = runtime.getInterfaceImplementation(started, BlaService.class);
+ assertNotNull(impl);
+ assertTrue(impl instanceof BlaService);
+ assertEquals("ladida", ((BlaService)impl).execute());
+ system.stop(runtime);