Java Code Examples for org.ojai.Document#set()

The following examples show how to use org.ojai.Document#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestJsonDocumentBuilder.java    From ojai with Apache License 2.0 6 votes vote down vote up
@Test
public void testDocumentPut() {
  Document document = Json.newDocument();
  document.set("recValue1", "string");
  document.set("recValue2", 1);
  Document document2 = Json.newDocument();
  document2.set("val1", true);
  document2.set("val2", 100);
  List<Object> l = new ArrayList<Object>();
  l.add("abcd");
  l.add(false);
  document2.set("list", l);
  document.set("rec", document2);
  DocumentBuilder documentBuilder = Json.newDocumentBuilder();
  documentBuilder.addNewMap();
  documentBuilder.put("document", document);
  documentBuilder.put("rootValue1", 1)
  .put("rootValue2", "2").endMap();
  logger.info(documentBuilder.toString());
}
 
Example 2
Source File: TestJsonDocumentBuilder.java    From ojai with Apache License 2.0 6 votes vote down vote up
@Test
public void testArrayWithinArray() {
  JsonDocumentBuilder w = (JsonDocumentBuilder)Json.newDocumentBuilder();
  w.addNewMap();
  w.putNewArray("array");
  w.add("abcd");
  Document r = Json.newDocument();
  List<Object> l = new ArrayList<Object>();
  l.add(123);
  l.add(456);
  r.set("list", l);
  w.add(r.getValue("list"));
  w.endArray();
  w.endMap();
  r = w.getDocument();
  assertEquals(456, r.getInt("array[1][1]"));
}
 
Example 3
Source File: TestDateTime.java    From ojai with Apache License 2.0 6 votes vote down vote up
@Test
public void testTimes() throws ParseException {
  OTime midnight = new OTime(MIDNIGHT_FEB29TH_2012);
  OTime milliSecondBeforeMidnight = new OTime(MILLIS_BEFORE_MIDNIGHT_FEB29TH_2012);
  Document doc = Json.newDocument();
  doc.set("midnight", midnight);
  doc.set("milliSecondBeforeMidnight", milliSecondBeforeMidnight);

  midnight = doc.getTime("midnight");
  milliSecondBeforeMidnight = doc.getTime("milliSecondBeforeMidnight");
  assertEquals("00:00:00.000", midnight.toString());
  assertEquals("23:59:59.999", milliSecondBeforeMidnight.toString());

  OTime parsedTime = OTime.parse("00:00:00");
  OTime storedTime = doc.getTime("midnight");
  assertEquals(storedTime, parsedTime);

  parsedTime = OTime.parse("23:59:59.999");
  storedTime = doc.getTime("milliSecondBeforeMidnight");
  assertEquals(storedTime, parsedTime);
}
 
Example 4
Source File: TestDateTime.java    From ojai with Apache License 2.0 6 votes vote down vote up
@Test
public void testDates() throws ParseException {
  ODate midnightFeb29th2012 = new ODate(MIDNIGHT_FEB29TH_2012);
  ODate milliSecondBeforeMidnightFeb29th2012 = new ODate(MILLIS_BEFORE_MIDNIGHT_FEB29TH_2012);
  Document doc = Json.newDocument();
  doc.set("midnightFeb29th2012", midnightFeb29th2012);
  doc.set("milliSecondBeforeMidnightFeb29th2012", milliSecondBeforeMidnightFeb29th2012);

  midnightFeb29th2012 = doc.getDate("midnightFeb29th2012");
  milliSecondBeforeMidnightFeb29th2012 = doc.getDate("milliSecondBeforeMidnightFeb29th2012");
  assertEquals("2012-02-29", midnightFeb29th2012.toString());
  assertEquals("2012-02-28", milliSecondBeforeMidnightFeb29th2012.toString());

  assertEquals(doc.getDate("midnightFeb29th2012"), ODate.parse("2012-02-29"));
  assertEquals(doc.getDate("milliSecondBeforeMidnightFeb29th2012"), ODate.parse("2012-02-28"));
}
 
