commit | author | age
|
5e3521
|
1 |
/* |
JM |
2 |
* Copyright 2014 gitblit.com. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
*/ |
|
16 |
package com.gitblit.tests; |
|
17 |
|
|
18 |
import com.gitblit.IStoredSettings; |
|
19 |
import com.gitblit.Keys; |
|
20 |
import com.gitblit.manager.INotificationManager; |
ba5670
|
21 |
import com.gitblit.manager.IPluginManager; |
5e3521
|
22 |
import com.gitblit.manager.IRepositoryManager; |
JM |
23 |
import com.gitblit.manager.IRuntimeManager; |
|
24 |
import com.gitblit.manager.IUserManager; |
|
25 |
import com.gitblit.manager.NotificationManager; |
ba5670
|
26 |
import com.gitblit.manager.PluginManager; |
5e3521
|
27 |
import com.gitblit.manager.RepositoryManager; |
JM |
28 |
import com.gitblit.manager.RuntimeManager; |
|
29 |
import com.gitblit.manager.UserManager; |
|
30 |
import com.gitblit.models.RepositoryModel; |
|
31 |
import com.gitblit.tickets.ITicketService; |
|
32 |
import com.gitblit.tickets.RedisTicketService; |
fc3a39
|
33 |
import com.gitblit.utils.XssFilter; |
JM |
34 |
import com.gitblit.utils.XssFilter.AllowXssFilter; |
5e3521
|
35 |
|
JM |
36 |
/** |
|
37 |
* Tests the Redis ticket service. |
|
38 |
* |
|
39 |
* @author James Moger |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class RedisTicketServiceTest extends TicketServiceTest { |
|
43 |
|
|
44 |
final RepositoryModel repo = new RepositoryModel("tickets/redis.git", null, null, null); |
|
45 |
|
|
46 |
@Override |
|
47 |
protected RepositoryModel getRepository() { |
|
48 |
return repo; |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
protected IStoredSettings getSettings(boolean deleteAll) throws Exception { |
|
53 |
IStoredSettings settings = super.getSettings(deleteAll); |
|
54 |
settings.overrideSetting(Keys.tickets.redis.url, "redis://localhost:6379/10"); |
|
55 |
return settings; |
|
56 |
} |
|
57 |
|
|
58 |
@Override |
|
59 |
protected ITicketService getService(boolean deleteAll) throws Exception { |
|
60 |
|
|
61 |
IStoredSettings settings = getSettings(deleteAll); |
fc3a39
|
62 |
XssFilter xssFilter = new AllowXssFilter(); |
JM |
63 |
IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start(); |
ba5670
|
64 |
IPluginManager pluginManager = new PluginManager(runtimeManager).start(); |
5e3521
|
65 |
INotificationManager notificationManager = new NotificationManager(settings).start(); |
ca4d98
|
66 |
IUserManager userManager = new UserManager(runtimeManager, pluginManager).start(); |
eecaad
|
67 |
IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager, null).start(); |
5e3521
|
68 |
|
JM |
69 |
RedisTicketService service = new RedisTicketService( |
|
70 |
runtimeManager, |
ba5670
|
71 |
pluginManager, |
5e3521
|
72 |
notificationManager, |
JM |
73 |
userManager, |
|
74 |
repositoryManager).start(); |
|
75 |
|
|
76 |
if (deleteAll) { |
|
77 |
service.deleteAll(getRepository()); |
|
78 |
} |
|
79 |
return service; |
|
80 |
} |
|
81 |
} |