Package com.jcabi.http.request

Examples of com.jcabi.http.request.ApacheRequest


    @Test
    public void sendHttpRequest() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"body\":\"hi\"}")
        ).start();
        final RtJson json = new RtJson(new ApacheRequest(container.home()));
        MatcherAssert.assertThat(
            json.fetch().getString("body"),
            Matchers.equalTo("hi")
        );
        container.stop();
View Full Code Here


    @Test
    public void executePatchRequest() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"body\":\"hj\"}")
        ).start();
        final RtJson json = new RtJson(new ApacheRequest(container.home()));
        json.patch(
            Json.createObjectBuilder()
                .add("content", "hi you!")
                .build()
        );
View Full Code Here

            new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT, "")
        ).start();
        final Repo repo = repo();
        final Issue issue = repo.issues().create("testing3", "issue3");
        final RtComment comment = new RtComment(
            new ApacheRequest(container.home()), issue, 10
        );
        try {
            comment.remove();
            final MkQuery query = container.take();
            MatcherAssert.assertThat(
View Full Code Here

            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, body)
        ).start();
        final Repo repo = repo();
        final Issue issue = repo.issues().create("testing4", "issue4");
        final RtComment comment = new RtComment(
            new ApacheRequest(container.home()), issue, 10
        );
        try {
            final JsonObject json = comment.json();
            MatcherAssert.assertThat(
                json.getString("body"),
View Full Code Here

            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "")
        ).start();
        final Repo repo = repo();
        final Issue issue = repo.issues().create("testing5", "issue5");
        final RtComment comment = new RtComment(
            new ApacheRequest(container.home()), issue, 10
        );
        final JsonObject jsonPatch = Json.createObjectBuilder()
            .add("title", "test comment").build();
        try {
            comment.patch(jsonPatch);
View Full Code Here

            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "")
        ).start();
        final Repo repo = repo();
        final Issue issue = repo.issues().create("testing6", "issue6");
        final RtComment comment = new RtComment(
            new ApacheRequest(container.home()), issue, 10
        );
        try {
            final String stringComment = comment.toString();
            MatcherAssert.assertThat(
                stringComment, Matchers.not(Matchers.isEmptyOrNullString())
View Full Code Here

            )
        ).start();
        try {
            final Organizations orgs = new RtOrganizations(
                new MkGithub(),
                new ApacheRequest(container.home()),
                Mockito.mock(User.class)
            );
            MatcherAssert.assertThat(
                orgs.iterate(),
                Matchers.<Organization>iterableWithSize(3)
View Full Code Here

            )
        ).start();
        try {
            final Organizations orgs = new RtOrganizations(
                new MkGithub(),
                new ApacheRequest(container.home()),
                Mockito.mock(User.class)
            );
            final String username = "octopus";
            MatcherAssert.assertThat(
                orgs.iterate(username),
View Full Code Here

            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "")
        ).start();
        try {
            final Organizations orgs = new RtOrganizations(
                new MkGithub(),
                new ApacheRequest(container.home()),
                Mockito.mock(User.class)
            );
            MatcherAssert.assertThat(
                orgs.get("org"),
                Matchers.notNullValue()
View Full Code Here

                HttpURLConnection.HTTP_CREATED,
                "{\"sha\":\"0abcd89jcabitest\"}"
            )
        ).start();
        final Commits commits = new RtCommits(
            new ApacheRequest(container.home()),
            repo()
        );
        final JsonObject author = Json.createObjectBuilder()
            .add("name", "Scott").add("email", "scott@gmail.com")
            .add("date", "2011-06-17T14:53:35-07:00").build();
View Full Code Here

TOP

Related Classes of com.jcabi.http.request.ApacheRequest

Copyright © 2018 www.massapicom. 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.