Search in sources :

Example 1 with Hello

use of org.apache.aries.subsystem.itests.hello.api.Hello in project aries by apache.

the class Activator method start.

@Override
public void start(BundleContext bc) throws Exception {
    Hello helloService = new HelloImpl();
    _sr = bc.registerService(Hello.class, helloService, null);
}
Also used : Hello(org.apache.aries.subsystem.itests.hello.api.Hello)

Example 2 with Hello

use of org.apache.aries.subsystem.itests.hello.api.Hello in project aries by apache.

the class Activator method start.

@Override
public void start(BundleContext bc) throws Exception {
    System.out.println("into " + this.getClass().getCanonicalName() + ".start()");
    Hello helloService = new DynamicImportHelloImpl();
    _sr = bc.registerService(Hello.class, helloService, null);
    System.out.println("exiting " + this.getClass().getCanonicalName() + ".start()");
}
Also used : Hello(org.apache.aries.subsystem.itests.hello.api.Hello)

Example 3 with Hello

use of org.apache.aries.subsystem.itests.hello.api.Hello in project aries by apache.

the class BlueprintTest method checkBlueprint.

@Test
public void checkBlueprint() throws Exception {
    Subsystem subsystem = installSubsystemFromFile(BLUEPRINT_ESA);
    try {
        startSubsystem(subsystem);
        BundleContext bc = subsystem.getBundleContext();
        Hello h = new RichBundleContext(bc).getService(Hello.class);
        String message = h.saySomething();
        assertEquals("Wrong message back", "messageFromBlueprint", message);
    } finally {
        stopSubsystem(subsystem);
        uninstallSubsystem(subsystem);
    }
}
Also used : RichBundleContext(org.apache.aries.itest.RichBundleContext) Hello(org.apache.aries.subsystem.itests.hello.api.Hello) Subsystem(org.osgi.service.subsystem.Subsystem) RichBundleContext(org.apache.aries.itest.RichBundleContext) BundleContext(org.osgi.framework.BundleContext) Test(org.junit.Test)

Example 4 with Hello

use of org.apache.aries.subsystem.itests.hello.api.Hello in project aries by apache.

the class HelloWorldTest method checkHelloSubsystem.

void checkHelloSubsystem(Subsystem helloSubsystem) throws Exception {
    helloSubsystem.start();
    BundleContext bc = helloSubsystem.getBundleContext();
    Hello h = new RichBundleContext(bc).getService(Hello.class);
    String message = h.saySomething();
    assertEquals("Wrong message back", "something", message);
    helloSubsystem.stop();
}
Also used : RichBundleContext(org.apache.aries.itest.RichBundleContext) Hello(org.apache.aries.subsystem.itests.hello.api.Hello) RichBundleContext(org.apache.aries.itest.RichBundleContext) BundleContext(org.osgi.framework.BundleContext)

Example 5 with Hello

use of org.apache.aries.subsystem.itests.hello.api.Hello in project aries by apache.

the class DynamicImportTest method testFirstPassWeavingApproach.

@SuppressWarnings("rawtypes")
@Test
public void testFirstPassWeavingApproach() throws Exception {
    ServiceRegistration<?> sr = bundleContext.registerService(WeavingHook.class, new TokenWeaver(), null);
    try {
        Subsystem subsystem = installSubsystemFromFile("dynamicImport.esa");
        startSubsystem(subsystem);
        BundleContext bc = subsystem.getBundleContext();
        Hello h = new RichBundleContext(bc).getService(Hello.class);
        String message = h.saySomething();
        // DynamicImportHelloImpl.java
        assertEquals("Wrong message back", "Hello, this is something", message);
        stopSubsystem(subsystem);
        uninstallSubsystem(subsystem);
    } finally {
        sr.unregister();
    }
}
Also used : RichBundleContext(org.apache.aries.itest.RichBundleContext) Hello(org.apache.aries.subsystem.itests.hello.api.Hello) Subsystem(org.osgi.service.subsystem.Subsystem) RichBundleContext(org.apache.aries.itest.RichBundleContext) BundleContext(org.osgi.framework.BundleContext) Test(org.junit.Test)

Aggregations

Hello (org.apache.aries.subsystem.itests.hello.api.Hello)5 RichBundleContext (org.apache.aries.itest.RichBundleContext)3 BundleContext (org.osgi.framework.BundleContext)3 Test (org.junit.Test)2 Subsystem (org.osgi.service.subsystem.Subsystem)2