/**
   * Tests if the serviceReolver is actually present(registered as the osgi service) in the
   * Swordfish Runtime Platform
   */
  public void test1ResolverInitialization() throws Exception {
    Collection<ServiceResolverRegistry> registries =
        OsgiSupport.getReferences(bundleContext, ServiceResolverRegistry.class);
    assertEquals("Thre must be only one ServiceResolver registry", registries.size(), 1);

    ServiceResolverRegistry registry = registries.iterator().next();
    assertTrue("No ServiceResolver instances are registered", registry.getKeys().size() > 0);
  }
  @Override
  protected void tearDown() throws Exception {
    NMR nmr = OsgiSupport.getReference(bundleContext, NMR.class);
    assertNotNull(nmr);

    ServiceMixSupport.unregisterEndpoints(nmr, endpointService1, endpointService2);

    ServiceResolverRegistry registry =
        OsgiSupport.getReference(bundleContext, ServiceResolverRegistry.class);
    registry.unregister(resolverMock, resolverProps);
    assertFalse(registry.getKeys().get(0).equals(resolverMock));

    super.tearDown();
  }
  public void test7ServiceResolverNoPolicyMatching() throws Exception {
    ServiceResolverRegistry registry =
        OsgiSupport.getReference(bundleContext, ServiceResolverRegistry.class);
    ServiceResolver resolver = registry.getKeys().get(0);
    assertNotNull("Couldn't find the ServiceResolver service", resolver);

    Collection<EndpointDescription> c =
        resolver.getEndpointsFor(
            new QName("http://service.dynamic.samples.swordfish.eclipse.org/", "FlightService"));
    assertNotNull("No endpoints resolved. ", c);
    assertEquals(c.size(), 1);
    assertEquals(
        c.iterator().next().getServiceName(),
        new QName("http://service.dynamic.samples.swordfish.eclipse.org/", "FlightServiceImpl"));
  }