EMMA Coverage Report (generated Thu Jan 24 13:37:04 CST 2013)
[all classes][org.springframework.batch.core.explore.support]

COVERAGE SUMMARY FOR SOURCE FILE [MapJobExplorerFactoryBean.java]

nameclass, %method, %block, %line, %
MapJobExplorerFactoryBean.java100% (1/1)78%  (7/9)85%  (45/53)73%  (10.9/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MapJobExplorerFactoryBean100% (1/1)78%  (7/9)85%  (45/53)73%  (10.9/15)
MapJobExplorerFactoryBean (): void 0%   (0/1)0%   (0/3)0%   (0/2)
setRepositoryFactory (MapJobRepositoryFactoryBean): void 0%   (0/1)0%   (0/4)0%   (0/2)
afterPropertiesSet (): void 100% (1/1)92%  (11/12)97%  (2.9/3)
MapJobExplorerFactoryBean (MapJobRepositoryFactoryBean): void 100% (1/1)100% (6/6)100% (3/3)
createExecutionContextDao (): ExecutionContextDao 100% (1/1)100% (4/4)100% (1/1)
createJobExecutionDao (): JobExecutionDao 100% (1/1)100% (4/4)100% (1/1)
createJobInstanceDao (): JobInstanceDao 100% (1/1)100% (4/4)100% (1/1)
createStepExecutionDao (): StepExecutionDao 100% (1/1)100% (4/4)100% (1/1)
getObject (): Object 100% (1/1)100% (12/12)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.explore.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.StepExecutionDao;
23import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
24import org.springframework.beans.factory.FactoryBean;
25import org.springframework.beans.factory.InitializingBean;
26import org.springframework.util.Assert;
27 
28/**
29 * A {@link FactoryBean} that automates the creation of a
30 * {@link SimpleJobExplorer} using in-memory DAO implementations.
31 * 
32 * @author Dave Syer
33 * @since 2.0
34 */
35public class MapJobExplorerFactoryBean extends AbstractJobExplorerFactoryBean implements InitializingBean {
36 
37        private MapJobRepositoryFactoryBean repositoryFactory;
38 
39        /**
40         * Create an instance with the provided {@link MapJobRepositoryFactoryBean}
41         * as a source of Dao instances.
42         * @param repositoryFactory
43         */
44        public MapJobExplorerFactoryBean(MapJobRepositoryFactoryBean repositoryFactory) {
45                this.repositoryFactory = repositoryFactory;
46        }
47 
48        /**
49         * Create a factory with no {@link MapJobRepositoryFactoryBean}. It must be
50         * injected as a property.
51         */
52        public MapJobExplorerFactoryBean() {
53        }
54 
55        /**
56         * The repository factory that can be used to create daos for the explorer.
57         * 
58         * @param repositoryFactory a {@link MapJobExplorerFactoryBean}
59         */
60        public void setRepositoryFactory(MapJobRepositoryFactoryBean repositoryFactory) {
61                this.repositoryFactory = repositoryFactory;
62        }
63 
64        /**
65         * @throws Exception
66         * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
67         */
68        public void afterPropertiesSet() throws Exception {
69                Assert.state(repositoryFactory != null, "A MapJobRepositoryFactoryBean must be provided");
70                repositoryFactory.afterPropertiesSet();
71        }
72 
73        @Override
74        protected JobExecutionDao createJobExecutionDao() throws Exception {
75                return repositoryFactory.getJobExecutionDao();
76        }
77 
78        @Override
79        protected JobInstanceDao createJobInstanceDao() throws Exception {
80                return repositoryFactory.getJobInstanceDao();
81        }
82 
83        @Override
84        protected StepExecutionDao createStepExecutionDao() throws Exception {
85                return repositoryFactory.getStepExecutionDao();
86        }
87 
88        @Override
89        protected ExecutionContextDao createExecutionContextDao() throws Exception {
90                return repositoryFactory.getExecutionContextDao();
91        }
92 
93        public Object getObject() throws Exception {
94                return new SimpleJobExplorer(createJobInstanceDao(), createJobExecutionDao(), createStepExecutionDao(),
95                                createExecutionContextDao());
96        }
97 
98}

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