EMMA Coverage Report (generated Tue Oct 27 11:32:50 PDT 2009)
[all classes][net.spy.memcached.protocol.ascii]

COVERAGE SUMMARY FOR SOURCE FILE [DeleteOperationImpl.java]

nameclass, %method, %block, %line, %
DeleteOperationImpl.java100% (1/1)100% (5/5)100% (88/88)100% (15/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DeleteOperationImpl100% (1/1)100% (5/5)100% (88/88)100% (15/15)
<static initializer> 100% (1/1)100% (13/13)100% (2/2)
DeleteOperationImpl (String, OperationCallback): void 100% (1/1)100% (7/7)100% (3/3)
getKeys (): Collection 100% (1/1)100% (4/4)100% (1/1)
handleLine (String): void 100% (1/1)100% (35/35)100% (4/4)
initialize (): void 100% (1/1)100% (29/29)100% (5/5)

1// Copyright (c) 2006  Dustin Sallings <dustin@spy.net>
2 
3package net.spy.memcached.protocol.ascii;
4 
5import java.nio.ByteBuffer;
6import java.util.Collection;
7import java.util.Collections;
8 
9import net.spy.memcached.KeyUtil;
10import net.spy.memcached.ops.DeleteOperation;
11import net.spy.memcached.ops.OperationCallback;
12import net.spy.memcached.ops.OperationState;
13import net.spy.memcached.ops.OperationStatus;
14 
15/**
16 * Operation to delete an item from the cache.
17 */
18final class DeleteOperationImpl extends OperationImpl
19        implements DeleteOperation {
20 
21        private static final int OVERHEAD=32;
22 
23        private static final OperationStatus DELETED=
24                new OperationStatus(true, "DELETED");
25        private static final OperationStatus NOT_FOUND=
26                new OperationStatus(false, "NOT_FOUND");
27 
28        private final String key;
29 
30        public DeleteOperationImpl(String k, OperationCallback cb) {
31                super(cb);
32                key=k;
33        }
34 
35        @Override
36        public void handleLine(String line) {
37                getLogger().debug("Delete of %s returned %s", key, line);
38                getCallback().receivedStatus(matchStatus(line, DELETED, NOT_FOUND));
39                transitionState(OperationState.COMPLETE);
40        }
41 
42        @Override
43        public void initialize() {
44                ByteBuffer b=ByteBuffer.allocate(
45                        KeyUtil.getKeyBytes(key).length + OVERHEAD);
46                setArguments(b, "delete", key);
47                b.flip();
48                setBuffer(b);
49        }
50 
51        public Collection<String> getKeys() {
52                return Collections.singleton(key);
53        }
54 
55}

[all classes][net.spy.memcached.protocol.ascii]
EMMA 2.0.5312 (C) Vladimir Roubtsov