EMMA Coverage Report (generated Fri Jan 30 13:20:29 EST 2009)
[all classes][org.springframework.batch.core]

COVERAGE SUMMARY FOR SOURCE FILE [StepContribution.java]

nameclass, %method, %block, %line, %
StepContribution.java100% (1/1)86%  (12/14)67%  (79/118)88%  (21/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StepContribution100% (1/1)86%  (12/14)67%  (79/118)88%  (21/24)
incrementReadsSkipCount (): void 0%   (0/1)0%   (0/7)0%   (0/2)
toString (): String 0%   (0/1)0%   (0/32)0%   (0/1)
StepContribution (StepExecution): void 100% (1/1)100% (10/10)100% (4/4)
combineSkipCounts (): void 100% (1/1)100% (11/11)100% (3/3)
getCommitCount (): int 100% (1/1)100% (3/3)100% (1/1)
getItemCount (): int 100% (1/1)100% (3/3)100% (1/1)
getReadSkipCount (): int 100% (1/1)100% (3/3)100% (1/1)
getSkipCount (): int 100% (1/1)100% (6/6)100% (1/1)
getStepSkipCount (): int 100% (1/1)100% (12/12)100% (1/1)
getWriteSkipCount (): int 100% (1/1)100% (3/3)100% (1/1)
incrementCommitCount (): void 100% (1/1)100% (7/7)100% (2/2)
incrementItemCount (): void 100% (1/1)100% (7/7)100% (2/2)
incrementTemporaryReadSkipCount (): void 100% (1/1)100% (7/7)100% (2/2)
incrementWriteSkipCount (): void 100% (1/1)100% (7/7)100% (2/2)

1/*
2 * Copyright 2006-2007 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.springframework.batch.core;
17 
18/**
19 * Represents a contribution to a {@link StepExecution}, buffering changes
20 * until they can be applied at a chunk boundary.
21 * 
22 * @author Dave Syer
23 * 
24 */
25public class StepContribution {
26 
27        private volatile int itemCount = 0;
28 
29        private final int parentSkipCount;
30 
31        private volatile int commitCount;
32 
33        private volatile int readSkipCount;
34 
35        private volatile int writeSkipCount;
36 
37        private volatile int uncommitedReadSkipCount;
38 
39        /**
40         * @param execution
41         */
42        public StepContribution(StepExecution execution) {
43                this.parentSkipCount = execution.getSkipCount();
44        }
45 
46        /**
47         * Increment the counter for the number of items processed.
48         */
49        public void incrementItemCount() {
50                itemCount++;
51        }
52 
53        /**
54         * Public access to the item counter.
55         * 
56         * @return the item counter.
57         */
58        public int getItemCount() {
59                return itemCount;
60        }
61 
62        /**
63         * Increment the commit counter.
64         */
65        public void incrementCommitCount() {
66                commitCount++;
67        }
68 
69        /**
70         * Public getter for the commit counter.
71         * @return the commitCount
72         */
73        public int getCommitCount() {
74                return commitCount;
75        }
76 
77        /**
78         * @return the sum of skips accumulated in the parent {@link StepExecution}
79         * and this <code>StepContribution</code>, including uncommitted read
80         * skips.
81         */
82        public int getStepSkipCount() {
83                return uncommitedReadSkipCount + readSkipCount + writeSkipCount + parentSkipCount;
84        }
85 
86        /**
87         * @return the number of skips collected in this
88         * <code>StepContribution</code> (not including skips accumulated in the
89         * parent {@link StepExecution}.
90         */
91        public int getSkipCount() {
92                return readSkipCount + writeSkipCount;
93        }
94 
95        /**
96         * Increment the read skip count for this contribution
97         */
98        public void incrementReadsSkipCount() {
99                readSkipCount++;
100        }
101 
102        /**
103         * Increment the write skip count for this contribution
104         */
105        public void incrementWriteSkipCount() {
106                writeSkipCount++;
107        }
108 
109        /**
110         * Increment the counter for temporary skipped reads
111         */
112        public void incrementTemporaryReadSkipCount() {
113                uncommitedReadSkipCount++;
114        }
115 
116        /**
117         * @return the read skip count
118         */
119        public int getReadSkipCount() {
120                return readSkipCount;
121        }
122 
123        /**
124         * @return the write skip count
125         */
126        public int getWriteSkipCount() {
127                return writeSkipCount;
128        }
129 
130        /**
131         * Add the temporary read skip count to read skip count and reset the
132         * temporary counter.
133         */
134        public void combineSkipCounts() {
135                readSkipCount += uncommitedReadSkipCount;
136                uncommitedReadSkipCount = 0;
137        }
138 
139        /*
140         * (non-Javadoc)
141         * @see java.lang.Object#toString()
142         */
143        public String toString() {
144                return "[StepContribution: items=" + itemCount + ", commits=" + commitCount + ", uncommitedReadSkips="
145                                + uncommitedReadSkipCount + ", readSkips=" + readSkipCount + "writeSkips=" + writeSkipCount + "]";
146        }
147 
148}

[all classes][org.springframework.batch.core]
EMMA 2.0.5312 (C) Vladimir Roubtsov