Package javax.json

Examples of javax.json.JsonObject


        Response response = target.resolveTemplate("application", applicationName).
                request(MediaType.APPLICATION_JSON).get(Response.class);
        if (response.getStatus() == 404) {
            return null;
        }
        JsonObject rawStatistics = response.readEntity(JsonObject.class);
        return preprocessEntity(rawStatistics);
    }
View Full Code Here


                resolveTemplate("method", methodName).
                request(MediaType.APPLICATION_JSON).get(Response.class);
        if (response.getStatus() == 404) {
            return null;
        }
        JsonObject rawStatistics = response.readEntity(JsonObject.class);
        return preprocessEntity(rawStatistics);
    }
View Full Code Here

                resolveTemplate("bean", ejbName).
                request(MediaType.APPLICATION_JSON).get(Response.class);
        if (response.getStatus() == 404) {
            return null;
        }
        JsonObject rawStatistics = response.readEntity(JsonObject.class);
        return preprocessEntity(rawStatistics);
    }
View Full Code Here

    JsonObject preprocessEntity(JsonObject entityResource) {
        if (isFailure(entityResource)) {
            return null;
        }
        JsonObject extraProperties = entityResource.getJsonObject("extraProperties");
        return extraProperties.getJsonObject("entity");
    }
View Full Code Here

    JsonObject preprocessChildResource(JsonObject childResource) {
        if (isFailure(childResource)) {
            return null;
        }
        JsonObject extraProperties = childResource.getJsonObject("extraProperties");
        return extraProperties.getJsonObject("childResources");
    }
View Full Code Here

      String jsonData = "{\"firstName\": \"George\", \"lastName\": \"Gastaldi\"}";
      Files.write(tmpFile.toPath(), jsonData.getBytes());
      Resource<File> resource = resourceFactory.create(tmpFile);
      Assert.assertThat(resource, CoreMatchers.instanceOf(JsonResource.class));
      JsonResource jsonResource = resource.reify(JsonResource.class);
      JsonObject jsonObject = jsonResource.getJsonObject();
      Assert.assertNotNull(jsonObject);
      Assert.assertEquals("George", jsonObject.getString("firstName"));
      Assert.assertEquals("Gastaldi", jsonObject.getString("lastName"));
   }
View Full Code Here

   @Test
   public void testJsonResourceDataWriteJsonObject() throws Exception
   {
      File tmpFile = File.createTempFile("parser_json_test", ".json");
      tmpFile.deleteOnExit();
      JsonObject jsonObject = Json.createObjectBuilder().add("firstName", "George").add("lastName", "Gastaldi").build();
      Resource<File> resource = resourceFactory.create(tmpFile);
      Assert.assertThat(resource, CoreMatchers.instanceOf(JsonResource.class));
      JsonResource jsonResource = resource.reify(JsonResource.class);
      jsonResource.setContents(jsonObject);
      jsonObject = jsonResource.getJsonObject();
      Assert.assertNotNull(jsonObject);
      Assert.assertEquals("George", jsonObject.getString("firstName"));
      Assert.assertEquals("Gastaldi", jsonObject.getString("lastName"));
   }
View Full Code Here

            ),
            RtCommitsComparisonTest.repo(),
            "6dcb09b5b57875f334f61aebed695e2e4193db51",
            "6dcb09b5b57875f334f61aebed695e2e4193db52"
        );
        final JsonObject json = comparison.json();
        MatcherAssert.assertThat(
            json.getJsonObject("base_commit"), Matchers.notNullValue()
        );
        MatcherAssert.assertThat(
            json.getJsonArray("commits"), Matchers.notNullValue()
        );
        MatcherAssert.assertThat(
            json.getJsonArray("files"), Matchers.notNullValue()
        );
    }
View Full Code Here

            new ApacheRequest(container.home()),
            release(),
            2
        );
        try {
            final JsonObject json = Json.createObjectBuilder()
                .add("name", "hello").build();
            asset.patch(json);
            final MkQuery query = container.take();
            MatcherAssert.assertThat(
                query.method(), Matchers.equalTo(Request.PATCH)
View Full Code Here

        final String key = System.getProperty("failsafe.github.key");
        Assume.assumeThat(key, Matchers.notNullValue());
        final References refs = repo.git().references();
        final String sha = refs.get("refs/heads/master").json()
            .getJsonObject(object).getString("sha");
        final JsonObject tagger = Json.createObjectBuilder()
            .add("name", "Scott").add("email", "scott@gmail.com")
            .add("date", "2013-06-17T14:53:35-07:00").build();
        try {
            MatcherAssert.assertThat(
                repo.git().tags().create(
View Full Code Here

TOP

Related Classes of javax.json.JsonObject

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.