Example 5
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 6 votes vote down vote up
@Test
public void testAsReaderPartial() {
  Document document = Json.newDocument();
  document.set(FIELD_MAP_BYTE, (byte)127);
  document.set("map.num", 12345);
  Map<String, Object> map = new HashMap<String, Object>();
  map.put("first","John");
  map.put("last", "Doe");
  map.put("id", (long)123456789);
  document.set("map.name", map);
  List<Object> mylist = new ArrayList<Object>();
  mylist.add(true);
  mylist.add("string");
  mylist.add(123.456);
  document.set(FIELD_MAP_ARRAY, mylist);
  DocumentReader r = document.asReader("map.name");
  EventType event;
  while ((event = r.next()) != null) {
    if (event == EventType.LONG) {
      assertEquals("id", r.getFieldName());
      assertEquals(123456789, r.getLong());
    }
  }
}
 
Example 6
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 6 votes vote down vote up
@Test
public void testAsReaderLeaf() {
  Document document = Json.newDocument();
  document.set(FIELD_MAP_BYTE, (byte)127);
  document.set("map.num", 12345);
  Map<String, Object> m = new HashMap<String, Object>();
  m.put("first", "John");
  m.put("last", "Doe");
  m.put("age", (short)45);
  document.set("map.info", m);
  DocumentReader myReader = document.asReader("map.info.age");
  EventType event;
  int numtokens = 0;
  while ((event = myReader.next()) != null) {
    if (event == EventType.SHORT) {
      numtokens++;
      assertEquals((short)45, myReader.getShort());
    }
  }
  assertEquals(1, numtokens);
}
 
Example 7
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 6 votes vote down vote up
@Test
public void testJsonList() throws Exception {
  Object[] objArr = new Object[11];
  objArr[0] = null;
  objArr[1] = true;
  objArr[2] = (byte) 127;
  objArr[3] = (short) 32767;
  objArr[4] = 2147483647;
  objArr[5] = (long) 123456789;
  objArr[6] = (float) 3.015625;
  objArr[7] = 1.7976931348623157e308;
  objArr[8] = ODate.parse("2015-12-31");
  objArr[9] = OTime.parse("11:59:59");
  objArr[10] = ByteBuffer.wrap("ola".getBytes());

  List<Object> listOfObjs = Arrays.asList(objArr);
  Document doc = Json.newDocument();
  doc.set("objarray", listOfObjs);
  List<Object> newList = doc.getList("objarray");
  assertEquals(newList, listOfObjs);
  assertEquals(listOfObjs, newList);
}
 
Example 8
Source File: TestJsonDocumentEquals.java    From ojai with Apache License 2.0 5 votes vote down vote up
@Test
public void testDocumentEquals() throws IOException {
  String fieldPath = "`a|b`.`c,''-\\\"d`.` a!\\`#$%&'()*+,-/:;<=>?@`.`[]^_{|}~`";
  FieldPath fp = FieldPath.parseFrom(fieldPath);
  Document d1 = Json.newDocument();
  d1.set(fp, 10);
  Document d2 = Json.newDocument();
  d2.set(fp, 10);
  assertEquals(d1, d2);
}
 
Example 9
Source File: TestJsonUtil.java    From ojai with Apache License 2.0 5 votes vote down vote up
@Test
public void testValuesAsJsonString() {
  Document r = Json.newDocument();
  r.set("a", (long)1234);
  r.set("b", ODate.parse("2011-09-15"));

  assertEquals("{\"$numberLong\":1234}", Values.asJsonString(r.getValue("a")));
}
 
Example 10
Source File: TestJsonDocumentBuilder.java    From ojai with Apache License 2.0 5 votes vote down vote up
@Test
public void testDocumentAdd() {
  Map<String, Object> map = new LinkedHashMap<String, Object>();

  map.put("null", null);
  map.put("boolean", true);
  map.put("string", "eureka");
  List<Object> l = new ArrayList<Object>();
  l.add("test1");
  Map<String, Object> m2 = new LinkedHashMap<String, Object>();
  m2.put("int", 32900);
  l.add(m2);
  l.add(Long.valueOf("9223372036854775807").longValue());
  l.add(new BigDecimal(7126353.167263));
  map.put("array", l);

  Document innerDocument = Json.newDocument();
  innerDocument.set("map", map);

  //assert on integer field inside innerDocument
  assertEquals(32900, innerDocument.getInt("map.array[1].int"));

  JsonDocumentBuilder builder = (JsonDocumentBuilder)Json.newDocumentBuilder();
  builder.addNewMap();
  builder.putNewMap("map");
  builder.putNewArray("array");
  builder.add(innerDocument);
  builder.add(true);
  builder.endArray();
  builder.endMap();
  builder.endMap();

  Document rec = builder.getDocument();
  //rerun assert on built document
  assertEquals(32900, rec.getInt("map.array[0].map.array[1].int"));
  logger.info(builder.asUTF8String());
}
 
