use of org.eclipse.egit.github.core.RepositoryCommit in project camel by apache.
the class CommitConsumer method poll.
@Override
protected int poll() throws Exception {
List<RepositoryCommit> commits = commitService.getCommits(getRepository());
// In the end, we want tags oldest to newest.
Stack<RepositoryCommit> newCommits = new Stack<RepositoryCommit>();
for (RepositoryCommit commit : commits) {
if (!commitHashes.contains(commit.getSha())) {
newCommits.push(commit);
commitHashes.add(commit.getSha());
}
}
while (!newCommits.empty()) {
RepositoryCommit newCommit = newCommits.pop();
Exchange e = getEndpoint().createExchange();
e.getIn().setBody(newCommit);
getProcessor().process(e);
}
return newCommits.size();
}
use of org.eclipse.egit.github.core.RepositoryCommit in project camel by apache.
the class CommitConsumerTest method commitConsumerTest.
@Test
public void commitConsumerTest() throws Exception {
mockResultEndpoint.expectedMessageCount(2);
RepositoryCommit commit1 = commitService.addRepositoryCommit();
RepositoryCommit commit2 = commitService.addRepositoryCommit();
mockResultEndpoint.expectedBodiesReceivedInAnyOrder(commit1, commit2);
Thread.sleep(1 * 1000);
mockResultEndpoint.assertIsSatisfied();
}
use of org.eclipse.egit.github.core.RepositoryCommit in project Bitocle by mthli.
the class CommitTask method doInBackground.
@Override
protected Boolean doInBackground(Void... params) {
if (flag == Flag.REPO_COMMIT_FIRST || flag == Flag.REPO_COMMIT_REFRESH) {
RepositoryId id = RepositoryId.create(repoItem.getOwner(), repoItem.getName());
PageIterator<RepositoryCommit> pageIterator = commitService.pageCommits(id, 17);
iterator = pageIterator.next().iterator();
} else {
RepositoryId id = RepositoryId.create(starItem.getOwner(), starItem.getName());
PageIterator<RepositoryCommit> pageIterator = commitService.pageCommits(id, 17);
iterator = pageIterator.next().iterator();
}
if (isCancelled()) {
return false;
}
return true;
}
use of org.eclipse.egit.github.core.RepositoryCommit in project camel by apache.
the class MockCommitService method addRepositoryCommit.
public synchronized RepositoryCommit addRepositoryCommit() {
User author = new User();
// TODO change
author.setEmail("someguy@gmail.com");
author.setHtmlUrl("http://github/someguy");
author.setLogin("someguy");
RepositoryCommit rc = new RepositoryCommit();
rc.setAuthor(author);
rc.setSha(fakeSha.incrementAndGet() + "");
LOG.debug("In MockCommitService added commit with sha " + rc.getSha());
commitsList.add(rc);
return rc;
}
use of org.eclipse.egit.github.core.RepositoryCommit in project Bitocle by mthli.
the class CommitTask method onPostExecute.
@Override
protected void onPostExecute(Boolean result) {
if (result) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
list.clear();
while (iterator.hasNext()) {
RepositoryCommit commit = iterator.next();
list.add(new CommitItem(commit.getCommit().getAuthor().getName(), format.format(commit.getCommit().getAuthor().getDate()), commit.getCommit().getMessage()));
}
if (list.size() <= 0) {
fragment.setContentEmpty(true);
fragment.setEmptyText(R.string.commit_empty_list);
fragment.setContentShown(true);
} else {
fragment.setContentEmpty(false);
adapter.notifyDataSetChanged();
fragment.setContentShown(true);
}
} else {
fragment.setContentEmpty(true);
fragment.setEmptyText(R.string.commit_empty_error);
fragment.setContentShown(true);
}
}
Aggregations