EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.simucomframework.calculator]

COVERAGE SUMMARY FOR SOURCE FILE [CalculatorFactory.java]

nameclass, %method, %block, %line, %
CalculatorFactory.java0%   (0/1)0%   (0/9)0%   (0/472)0%   (0/96)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CalculatorFactory0%   (0/1)0%   (0/9)0%   (0/472)0%   (0/96)
CalculatorFactory (SimuComModel, ISetupDataSinkStrategy): void 0%   (0/1)0%   (0/20)0%   (0/5)
buildDemandBasedWaitingTimeCalculator (String, Integer, Integer): WaitingTime... 0%   (0/1)0%   (0/62)0%   (0/12)
buildDemandCalculator (String, Integer): DemandCalculator 0%   (0/1)0%   (0/55)0%   (0/11)
buildExecutionResultCalculator (String, Integer): ExecutionResultCalculator 0%   (0/1)0%   (0/57)0%   (0/11)
buildHoldTimeCalculator (String, Integer, Integer): HoldTimeCalculator 0%   (0/1)0%   (0/56)0%   (0/12)
buildOverallUtilizationCalculator (String, Integer): StateCalculator 0%   (0/1)0%   (0/55)0%   (0/11)
buildResponseTimeCalculator (String, Integer, Integer): Calculator 0%   (0/1)0%   (0/56)0%   (0/11)
buildStateCalculator (String, Integer): StateCalculator 0%   (0/1)0%   (0/55)0%   (0/11)
buildWaitingTimeCalculator (String, Integer, Integer): WaitingTimeCalculator 0%   (0/1)0%   (0/56)0%   (0/12)

