use of org.eclipse.jgit.lib.PersonIdent in project gerrit by GerritCodeReview.
the class ChangeNotesParser method parseRealAccountId.
private Account.Id parseRealAccountId(ChangeNotesCommit commit, Account.Id effectiveAccountId) throws ConfigInvalidException {
String realUser = parseOneFooter(commit, FOOTER_REAL_USER);
if (realUser == null) {
return effectiveAccountId;
}
PersonIdent ident = RawParseUtils.parsePersonIdent(realUser);
return noteUtil.parseIdent(ident, id);
}
use of org.eclipse.jgit.lib.PersonIdent in project gerrit by GerritCodeReview.
the class ChangeUpdate method addIdent.
private StringBuilder addIdent(StringBuilder sb, Account.Id accountId) {
Account account = accountCache.get(accountId).getAccount();
PersonIdent ident = newIdent(account, when);
PersonIdent.appendSanitized(sb, ident.getName());
sb.append(" <");
PersonIdent.appendSanitized(sb, ident.getEmailAddress());
sb.append('>');
return sb;
}
use of org.eclipse.jgit.lib.PersonIdent in project gerrit by GerritCodeReview.
the class ChangeNotesParser method parseAssignee.
private void parseAssignee(ChangeNotesCommit commit) throws ConfigInvalidException {
if (pastAssignees == null) {
pastAssignees = Lists.newArrayList();
}
String assigneeValue = parseOneFooter(commit, FOOTER_ASSIGNEE);
if (assigneeValue != null) {
Optional<Account.Id> parsedAssignee;
if (assigneeValue.equals("")) {
// Empty footer found, assignee deleted
parsedAssignee = Optional.empty();
} else {
PersonIdent ident = RawParseUtils.parsePersonIdent(assigneeValue);
parsedAssignee = Optional.ofNullable(noteUtil.parseIdent(ident, id));
}
if (assignee == null) {
assignee = parsedAssignee;
}
if (parsedAssignee.isPresent()) {
pastAssignees.add(parsedAssignee.get());
}
}
}
use of org.eclipse.jgit.lib.PersonIdent in project gerrit by GerritCodeReview.
the class FromAddressGeneratorProviderTest method setUp.
@Before
public void setUp() throws Exception {
config = new Config();
ident = new PersonIdent("NAME", "e@email", 0, 0);
accountCache = createStrictMock(AccountCache.class);
}
use of org.eclipse.jgit.lib.PersonIdent in project gerrit by GerritCodeReview.
the class AbstractChangeNotesTest method setUp.
@Before
public void setUp() throws Exception {
setTimeForTesting();
serverIdent = new PersonIdent("Gerrit Server", "noreply@gerrit.com", TimeUtil.nowTs(), TZ);
project = new Project.NameKey("test-project");
repoManager = new InMemoryRepositoryManager();
repo = repoManager.createRepository(project);
tr = new TestRepository<>(repo);
rw = tr.getRevWalk();
accountCache = new FakeAccountCache();
Account co = new Account(new Account.Id(1), TimeUtil.nowTs());
co.setFullName("Change Owner");
co.setPreferredEmail("change@owner.com");
accountCache.put(co);
Account ou = new Account(new Account.Id(2), TimeUtil.nowTs());
ou.setFullName("Other Account");
ou.setPreferredEmail("other@account.com");
accountCache.put(ou);
injector = Guice.createInjector(new FactoryModule() {
@Override
public void configure() {
install(new GitModule());
install(NoteDbModule.forTest(testConfig));
bind(AllUsersName.class).toProvider(AllUsersNameProvider.class);
bind(String.class).annotatedWith(GerritServerId.class).toInstance("gerrit");
bind(NotesMigration.class).toInstance(MIGRATION);
bind(GitRepositoryManager.class).toInstance(repoManager);
bind(ProjectCache.class).toProvider(Providers.<ProjectCache>of(null));
bind(CapabilityControl.Factory.class).toProvider(Providers.<CapabilityControl.Factory>of(null));
bind(Config.class).annotatedWith(GerritServerConfig.class).toInstance(testConfig);
bind(String.class).annotatedWith(AnonymousCowardName.class).toProvider(AnonymousCowardNameProvider.class);
bind(String.class).annotatedWith(CanonicalWebUrl.class).toInstance("http://localhost:8080/");
bind(Boolean.class).annotatedWith(DisableReverseDnsLookup.class).toInstance(Boolean.FALSE);
bind(Realm.class).to(FakeRealm.class);
bind(GroupBackend.class).to(SystemGroupBackend.class).in(SINGLETON);
bind(AccountCache.class).toInstance(accountCache);
bind(PersonIdent.class).annotatedWith(GerritPersonIdent.class).toInstance(serverIdent);
bind(GitReferenceUpdated.class).toInstance(GitReferenceUpdated.DISABLED);
bind(MetricMaker.class).to(DisabledMetricMaker.class);
bind(ReviewDb.class).toProvider(Providers.<ReviewDb>of(null));
}
});
injector.injectMembers(this);
repoManager.createRepository(allUsers);
changeOwner = userFactory.create(co.getId());
otherUser = userFactory.create(ou.getId());
otherUserId = otherUser.getAccountId();
internalUser = new InternalUser(null);
}
Aggregations