Examples of JsonStructure


Examples of javax.json.JsonStructure

            builder = builder.add(
                file.getKey(),
                Json.createObjectBuilder().add("content", file.getValue())
            );
        }
        final JsonStructure json = Json.createObjectBuilder()
            .add("files", builder)
            .add("public", visible)
            .build();
        return this.get(
            this.request.method(Request.POST)
View Full Code Here

Examples of javax.json.JsonStructure

        @NotNull(message = "body can't be NULL") final String body,
        @NotNull(message = "commit can't be NULL") final String commit,
        @NotNull(message = "path can't be NULL") final String path,
        final int position
    ) throws IOException {
        final JsonStructure json = Json.createObjectBuilder()
            // @checkstyle MultipleStringLiterals (4 line)
            .add("body", body)
            .add("commit_id", commit)
            .add("path", path)
            .add("position", position)
View Full Code Here

Examples of javax.json.JsonStructure

    @NotNull(message = "pull comment is never NULL")
    public PullComment reply(
        @NotNull(message = "text can't be NULL") final String body,
        @NotNull(message = "comment can't be NULL") final int comment
    ) throws IOException {
        final JsonStructure json = Json.createObjectBuilder()
            .add("body", body)
            .add("in_reply_to", comment)
            .build();
        return this.get(
            this.request.method(Request.POST)
View Full Code Here

Examples of javax.json.JsonStructure

    @Override
    @NotNull(message = "Content can't be NULL")
    public Content readme(
        @NotNull(message = "branch can't be NULL") final String branch
    ) throws IOException {
        final JsonStructure json = Json.createObjectBuilder()
            .add("ref", branch)
            .build();
        return new RtContent(
            this.entry, this.owner,
            this.entry.uri()
View Full Code Here

Examples of javax.json.JsonStructure

    public Pull create(
        @NotNull(message = "pull title is never NULL") final String title,
        @NotNull(message = "head is never NULL") final String head,
        @NotNull(message = "base is never NULL") final String base)
        throws IOException {
        final JsonStructure json = Json.createObjectBuilder()
            .add("title", title)
            .add("head", head)
            .add("base", base)
            .build();
        return this.get(
View Full Code Here

Examples of javax.json.JsonStructure

            .close();
       
        final String str = writer.toString();
        writer.close();
       
        final JsonStructure obj = provider.readFrom(JsonStructure.class, null, null, null, null,
            new ByteArrayInputStream(str.getBytes()));
       
        assertThat(obj, instanceOf(JsonObject.class));
        assertThat(((JsonObject)obj).getString("firstName"), equalTo("Tom"));
        assertThat(((JsonObject)obj).getString("lastName"), equalTo("Tommyknocker"));
View Full Code Here

Examples of javax.json.JsonStructure

            .write("Tom")
            .write("Tommyknocker")
            .writeEnd()
            .close();
       
        final JsonStructure obj = provider.readFrom(JsonStructure.class, null, null, null, null,
            new ByteArrayInputStream(writer.toString().getBytes()));
       
        assertThat(obj, instanceOf(JsonArray.class));
        assertThat(((JsonArray)obj).getString(0), equalTo("Tom"));
        assertThat(((JsonArray)obj).getString(1), equalTo("Tommyknocker"));
View Full Code Here

Examples of javax.json.JsonStructure

                    }
                }
                jsonReader = Json.createReader(new InputStreamReader(inputStream));
            }
            if (jsonReader != null) {
                JsonStructure structure = jsonReader.read();
                parseRoot(structure);
            }

            if (null != inputStream) {
                inputStream.close();
View Full Code Here

Examples of javax.json.JsonStructure

      WebTarget target = client.target(generateURL("/test/json/structure"));
      String json = target.request().post(Entity.json("{ \"name\" : \"Bill\" }"), String.class);
      System.out.println(json);

      JsonObject obj = Json.createObjectBuilder().add("name", "Bill").build();
      JsonStructure structure = target.request().post(Entity.json(obj), JsonStructure.class);
      obj = (JsonObject)structure;
      Assert.assertTrue(obj.containsKey("name"));
      Assert.assertEquals(obj.getJsonString("name").getString(), "Bill");

   }
View Full Code Here

Examples of javax.json.JsonStructure

                    }
                }
                jsonReader = Json.createReader(new InputStreamReader(inputStream));
            }
            if (jsonReader != null) {
                JsonStructure structure = jsonReader.read();
                parseRoot(structure);
            }

            if (null != inputStream) {
                inputStream.close();
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.