map = fetchMap(mapBucketType, bucketName, key);
assertEquals(3, map.view().size());
assertNotNull(map.view().get(mapKey));
assertEquals(1, map.view().get(mapKey).size());
assertTrue(map.view().get(mapKey).get(0).isFlag());
RiakFlag flag = map.view().get(mapKey).get(0).getAsFlag();
assertTrue(flag.getEnabled());
mapKey = BinaryValue.create("register");
update = new DtUpdateOperation.Builder(location)
.withOp(new MapOp().update(mapKey, new RegisterOp(mapKey)))
.build();
cluster.execute(update);
update.get();
map = fetchMap(mapBucketType, bucketName, key);
assertEquals(4, map.view().size());
assertNotNull(map.view().get(mapKey));
assertEquals(1, map.view().get(mapKey).size());
RiakRegister register = map.view().get(mapKey).get(0).getAsRegister();
assertEquals(mapKey, register.getValue());
mapKey = BinaryValue.create("map");
update = new DtUpdateOperation.Builder(location)
.withOp(new MapOp().update(mapKey, new MapOp().update(mapKey, new FlagOp(false))))
.build();
cluster.execute(update);
update.get();
map = fetchMap(mapBucketType, bucketName, key);
Map<BinaryValue, List<RiakDatatype>> mapView = map.view();
assertEquals(5, mapView.size());
assertTrue(mapView.containsKey(mapKey));
assertNotNull(map.view().get(mapKey));
assertEquals(1, map.view().get(mapKey).size());
assertTrue(mapView.get(mapKey).get(0).isMap());
RiakMap nestedMap = mapView.get(mapKey).get(0).getAsMap();
Map<BinaryValue, List<RiakDatatype>> nestedMapView = nestedMap.view();
assertEquals(1, nestedMapView.size());
assertTrue(nestedMapView.containsKey(mapKey));
assertNotNull(map.view().get(mapKey));
assertEquals(1, map.view().get(mapKey).size());
assertTrue(nestedMapView.get(mapKey).get(0).isFlag());
RiakFlag nestedFlag = nestedMapView.get(mapKey).get(0).getAsFlag();
assertFalse(nestedFlag.getEnabled());
resetAndEmptyBucket(new Namespace(mapBucketType, bucketName));
}