Package de.undercouch.bson4jackson.types

Examples of de.undercouch.bson4jackson.types.Timestamp


    Pattern p = Pattern.compile(".*", Pattern.CASE_INSENSITIVE |
        Pattern.DOTALL | Pattern.MULTILINE | Pattern.UNICODE_CASE);
    o.put("Regex", p);
   
    Map<?, ?> data = parseBsonObject(o);
    assertEquals(new Timestamp(0xAABB, 0xCCDD), data.get("Timestamp"));
    assertEquals(new de.undercouch.bson4jackson.types.Symbol("Test"), data.get("Symbol"));
    ObjectId oid = (ObjectId)data.get("ObjectId");
    assertEquals(Integer.MAX_VALUE, oid.getTime());
    assertEquals(-2, oid.getMachine());
    assertEquals(Integer.MIN_VALUE, oid.getInc());
View Full Code Here


   * @throws IOException if the timestamp could not be read
   */
  protected Timestamp readTimestamp() throws IOException {
    int inc = _in.readInt();
    int time = _in.readInt();
    return new Timestamp(time, inc);
  }
View Full Code Here

   * Tests {@link BsonTimestampSerializer}
   * @throws Exception if something goes wrong
   */
  @Test
  public void timestamp() throws Exception {
    Timestamp ts = new Timestamp(1, 2);
    org.bson.types.BSONTimestamp rts = (org.bson.types.BSONTimestamp)generateAndParse(ts);
    assertEquals(ts.getTime(), rts.getTime());
    assertEquals(ts.getInc(), rts.getInc());
  }
View Full Code Here

    assertEquals(pattern.flags(), result.flags());
  }

  @Test
  public void timestamps() throws Exception {
    Timestamp timestamp = new Timestamp(100, 200);
    Map<String, Object> data = new LinkedHashMap<String, Object>();
    data.put("timestamp", timestamp);

    BSONObject obj = generateAndParse(data);

    BSONTimestamp result = (BSONTimestamp) obj.get("timestamp");
    assertNotNull(result);
    assertEquals(timestamp.getInc(), result.getInc());
    assertEquals(timestamp.getTime(), result.getTime());
  }
View Full Code Here

TOP

Related Classes of de.undercouch.bson4jackson.types.Timestamp

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.