use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class FileTicketServiceTest 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();
FileTicketService service = (FileTicketService) new FileTicketService(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 MarkdownUtilsTest method testUserMentions.
@Test
public void testUserMentions() {
IStoredSettings settings = getSettings();
String repositoryName = "test3";
String mentionHtml = "<strong><a href=\"http://localhost/user/%1$s\">@%1$s</a></strong>";
String input = "@j.doe";
String output = "<p>" + String.format(mentionHtml, "j.doe") + "</p>";
assertEquals(output, MarkdownUtils.transformGFM(settings, input, repositoryName));
input = " @j.doe";
output = "<p>" + String.format(mentionHtml, "j.doe") + "</p>";
assertEquals(output, MarkdownUtils.transformGFM(settings, input, repositoryName));
input = "@j.doe.";
output = "<p>" + String.format(mentionHtml, "j.doe") + ".</p>";
assertEquals(output, MarkdownUtils.transformGFM(settings, input, repositoryName));
input = "To @j.doe: ask @jim.beam!";
output = "<p>To " + String.format(mentionHtml, "j.doe") + ": ask " + String.format(mentionHtml, "jim.beam") + "!</p>";
assertEquals(output, MarkdownUtils.transformGFM(settings, input, repositoryName));
input = "@sta.rt\n" + "\n" + "User mentions in tickets are broken.\n" + "So:\n" + "@mc_guyver can fix this.\n" + "@j.doe, can you test after the fix by @m+guyver?\n" + "Please review this, @jim.beam!\n" + "Was reported by @jill and @j!doe from jane@doe yesterday.\n" + "\n" + "@jack.daniels can vote for john@wayne.name hopefully.\n" + "@en.de";
output = "<p>" + String.format(mentionHtml, "sta.rt") + "</p>" + "<p>" + "User mentions in tickets are broken.<br/>" + "So:<br/>" + String.format(mentionHtml, "mc_guyver") + " can fix this.<br/>" + String.format(mentionHtml, "j.doe") + ", can you test after the fix by " + String.format(mentionHtml, "m+guyver") + "?<br/>" + "Please review this, " + String.format(mentionHtml, "jim.beam") + "!<br/>" + "Was reported by " + String.format(mentionHtml, "jill") + " and " + String.format(mentionHtml, "j!doe") + " from <a href=\"mailto:jane@doe\">jane@doe</a> yesterday." + "</p>" + "<p>" + String.format(mentionHtml, "jack.daniels") + " can vote for " + "<a href=\"mailto:john@wayne.name\">john@wayne.name</a> hopefully.<br/>" + String.format(mentionHtml, "en.de") + "</p>";
assertEquals(output, MarkdownUtils.transformGFM(settings, input, repositoryName));
}
use of com.gitblit.IStoredSettings in project gitblit by gitblit.
the class GravatarTest method gravatarIdenticonTest.
@Test
public void gravatarIdenticonTest() {
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, true, width);
assertNotNull(url);
assertEquals(ActivityUtils.getGravatarIdenticonUrl(emailAddress, width), url);
}
Aggregations