use of com.jcabi.immutable.ArrayMap in project jcabi-github by jcabi.
the class MkIssuesTest method iteratesIssues.
/**
* MkIssues can list issues.
* @throws Exception If some problem inside
*/
@Test
public void iteratesIssues() throws Exception {
final Repo repo = new MkGithub().randomRepo();
repo.issues().create("hey, you", "body of issue");
repo.issues().create("hey", "body of 2nd issue");
repo.issues().create("hey again", "body of 3rd issue");
MatcherAssert.assertThat(repo.issues().iterate(new ArrayMap<String, String>()), Matchers.<Issue>iterableWithSize(Tv.THREE));
}
use of com.jcabi.immutable.ArrayMap in project jcabi-github by jcabi.
the class MkMilestonesTest method iteratesMilestones.
/**
* This tests that the iterate(Map<String, String> params)
* method in MkMilestones works fine.
* @throws Exception - if something goes wrong.
*/
@Test
public void iteratesMilestones() throws Exception {
final Milestones milestones = new MkGithub().randomRepo().milestones();
milestones.create("testMilestone");
MatcherAssert.assertThat(milestones.iterate(new ArrayMap<String, String>()), Matchers.<Milestone>iterableWithSize(1));
}
use of com.jcabi.immutable.ArrayMap in project jcabi-github by jcabi.
the class MkMilestonesTest method removesMilestone.
/**
* This tests that MkMilestones can remove a certain MkMilestone, by number.
* @throws Exception - if something goes wrong.
*/
@Test
public void removesMilestone() throws Exception {
final Milestones milestones = new MkGithub().randomRepo().milestones();
final Milestone created = milestones.create("testTitle");
MatcherAssert.assertThat(milestones.iterate(new ArrayMap<String, String>()), Matchers.<Milestone>iterableWithSize(1));
milestones.remove(created.number());
MatcherAssert.assertThat(milestones.iterate(new ArrayMap<String, String>()), Matchers.<Milestone>iterableWithSize(0));
}
use of com.jcabi.immutable.ArrayMap 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.immutable.ArrayMap in project jcabi-github by jcabi.
the class RtIssuesTest method iterateIssues.
/**
* RtIssues can iterate issues.
* @throws Exception if there is any error
*/
@Test
public void iterateIssues() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, Json.createArrayBuilder().add(issue("new issue")).add(issue("code issue")).build().toString())).start(this.resource.port());
final RtIssues issues = new RtIssues(new JdkRequest(container.home()), repo());
MatcherAssert.assertThat(issues.iterate(new ArrayMap<String, String>()), Matchers.<Issue>iterableWithSize(2));
container.stop();
}
Aggregations