Search in sources :

Example 1 with KvMongoObjectId

use of com.torodb.kvdocument.values.KvMongoObjectId in project torodb by torodb.

the class TestConvertJson method parse_id.

@Test
public void parse_id() {
    KvDocument doc = parser.createFromResource("_idField.json");
    assertTrue(doc.containsKey("_id"));
    KvValue<?> id = doc.get("_id");
    assertTrue(id instanceof KvMongoObjectId);
    assertEquals("55129FF25916F02D31387E1C", id.toString());
}
Also used : KvDocument(com.torodb.kvdocument.values.KvDocument) KvMongoObjectId(com.torodb.kvdocument.values.KvMongoObjectId) Test(org.junit.Test)

Example 2 with KvMongoObjectId

use of com.torodb.kvdocument.values.KvMongoObjectId in project torodb by torodb.

the class PostgreSqlValueToCopyConverterTest method testMongoObjectId.

@Test
public void testMongoObjectId() {
    KvMongoObjectId mongoObjectIdValue = new ByteArrayKvMongoObjectId(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc });
    mongoObjectIdValue.accept(visitor, sb);
    assertEquals("\\\\x0102030405060708090A0B0C", sb.toString());
}
Also used : ByteArrayKvMongoObjectId(com.torodb.kvdocument.values.heap.ByteArrayKvMongoObjectId) KvMongoObjectId(com.torodb.kvdocument.values.KvMongoObjectId) ByteArrayKvMongoObjectId(com.torodb.kvdocument.values.heap.ByteArrayKvMongoObjectId) Test(org.junit.Test)

Aggregations

KvMongoObjectId (com.torodb.kvdocument.values.KvMongoObjectId)2 Test (org.junit.Test)2 KvDocument (com.torodb.kvdocument.values.KvDocument)1 ByteArrayKvMongoObjectId (com.torodb.kvdocument.values.heap.ByteArrayKvMongoObjectId)1