Package com.jcabi.github

Examples of com.jcabi.github.Contents.create()


    @Test
    public void canFetchReadmeFile() throws Exception {
        final Contents contents = MkContentsTest.repo().contents();
        final String body = "Readme On Master";
        // @checkstyle MultipleStringLiterals (6 lines)
        contents.create(
            content("README.md", "readme on master", body).build()
        );
        MatcherAssert.assertThat(
            contents.readme().json().getString("content"),
            Matchers.is(body)
View Full Code Here


    @Test
    public void canFetchReadmeFromBranch() throws Exception {
        final String branch = "branch-1";
        final Contents contents = MkContentsTest.repo().contents();
        final String body = "Readme On Branch";
        contents.create(
            content("README.md", "readme on branch", body)
                .add("ref", branch)
                .build()
        );
        MatcherAssert.assertThat(
View Full Code Here

        final String initial = "initial text";
        final String updated = "updated text";
        final String cont = "content";
        final Contents contents = MkContentsTest.repo().contents();
        MatcherAssert.assertThat(
            contents.create(
                MkContentsTest.content(path, message, initial).build()
            ).json().getString(cont),
            Matchers.is(initial)
        );
        contents.update(
View Full Code Here

        final String path = "file.txt";
        final JsonObject json = MkContentsTest
            .content(path, "theCreateMessage", "newContent")
            .add("committer", MkContentsTest.committer())
            .build();
        contents.create(json);
        final String xpath = "/github/repos/repo/commits/commit";
        MatcherAssert.assertThat(
            storage.xml().nodes(xpath),
            Matchers.<XML>iterableWithSize(1)
        );
View Full Code Here

        final JsonObject content = MkContentsTest
            .content(path, message, initial)
            .add("ref", branch)
            .build();
        MatcherAssert.assertThat(
            new Content.Smart(contents.create(content)).content(),
            Matchers.is(initial)
        );
        contents.update(
            path, MkContentsTest.content(path, message, updated)
                .add("ref", branch).build()
View Full Code Here

    @Test
    public void checkExists() throws Exception {
        final String path = "content-exist.txt";
        final String branch = "rel.08";
        final Contents contents = MkContentsTest.repo().contents();
        contents.create(
            MkContentsTest.content(path, "commit", "content exists")
                .add("ref", branch)
                .build()
        );
        MatcherAssert.assertThat(
View Full Code Here

        final Contents contents = MkContentsTest.repo().contents();
        final JsonObject content = MkContentsTest
            .content(path, message, text)
            .build();
        MatcherAssert.assertThat(
            new Content.Smart(contents.create(content)).content(),
            Matchers.is(text)
        );
        MatcherAssert.assertThat(
            new Content.Smart(contents.get(path)).content(),
            Matchers.is(text)
View Full Code Here

        final Contents contents = repo.contents();
        final JsonObject json = MkContentsTest
            .content(path, "theCreateMessage", "newContent")
            .add("committer", MkContentsTest.committer())
            .build();
        return contents.create(json);
    }

    /**
     * Create content JsonObjectBuilder.
     * @param path Content path
View Full Code Here

     */
    @Test
    public void canGetOwnRepo() throws Exception {
        final Repo repo = MkContentTest.repo();
        final Contents contents = repo.contents();
        final Content content = contents.create(
            jsonContent("repo.txt", "for repo", "json repo")
        );
        MatcherAssert.assertThat(
            content.repo(),
            Matchers.is(repo)
View Full Code Here

     */
    @Test
    public void canGetOwnPath() throws Exception {
        final Contents contents = MkContentTest.repo().contents();
        final String path = "dummy.txt";
        final Content content = contents.create(
            jsonContent(path, "for path", "path test")
        );
        MatcherAssert.assertThat(
            content.path(),
            Matchers.is(path)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.