Example 11
Source File: TestJsonDocumentBuilder.java    From ojai with Apache License 2.0 5 votes vote down vote up
@Test
public void testArrayAndMapWithinMap() {
  JsonDocumentBuilder w = (JsonDocumentBuilder)Json.newDocumentBuilder();
  w.addNewMap();
  w.putNewArray("array");
  w.add("abcd");
  Document r = Json.newDocument();
  List<Object> l = new ArrayList<Object>();
  l.add(123);
  l.add(456);
  r.set("list", l);
  w.add(r.getValue("list"));
  w.endArray();
  Map<String, Object> m = new HashMap<String, Object>();
  Map<String, Object> m2 = new HashMap<String, Object>();
  m2.put("a1", true);
  m2.put("a2", 11.456);
  List<Object> ll = new ArrayList<Object>();
  ll.add(new BigDecimal(111.11111));
  m2.put("arr2",ll);
  m.put("a3", 5555);
  m.put("map", m2);
  w.put("f", m);
  w.endMap();
  r = w.getDocument();

  assertEquals(5555, r.getInt("f.a3"));
  assertEquals(true, r.getBoolean("f.map.a1"));

}
 
Example 12
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetMap() {
  Document document = Json.newDocument();
  Map<String, Object> map = new HashMap<String, Object>();
  map.put("a", 1);
  map.put("b", "A");
  document.set("map", map);
  assertEquals(map, document.getMap("map"));
}
 
Example 13
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetBooleanArray() {
  Document document = Json.newDocument();
  document.set(FIELD_MAP_INT, 111);
  boolean[] boolArray = new boolean[3];
  boolArray[0] = true;
  boolArray[1] = false;
  boolArray[2] = true;
  document.setArray("map.boolarray", boolArray);

  assertEquals(false, document.getBoolean("map.boolarray[1]"));
  assertEquals(true, document.getBoolean("map.boolarray[2]"));
}
 
Example 14
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 5 votes vote down vote up
@Test
public void testDateWithIntegerMaxMin() {
  Document doc = Json.newDocument();
  ODate d1 = new ODate(Integer.MAX_VALUE);
  ODate d2 = new ODate(Integer.MIN_VALUE);
  doc.set("maxdate", d1);
  doc.set("boolean", false);
  doc.set("mindate", d2);

  logger.info("{}", d1);
  logger.info("{}", doc.getDate("maxdate"));

  assertEquals(true, doc.getValue("maxdate").equals(d1));
  assertEquals(true, doc.getValue("mindate").equals(d2));
}
 
Example 15
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 5 votes vote down vote up
@Test
public void testDate() {
  Document doc = Json.newDocument();
  doc.set("d1", ODate.parse("2005-06-22"));
  ODate d = new ODate(new java.util.Date());
  doc.set("d2", d);
  logger.info("{}", doc.getDate("d1"));
  logger.info("{}", doc.getDate("d2"));

  assertEquals(true, doc.getDate("d1").toString().equals("2005-06-22"));
  assertEquals(true, doc.getDate("d2").toString().equals(d.toString()));
}
 
Example 16
Source File: MapRJsonDocumentLoader.java    From datacollector with Apache License 2.0 4 votes vote down vote up
/**
 * Map mode
 */
