| 43 | import org.slf4j.LoggerFactory; |
| 44 | |
| 45 | public abstract class AbstractTestCase<T extends BenchmarkModule> { |
| 46 | |
| 47 | protected final Logger LOG = LoggerFactory.getLogger(getClass()); |
| 48 | |
| 49 | // ----------------------------------------------------------------- |
| 50 | |
| 51 | /** |
| 52 | * This is the database type that we will use in our unit tests. This should always be one of the |
| 53 | * embedded java databases |
| 54 | */ |
| 55 | private static final DatabaseType DB_TYPE = DatabaseType.HSQLDB; |
| 56 | |
| 57 | // ----------------------------------------------------------------- |
| 58 | |
| 59 | protected static final double DB_SCALE_FACTOR = 0.01; |
| 60 | |
| 61 | private Server server = null; |
| 62 | |
| 63 | protected WorkloadConfiguration workConf; |
| 64 | protected T benchmark; |
| 65 | protected AbstractCatalog catalog; |
| 66 | protected Connection conn; |
| 67 | |
| 68 | protected final boolean createDatabase; |
| 69 | protected final boolean loadDatabase; |
| 70 | protected final String ddlOverridePath; |
| 71 | protected final String sessionSetupFile; |
| 72 | |
| 73 | private static final AtomicInteger portCounter = new AtomicInteger(9001); |
| 74 | private static final int MAX_PORT_NUMBER = 65535; |
| 75 | |
| 76 | public AbstractTestCase(boolean createDatabase, boolean loadDatabase) { |
| 77 | this.benchmark = null; |
| 78 | this.createDatabase = createDatabase; |
| 79 | this.loadDatabase = loadDatabase; |
| 80 | this.ddlOverridePath = null; |
| 81 | this.sessionSetupFile = null; |
| 82 | } |
| 83 | |
| 84 | public AbstractTestCase(boolean createDatabase, boolean loadDatabase, String ddlOverridePath) { |
| 85 | this.benchmark = null; |
| 86 | this.createDatabase = createDatabase; |
| 87 | this.loadDatabase = loadDatabase; |
| 88 | this.ddlOverridePath = ddlOverridePath; |
| 89 | this.sessionSetupFile = null; |
| 90 | } |
| 91 | |
| 92 | public AbstractTestCase( |
| 93 | boolean createDatabase, |
| 94 | boolean loadDatabase, |
| 95 | String ddlOverridePath, |
| 96 | String sessionSetupFile) { |
| 97 | this.benchmark = null; |
| 98 | this.createDatabase = createDatabase; |
| 99 | this.loadDatabase = loadDatabase; |
| 100 | this.ddlOverridePath = ddlOverridePath; |
| 101 | this.sessionSetupFile = sessionSetupFile; |
| 102 | } |