EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[all classes][org.springframework.batch.core.repository.support]

COVERAGE SUMMARY FOR SOURCE FILE [MapJobRepositoryFactoryBean.java]

nameclass, %method, %block, %line, %
MapJobRepositoryFactoryBean.java100% (1/1)100% (11/11)100% (69/69)100% (22/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MapJobRepositoryFactoryBean100% (1/1)100% (11/11)100% (69/69)100% (22/22)
MapJobRepositoryFactoryBean (): void 100% (1/1)100% (6/6)100% (2/2)
MapJobRepositoryFactoryBean (PlatformTransactionManager): void 100% (1/1)100% (6/6)100% (3/3)
clear (): void 100% (1/1)100% (13/13)100% (5/5)
createExecutionContextDao (): ExecutionContextDao 100% (1/1)100% (8/8)100% (2/2)
createJobExecutionDao (): JobExecutionDao 100% (1/1)100% (8/8)100% (2/2)
createJobInstanceDao (): JobInstanceDao 100% (1/1)100% (8/8)100% (2/2)
createStepExecutionDao (): StepExecutionDao 100% (1/1)100% (8/8)100% (2/2)
getExecutionContextDao (): ExecutionContextDao 100% (1/1)100% (3/3)100% (1/1)
getJobExecutionDao (): JobExecutionDao 100% (1/1)100% (3/3)100% (1/1)
getJobInstanceDao (): JobInstanceDao 100% (1/1)100% (3/3)100% (1/1)
getStepExecutionDao (): StepExecutionDao 100% (1/1)100% (3/3)100% (1/1)

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 */
16 
17package org.springframework.batch.core.repository.support;
18 
19import org.springframework.batch.core.repository.dao.ExecutionContextDao;
20import org.springframework.batch.core.repository.dao.JobExecutionDao;
21import org.springframework.batch.core.repository.dao.JobInstanceDao;
22import org.springframework.batch.core.repository.dao.MapExecutionContextDao;
23import org.springframework.batch.core.repository.dao.MapJobExecutionDao;
24import org.springframework.batch.core.repository.dao.MapJobInstanceDao;
25import org.springframework.batch.core.repository.dao.MapStepExecutionDao;
26import org.springframework.batch.core.repository.dao.StepExecutionDao;
27import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
28import org.springframework.beans.factory.FactoryBean;
29import org.springframework.transaction.PlatformTransactionManager;
30 
31/**
32 * A {@link FactoryBean} that automates the creation of a
33 * {@link SimpleJobRepository} using non-persistent in-memory DAO
34 * implementations. This repository is only really intended for use in testing
35 * and rapid prototyping. In such settings you might find that
36 * {@link ResourcelessTransactionManager} is useful (as long as your business
37 * logic does not use a relational database). Not suited for use in
38 * multi-threaded jobs with splits, although it should be safe to use in a
39 * multi-threaded step.
40 * 
41 * @author Robert Kasanicky
42 */
43public class MapJobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean {
44 
45        private MapJobExecutionDao jobExecutionDao;
46 
47        private MapJobInstanceDao jobInstanceDao;
48 
49        private MapStepExecutionDao stepExecutionDao;
50 
51        private MapExecutionContextDao executionContextDao;
52 
53        /**
54         * Create a new instance with a {@link ResourcelessTransactionManager}.
55         */
56        public MapJobRepositoryFactoryBean() {
57                this(new ResourcelessTransactionManager());
58        }
59 
60        /**
61         * Create a new instance with the provided transaction manager.
62         * 
63         * @param transactionManager
64         */
65        public MapJobRepositoryFactoryBean(PlatformTransactionManager transactionManager) {
66                setTransactionManager(transactionManager);
67        }
68 
69        public JobExecutionDao getJobExecutionDao() {
70                return jobExecutionDao;
71        }
72 
73        public JobInstanceDao getJobInstanceDao() {
74                return jobInstanceDao;
75        }
76 
77        public StepExecutionDao getStepExecutionDao() {
78                return stepExecutionDao;
79        }
80 
81        public ExecutionContextDao getExecutionContextDao() {
82                return executionContextDao;
83        }
84 
85        /**
86         * Convenience method to clear all the map daos globally, removing all
87         * entities.
88         */
89        public void clear() {
90                jobInstanceDao.clear();
91                jobExecutionDao.clear();
92                stepExecutionDao.clear();
93                executionContextDao.clear();
94        }
95 
96        @Override
97        protected JobExecutionDao createJobExecutionDao() throws Exception {
98                jobExecutionDao = new MapJobExecutionDao();
99                return jobExecutionDao;
100        }
101 
102        @Override
103        protected JobInstanceDao createJobInstanceDao() throws Exception {
104                jobInstanceDao = new MapJobInstanceDao();
105                return jobInstanceDao;
106        }
107 
108        @Override
109        protected StepExecutionDao createStepExecutionDao() throws Exception {
110                stepExecutionDao = new MapStepExecutionDao();
111                return stepExecutionDao;
112        }
113 
114        @Override
115        protected ExecutionContextDao createExecutionContextDao() throws Exception {
116                executionContextDao = new MapExecutionContextDao();
117                return executionContextDao;
118        }
119 
120}

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