Package org.osgi.framework

Examples of org.osgi.framework.BundleContext


    protected ReferrerFilter filter;

    @Before public void setup() {
        filter = new ReferrerFilter();
        final ComponentContext ctx = mock(ComponentContext.class);
        final BundleContext bundleCtx = mock(BundleContext.class);
        final ServiceRegistration reg = mock(ServiceRegistration.class);
        final Dictionary<String, Object> props = new Hashtable<String, Object>(){{
            put("allow.hosts", new String[]{"relhost"});
            put("allow.hosts.regexp", new String[]{"http://([^.]*.)?abshost:80"});
        }};
View Full Code Here


public class ChainReplicateReplicationTriggerTest {

    @Test
    public void testRegister() throws Exception {
        String pathPrefix = "/prefix";
        BundleContext bundleContext = mock(BundleContext.class);
        ChainReplicateReplicationTrigger chainReplicateReplicationTrigger = new ChainReplicateReplicationTrigger(pathPrefix, bundleContext);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        chainReplicateReplicationTrigger.register(handler);
    }
View Full Code Here

    }

    @Test
    public void testUnregister() throws Exception {
        String pathPrefix = "/prefix";
        BundleContext bundleContext = mock(BundleContext.class);
        ChainReplicateReplicationTrigger chainReplicateReplicationTrigger = new ChainReplicateReplicationTrigger(pathPrefix, bundleContext);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        chainReplicateReplicationTrigger.unregister(handler);
    }
View Full Code Here

    }

    @Test
    public void testEnable() throws Exception {
        String pathPrefix = "/prefix";
        BundleContext bundleContext = mock(BundleContext.class);
        ChainReplicateReplicationTrigger chainReplicateReplicationTrigger = new ChainReplicateReplicationTrigger(pathPrefix, bundleContext);
        chainReplicateReplicationTrigger.enable();
    }
View Full Code Here

    }

    @Test
    public void testDisable() throws Exception {
        String pathPrefix = "/prefix";
        BundleContext bundleContext = mock(BundleContext.class);
        ChainReplicateReplicationTrigger chainReplicateReplicationTrigger = new ChainReplicateReplicationTrigger(pathPrefix, bundleContext);
        chainReplicateReplicationTrigger.disable();
    }
View Full Code Here

public class ResourceEventReplicationTriggerTest {

    @Test
    public void testRegister() throws Exception {
        String path = "/some/path";
        BundleContext bundleContext = mock(BundleContext.class);
        ServiceRegistration registration = mock(ServiceRegistration.class);
        when(bundleContext.registerService(any(String.class), any(Object.class), any(Dictionary.class))).thenReturn(registration);
        ResourceEventReplicationTrigger resourceEventReplicationTrigger = new ResourceEventReplicationTrigger(path, bundleContext);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        resourceEventReplicationTrigger.register(handler);
    }
View Full Code Here

    }

    @Test
    public void testUnregister() throws Exception {
        String path = "/some/path";
        BundleContext bundleContext = mock(BundleContext.class);
        ResourceEventReplicationTrigger resourceEventReplicationTrigger = new ResourceEventReplicationTrigger(path, bundleContext);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        resourceEventReplicationTrigger.unregister(handler);
    }
View Full Code Here

    }

    @Test
    public void testEnable() throws Exception {
        String path = "/some/path";
        BundleContext bundleContext = mock(BundleContext.class);
        ResourceEventReplicationTrigger resourceEventReplicationTrigger = new ResourceEventReplicationTrigger(path, bundleContext);
        resourceEventReplicationTrigger.enable();
    }
View Full Code Here

    }

    @Test
    public void testDisable() throws Exception {
        String path = "/some/path";
        BundleContext bundleContext = mock(BundleContext.class);
        ResourceEventReplicationTrigger resourceEventReplicationTrigger = new ResourceEventReplicationTrigger(path, bundleContext);
        resourceEventReplicationTrigger.disable();
    }
View Full Code Here

  /**
   * Returns the root file system location for the workspace.
   */
  public IPath getPlatformLocation() {
    BundleContext context = Activator.getDefault().getContext();
    Collection<ServiceReference<Location>> refs;
    try {
      refs = context.getServiceReferences(Location.class,
          Location.INSTANCE_FILTER);
    } catch (InvalidSyntaxException e) {
      // we know the instance location filter syntax is valid
      throw new RuntimeException(e);
    }
    if (refs.isEmpty())
      return null;
    ServiceReference<Location> ref = refs.iterator().next();
    Location location = context.getService(ref);
    try {
      if (location == null)
        return null;
      URL root = location.getURL();
      if (root == null)
        return null;
      // strip off file: prefix from URL
      return new Path(root.toExternalForm().substring(5));
    } finally {
      context.ungetService(ref);
    }
  }
View Full Code Here

TOP

Related Classes of org.osgi.framework.BundleContext

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.