defaultWiringService.setBundleContext(bundleContext);
context.putBean("wiringService", defaultWiringService);
serviceUtils = new DefaultOsgiUtilsService(bundleContext);
context.putBean("osgiUtilsService", serviceUtils);
ConnectorRegistrationManager registrationManager = new ConnectorRegistrationManager(bundleContext,
mock(TransformationEngine.class), new ForwardMethodInterceptor(), new SecurityAttributeProviderImpl());
XLinkConnectorManagerImpl serviceManager = new XLinkConnectorManagerImpl();
serviceManager.setRegistrationManager(registrationManager);
DummyConfigPersistenceService<String> backend = new DummyConfigPersistenceService<String>();
DefaultConfigPersistenceService persistenceService = new DefaultConfigPersistenceService(backend);
serviceManager.setConfigPersistence(persistenceService);
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("configuration.id", Constants.CONFIG_CONNECTOR);
registerService(persistenceService, props, ConfigPersistenceService.class);
this.registrationManager = registrationManager;
this.serviceManager = serviceManager;
context.putBean("serviceManager", serviceManager);
userManager = new UserManagerStub();
userManager.createUser("test");
userManager.setUserCredentials("test", "password", "password");
userManager.addPermissionToUser("test", new WicketPermission("USER"));
userManager.addPermissionToUser("test", new WicketPermission("INDEX"));
userManager.createUser("user");
userManager.setUserCredentials("user", "password", "password");
userManager.addPermissionToUser("user", new WicketPermission("INDEX"));
userManager.createUser("admin");
userManager.setUserCredentials("admin", "password", "password");
userManager.addPermissionToUser("admin", new RootPermission());
context.putBean("userManager", userManager);
Dictionary<String, Object> wicketProviderProps = new Hashtable<String, Object>();
wicketProviderProps.put(org.openengsb.labs.delegation.service.Constants.PROVIDED_CLASSES_KEY,
WicketPermission.class.getName());
wicketProviderProps.put(org.openengsb.labs.delegation.service.Constants.DELEGATION_CONTEXT_KEY,
Constants.DELEGATION_CONTEXT_PERMISSIONS);
ClassProvider wicketPermissionProvider =
new ClassProviderImpl(bundle, Sets.newHashSet(WicketPermission.class.getName()));
registerService(wicketPermissionProvider, wicketProviderProps, ClassProvider.class);
SecurityAttributeProvider attributeStore = new SecurityAttributeProviderImpl();
context.putBean("attributeStore", attributeStore);
context.putBean("attributeProviders", Collections.singletonList(attributeStore));
context.putBean("domainProviders", makeServiceList(DomainProvider.class));
context.putBean("permissionProviders", makeServiceList(ClassProvider.class));