use of com.gitblit.manager.IUserManager in project gitblit by gitblit.
the class RedisTicketServiceTest method getService.
@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
IStoredSettings settings = getSettings(deleteAll);
XssFilter xssFilter = new AllowXssFilter();
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
IPluginManager pluginManager = new PluginManager(runtimeManager).start();
INotificationManager notificationManager = new NotificationManager(settings).start();
IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
RedisTicketService service = (RedisTicketService) new RedisTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
if (deleteAll) {
service.deleteAll(getRepository());
}
return service;
}
use of com.gitblit.manager.IUserManager in project gitblit by gitblit.
the class UITicketTest method getService.
protected ITicketService getService(boolean deleteAll) throws Exception {
IStoredSettings settings = getSettings(deleteAll);
XssFilter xssFilter = new AllowXssFilter();
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
IPluginManager pluginManager = new PluginManager(runtimeManager).start();
INotificationManager notificationManager = new NotificationManager(settings).start();
IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
BranchTicketService service = (BranchTicketService) new BranchTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
if (deleteAll) {
service.deleteAll(repo);
}
return service;
}
use of com.gitblit.manager.IUserManager in project gitblit by gitblit.
the class BranchTicketServiceTest method getService.
@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
IStoredSettings settings = getSettings(deleteAll);
XssFilter xssFilter = new AllowXssFilter();
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
IPluginManager pluginManager = new PluginManager(runtimeManager).start();
INotificationManager notificationManager = new NotificationManager(settings).start();
IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
BranchTicketService service = (BranchTicketService) new BranchTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
if (deleteAll) {
service.deleteAll(getRepository());
}
return service;
}
use of com.gitblit.manager.IUserManager in project gitblit by gitblit.
the class SshKerberosAuthenticationTest method testUserManager.
@Test
public void testUserManager() {
IRuntimeManager rm = Mockito.mock(IRuntimeManager.class);
// Build an UserManager that can build a UserModel
IUserManager im = Mockito.mock(IUserManager.class);
Mockito.doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
String user = (String) args[0];
return new UserModel(user);
}
}).when(im).getUserModel(Mockito.anyString());
AuthenticationManager am = new AuthenticationManager(rm, im);
GSSAuthenticator gssAuthenticator = new SshKrbAuthenticator(new MemorySettings(), am);
ServerSession session = Mockito.mock(ServerSession.class);
// Build an SshDaemonClient that can set and get the UserModel
final UserModelWrapper umw = new UserModelWrapper();
SshDaemonClient client = Mockito.mock(SshDaemonClient.class);
Mockito.when(client.getUser()).thenReturn(umw.um);
Mockito.doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
UserModel um = (UserModel) args[0];
umw.um = um;
return null;
}
}).when(client).setUser(Mockito.any(UserModel.class));
Mockito.when(session.getAttribute(SshDaemonClient.KEY)).thenReturn(client);
Assert.assertTrue(gssAuthenticator.validateIdentity(session, "jhappy"));
}
use of com.gitblit.manager.IUserManager in project gitblit by gitblit.
the class FileTicketServiceTest method getService.
@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
IStoredSettings settings = getSettings(deleteAll);
XssFilter xssFilter = new AllowXssFilter();
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
IPluginManager pluginManager = new PluginManager(runtimeManager).start();
INotificationManager notificationManager = new NotificationManager(settings).start();
IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
FileTicketService service = (FileTicketService) new FileTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
if (deleteAll) {
service.deleteAll(getRepository());
}
return service;
}
Aggregations