Search in sources :

Example 1 with Rpc

use of com.tvd12.quick.rpc.server.annotation.Rpc in project calabash by youngmonkeys.

the class MapRequestController method mapRemoveMany.

@Rpc(Commands.MAP_REMOVE_MANY)
public boolean mapRemoveMany(MapRemoveManyRequest request) {
    BytesMap map = getBytesMap(request.getMapId());
    map.remove(request.getKeys());
    return Boolean.TRUE;
}
Also used : BytesMap(com.tvd12.calabash.core.BytesMap) Rpc(com.tvd12.quick.rpc.server.annotation.Rpc)

Example 2 with Rpc

use of com.tvd12.quick.rpc.server.annotation.Rpc in project calabash by youngmonkeys.

the class MapRequestController method mapSet.

@Rpc(Commands.MAP_SET)
public boolean mapSet(MapSetRequest request) {
    BytesMap map = getBytesMap(request.getMapId());
    map.set(request.getKey(), request.getValue());
    return Boolean.TRUE;
}
Also used : BytesMap(com.tvd12.calabash.core.BytesMap) Rpc(com.tvd12.quick.rpc.server.annotation.Rpc)

Example 3 with Rpc

use of com.tvd12.quick.rpc.server.annotation.Rpc in project calabash by youngmonkeys.

the class MapRequestController method mapGetMany.

@Rpc(Commands.MAP_GET_MANY)
public List<byte[]> mapGetMany(MapGetManyRequest request) {
    BytesMap map = getBytesMap(request.getMapId());
    List<ByteArray> keys = ByteArray.wrap(request.getKeys());
    Map<ByteArray, byte[]> m = map.get(keys);
    List<byte[]> answer = new ArrayList<>(keys.size());
    for (ByteArray key : keys) {
        answer.add(m.get(key));
    }
    return answer;
}
Also used : BytesMap(com.tvd12.calabash.core.BytesMap) ArrayList(java.util.ArrayList) ByteArray(com.tvd12.calabash.core.util.ByteArray) Rpc(com.tvd12.quick.rpc.server.annotation.Rpc)

Example 4 with Rpc

use of com.tvd12.quick.rpc.server.annotation.Rpc in project calabash by youngmonkeys.

the class MessageChannelRequestController method messageChannelPublish.

@Rpc(Commands.MESSAGE_CHANNEL_PUBLISH)
public void messageChannelPublish(MessageChannelPublishRequest request) {
    MessageChannel messageChannel = getMessageChannel(request.getChannelId());
    messageChannel.broadcast(request);
}
Also used : MessageChannel(com.tvd12.calabash.server.core.message.MessageChannel) Rpc(com.tvd12.quick.rpc.server.annotation.Rpc)

Example 5 with Rpc

use of com.tvd12.quick.rpc.server.annotation.Rpc 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;
}
Also used : BytesMap(com.tvd12.calabash.core.BytesMap) Rpc(com.tvd12.quick.rpc.server.annotation.Rpc)

Aggregations

Rpc (com.tvd12.quick.rpc.server.annotation.Rpc)7 BytesMap (com.tvd12.calabash.core.BytesMap)5 MessageChannel (com.tvd12.calabash.server.core.message.MessageChannel)2 ByteArray (com.tvd12.calabash.core.util.ByteArray)1 ArrayList (java.util.ArrayList)1