@Test public void testMongoEntityConvert() { HashMap<String, Object> body = new HashMap<String, Object>(); body.put("field1", "field1"); body.put("field2", "field2"); HashMap<String, Object> meta = new HashMap<String, Object>(); meta.put("meta1", "field1"); meta.put("meta2", "field2"); MongoEntity e = new MongoEntity("collection", UUID.randomUUID().toString(), body, meta); DBObject d = converter.convert(e); Assert.assertNotNull(d); assertSame(body, (Map<?, ?>) d.get("body")); assertSame(meta, (Map<?, ?>) d.get("metaData")); Assert.assertEquals(1, encryptCalls.size()); Assert.assertEquals(2, encryptCalls.get(0).length); Assert.assertEquals(e.getType(), encryptCalls.get(0)[0]); Assert.assertEquals(e.getBody(), encryptCalls.get(0)[1]); }
@Override public DBObject convert(Entity e) { MongoEntity me; if (e instanceof MongoEntity) { me = (MongoEntity) e; } else { me = new MongoEntity(e.getType(), e.getEntityId(), e.getBody(), e.getMetaData(), e.getCalculatedValues(), e.getAggregates()); } if (encrypt != null) { me.encrypt(encrypt); } return me.toDBObject(uuidGeneratorStrategy, naturalKeyExtractor); }
EntityWriteConverter implements Converter<Entity, DBObject> { @Override public DBObject convert(Entity e) { MongoEntity me; if (e instanceof MongoEntity) { me = (MongoEntity) e; } else { me = new MongoEntity(e.getType(), e.getEntityId(), e.getBody(), e.getMetaData(), e.getCalculatedValues(), e.getAggregates()); } if (encrypt != null) { me.encrypt(encrypt); } return me.toDBObject(uuidGeneratorStrategy, naturalKeyExtractor); } }
EntityWriteConverter implements Converter<Entity, DBObject> { @Override public DBObject convert(Entity e) { MongoEntity me; if (e instanceof MongoEntity) { me = (MongoEntity) e; } else { me = new MongoEntity(e.getType(), e.getEntityId(), e.getBody(), e.getMetaData(), e.getCalculatedValues(), e.getAggregates()); } if (encrypt != null) { me.encrypt(encrypt); } return me.toDBObject(uuidGeneratorStrategy, naturalKeyExtractor); }  }
EntityWriteConverter implements Converter<Entity, DBObject> { @Override public DBObject convert(Entity e) { MongoEntity me; if (e instanceof MongoEntity) { me = (MongoEntity) e; } else { me = new MongoEntity(e.getType(), e.getEntityId(), e.getBody(), e.getMetaData(), e.getCalculatedValues(), e.getAggregates()); } if (encrypt != null) { me.encrypt(encrypt); } return me.toDBObject(uuidGeneratorStrategy, naturalKeyExtractor); }  @Override DBObject convert(Entity e); }
EntityWriteConverter implements Converter<Entity, DBObject> { @Override public DBObject convert(Entity e) { MongoEntity me; if (e instanceof MongoEntity) { me = (MongoEntity) e; } else { me = new MongoEntity(e.getType(), e.getEntityId(), e.getBody(), e.getMetaData(), e.getCalculatedValues(), e.getAggregates()); } if (encrypt != null) { me.encrypt(encrypt); } return me.toDBObject(uuidGeneratorStrategy, naturalKeyExtractor); }  @Override DBObject convert(Entity e);  }