use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkGithubTest method canHandleMultipleThreads.
/**
* MkGithub can handle multiple threads in parallel.
* @throws Exception if some problem inside
*/
@Test
public void canHandleMultipleThreads() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final int threads = Tv.HUNDRED;
final ExecutorService svc = Executors.newFixedThreadPool(threads);
final Callable<Void> task = new VerboseCallable<Void>(new Callable<Void>() {
@Override
public Void call() throws Exception {
repo.issues().create("", "");
return null;
}
});
final Collection<Callable<Void>> tasks = new ArrayList<Callable<Void>>(threads);
for (int idx = 0; idx < threads; ++idx) {
tasks.add(task);
}
svc.invokeAll(tasks);
MatcherAssert.assertThat(repo.issues().iterate(new ArrayMap<String, String>()), Matchers.<Issue>iterableWithSize(threads));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class SampleTest method fetchesLabelsFromGithub.
/**
* Fetches labels from Github.
* @throws Exception If fails
*/
@Test
public void fetchesLabelsFromGithub() throws Exception {
final Github github = new RtGithub();
final Repo repo = github.repos().get(new Coordinates.Simple("jcabi/jcabi-github"));
MatcherAssert.assertThat(repo.labels().iterate().iterator().hasNext(), Matchers.equalTo(true));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkRepos method create.
@Override
public Repo create(final RepoCreate settings) throws IOException {
final Coordinates coords = new Coordinates.Simple(this.self, settings.name());
this.storage.apply(new Directives().xpath(this.xpath()).add("repo").attr("coords", coords.toString()).add("name").set(settings.name()).up().add("description").set("test repository").up().add("private").set("false").up());
final Repo repo = this.get(coords);
repo.patch(settings.json());
Logger.info(this, "repository %s created by %s", coords, this.self);
return repo;
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkAssigneesTest method checkCollaboratorIsAssigneeForRepo.
/**
* MkAssignees can check if a collaborator is an assignee for this repo.
* @throws Exception Exception If some problem inside
*/
@Test
public void checkCollaboratorIsAssigneeForRepo() throws Exception {
final Repo repo = repo();
repo.collaborators().add("Vladimir");
MatcherAssert.assertThat(repo.assignees().check("Vladimir"), Matchers.is(true));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkBranchTest method fetchesRepo.
/**
* MkBranch can fetch its repo.
* @throws IOException If an I/O problem occurs
*/
@Test
public void fetchesRepo() throws IOException {
final Repo repo = new MkGithub().randomRepo();
final Coordinates coords = MkBranchTest.branches(repo).create("test", "sha").repo().coordinates();
MatcherAssert.assertThat(coords.user(), Matchers.equalTo(repo.coordinates().user()));
MatcherAssert.assertThat(coords.repo(), Matchers.equalTo(repo.coordinates().repo()));
}
Aggregations