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

COVERAGE SUMMARY FOR SOURCE FILE [ConcatenationOperationImpl.java]

nameclass, %method, %block, %line, %
ConcatenationOperationImpl.java100% (2/2)100% (10/10)83%  (96/115)89%  (24/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ConcatenationOperationImpl100% (1/1)100% (9/9)82%  (79/96)89%  (24/27)
cmdMap (ConcatenationType): int 100% (1/1)61%  (19/31)88%  (5.3/6)
<static initializer> 100% (1/1)75%  (6/8)75%  (0.8/1)
getStatusForErrorCode (int, byte []): OperationStatus 100% (1/1)79%  (11/14)75%  (6/8)
ConcatenationOperationImpl (ConcatenationType, String, byte [], long, Operati... 100% (1/1)100% (19/19)100% (6/6)
getCasValue (): long 100% (1/1)100% (3/3)100% (1/1)
getData (): byte [] 100% (1/1)100% (3/3)100% (1/1)
getKeys (): Collection 100% (1/1)100% (4/4)100% (1/1)
getStoreType (): ConcatenationType 100% (1/1)100% (3/3)100% (1/1)
initialize (): void 100% (1/1)100% (11/11)100% (2/2)
     
class ConcatenationOperationImpl$1100% (1/1)100% (1/1)89%  (17/19)89%  (0.9/1)
<static initializer> 100% (1/1)89%  (17/19)89%  (0.9/1)

1package net.spy.memcached.protocol.binary;
2 
3import java.util.Collection;
4import java.util.Collections;
5 
6import net.spy.memcached.ops.ConcatenationOperation;
7import net.spy.memcached.ops.ConcatenationType;
8import net.spy.memcached.ops.OperationCallback;
9import net.spy.memcached.ops.OperationStatus;
10 
11class ConcatenationOperationImpl extends OperationImpl
12        implements ConcatenationOperation {
13 
14        private static final int APPEND=0x0e;
15        private static final int PREPEND=0x0f;
16 
17        private final String key;
18        private final long cas;
19        private final ConcatenationType catType;
20        private final byte[] data;
21 
22        private static int cmdMap(ConcatenationType t) {
23                int rv=-1;
24                switch(t) {
25                        case append: rv=APPEND; break;
26                        case prepend: rv=PREPEND; break;
27                }
28                // Check fall-through.
29                assert rv != -1 : "Unhandled store type:  " + t;
30                return rv;
31        }
32 
33        public ConcatenationOperationImpl(ConcatenationType t, String k,
34                        byte[] d, long c, OperationCallback cb) {
35                super(cmdMap(t), generateOpaque(), cb);
36                key=k;
37                data=d;
38                cas=c;
39                catType=t;
40        }
41 
42        @Override
43        public void initialize() {
44                prepareBuffer(key, cas, data);
45        }
46 
47        @Override
48        protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) {
49                OperationStatus rv=null;
50                switch(errCode) {
51                        case ERR_EXISTS:
52                                rv=EXISTS_STATUS;
53                                break;
54                        case ERR_NOT_FOUND:
55                                rv=NOT_FOUND_STATUS;
56                                break;
57                        case ERR_NOT_STORED:
58                                rv=NOT_FOUND_STATUS;
59                                break;
60                }
61                return rv;
62        }
63 
64        public Collection<String> getKeys() {
65                return Collections.singleton(key);
66        }
67 
68        public long getCasValue() {
69                return cas;
70        }
71 
72        public byte[] getData() {
73                return data;
74        }
75 
76        public ConcatenationType getStoreType() {
77                return catType;
78        }
79 
80}

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