summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/gitblit/DaggerModule.java9
-rw-r--r--src/main/java/com/gitblit/FederationClient.java4
-rw-r--r--src/main/java/com/gitblit/MigrateTickets.java2
-rw-r--r--src/main/java/com/gitblit/ReindexTickets.java2
-rw-r--r--src/main/java/com/gitblit/extensions/RepositoryLifeCycleListener.java45
-rw-r--r--src/main/java/com/gitblit/extensions/UserTeamLifeCycleListener.java62
-rw-r--r--src/main/java/com/gitblit/manager/RepositoryManager.java25
-rw-r--r--src/main/java/com/gitblit/manager/UserManager.java124
-rw-r--r--src/main/java/com/gitblit/servlet/GitblitContext.java10
-rw-r--r--src/site/plugins_extensions.mkd75
-rw-r--r--src/test/config/test-users.conf6
-rw-r--r--src/test/java/com/gitblit/tests/AuthenticationManagerTest.java2
-rw-r--r--src/test/java/com/gitblit/tests/BranchTicketServiceTest.java4
-rw-r--r--src/test/java/com/gitblit/tests/FileTicketServiceTest.java4
-rw-r--r--src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java8
-rw-r--r--src/test/java/com/gitblit/tests/LdapAuthenticationTest.java10
-rw-r--r--src/test/java/com/gitblit/tests/LuceneExecutorTest.java4
-rw-r--r--src/test/java/com/gitblit/tests/RedisTicketServiceTest.java4
-rw-r--r--src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java6
19 files changed, 362 insertions, 44 deletions
diff --git a/src/main/java/com/gitblit/DaggerModule.java b/src/main/java/com/gitblit/DaggerModule.java
index b89f8c44..6ad3fe63 100644
--- a/src/main/java/com/gitblit/DaggerModule.java
+++ b/src/main/java/com/gitblit/DaggerModule.java
@@ -91,8 +91,11 @@ public class DaggerModule {
return new NotificationManager(settings);
}
- @Provides @Singleton IUserManager provideUserManager(IRuntimeManager runtimeManager) {
- return new UserManager(runtimeManager);
+ @Provides @Singleton IUserManager provideUserManager(
+ IRuntimeManager runtimeManager,
+ IPluginManager pluginManager) {
+
+ return new UserManager(runtimeManager, pluginManager);
}
@Provides @Singleton IAuthenticationManager provideAuthenticationManager(
@@ -131,10 +134,12 @@ public class DaggerModule {
@Provides @Singleton IRepositoryManager provideRepositoryManager(
IRuntimeManager runtimeManager,
+ IPluginManager pluginManager,
IUserManager userManager) {
return new RepositoryManager(
runtimeManager,
+ pluginManager,
userManager);
}
diff --git a/src/main/java/com/gitblit/FederationClient.java b/src/main/java/com/gitblit/FederationClient.java
index cd06c3cb..29cdefe6 100644
--- a/src/main/java/com/gitblit/FederationClient.java
+++ b/src/main/java/com/gitblit/FederationClient.java
@@ -94,8 +94,8 @@ public class FederationClient {
// configure the Gitblit singleton for minimal, non-server operation
RuntimeManager runtime = new RuntimeManager(settings, baseFolder).start();
NoopNotificationManager notifications = new NoopNotificationManager().start();
- UserManager users = new UserManager(runtime).start();
- RepositoryManager repositories = new RepositoryManager(runtime, users).start();
+ UserManager users = new UserManager(runtime, null).start();
+ RepositoryManager repositories = new RepositoryManager(runtime, null, users).start();
FederationManager federation = new FederationManager(runtime, notifications, repositories).start();
IGitblit gitblit = new GitblitManager(runtime, null, notifications, users, null, null, repositories, null, federation);
diff --git a/src/main/java/com/gitblit/MigrateTickets.java b/src/main/java/com/gitblit/MigrateTickets.java
index b6d72376..ad1c63ea 100644
--- a/src/main/java/com/gitblit/MigrateTickets.java
+++ b/src/main/java/com/gitblit/MigrateTickets.java
@@ -135,7 +135,7 @@ public class MigrateTickets {
settings.overrideSetting(ITicketService.SETTING_UPDATE_DIFFSTATS, false);
IRuntimeManager runtimeManager = new RuntimeManager(settings, baseFolder).start();
- IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null).start();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null).start();
String inputServiceName = settings.getString(Keys.tickets.service, BranchTicketService.class.getSimpleName());
if (StringUtils.isEmpty(inputServiceName)) {
diff --git a/src/main/java/com/gitblit/ReindexTickets.java b/src/main/java/com/gitblit/ReindexTickets.java
index 51ca1657..5a614481 100644
--- a/src/main/java/com/gitblit/ReindexTickets.java
+++ b/src/main/java/com/gitblit/ReindexTickets.java
@@ -127,7 +127,7 @@ public class ReindexTickets {
settings.overrideSetting(Keys.web.activityCacheDays, 0);
IRuntimeManager runtimeManager = new RuntimeManager(settings, baseFolder).start();
- IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null).start();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, null, null).start();
String serviceName = settings.getString(Keys.tickets.service, BranchTicketService.class.getSimpleName());
if (StringUtils.isEmpty(serviceName)) {
diff --git a/src/main/java/com/gitblit/extensions/RepositoryLifeCycleListener.java b/src/main/java/com/gitblit/extensions/RepositoryLifeCycleListener.java
new file mode 100644
index 00000000..5ef03af7
--- /dev/null
+++ b/src/main/java/com/gitblit/extensions/RepositoryLifeCycleListener.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2014 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.extensions;
+
+import ro.fortsoft.pf4j.ExtensionPoint;
+
+import com.gitblit.models.RepositoryModel;
+
+/**
+ * Extension point to allow plugins to listen to major repository lifecycle events.
+ *
+ * @author James Moger
+ * @since 1.6.0
+ */
+public abstract class RepositoryLifeCycleListener implements ExtensionPoint {
+
+ /**
+ * Called after a repository has been created.
+ *
+ * @param repository
+ * @since 1.6.0
+ */
+ public abstract void onCreation(RepositoryModel repository);
+
+ /**
+ * Called after a repository has been deleted.
+ *
+ * @param repository
+ * @since 1.6.0
+ */
+ public abstract void onDeletion(RepositoryModel repository);
+}
diff --git a/src/main/java/com/gitblit/extensions/UserTeamLifeCycleListener.java b/src/main/java/com/gitblit/extensions/UserTeamLifeCycleListener.java
new file mode 100644
index 00000000..6f4cd9ba
--- /dev/null
+++ b/src/main/java/com/gitblit/extensions/UserTeamLifeCycleListener.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2014 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.extensions;
+
+import ro.fortsoft.pf4j.ExtensionPoint;
+
+import com.gitblit.models.TeamModel;
+import com.gitblit.models.UserModel;
+
+/**
+ * Extension point to allow plugins to listen to major user and team lifecycle events.
+ *
+ * @author James Moger
+ * @since 1.6.0
+ */
+public abstract class UserTeamLifeCycleListener implements ExtensionPoint {
+
+ /**
+ * Called after a user has been created.
+ *
+ * @param user
+ * @since 1.6.0
+ */
+ public abstract void onCreation(UserModel user);
+
+ /**
+ * Called after a user has been deleted.
+ *
+ * @param user
+ * @since 1.6.0
+ */
+ public abstract void onDeletion(UserModel user);
+
+ /**
+ * Called after a team has been created.
+ *
+ * @param team
+ * @since 1.6.0
+ */
+ public abstract void onCreation(TeamModel team);
+
+ /**
+ * Called after a team has been deleted.
+ *
+ * @param team
+ * @since 1.6.0
+ */
+ public abstract void onDeletion(TeamModel team);
+}
diff --git a/src/main/java/com/gitblit/manager/RepositoryManager.java b/src/main/java/com/gitblit/manager/RepositoryManager.java
index 31d6b341..e0721c7c 100644
--- a/src/main/java/com/gitblit/manager/RepositoryManager.java
+++ b/src/main/java/com/gitblit/manager/RepositoryManager.java
@@ -66,6 +66,7 @@ import com.gitblit.Constants.RegistrantType;
import com.gitblit.GitBlitException;
import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
+import com.gitblit.extensions.RepositoryLifeCycleListener;
import com.gitblit.models.ForkModel;
import com.gitblit.models.Metric;
import com.gitblit.models.RefModel;
@@ -114,6 +115,8 @@ public class RepositoryManager implements IRepositoryManager {
private final IRuntimeManager runtimeManager;
+ private final IPluginManager pluginManager;
+
private final IUserManager userManager;
private final File repositoriesFolder;
@@ -126,10 +129,12 @@ public class RepositoryManager implements IRepositoryManager {
public RepositoryManager(
IRuntimeManager runtimeManager,
+ IPluginManager pluginManager,
IUserManager userManager) {
this.settings = runtimeManager.getSettings();
this.runtimeManager = runtimeManager;
+ this.pluginManager = pluginManager;
this.userManager = userManager;
this.repositoriesFolder = runtimeManager.getFileOrFolder(Keys.git.repositoriesFolder, "${baseFolder}/git");
}
@@ -1420,6 +1425,16 @@ public class RepositoryManager implements IRepositoryManager {
removeFromCachedRepositoryList(repositoryName);
// model will actually be replaced on next load because config is stale
addToCachedRepositoryList(repository);
+
+ if (isCreate && pluginManager != null) {
+ for (RepositoryLifeCycleListener listener : pluginManager.getExtensions(RepositoryLifeCycleListener.class)) {
+ try {
+ listener.onCreation(repository);
+ } catch (Throwable t) {
+ logger.error(String.format("failed to call plugin onCreation %s", repositoryName), t);
+ }
+ }
+ }
}
/**
@@ -1588,6 +1603,16 @@ public class RepositoryManager implements IRepositoryManager {
FileUtils.delete(folder, FileUtils.RECURSIVE | FileUtils.RETRY);
if (userManager.deleteRepositoryRole(repositoryName)) {
logger.info(MessageFormat.format("Repository \"{0}\" deleted", repositoryName));
+
+ if (pluginManager != null) {
+ for (RepositoryLifeCycleListener listener : pluginManager.getExtensions(RepositoryLifeCycleListener.class)) {
+ try {
+ listener.onDeletion(repository);
+ } catch (Throwable t) {
+ logger.error(String.format("failed to call plugin onDeletion %s", repositoryName), t);
+ }
+ }
+ }
return true;
}
}
diff --git a/src/main/java/com/gitblit/manager/UserManager.java b/src/main/java/com/gitblit/manager/UserManager.java
index 67b1d68f..2b82ffb6 100644
--- a/src/main/java/com/gitblit/manager/UserManager.java
+++ b/src/main/java/com/gitblit/manager/UserManager.java
@@ -32,6 +32,7 @@ import com.gitblit.Constants;
import com.gitblit.IStoredSettings;
import com.gitblit.IUserService;
import com.gitblit.Keys;
+import com.gitblit.extensions.UserTeamLifeCycleListener;
import com.gitblit.models.TeamModel;
import com.gitblit.models.UserModel;
import com.gitblit.utils.StringUtils;
@@ -50,13 +51,16 @@ public class UserManager implements IUserManager {
private final IRuntimeManager runtimeManager;
+ private final IPluginManager pluginManager;
+
private final Map<String, String> legacyBackingServices;
private IUserService userService;
- public UserManager(IRuntimeManager runtimeManager) {
+ public UserManager(IRuntimeManager runtimeManager, IPluginManager pluginManager) {
this.settings = runtimeManager.getSettings();
this.runtimeManager = runtimeManager;
+ this.pluginManager = pluginManager;
// map of legacy realm backing user services
legacyBackingServices = new HashMap<String, String>();
@@ -209,7 +213,14 @@ public class UserManager implements IUserManager {
*/
@Override
public boolean updateUserModel(UserModel model) {
- return userService.updateUserModel(model);
+ final boolean isCreate = null == userService.getUserModel(model.username);
+ if (userService.updateUserModel(model)) {
+ if (isCreate) {
+ callCreateUserListeners(model);
+ }
+ return true;
+ }
+ return false;
}
/**
@@ -236,7 +247,14 @@ public class UserManager implements IUserManager {
*/
@Override
public boolean updateUserModel(String username, UserModel model) {
- return userService.updateUserModel(username, model);
+ final boolean isCreate = null == userService.getUserModel(username);
+ if (userService.updateUserModel(username, model)) {
+ if (isCreate) {
+ callCreateUserListeners(model);
+ }
+ return true;
+ }
+ return false;
}
/**
@@ -247,7 +265,11 @@ public class UserManager implements IUserManager {
*/
@Override
public boolean deleteUserModel(UserModel model) {
- return userService.deleteUserModel(model);
+ if (userService.deleteUserModel(model)) {
+ callDeleteUserListeners(model);
+ return true;
+ }
+ return false;
}
/**
@@ -262,7 +284,12 @@ public class UserManager implements IUserManager {
return false;
}
String usernameDecoded = StringUtils.decodeUsername(username);
- return userService.deleteUser(usernameDecoded);
+ UserModel user = getUserModel(usernameDecoded);
+ if (userService.deleteUser(usernameDecoded)) {
+ callDeleteUserListeners(user);
+ return true;
+ }
+ return false;
}
/**
@@ -349,7 +376,14 @@ public class UserManager implements IUserManager {
*/
@Override
public boolean updateTeamModel(TeamModel model) {
- return userService.updateTeamModel(model);
+ final boolean isCreate = null == userService.getTeamModel(model.name);
+ if (userService.updateTeamModel(model)) {
+ if (isCreate) {
+ callCreateTeamListeners(model);
+ }
+ return true;
+ }
+ return false;
}
/**
@@ -377,7 +411,14 @@ public class UserManager implements IUserManager {
*/
@Override
public boolean updateTeamModel(String teamname, TeamModel model) {
- return userService.updateTeamModel(teamname, model);
+ final boolean isCreate = null == userService.getTeamModel(teamname);
+ if (userService.updateTeamModel(teamname, model)) {
+ if (isCreate) {
+ callCreateTeamListeners(model);
+ }
+ return true;
+ }
+ return false;
}
/**
@@ -389,7 +430,11 @@ public class UserManager implements IUserManager {
*/
@Override
public boolean deleteTeamModel(TeamModel model) {
- return userService.deleteTeamModel(model);
+ if (userService.deleteTeamModel(model)) {
+ callDeleteTeamListeners(model);
+ return true;
+ }
+ return false;
}
/**
@@ -401,7 +446,12 @@ public class UserManager implements IUserManager {
*/
@Override
public boolean deleteTeam(String teamname) {
- return userService.deleteTeam(teamname);
+ TeamModel team = userService.getTeamModel(teamname);
+ if (userService.deleteTeam(teamname)) {
+ callDeleteTeamListeners(team);
+ return true;
+ }
+ return false;
}
/**
@@ -440,4 +490,60 @@ public class UserManager implements IUserManager {
public boolean deleteRepositoryRole(String role) {
return userService.deleteRepositoryRole(role);
}
+
+ protected void callCreateUserListeners(UserModel user) {
+ if (pluginManager == null || user == null) {
+ return;
+ }
+
+ for (UserTeamLifeCycleListener listener : pluginManager.getExtensions(UserTeamLifeCycleListener.class)) {
+ try {
+ listener.onCreation(user);
+ } catch (Throwable t) {
+ logger.error(String.format("failed to call plugin.onCreation%s", user.username), t);
+ }
+ }
+ }
+
+ protected void callCreateTeamListeners(TeamModel team) {
+ if (pluginManager == null || team == null) {
+ return;
+ }
+
+ for (UserTeamLifeCycleListener listener : pluginManager.getExtensions(UserTeamLifeCycleListener.class)) {
+ try {
+ listener.onCreation(team);
+ } catch (Throwable t) {
+ logger.error(String.format("failed to call plugin.onCreation %s", team.name), t);
+ }
+ }
+ }
+
+ protected void callDeleteUserListeners(UserModel user) {
+ if (pluginManager == null || user == null) {
+ return;
+ }
+
+ for (UserTeamLifeCycleListener listener : pluginManager.getExtensions(UserTeamLifeCycleListener.class)) {
+ try {
+ listener.onDeletion(user);
+ } catch (Throwable t) {
+ logger.error(String.format("failed to call plugin.onDeletion %s", user.username), t);
+ }
+ }
+ }
+
+ protected void callDeleteTeamListeners(TeamModel team) {
+ if (pluginManager == null || team == null) {
+ return;
+ }
+
+ for (UserTeamLifeCycleListener listener : pluginManager.getExtensions(UserTeamLifeCycleListener.class)) {
+ try {
+ listener.onDeletion(team);
+ } catch (Throwable t) {
+ logger.error(String.format("failed to call plugin.onDeletion %s", team.name), t);
+ }
+ }
+ }
}
diff --git a/src/main/java/com/gitblit/servlet/GitblitContext.java b/src/main/java/com/gitblit/servlet/GitblitContext.java
index 50f22d5a..d5b4092c 100644
--- a/src/main/java/com/gitblit/servlet/GitblitContext.java
+++ b/src/main/java/com/gitblit/servlet/GitblitContext.java
@@ -175,6 +175,9 @@ public class GitblitContext extends DaggerContext {
runtime.start();
managers.add(runtime);
+ // create the plugin manager instance but do not start it
+ loadManager(injector, IPluginManager.class);
+
// start all other managers
startManager(injector, INotificationManager.class);
startManager(injector, IUserManager.class);
@@ -215,9 +218,14 @@ public class GitblitContext extends DaggerContext {
return null;
}
+ protected <X extends IManager> X loadManager(ObjectGraph injector, Class<X> clazz) {
+ X x = injector.get(clazz);
+ return x;
+ }
+
protected <X extends IManager> X startManager(ObjectGraph injector, Class<X> clazz) {
+ X x = loadManager(injector, clazz);
logManager(clazz);
- X x = injector.get(clazz);
x.start();
managers.add(x);
return x;
diff --git a/src/site/plugins_extensions.mkd b/src/site/plugins_extensions.mkd
index 99b6400f..0e066438 100644
--- a/src/site/plugins_extensions.mkd
+++ b/src/site/plugins_extensions.mkd
@@ -286,7 +286,7 @@ public class MyNavLink extends NavLinkExtension {
}
```
-### Lifecycle Listener
+### Server Lifecycle Listener
*SINCE 1.6.0*
@@ -313,4 +313,75 @@ public class MyLifeCycleListener extends LifeCycleListener {
log.info("Gitblit is Going Down!!");
}
}
-``` \ No newline at end of file
+```
+
+### Repository Lifecycle Listener
+
+*SINCE 1.6.0*
+
+You can provide a lifecycle listener to be notified when Gitblit has created or deleted a repository.
+
+```java
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import ro.fortsoft.pf4j.Extension;
+import com.gitblit.extensions.RepositoryLifeCycleListener;
+import com.gitblit.models.RepositoryModel;
+
+@Extension
+public class MyRepoLifeCycleListener extends RepositoryLifeCycleListener {
+
+ final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Override
+ public void onCreation(RepositoryModel repo) {
+ log.info("Gitblit created {}", repo);
+ }
+
+ @Override
+ public void onDeletion(RepositoryModel repo) {
+ log.info("Gitblit deleted {}", repo);
+ }
+}
+```
+
+### User/Team Lifecycle Listener
+
+*SINCE 1.6.0*
+
+You can provide a lifecycle listener to be notified when Gitblit has created or deleted a user or a team.
+
+```java
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import ro.fortsoft.pf4j.Extension;
+import com.gitblit.extensions.UserTeamLifeCycleListener;
+import com.gitblit.models.TeamModel;
+import com.gitblit.models.UserModel;
+
+@Extension
+public class MyUserTeamLifeCycleListener extends UserTeamLifeCycleListener {
+
+ final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Override
+ public void onCreation(UserModel user) {
+ log.info("Gitblit created user {}", user);
+ }
+
+ @Override
+ public void onDeletion(UserModel user) {
+ log.info("Gitblit deleted user {}", user);
+ }
+
+ @Override
+ public void onCreation(TeamModel team) {
+ log.info("Gitblit created team {}", team);
+ }
+
+ @Override
+ public void onDeletion(TeamModel team) {
+ log.info("Gitblit deleted team {}", team);
+ }
+}
+```
diff --git a/src/test/config/test-users.conf b/src/test/config/test-users.conf
index 1d01f846..4361410c 100644
--- a/src/test/config/test-users.conf
+++ b/src/test/config/test-users.conf
@@ -2,13 +2,9 @@
password = admin
cookie = dd94709528bb1c83d08f3088d4043f4742891f4f
accountType = LOCAL
+ emailMeOnMyTicketChanges = true
role = "#admin"
role = "#notfederated"
-[user "sampleuser"]
- password = sampleuser
- cookie = 6e07ed42149fc166206319faffdfba2e2ec82e43
- accountType = LOCAL
- role = "#none"
[team "admins"]
role = "#none"
accountType = LOCAL
diff --git a/src/test/java/com/gitblit/tests/AuthenticationManagerTest.java b/src/test/java/com/gitblit/tests/AuthenticationManagerTest.java
index 84a2b749..f1d2711e 100644
--- a/src/test/java/com/gitblit/tests/AuthenticationManagerTest.java
+++ b/src/test/java/com/gitblit/tests/AuthenticationManagerTest.java
@@ -43,7 +43,7 @@ public class AuthenticationManagerTest extends GitblitUnitTest {
IAuthenticationManager newAuthenticationManager() {
RuntimeManager runtime = new RuntimeManager(getSettings(), GitBlitSuite.BASEFOLDER).start();
- users = new UserManager(runtime).start();
+ users = new UserManager(runtime, null).start();
AuthenticationManager auth = new AuthenticationManager(runtime, users).start();
return auth;
}
diff --git a/src/test/java/com/gitblit/tests/BranchTicketServiceTest.java b/src/test/java/com/gitblit/tests/BranchTicketServiceTest.java
index 6119b8db..cc404abf 100644
--- a/src/test/java/com/gitblit/tests/BranchTicketServiceTest.java
+++ b/src/test/java/com/gitblit/tests/BranchTicketServiceTest.java
@@ -54,8 +54,8 @@ public class BranchTicketServiceTest extends TicketServiceTest {
IRuntimeManager runtimeManager = new RuntimeManager(settings).start();
IPluginManager pluginManager = new PluginManager(runtimeManager).start();
INotificationManager notificationManager = new NotificationManager(settings).start();
- IUserManager userManager = new UserManager(runtimeManager).start();
- IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, userManager).start();
+ IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
BranchTicketService service = new BranchTicketService(
runtimeManager,
diff --git a/src/test/java/com/gitblit/tests/FileTicketServiceTest.java b/src/test/java/com/gitblit/tests/FileTicketServiceTest.java
index 20cde26b..6ede042a 100644
--- a/src/test/java/com/gitblit/tests/FileTicketServiceTest.java
+++ b/src/test/java/com/gitblit/tests/FileTicketServiceTest.java
@@ -53,8 +53,8 @@ public class FileTicketServiceTest extends TicketServiceTest {
IRuntimeManager runtimeManager = new RuntimeManager(settings).start();
IPluginManager pluginManager = new PluginManager(runtimeManager).start();
INotificationManager notificationManager = new NotificationManager(settings).start();
- IUserManager userManager = new UserManager(runtimeManager).start();
- IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, userManager).start();
+ IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
FileTicketService service = new FileTicketService(
runtimeManager,
diff --git a/src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java b/src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java
index 4e1c3ac1..f4e24d4e 100644
--- a/src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java
+++ b/src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java
@@ -75,15 +75,15 @@ public class HtpasswdAuthenticationTest extends GitblitUnitTest {
private HtpasswdAuthProvider newHtpasswdAuthentication(IStoredSettings settings) {
RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start();
- UserManager users = new UserManager(runtime).start();
+ UserManager users = new UserManager(runtime, null).start();
HtpasswdAuthProvider htpasswd = new HtpasswdAuthProvider();
htpasswd.setup(runtime, users);
return htpasswd;
}
-
+
private AuthenticationManager newAuthenticationManager(IStoredSettings settings) {
RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start();
- UserManager users = new UserManager(runtime).start();
+ UserManager users = new UserManager(runtime, null).start();
HtpasswdAuthProvider htpasswd = new HtpasswdAuthProvider();
htpasswd.setup(runtime, users);
AuthenticationManager auth = new AuthenticationManager(runtime, users);
@@ -191,7 +191,7 @@ public class HtpasswdAuthenticationTest extends GitblitUnitTest {
assertEquals("leading", user.username);
}
-
+
@Test
public void testAuthenticationManager()
{
diff --git a/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java b/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
index 21063d58..646f7e9f 100644
--- a/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
+++ b/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
@@ -68,7 +68,7 @@ public class LdapAuthenticationTest extends GitblitUnitTest {
private static InMemoryDirectoryServer ds;
private IUserManager userManager;
-
+
private AuthenticationManager auth;
private MemorySettings settings;
@@ -97,12 +97,12 @@ public class LdapAuthenticationTest extends GitblitUnitTest {
private LdapAuthProvider newLdapAuthentication(IStoredSettings settings) {
RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start();
- userManager = new UserManager(runtime).start();
+ userManager = new UserManager(runtime, null).start();
LdapAuthProvider ldap = new LdapAuthProvider();
ldap.setup(runtime, userManager);
return ldap;
}
-
+
private AuthenticationManager newAuthenticationManager(IStoredSettings settings) {
RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start();
AuthenticationManager auth = new AuthenticationManager(runtime, userManager);
@@ -258,7 +258,7 @@ public class LdapAuthenticationTest extends GitblitUnitTest {
assertNull(userThreeModel.getTeam("git_admins"));
assertTrue(userThreeModel.canAdmin);
}
-
+
@Test
public void testBindWithUser() {
settings.put(Keys.realm.ldap.bindpattern, "CN=${username},OU=US,OU=Users,OU=UserControl,OU=MyOrganization,DC=MyDomain");
@@ -267,7 +267,7 @@ public class LdapAuthenticationTest extends GitblitUnitTest {
UserModel userOneModel = auth.authenticate("UserOne", "userOnePassword".toCharArray());
assertNotNull(userOneModel);
-
+
UserModel userOneModelFailedAuth = auth.authenticate("UserOne", "userTwoPassword".toCharArray());
assertNull(userOneModelFailedAuth);
}
diff --git a/src/test/java/com/gitblit/tests/LuceneExecutorTest.java b/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
index 319c09c1..5c319e65 100644
--- a/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
+++ b/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
@@ -49,8 +49,8 @@ public class LuceneExecutorTest extends GitblitUnitTest {
MemorySettings settings = new MemorySettings();
settings.put(Keys.git.repositoriesFolder, GitBlitSuite.REPOSITORIES);
RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start();
- UserManager users = new UserManager(runtime).start();
- RepositoryManager repos = new RepositoryManager(runtime, users);
+ UserManager users = new UserManager(runtime, null).start();
+ RepositoryManager repos = new RepositoryManager(runtime, null, users);
return new LuceneService(settings, repos);
}
diff --git a/src/test/java/com/gitblit/tests/RedisTicketServiceTest.java b/src/test/java/com/gitblit/tests/RedisTicketServiceTest.java
index 94391a15..b782b449 100644
--- a/src/test/java/com/gitblit/tests/RedisTicketServiceTest.java
+++ b/src/test/java/com/gitblit/tests/RedisTicketServiceTest.java
@@ -61,8 +61,8 @@ public class RedisTicketServiceTest extends TicketServiceTest {
IRuntimeManager runtimeManager = new RuntimeManager(settings).start();
IPluginManager pluginManager = new PluginManager(runtimeManager).start();
INotificationManager notificationManager = new NotificationManager(settings).start();
- IUserManager userManager = new UserManager(runtimeManager).start();
- IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, userManager).start();
+ IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
+ IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
RedisTicketService service = new RedisTicketService(
runtimeManager,
diff --git a/src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java b/src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java
index 6ede8313..3b6b7bba 100644
--- a/src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java
+++ b/src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java
@@ -26,7 +26,7 @@ public class RedmineAuthenticationTest extends GitblitUnitTest {
RedmineAuthProvider newRedmineAuthentication(IStoredSettings settings) {
RuntimeManager runtime = new RuntimeManager(settings, GitBlitSuite.BASEFOLDER).start();
- UserManager users = new UserManager(runtime).start();
+ UserManager users = new UserManager(runtime, null).start();
RedmineAuthProvider redmine = new RedmineAuthProvider();
redmine.setup(runtime, users);
return redmine;
@@ -35,10 +35,10 @@ public class RedmineAuthenticationTest extends GitblitUnitTest {
RedmineAuthProvider newRedmineAuthentication() {
return newRedmineAuthentication(getSettings());
}
-
+
AuthenticationManager newAuthenticationManager() {
RuntimeManager runtime = new RuntimeManager(getSettings(), GitBlitSuite.BASEFOLDER).start();
- UserManager users = new UserManager(runtime).start();
+ UserManager users = new UserManager(runtime, null).start();
RedmineAuthProvider redmine = new RedmineAuthProvider();
redmine.setup(runtime, users);
redmine.setTestingCurrentUserAsJson(JSON);