use of com.jcabi.github.Coordinates in project jcabi-github by jcabi.
the class MkMilestoneTest method returnsSameCoordinatesRepo.
/**
* MkMilestone returns a repo with same coordinates.
* @throws Exception if test fails
*/
@Test
public final void returnsSameCoordinatesRepo() throws Exception {
final Coordinates coordinates = new Coordinates.Simple("user", "repo");
final MkMilestone milestone = new MkMilestone(new MkStorage.InFile(), "login", coordinates, 1);
final Repo repo = milestone.repo();
MatcherAssert.assertThat(repo.coordinates(), Matchers.equalTo(coordinates));
}
use of com.jcabi.github.Coordinates in project jcabi-github by jcabi.
the class MkBranchesTest method createsBranch.
/**
* MkBranches can create a new branch.
* @throws IOException if there is any I/O problem
*/
@Test
public void createsBranch() throws IOException {
final String name = "my-new-feature";
final String sha = "590e188e3d52a8da38cf51d3f9bf598bb46911af";
final Repo repo = new MkGithub().randomRepo();
final Branch branch = ((MkBranches) (repo.branches())).create(name, sha);
MatcherAssert.assertThat(branch.name(), Matchers.equalTo(name));
MatcherAssert.assertThat(branch.commit().sha(), Matchers.equalTo(sha));
final Coordinates coords = branch.commit().repo().coordinates();
MatcherAssert.assertThat(coords.user(), Matchers.equalTo(repo.coordinates().user()));
MatcherAssert.assertThat(coords.repo(), Matchers.equalTo(repo.coordinates().repo()));
}
use of com.jcabi.github.Coordinates 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.Coordinates 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()));
}
use of com.jcabi.github.Coordinates in project wring by yegor256.
the class BoCommit method push.
@Override
public void push(final Events events) throws IOException {
final Coordinates coords = this.commit.repo().coordinates();
final String body = this.text(coords);
if (body.isEmpty()) {
Logger.info(this, "%s %s ignored", coords, this.commit.sha());
} else {
events.post(String.format("[%s] %s", coords, this.commit.sha()), body);
Logger.info(this, "New event in %s#%s", coords, this.commit.sha());
}
}
Aggregations