1package de.uka.ipd.sdq.simucomframework.calculator;
2 
3import java.util.Date;
4 
5import de.uka.ipd.sdq.pipesandfilters.framework.MetaDataInit;
6import de.uka.ipd.sdq.pipesandfilters.framework.PipesAndFiltersManager;
7import de.uka.ipd.sdq.pipesandfilters.framework.recorder.sensorframework.ExecutionResultMetaDataInit;
8import de.uka.ipd.sdq.pipesandfilters.framework.recorder.sensorframework.SensorFrameworkMetaDataInit;
9import de.uka.ipd.sdq.pipesandfilters.framework.recorder.sensorframework.launch.SensorFrameworkConfig;
10import de.uka.ipd.sdq.probespec.framework.calculator.Calculator;
11import de.uka.ipd.sdq.probespec.framework.calculator.DemandBasedWaitingTimeCalculator;
12import de.uka.ipd.sdq.probespec.framework.calculator.DemandCalculator;
13import de.uka.ipd.sdq.probespec.framework.calculator.ExecutionResultCalculator;
14import de.uka.ipd.sdq.probespec.framework.calculator.HoldTimeCalculator;
15import de.uka.ipd.sdq.probespec.framework.calculator.ICalculatorFactory;
16import de.uka.ipd.sdq.probespec.framework.calculator.ResponseTimeCalculator;
17import de.uka.ipd.sdq.probespec.framework.calculator.StateCalculator;
18import de.uka.ipd.sdq.probespec.framework.calculator.WaitingTimeCalculator;
19import de.uka.ipd.sdq.reliability.core.FailureStatistics;
20import de.uka.ipd.sdq.simucomframework.model.SimuComModel;
21 
22/**
23 * TODO: This class still depends on SensorFramework. Try to remove the
24 * SensorFramework dependency.
25 * 
26 * @author Philipp Merkle
27 * 
28 */
29public class CalculatorFactory implements ICalculatorFactory {
30 
31        private SimuComModel model;
32 
33        private String experimentRunName;
34        
35        private ISetupDataSinkStrategy dataSink;
36        
37        public CalculatorFactory(SimuComModel model, ISetupDataSinkStrategy dataSink) {
38                experimentRunName = "Run " + new Date();
39                this.model = model;
40                this.dataSink = dataSink;
41        }
42 
43        public Calculator buildResponseTimeCalculator(String calculatorName,
44                        Integer startProbeSetID, Integer endProbeSetID) {
45                // Initialize calculator
46        Calculator calculator = new ResponseTimeCalculator(model.getProbeSpecContext(), startProbeSetID, endProbeSetID);
47 
48                // Initialize metadata
49                MetaDataInit metaData = new SensorFrameworkMetaDataInit(calculator
50                                .getMeasurementMetrics(), (SensorFrameworkConfig) model
51                                .getConfiguration().getRecorderConfig());
52                metaData.setExperimentName(model.getConfiguration().getNameExperimentRun());
53                metaData.setExperimentRunName(experimentRunName);
54                metaData.setMeasurementName("Response Time of " + calculatorName);
55                metaData.setMetricName("Response Time"); // TODO Hard coded value!
56 
57                PipesAndFiltersManager pipeManager = dataSink.setupDataSink(calculator, metaData);
58                this.model.getProbeSpecContext().getPipeManagerRegisty().register(pipeManager);
59                return calculator;
60        }
61 
62        public WaitingTimeCalculator buildDemandBasedWaitingTimeCalculator(String calculatorName,
63                        Integer startWaitingProbeSetID, Integer stopProcessingProbeSetID) {
64                // Initialize calculator
65        WaitingTimeCalculator calculator = new DemandBasedWaitingTimeCalculator(model.getProbeSpecContext(),
66                startWaitingProbeSetID, stopProcessingProbeSetID);
67 
68                // Initialize metadata
69                MetaDataInit metaData = new SensorFrameworkMetaDataInit(calculator
70                                .getMeasurementMetrics(), (SensorFrameworkConfig) model
71                                .getConfiguration().getRecorderConfig());
72                metaData.setExperimentName(model.getConfiguration().getNameExperimentRun());
73                metaData.setExperimentRunName(experimentRunName);                
74                metaData.setMeasurementName(model.getConfiguration().getNameExperimentRun() + ": Wait time at " + calculatorName);
75                metaData.setMetricName("Waiting Time"); // TODO Hard coded value!
76 
77                PipesAndFiltersManager pipeManager = dataSink.setupDataSink(calculator, metaData);
78                this.model.getProbeSpecContext().getPipeManagerRegisty().register(pipeManager);
79                
80                return calculator;
81        }
82        
83        public WaitingTimeCalculator buildWaitingTimeCalculator(String calculatorName,
84                        Integer startWaitingProbeSetID, Integer stopWaitingProbeSetID) {
85                // Initialize calculator
86        WaitingTimeCalculator calculator = new WaitingTimeCalculator(model.getProbeSpecContext(), startWaitingProbeSetID,
87                stopWaitingProbeSetID);
88 
89                // Initialize metadata
90                MetaDataInit metaData = new SensorFrameworkMetaDataInit(calculator
91                                .getMeasurementMetrics(), (SensorFrameworkConfig) model
92                                .getConfig().getRecorderConfig());
93                metaData.setExperimentName(model.getConfiguration().getNameExperimentRun());
94                metaData.setExperimentRunName(experimentRunName);                
95                metaData.setMeasurementName("Wait time at " + calculatorName);
96                metaData.setMetricName("Waiting Time"); // TODO Hard coded value!
97 
98                PipesAndFiltersManager pipeManager = dataSink.setupDataSink(calculator, metaData);
99                this.model.getProbeSpecContext().getPipeManagerRegisty().register(pipeManager);
100                
101                return calculator;
102        }
103        
104        public HoldTimeCalculator buildHoldTimeCalculator(String calculatorName,
105                        Integer startHoldProbeSetID, Integer stopHoldProbeSetID) {
106                // Initialize calculator
107        HoldTimeCalculator calculator = new HoldTimeCalculator(model.getProbeSpecContext(), startHoldProbeSetID,
108                stopHoldProbeSetID);
109 
110                // Initialize metadata
111                MetaDataInit metaData = new SensorFrameworkMetaDataInit(calculator
112                                .getMeasurementMetrics(), (SensorFrameworkConfig) model
113                                .getConfiguration().getRecorderConfig());
114                metaData.setExperimentName(model.getConfiguration().getNameExperimentRun());
115                metaData.setExperimentRunName(experimentRunName);                
116                metaData.setMeasurementName("Hold time at " + calculatorName);
117                metaData.setMetricName("Hold Time"); // TODO Hard coded value!
118 
119                PipesAndFiltersManager pipeManager = dataSink.setupDataSink(calculator, metaData);
120                this.model.getProbeSpecContext().getPipeManagerRegisty().register(pipeManager);
121                
122                return calculator;
123        }
124        
125        public StateCalculator buildStateCalculator(String calculatorName, Integer probeSetId) {
126                // Initialize calculator
127        StateCalculator calculator = new StateCalculator(model.getProbeSpecContext(), probeSetId);
128 
129                // Initialize metadata
130                MetaDataInit metaData = new SensorFrameworkMetaDataInit(calculator
131                                .getMeasurementMetrics(), (SensorFrameworkConfig) model
132                                .getConfiguration().getRecorderConfig());
133                metaData.setExperimentName(model.getConfiguration().getNameExperimentRun());
134                metaData.setExperimentRunName(experimentRunName);                
135                metaData.setMeasurementName("Utilisation of " + calculatorName);
136                metaData.setMetricName("Utilisation"); // TODO Hard coded value!
137 
138                PipesAndFiltersManager pipeManager = dataSink.setupDataSink(calculator, metaData);
139                this.model.getProbeSpecContext().getPipeManagerRegisty().register(pipeManager);
140                
141                return calculator;
142        }
143        
144        public DemandCalculator buildDemandCalculator(String calculatorName,
145                        Integer probeSetID) {
146                // Initialize calculator
147        DemandCalculator calculator = new DemandCalculator(model.getProbeSpecContext(), probeSetID);
148 
149                // Initialize metadata
150                MetaDataInit metaData = new SensorFrameworkMetaDataInit(calculator
151                                .getMeasurementMetrics(), (SensorFrameworkConfig) model
152                                .getConfiguration().getRecorderConfig());
153                metaData.setExperimentName(model.getConfiguration().getNameExperimentRun());
154                metaData.setExperimentRunName(experimentRunName);                
155                metaData.setMeasurementName("Demanded time at " + calculatorName);
156                metaData.setMetricName("Demanded Time"); // TODO Hard coded value!
157 
158                PipesAndFiltersManager pipeManager = dataSink.setupDataSink(calculator, metaData);
159                this.model.getProbeSpecContext().getPipeManagerRegisty().register(pipeManager);
160                
161                return calculator;
162        }
163 
164        @Override
165        public StateCalculator buildOverallUtilizationCalculator(
166                        String calculatorName, Integer probeSetId) {
167                // Initialize calculator
168        StateCalculator calculator = new StateCalculator(model.getProbeSpecContext(), probeSetId);
169 
170                // Initialize metadata
171                MetaDataInit metaData = new SensorFrameworkMetaDataInit(calculator
172                                .getMeasurementMetrics(), (SensorFrameworkConfig) model
173                                .getConfiguration().getRecorderConfig());
174                metaData.setExperimentName(model.getConfiguration().getNameExperimentRun());
175                metaData.setExperimentRunName(experimentRunName);                
176                metaData.setMeasurementName("Overall Utilisation of " + calculatorName);
177                metaData.setMetricName("Overall Utilisation"); // TODO Hard coded value!
178 
179                PipesAndFiltersManager pipeManager = dataSink.setupDataSink(calculator, metaData);
180                this.model.getProbeSpecContext().getPipeManagerRegisty().register(pipeManager);
181                
182                return calculator;
183        }
184 
185    @Override
186    public ExecutionResultCalculator buildExecutionResultCalculator(String calculatorName, Integer probeSetId) {
187 
188        // Initialize calculator
189        ExecutionResultCalculator calculator = new ExecutionResultCalculator(model.getProbeSpecContext(), probeSetId);
190 
191        // Initialize metadata
192        MetaDataInit metaData = new ExecutionResultMetaDataInit(calculator.getMeasurementMetrics(),
193                (SensorFrameworkConfig) model.getConfiguration().getRecorderConfig(), FailureStatistics.getInstance()
194                        .getExecutionResultTypes());
195        metaData.setExperimentName(model.getConfiguration().getNameExperimentRun());
196        metaData.setExperimentRunName(experimentRunName);
197        metaData.setMeasurementName("Execution result of " + calculatorName);
198        metaData.setMetricName("Execution Time"); // TODO Hard coded value!
199 
200        PipesAndFiltersManager pipeManager = dataSink.setupDataSink(calculator, metaData);
201        model.getProbeSpecContext().getPipeManagerRegisty().register(pipeManager);
202 
203        return calculator;
204    }
205        
206}

[all classes][de.uka.ipd.sdq.simucomframework.calculator]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov