@Test
public void jndiLookupServiceNameTest() throws NamingException, SQLException
{

  InitialContext ctx = new InitialContext(new Hashtable<Object, Object>());
  
  BundleMock mock = new BundleMock("scooby.doo", new Properties());
  
  Thread.currentThread().setContextClassLoader(mock.getClassLoader());
  
  DataSource first = Skeleton.newMock(DataSource.class);
  DataSource second = Skeleton.newMock(DataSource.class);
  
  Hashtable<String, String> properties = new Hashtable<String, String>();
  properties.put("osgi.jndi.service.name", "jdbc/myDataSource");
  
  bc.registerService(DataSource.class.getName(), first, properties);
  properties = new Hashtable<String, String>();
  properties.put("osgi.jndi.service.name", "jdbc/myDataSource2");
  
  bc.registerService(DataSource.class.getName(), second, properties);
  
  DataSource s = (DataSource) ctx.lookup("osgi:service/jdbc/myDataSource");
  
  assertNotNull(s);
  
  s = (DataSource) ctx.lookup("osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/myDataSource2)");
  
  assertNotNull(s);
  
  s.isWrapperFor(DataSource.class); // don't care about the method, just need to call something.
  
  Skeleton.getSkeleton(second).assertCalled(new MethodCall(DataSource.class, "isWrapperFor", Class.class));
}