1 | package de.uka.ipd.sdq.statistics.test; |
2 | |
3 | import java.io.File; |
4 | import java.util.ArrayList; |
5 | import java.util.Collection; |
6 | import java.util.List; |
7 | |
8 | import junit.framework.TestCase; |
9 | import de.uka.ipd.sdq.sensorframework.dao.file.FileDAOFactory; |
10 | import de.uka.ipd.sdq.sensorframework.entities.Measurement; |
11 | import de.uka.ipd.sdq.sensorframework.entities.TimeSpanMeasurement; |
12 | import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory; |
13 | import de.uka.ipd.sdq.statistics.MCRWarmUpFilter; |
14 | |
15 | /** |
16 | * Tests the {@link MCRWarmUpFilter}. This test case is intended for manual |
17 | * testing only. For evaluating the outcome the date series needs to be plotted |
18 | * (e.g. as time series) and compared manually. |
19 | * |
20 | * @author Philipp Merkle |
21 | * |
22 | */ |
23 | public class TestMCRWarmUpFilter extends TestCase { |
24 | |
25 | public void testWarmUpFilter() { |
26 | // Adjust path to data store here! |
27 | String dataStorePath = "D:\\Studium\\Master\\HiWi IPD\\runtime-150909\\brs\\Data4"; |
28 | |
29 | File dataStoreFolder = new File(dataStorePath); |
30 | if (dataStoreFolder.exists()) { |
31 | |
32 | IDAOFactory factory = new FileDAOFactory(dataStorePath); |
33 | Collection<Measurement> measurements = TestUtils.loadMeasurements( |
34 | factory, 0, 0, 24); |
35 | |
36 | List<Double> samples = new ArrayList<Double>(measurements.size()); |
37 | for (Measurement m : measurements) { |
38 | TimeSpanMeasurement tsm = (TimeSpanMeasurement) m; |
39 | samples.add(tsm.getTimeSpan()); |
40 | } |
41 | |
42 | MCRWarmUpFilter filter = new MCRWarmUpFilter(); |
43 | filter.filter(samples); |
44 | System.out.println("Warm-Up Peroid: Up to measurement " |
45 | + filter.getTruncationIndex()); |
46 | |
47 | factory.finalizeAndClose(); |
48 | } else { |
49 | System.err.println("Could not find data store path \"" |
50 | + dataStorePath + "\""); |
51 | } |
52 | } |
53 | |
54 | } |