Package com.baasbox.service.query

Examples of com.baasbox.service.query.PartsLexer$ArrayField


  public void readValueFromArray() throws Exception {

    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3]}";

    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".coll[0]", 1));

    PartsParser pp = new PartsParser(parts);

    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
View Full Code Here


  public void readValueFromNonExistentSimpleField() throws Exception {

    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3]}";

    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".title2", 1));

    PartsParser pp = new PartsParser(parts);

    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
View Full Code Here

  public void readValueFromSimpleField() throws Exception {

    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3]}";

    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".title", 1));

    PartsParser pp = new PartsParser(parts);

    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
View Full Code Here

  public void readValueFromNonExistentArrayMember() throws Exception {

    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3]}";

    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".coll[3]", 1));

    PartsParser pp = new PartsParser(parts);

    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
View Full Code Here

  @Test
  public void setValueToSimpleField() throws Exception{
    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3],\"tags\":[\"one\",\"two\",\"three\"]}";
    String data = "{\"data\":\"title2\"}";
    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".title", 1));

    PartsParser pp = new PartsParser(parts);

    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
View Full Code Here

  @Test
  public void setValueToUnexistingSimpleField() throws Exception{
    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3],\"tags\":[\"one\",\"two\",\"three\"]}";
    String data = "{\"data\":\"title2\"}";
    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".title2", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    JsonTree.write(json, pp, jsonData.get("data"));
View Full Code Here

  @Test
  public void setValueToNestedUnexistingSimpleField() throws Exception{
    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3],\"tags\":[\"one\",\"two\",\"three\"]}";
    String data = "{\"data\":\"t\"}";
    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".title2", 1));
    parts.add(pl.parse(".firstLetter", 2));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
View Full Code Here

  @Test
  public void setValueToArrayAdding() throws Exception{
    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3],\"tags\":[\"one\",\"two\",\"three\"]}";
    String data = "{\"data\":\"4\"}";
    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".coll[3]", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
View Full Code Here

  @Test
  public void setValueToArrayReplacing$Int() throws Exception{
    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3],\"tags\":[\"one\",\"two\",\"three\"]}";
    String data = "{\"data\":10}";
    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".coll[0]", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
View Full Code Here

  @Test
  public void setValueToArrayAdding$Int() throws Exception{
    String content = "{\"@rid\":\"#20:0\",\"@version\":25,\"@class\":\"posts\",\"title\":\"title\",\"content\":\"content\",\"id\":\"a843d3f0-25fb-468c-8452-f14b1f0c6f42\",\"coll\":[1,2,3],\"tags\":[\"one\",\"two\",\"three\"]}";
    String data = "{\"data\":4}";
    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".coll[3]", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
View Full Code Here

TOP

Related Classes of com.baasbox.service.query.PartsLexer$ArrayField

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.