private void writeFieldToDocumentMap(Document doc, Field field, String name) throws IOException {
  if (field.getValue() == null) {
    // On the Map mode just set the null on the document using the name.
    doc.setNull(name);
  } else {
    switch (field.getType()) {
      case FILE_REF:
        throw new IOException("Cannot serialize FileRef fields.");
      case MAP:
      case LIST_MAP:
        Document newDoc = loader.createNewEmptyDocument();
        Map<String, Field> map = field.getValueAsMap();
        for (Map.Entry<String, Field> fieldEntry : map.entrySet()) {
          String fieldName = fieldEntry.getKey();
          Field newField = fieldEntry.getValue();
          // recursive call in map mode.
          writeFieldToDocumentMap(newDoc, newField, fieldName);
        }
        // Map the new doc
        doc.set(name, newDoc);
        break;
      case LIST:
        List<Field> listOfFields = field.getValueAsList();
        List<Object> objsList = new ArrayList<>();
        for (Field f : listOfFields) {
          // recursive call in a list mode.
          writeFieldToDocumentList(f, objsList);
        }
        doc.setArray(name, objsList.toArray());
        break;
      case BOOLEAN:
        doc.set(name, field.getValueAsBoolean());
        break;
      case CHAR:
        doc.set(name, String.valueOf(field.getValueAsChar()));
        break;
      case BYTE:
        doc.set(name, new byte[]{field.getValueAsByte()});
        break;
      case SHORT:
        doc.set(name, field.getValueAsShort());
        break;
      case INTEGER:
        doc.set(name, field.getValueAsInteger());
        break;
      case LONG:
        doc.set(name, field.getValueAsLong());
        break;
      case FLOAT:
        doc.set(name, field.getValueAsFloat());
        break;
      case DOUBLE:
        doc.set(name, field.getValueAsDouble());
        break;
      case DATE:
        doc.set(name, field.getValueAsDate().getTime());
        break;
      case DATETIME:
        doc.set(name, field.getValueAsDatetime().getTime());
        break;
      case TIME:
        doc.set(name, field.getValueAsTime().getTime());
        break;
      case DECIMAL:
        doc.set(name, field.getValueAsDecimal());
        break;
      case STRING:
      case ZONED_DATETIME:
        doc.set(name, field.getValueAsString());
        break;
      case BYTE_ARRAY:
        doc.set(name, field.getValueAsByteArray());
        break;
      default:
        throw new IllegalStateException(String.format("Unrecognized field type (%s) in field: %s",
            field.getType().name(),
            field.toString()
        ));
    }
  }
}
 
Example 17
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 4 votes vote down vote up
@Test
public void testAsReaderFull() {
  Document document = Json.newDocument();
  document.set(FIELD_MAP_BYTE, (byte)127);
  document.set(FIELD_MAP_LONG, 123456789L);
  Map<String, Object> map = new LinkedHashMap<String, Object>();
  map.put("first","John");
  map.put("last", "Doe");
  document.set("map.name", map);
  List<Object> mylist = new ArrayList<Object>();
  mylist.add(true);
  mylist.add("string");
  mylist.add(123.456);
  document.set(FIELD_MAP_ARRAY, mylist);

  DocumentReader r = document.asReader();
  EventType et = null;
  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.START_MAP, et);

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.START_MAP, et);
  assertEquals("map", r.getFieldName());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.BYTE, et);
  assertEquals("byte", r.getFieldName());
  assertEquals(127, r.getByte());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.LONG, et);
  assertEquals("long", r.getFieldName());
  assertEquals(123456789, r.getLong());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.START_MAP, et);
  assertEquals("name", r.getFieldName());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.STRING, et);
  assertEquals("first", r.getFieldName());
  assertEquals("John", r.getString());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.STRING, et);
  assertEquals("last", r.getFieldName());
  assertEquals("Doe", r.getString());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.END_MAP, et);
  assertEquals("name", r.getFieldName());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.START_ARRAY, et);
  assertEquals("array", r.getFieldName());

  assertTrue((et = r.next()) != null);
  assertTrue(!r.inMap());
  assertEquals(EventType.BOOLEAN, et);
  assertEquals(0, r.getArrayIndex());
  assertEquals(true, r.getBoolean());

  assertTrue((et = r.next()) != null);
  assertTrue(!r.inMap());
  assertEquals(EventType.STRING, et);
  assertEquals(1, r.getArrayIndex());
  assertEquals("string", r.getString());

  assertTrue((et = r.next()) != null);
  assertTrue(!r.inMap());
  assertEquals(EventType.DOUBLE, et);
  assertEquals(2, r.getArrayIndex());
  assertEquals(123.456, r.getDouble(), 0.000001);

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.END_ARRAY, et);
  assertEquals("array", r.getFieldName());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.END_MAP, et);
  assertEquals("map", r.getFieldName());

  assertTrue((et = r.next()) != null);
  assertTrue(r.inMap());
  assertEquals(EventType.END_MAP, et);
  assertNull(r.getFieldName());
}
 
