private RepositoryAdminImpl createRepositoryAdmin(Class repositoryParser) throws Exception
{
BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
Bundle systemBundle = EasyMock.createMock(Bundle.class);
BundleRevision systemBundleRevision = EasyMock.createMock(BundleRevision.class);
Activator.setContext(bundleContext);
EasyMock.expect(bundleContext.getProperty(RepositoryAdminImpl.REPOSITORY_URL_PROP))
.andReturn(getClass().getResource("/referral1_repository.xml").toExternalForm());
EasyMock.expect(bundleContext.getProperty(RepositoryParser.OBR_PARSER_CLASS))
.andReturn(repositoryParser.getName());
EasyMock.expect(bundleContext.getProperty((String) EasyMock.anyObject())).andReturn(null).anyTimes();
EasyMock.expect(bundleContext.getBundle(0)).andReturn(systemBundle);
EasyMock.expect(systemBundle.getHeaders()).andReturn(new Hashtable());
EasyMock.expect(systemBundle.getRegisteredServices()).andReturn(null);
EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes();
EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext);
EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.<Capability>emptyList());
EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
final Capture c = new Capture();