use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class GravatarTest method gravatarThumbnailTest.
@Test
public void gravatarThumbnailTest() {
IStoredSettings settings = new MemorySettings();
settings.overrideSetting(Keys.web.avatarClass, GravatarGenerator.class.getName());
Injector injector = Guice.createInjector(new AvatarModule(settings));
AvatarGenerator avatarGenerator = injector.getInstance(AvatarGenerator.class);
String username = "username";
String emailAddress = "emailAddress";
int width = 10;
String url = avatarGenerator.getURL(username, emailAddress, false, width);
assertNotNull(url);
assertEquals(ActivityUtils.getGravatarThumbnailUrl(emailAddress, width), url);
}
use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class WorkQueueProvider method get.
@Override
public synchronized WorkQueue get() {
if (workQueue != null) {
return workQueue;
}
IStoredSettings settings = runtimeManager.getSettings();
int defaultThreadPoolSize = settings.getInteger(Keys.execution.defaultThreadPoolSize, 1);
IdGenerator idGenerator = new IdGenerator();
workQueue = new WorkQueue(idGenerator, defaultThreadPoolSize);
return workQueue;
}
use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class TicketServiceTest method getSettings.
protected IStoredSettings getSettings(boolean deleteAll) throws Exception {
File dir = new File(GitBlitSuite.REPOSITORIES, getRepository().name);
if (deleteAll) {
if (dir.exists()) {
FileUtils.delete(dir, FileUtils.RECURSIVE | FileUtils.RETRY);
}
JGitUtils.createRepository(GitBlitSuite.REPOSITORIES, getRepository().name).close();
}
File luceneDir = new File(dir, "tickets/lucene");
luceneDir.mkdirs();
Map<String, Object> map = new HashMap<String, Object>();
map.put(Keys.git.repositoriesFolder, GitBlitSuite.REPOSITORIES.getAbsolutePath());
map.put(Keys.tickets.indexFolder, luceneDir.getAbsolutePath());
IStoredSettings settings = new MemorySettings(map);
return settings;
}
use of com.gitblit.IStoredSettings 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.IStoredSettings in project gitblit by gitblit.
the class RedisTicketServiceTest method getSettings.
@Override
protected IStoredSettings getSettings(boolean deleteAll) throws Exception {
IStoredSettings settings = super.getSettings(deleteAll);
settings.overrideSetting(Keys.tickets.redis.url, "redis://localhost:6379/10");
return settings;
}
Aggregations