Example 18
Source File: TestJsonDocument.java    From ojai with Apache License 2.0 4 votes vote down vote up
@Test
public void testAllTypes() {
  Document rec = Json.newDocument();
  rec.set("map.field1", (byte) 100);
  rec.set("map.field2", (short) 10000);
  rec.set("map.longfield2verylongverylong", 12.345678);
  rec.set("FIELD2", "VERY LONG STRING IS THIS YOU KNOW");

  rec.set("map2.field1", (byte) 100);
  rec.set("map2.field2", (short) 10000);
  rec.set("map2.longfield2verylongverylong", 12.345678);
  rec.set("FIELD3", "VERY LONG STRING IS THIS YOU KNOW");
  Map<String, Object> map = new HashMap<String, Object>();
  map.put("Name", "Anurag");
  map.put("Age", 20);
  rec.set("newmap.map", map);

  rec.set(FIELD_MAP_BOOLEAN, false);
  rec.set(FIELD_MAP_STRING, "string");
  rec.set(FIELD_MAP_BYTE, (byte) 100);
  rec.set(FIELD_MAP_SHORT, (short) 10000);
  rec.set(FIELD_MAP_INT, 50000);
  rec.set(FIELD_MAP_LONG, 12345678999L);
  rec.set(FIELD_MAP_FLOAT, 10.1234f);
  rec.set(FIELD_MAP_DOUBLE, 10.12345678910d);
  // rec.set("map.interval", new Interval(1000, 2000));
  rec.set(FIELD_MAP_DECIMAL, new BigDecimal("1000000000.11111111111111111111"));
  byte[] bytes = new byte[5];
  for (int i = 0; i < bytes.length; ++i) {
    bytes[i] = (byte) i;
  }
  rec.set("map.binary1", bytes);
  rec.set("map.binary2", bytes, 1, 3);
  ByteBuffer bbuf = ByteBuffer.allocate(100);
  for (int i = 0; i < bbuf.capacity(); ++i) {
    bbuf.put((byte) i);
  }
  rec.set("map.binary3", bbuf);

  map = new HashMap<String, Object>();
  map.put("Name", "Anurag");
  map.put("Age", 20);
  List<Integer> scores = new ArrayList<Integer>();
  scores.add(100);
  scores.add(200);
  scores.add(300);
  scores.add(400);
  // map.put("Score", scores);
  rec.set("map.map", map);

  List<Object> values = new ArrayList<Object>();
  values.add("Field1");
  values.add(new Integer(500));
  values.add(new Double(5555.5555));
  rec.set("map.list", values);

  assertEquals(rec.getValue("map").getType(), Type.MAP);
  assertEquals(rec.getBoolean(FIELD_MAP_BOOLEAN), false);
  assertEquals(rec.getString(FIELD_MAP_STRING), "string");
  assertEquals(rec.getByte(FIELD_MAP_BYTE), (byte) 100);
  assertEquals(rec.getShort(FIELD_MAP_SHORT), (short) 10000);
  assertEquals(rec.getInt(FIELD_MAP_INT), 50000);
  assertEquals(rec.getLong(FIELD_MAP_LONG), 12345678999L);
  assertEquals(rec.getFloat(FIELD_MAP_FLOAT), (float) 10.1234, 0.0);
  assertEquals(rec.getDouble(FIELD_MAP_DOUBLE), 10.12345678910d, 0.0);
  // assertEquals(rec.getInterval("map.interval"), new Interval(1000, 2000));
  assertEquals(rec.getDecimal(FIELD_MAP_DECIMAL), new BigDecimal(
      "1000000000.11111111111111111111"));

  java.nio.ByteBuffer readBuf;
  readBuf = rec.getBinary("map.binary1");
  for (int i = 0; i < bytes.length; ++i) {
    assertEquals(readBuf.get(i), bytes[i]);
  }

  readBuf = rec.getBinary("map.binary2");
  for (int i = 0; i < 3; ++i) {
    assertEquals(readBuf.get(), bytes[1 + i]);
  }
  readBuf = rec.getBinary("map.binary3");
  assertEquals(readBuf, bbuf);

  try {
    List<Object> l = rec.getValue("map.list").getList();
    assertEquals(values, l);
  } catch (Exception e) {
    logger.error("Exception from list test " + e.getMessage());
  }
}
 
