Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonNode.path()


    Part last = pp.last();
   
    if(last instanceof PartsLexer.ArrayField){
      PartsLexer.ArrayField arr = (PartsLexer.ArrayField)last;
      int index = arr.arrayIndex;
      root = root.path(last.getName());
      ArrayNode arrNode = (ArrayNode)root;
      if(arrNode.size()<=index){
        arrNode.add(data);
      }else{
        arrNode.set(index, data);
View Full Code Here


                req = req.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(USER, USER));
                req = req.withJsonBody(node);
                Result result = routeAndCall(req);
                String resultString = contentAsString(result);
                JsonNode resp = Json.mapper().readTree(resultString);
                assertTrue(resp.path("data").path("exists").asBoolean());

            } catch (Exception  e){
                fail(ExceptionUtils.getStackTrace(e));
            }
        });
View Full Code Here

                ObjectNode params = mapper.createObjectNode();
                params.put("username",sTestUser);
                cmd.put(ScriptCommand.PARAMS,params);
                JsonNode exec  = CommandRegistry.execute(cmd,null);
                assertTrue(exec.isObject());
                assertEquals(sTestUser, exec.path("user").path("name").asText());
                assertNotNull(exec.get("visibleByTheUser"));
                assertNotNull(exec.get("visibleByAnonymousUsers"));
                assertNotNull(exec.get("visibleByRegisteredUsers"));
                assertNotNull(exec.get("visibleByFriends"));
            }catch (Throwable e){
View Full Code Here

                put.withJsonBody(user,PUT);
                Result invoke = routeAndCall(put);
                String s = contentAsString(invoke);
                JsonNode body = mapper.readTreeOrMissing(s);
                assertEquals("ok",body.get("result").asText());
                assertEquals(sRandUsers.first(),body.path("data").path("user").path("name").asText());
                assertNotNull(body.path("data").path("user").path("visibleByFriends"));

                FakeRequest delete = new FakeRequest(DELETE,endpoint);
                delete.withHeader(TestConfig.KEY_APPCODE,TestConfig.VALUE_APPCODE);
                delete.withHeader(TestConfig.KEY_AUTH,TestConfig.encodeAuth(sTestUser,sTestUser));
View Full Code Here

                Result invoke = routeAndCall(put);
                String s = contentAsString(invoke);
                JsonNode body = mapper.readTreeOrMissing(s);
                assertEquals("ok",body.get("result").asText());
                assertEquals(sRandUsers.first(),body.path("data").path("user").path("name").asText());
                assertNotNull(body.path("data").path("user").path("visibleByFriends"));

                FakeRequest delete = new FakeRequest(DELETE,endpoint);
                delete.withHeader(TestConfig.KEY_APPCODE,TestConfig.VALUE_APPCODE);
                delete.withHeader(TestConfig.KEY_AUTH,TestConfig.encodeAuth(sTestUser,sTestUser));
                delete.withHeader(HTTP.CONTENT_TYPE,MediaType.APPLICATION_JSON);
View Full Code Here

                delete.withJsonBody(user,DELETE);
                Result dinvoke = routeAndCall(delete);
                String ds = contentAsString(dinvoke);

                JsonNode dbody = mapper.readTreeOrMissing(ds);
                assertTrue(dbody.path("data").asBoolean(false));

            }catch (Throwable e){
                fail(ExceptionUtils.getFullStackTrace(e));
            } finally {
                DbHelper.close(DbHelper.getConnection());
View Full Code Here

                req = req.withHeader(TestConfig.KEY_APPCODE,TestConfig.VALUE_APPCODE)
                         .withHeader(TestConfig.KEY_AUTH,TestConfig.AUTH_ADMIN_ENC);
                Result res = routeAndCall(req);
                JsonNode result = Json.mapper().readTree(contentAsString(res));
                JsonNode data = result.path("data");
                assertTrue(data.path("integer").isIntegralNumber());
                assertTrue(data.path("double").isDouble());
                assertTrue(data.path("text").isTextual());
                assertTrue(data.path("obj").isObject());
                assertTrue(data.path("ary").isArray());
                assertTrue(data.path("no").isNull());
View Full Code Here

                         .withHeader(TestConfig.KEY_AUTH,TestConfig.AUTH_ADMIN_ENC);
                Result res = routeAndCall(req);
                JsonNode result = Json.mapper().readTree(contentAsString(res));
                JsonNode data = result.path("data");
                assertTrue(data.path("integer").isIntegralNumber());
                assertTrue(data.path("double").isDouble());
                assertTrue(data.path("text").isTextual());
                assertTrue(data.path("obj").isObject());
                assertTrue(data.path("ary").isArray());
                assertTrue(data.path("no").isNull());
                assertTrue(data.path("date").asText().startsWith(Year.now().toString()));
View Full Code Here

                Result res = routeAndCall(req);
                JsonNode result = Json.mapper().readTree(contentAsString(res));
                JsonNode data = result.path("data");
                assertTrue(data.path("integer").isIntegralNumber());
                assertTrue(data.path("double").isDouble());
                assertTrue(data.path("text").isTextual());
                assertTrue(data.path("obj").isObject());
                assertTrue(data.path("ary").isArray());
                assertTrue(data.path("no").isNull());
                assertTrue(data.path("date").asText().startsWith(Year.now().toString()));
                assertEquals("custom", data.path("custom").path("val").asText());
View Full Code Here

                JsonNode result = Json.mapper().readTree(contentAsString(res));
                JsonNode data = result.path("data");
                assertTrue(data.path("integer").isIntegralNumber());
                assertTrue(data.path("double").isDouble());
                assertTrue(data.path("text").isTextual());
                assertTrue(data.path("obj").isObject());
                assertTrue(data.path("ary").isArray());
                assertTrue(data.path("no").isNull());
                assertTrue(data.path("date").asText().startsWith(Year.now().toString()));
                assertEquals("custom", data.path("custom").path("val").asText());
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.