Search in sources :

Example 1 with IStoredSettings

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);
}
Also used : GravatarGenerator(com.gitblit.GravatarGenerator) AvatarGenerator(com.gitblit.AvatarGenerator) IStoredSettings(com.gitblit.IStoredSettings) Injector(com.google.inject.Injector) MemorySettings(com.gitblit.tests.mock.MemorySettings) Test(org.junit.Test)

Example 2 with IStoredSettings

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;
}
Also used : IStoredSettings(com.gitblit.IStoredSettings) IdGenerator(com.gitblit.utils.IdGenerator) WorkQueue(com.gitblit.utils.WorkQueue)

Example 3 with IStoredSettings

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;
}
Also used : HashMap(java.util.HashMap) IStoredSettings(com.gitblit.IStoredSettings) MemorySettings(com.gitblit.tests.mock.MemorySettings) File(java.io.File)

Example 4 with IStoredSettings

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;
}
Also used : NotificationManager(com.gitblit.manager.NotificationManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) IStoredSettings(com.gitblit.IStoredSettings) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) IRuntimeManager(com.gitblit.manager.IRuntimeManager) IPluginManager(com.gitblit.manager.IPluginManager) PluginManager(com.gitblit.manager.PluginManager) RedisTicketService(com.gitblit.tickets.RedisTicketService) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) IPluginManager(com.gitblit.manager.IPluginManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Example 5 with IStoredSettings

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;
}
Also used : IStoredSettings(com.gitblit.IStoredSettings)

Aggregations

IStoredSettings (com.gitblit.IStoredSettings)18 IPluginManager (com.gitblit.manager.IPluginManager)5 IRuntimeManager (com.gitblit.manager.IRuntimeManager)5 INotificationManager (com.gitblit.manager.INotificationManager)4 IRepositoryManager (com.gitblit.manager.IRepositoryManager)4 IUserManager (com.gitblit.manager.IUserManager)4 NotificationManager (com.gitblit.manager.NotificationManager)4 PluginManager (com.gitblit.manager.PluginManager)4 RepositoryManager (com.gitblit.manager.RepositoryManager)4 RuntimeManager (com.gitblit.manager.RuntimeManager)4 UserManager (com.gitblit.manager.UserManager)4 MemorySettings (com.gitblit.tests.mock.MemorySettings)4 XssFilter (com.gitblit.utils.XssFilter)4 AllowXssFilter (com.gitblit.utils.XssFilter.AllowXssFilter)4 AvatarGenerator (com.gitblit.AvatarGenerator)3 GravatarGenerator (com.gitblit.GravatarGenerator)3 Injector (com.google.inject.Injector)3 File (java.io.File)3 Test (org.junit.Test)3 BranchTicketService (com.gitblit.tickets.BranchTicketService)2