Search in sources :

Example 1 with MemorySettings

use of com.gitblit.tests.mock.MemorySettings 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) {
        FileUtils.deleteDirectory(dir);
        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 2 with MemorySettings

use of com.gitblit.tests.mock.MemorySettings in project gitblit by gitblit.

the class UITicketTest method getSettings.

protected IStoredSettings getSettings(boolean deleteAll) throws Exception {
    File dir = new File(GitBlitSuite.REPOSITORIES, repoName);
    if (deleteAll) {
        FileUtils.deleteDirectory(dir);
        JGitUtils.createRepository(GitBlitSuite.REPOSITORIES, repoName).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 3 with MemorySettings

use of com.gitblit.tests.mock.MemorySettings in project gitblit by gitblit.

the class LdapSyncServiceTest method getSettings.

private MemorySettings getSettings() {
    Map<String, Object> backingMap = new HashMap<String, Object>();
    MemorySettings ms = new MemorySettings(backingMap);
    return ms;
}
Also used : HashMap(java.util.HashMap) MemorySettings(com.gitblit.tests.mock.MemorySettings)

Example 4 with MemorySettings

use of com.gitblit.tests.mock.MemorySettings in project gitblit by gitblit.

the class LuceneExecutorTest method newLuceneExecutor.

private LuceneService newLuceneExecutor() {
    MemorySettings settings = new MemorySettings();
    settings.put(Keys.git.repositoriesFolder, GitBlitSuite.REPOSITORIES);
    XssFilter xssFilter = new AllowXssFilter();
    RuntimeManager runtime = new RuntimeManager(settings, xssFilter, GitBlitSuite.BASEFOLDER).start();
    UserManager users = new UserManager(runtime, null).start();
    RepositoryManager repos = new RepositoryManager(runtime, null, users);
    return new LuceneService(settings, repos);
}
Also used : UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) RuntimeManager(com.gitblit.manager.RuntimeManager) MemorySettings(com.gitblit.tests.mock.MemorySettings) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) RepositoryManager(com.gitblit.manager.RepositoryManager) LuceneService(com.gitblit.service.LuceneService)

Example 5 with MemorySettings

use of com.gitblit.tests.mock.MemorySettings in project gitblit by gitblit.

the class LdapAuthenticationTest method testEmail.

@Test
public void testEmail() {
    UserModel userOneModel = ldap.authenticate("UserOne", "userOnePassword".toCharArray());
    assertNotNull(userOneModel);
    assertEquals("userone@gitblit.com", userOneModel.emailAddress);
    // Test more complicated scenarios - concat
    MemorySettings ms = getSettings();
    ms.put("realm.ldap.email", "${givenName}.${surname}@gitblit.com");
    ldap = newLdapAuthentication(ms);
    userOneModel = ldap.authenticate("UserOne", "userOnePassword".toCharArray());
    assertNotNull(userOneModel);
    assertEquals("User.One@gitblit.com", userOneModel.emailAddress);
}
Also used : UserModel(com.gitblit.models.UserModel) MemorySettings(com.gitblit.tests.mock.MemorySettings) Test(org.junit.Test)

Aggregations

MemorySettings (com.gitblit.tests.mock.MemorySettings)11 HashMap (java.util.HashMap)5 Test (org.junit.Test)5 IStoredSettings (com.gitblit.IStoredSettings)4 UserModel (com.gitblit.models.UserModel)3 AvatarGenerator (com.gitblit.AvatarGenerator)2 GravatarGenerator (com.gitblit.GravatarGenerator)2 Injector (com.google.inject.Injector)2 File (java.io.File)2 AuthenticationManager (com.gitblit.manager.AuthenticationManager)1 IRuntimeManager (com.gitblit.manager.IRuntimeManager)1 IUserManager (com.gitblit.manager.IUserManager)1 RepositoryManager (com.gitblit.manager.RepositoryManager)1 RuntimeManager (com.gitblit.manager.RuntimeManager)1 UserManager (com.gitblit.manager.UserManager)1 LuceneService (com.gitblit.service.LuceneService)1 SshDaemonClient (com.gitblit.transport.ssh.SshDaemonClient)1 SshKrbAuthenticator (com.gitblit.transport.ssh.SshKrbAuthenticator)1 XssFilter (com.gitblit.utils.XssFilter)1 AllowXssFilter (com.gitblit.utils.XssFilter.AllowXssFilter)1