ObjectResultDataset extends ResultDataset<Object> { @Override public boolean insert(Long entity, String attribute, Object value) { return thrift.insert(entity, attribute, Convert.javaToThrift(value)); } ObjectResultDataset();  ObjectResultDataset(Dataset<Long, String, TObject> thrift); @Override boolean delete(Long entity, String attribute, Object value); @Override Set<Entry<Long, Map<String, Set<Object>>>> entrySet(); @Override boolean equals(Object obj); @Override Set<Object> get(Long entity, String attribute); @Override Map<String, Set<Object>> get(Object entity); @Override int hashCode(); @Override boolean insert(Long entity, String attribute, Object value); @Override Map<String, Map<Object, Set<Long>>> invert(); @Override Map<Object, Set<Long>> invert(String attribute); @Override String toString(); @SuppressWarnings({ "unchecked", "rawtypes" })
    static Comparator<Object> OBJECT_COMPARATOR; }
@Test public void testConvertToComplexTObject() { TObjectResultDataset dataset = new TObjectResultDataset(); dataset.insert(1L, "age", Convert.javaToThrift(100)); ObjectResultDataset expected = new ObjectResultDataset(dataset); ComplexTObject complex = ComplexTObject.fromJavaObject(expected); Map<Long, Map<String, Object>> actual = complex.getJavaObject(); expected.forEach((key, value) -> { Assert.assertTrue(actual.containsKey(key)); Assert.assertTrue(actual.containsValue(value)); }); }
@Test public void testSerialization() { ObjectResultDataset dataset = new ObjectResultDataset( new TObjectResultDataset()); dataset.insert(1L, "name", "Jeff Nelson"); PluginSerializer serializer = new PluginSerializer(); ByteBuffer bytes = serializer.serialize(dataset); ComplexTObject complex = ComplexTObject.fromJavaObject(bytes); ByteBuffer bytes2 = complex.getJavaObject(); Object obj = serializer.deserialize(bytes2); Assert.assertEquals(dataset, obj); }
@Test public void testCacheDeletedAfterDeletingEntity() { ObjectResultDataset dataset = new ObjectResultDataset(); dataset.insert(1L, "name", "Jeff Nelson"); dataset.insert(2L, "name", "Jeff Nelson"); dataset.remove(1L); dataset.forEach((record, data) -> { Assert.assertNotEquals(Long.valueOf(1), record); }); }
@Test public void testRemoveConcurrentModificationExceptionRepro() { ObjectResultDataset dataset = new ObjectResultDataset(); dataset.insert(1L, "name", "Jeff Nelson"); dataset.insert(1L, "age", 29); dataset.insert(1L, "enabled", true); dataset.remove(1L); }