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

COVERAGE SUMMARY FOR SOURCE FILE [MapJobExplorerFactoryBean.java]

nameclass, %method, %block, %line, %
MapJobExplorerFactoryBean.java100% (1/1)100% (9/9)98%  (52/53)99%  (14.9/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MapJobExplorerFactoryBean100% (1/1)100% (9/9)98%  (52/53)99%  (14.9/15)
afterPropertiesSet (): void 100% (1/1)92%  (11/12)97%  (2.9/3)
MapJobExplorerFactoryBean (): void 100% (1/1)100% (3/3)100% (2/2)
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 (): JobExplorer 100% (1/1)100% (12/12)100% (1/1)
setRepositoryFactory (MapJobRepositoryFactoryBean): void 100% (1/1)100% (4/4)100% (2/2)

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

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