01: /* DDSteps - Data Driven JUnit Test Steps
02: * Copyright (C) 2006 Jayway AB
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License version 2.1 as published by the Free Software Foundation.
07: *
08: * This library is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, visit
15: * http://www.opensource.org/licenses/lgpl-license.php
16: */
17: package org.ddsteps.data.support;
18:
19: import org.ddsteps.data.DataLoader;
20: import org.ddsteps.data.DataSetDataLoader;
21: import org.ddsteps.dataset.excel.ExcelDataSetLoader;
22: import org.ddsteps.dataset.support.DataSetLoaderFactory;
23:
24: /**
25: * @author adamskogman
26: *
27: */
28: public class DataLoaderFactory {
29:
30: /**
31: * Lazy singleton.
32: */
33: protected static DataLoader cachingExcelDataLoader;
34:
35: /**
36: * Gets a singleton DataLoader that gets whole Excel files. It uses caching
37: * to speed up loading, and adds property placeholder replacement.
38: * <p>
39: * Just put an Excel file with the same name as your test case (with an .xls
40: * ending) in the same package as the test case.
41: *
42: * @see org.ddsteps.dataset.transform.PropertyPlaceholderTransformer
43: * @see ExcelDataSetLoader
44: * @return Never null
45: */
46: public static synchronized DataLoader getCachingExcelDataLoader() {
47:
48: if (cachingExcelDataLoader == null) {
49: cachingExcelDataLoader = new DataSetDataLoader(
50: DataSetLoaderFactory
51: .getCachingPropertyPlaceholderExcelDataSetLoader());
52: }
53:
54: return cachingExcelDataLoader;
55: }
56:
57: }
|