Example 19
Source File: TestJsonDocumentEquals.java    From ojai with Apache License 2.0 4 votes vote down vote up
@Test
public void testFieldsEquals() {
  Document rec = Json.newDocument();
  rec.set("map.field1", (byte) 100);
  rec.set("map.field2", (short) 10000);
  rec.set("map.string", "eureka");
  rec.set("map.boolean", false);
  rec.set("map.date", ODate.parse("2013-02-12"));
  OTime time = OTime.parse("07:42:46");
  rec.set("map.time", time);
  OTimestamp timeStamp = OTimestamp.parse("2012-10-20T07:42:46");
  rec.set("map.timestamp", timeStamp);
  rec.set("map.int", 12345678);
  byte[] byteArray = "abracadabra".getBytes();
  rec.set("map.bytearray", byteArray);
  rec.setNull("map.null");

  Map<String, Object> m = new HashMap<String, Object>();
  m.put("a", 500);
  m.put("b", "abcd");
  List<Object> newlist = new ArrayList<Object>();
  newlist.add("aaaaa");
  newlist.add(1234567.89);
  m.put("c",newlist);
  rec.set("map2", m);

  List<Object> l = new ArrayList<Object>();
  l.add(12345.678901);
  l.add("abracadabra");

  Map<String, Object> m2 = new HashMap<String, Object>();
  m2.put("a1", 111);
  m2.put("b1", false);
  l.add(m2);

  rec.set("list1", l);

  Document rec2 = rec;
  assertEquals(true, rec2.equals(rec));

  Value stringValue = rec.getValue("map.string");
  assertEquals(true, stringValue.equals("eureka"));

  byte b = rec.getByte("map.field1");
  assertEquals(true, rec.getValue("map.field1").equals(b));

  Byte bite = new Byte(b);
  assertEquals(true, bite.equals(rec.getByte("map.field1")));

  short s = rec.getShort("map.field2");
  assertEquals(true, rec.getValue("map.field2").equals(s));

  assertEquals(true, rec.getValue("map.field2").equals(JsonValueBuilder.initFrom(s)));

  assertEquals(true, rec.getValue("map.boolean").equals(false));

  assertEquals(true, rec.getValue("map.date").equals(ODate.parse("2013-02-12")));

  assertEquals(true, rec.getValue("map2").equals(m));

  int x = rec.getInt("map.int");
  assertEquals(true, rec.getValue("map.int").equals(x));

  assertEquals(true, rec.getList("list1").equals(l));

  assertEquals(true, rec.getValue("map.time").equals(time));

  assertEquals(true, rec.getValue("map.timestamp").equals(timeStamp));

  assertEquals(true, rec.getValue("map.bytearray").equals(ByteBuffer.wrap(byteArray)));

  Value myValue;
  myValue = rec.getValue("map.date");
  assertEquals(true, rec.getValue("map.date").equals(myValue));

  myValue = rec.getValue("map.time");
  assertEquals(true, rec.getValue("map.time").equals(myValue));

  myValue = rec.getValue("map.timestamp");
  assertEquals(true, rec.getValue("map.timestamp").equals(myValue));

  myValue = rec.getValue("list1");
  assertEquals(true,rec.getValue("list1").equals(myValue));

  myValue = rec.getValue("map2");
  assertEquals(true,rec.getValue("map2").equals(myValue));

  Value nval = rec.getValue("map.null");
  assertEquals(true, rec.getValue("map.null").equals(nval));

  Document r1 = Json.newDocument();
  Document r2 = Json.newDocument();
  Document r3 = Json.newDocument();
  r1.setNull("a");
  r2.setNull("a");
  r3.setNull("b");
  assertEquals(true, r1.equals(r2));
  assertEquals(false, r1.equals(r3));

}