use of com.tvd12.calabash.core.BytesMap in project calabash by youngmonkeys.
the class SimpleBytesMapManager method addStatistics.
@Override
public void addStatistics(Map<String, Object> statistics) {
synchronized (maps) {
statistics.put("numberOfMaps", maps.size());
List<Map<String, Object>> mapStats = new ArrayList<>();
for (String mapName : maps.keySet()) {
BytesMap map = maps.get(mapName);
Map<String, Object> mapStat = new HashMap<>();
mapStat.put("name", mapName);
((StatisticsAware) map).addStatistics(mapStat);
mapStats.add(mapStat);
}
statistics.put("maps", mapStats);
}
}
use of com.tvd12.calabash.core.BytesMap in project calabash by youngmonkeys.
the class SimpleBytesMapManager method newMap.
protected BytesMap newMap(String mapName) {
synchronized (maps) {
BytesMap map = maps.get(mapName);
if (map == null) {
map = mapFactory.newMap(mapName);
maps.put(mapName, map);
}
return map;
}
}
use of com.tvd12.calabash.core.BytesMap in project calabash by youngmonkeys.
the class LocalExample method main.
public static void main(String[] args) {
Settings settings = new SimpleSettings();
MapPersistManager mapPersistManager = new SimpleMapPersistManager();
BytesMapBackupExecutor backupExecutor = new SimpleBytesMapBackupExecutor();
BytesMapPersistExecutor persistExecutor = SimpleBytesMapPersistExecutor.builder().mapPersistManager(mapPersistManager).build();
BytesMap bytesMap = BytesMapImpl.builder().mapSetting(settings.getMapSetting("test")).mapBackupExecutor(backupExecutor).mapPersistExecutor(persistExecutor).build();
bytesMap.loadAll();
bytesMap.put(new ByteArray(new byte[] { 1, 2, 3 }), new byte[] { 1, 2, 3 });
System.out.println(Arrays.toString(bytesMap.get(new ByteArray(new byte[] { 1, 2, 3 }))));
}
use of com.tvd12.calabash.core.BytesMap in project calabash by youngmonkeys.
the class MapRequestController method mapPutAll.
@Rpc(Commands.MAP_PUT_ALL)
public boolean mapPutAll(MapPutAllRequest request) {
BytesMap map = getBytesMap(request.getMapId());
map.setAll(request.getValueMap());
return Boolean.TRUE;
}
use of com.tvd12.calabash.core.BytesMap in project calabash by youngmonkeys.
the class MapRequestController method mapClear.
@Rpc(Commands.MAP_CLEAR)
public boolean mapClear(MapClearRequest request) {
BytesMap map = getBytesMap(request.getMapId());
map.clear();
return Boolean.TRUE;
}
Aggregations