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

COVERAGE SUMMARY FOR SOURCE FILE [EjbCodeGenerationLaunchConfigurationBasedConfigBuilder.java]

nameclass, %method, %block, %line, %
EjbCodeGenerationLaunchConfigurationBasedConfigBuilder.java0%   (0/1)0%   (0/3)0%   (0/82)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EjbCodeGenerationLaunchConfigurationBasedConfigBuilder0%   (0/1)0%   (0/3)0%   (0/82)0%   (0/24)
EjbCodeGenerationLaunchConfigurationBasedConfigBuilder (ILaunchConfiguration,... 0%   (0/1)0%   (0/5)0%   (0/2)
fillConfiguration (AbstractWorkflowBasedRunConfiguration): void 0%   (0/1)0%   (0/51)0%   (0/18)
hasValidSensitvityVariableAttribute (String): boolean 0%   (0/1)0%   (0/26)0%   (0/4)

1package de.uka.ipd.sdq.codegen.ejb;
2 
3import org.eclipse.core.runtime.CoreException;
4import org.eclipse.debug.core.ILaunchConfiguration;
5 
6import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedRunConfiguration;
7import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowConfigurationBuilder;
8import de.uka.ipd.sdq.workflow.pcm.ConstantsContainer;
9import de.uka.ipd.sdq.workflow.pcm.configurations.AbstractCodeGenerationWorkflowRunConfiguration.CodeGenerationAdvice;
10import de.uka.ipd.sdq.workflow.pcm.runconfig.SensitivityAnalysisConfiguration;
11 
12public class EjbCodeGenerationLaunchConfigurationBasedConfigBuilder 
13extends
14                AbstractWorkflowConfigurationBuilder {
15 
16        public EjbCodeGenerationLaunchConfigurationBasedConfigBuilder(
17                        ILaunchConfiguration configuration, String mode) throws CoreException {
18                super(configuration,mode);
19        }
20 
21        @Override
22        public void fillConfiguration(AbstractWorkflowBasedRunConfiguration configuration) throws CoreException {
23                EjbCodeGenerationConfiguration config = (EjbCodeGenerationConfiguration) configuration;
24                
25                config.setDebug(this.isDebug);
26                
27                config.setSensitivityAnalysisEnabled(
28                                hasValidSensitvityVariableAttribute(ConstantsContainer.VARIABLE_TEXT));
29                if (config.isSensitivityAnalysisEnabled()) {
30                        SensitivityAnalysisConfiguration sensitivityConfig = 
31                                new SensitivityAnalysisConfiguration(
32                                                "EJB Sensitivity",
33                                                getStringAttribute(ConstantsContainer.VARIABLE_TEXT), 
34                                                getDoubleAttribute(ConstantsContainer.MINIMUM_TEXT), 
35                                                getDoubleAttribute(ConstantsContainer.MAXIMUM_TEXT), 
36                                                getDoubleAttribute(ConstantsContainer.STEP_WIDTH_TEXT));
37                        config.setSensitivityAnalysisConfiguration(sensitivityConfig);
38                }
39                
40                String modelToCodeTarget = getStringAttribute(ConstantsContainer.MODEL_TO_TEXT_CHOICE);
41                if (ConstantsContainer.MODEL_TO_TEXT_TARGET_PROTO.equals(modelToCodeTarget)){
42                        config.setCodeGenerationAdvicesFile(CodeGenerationAdvice.PROTO);
43                } else {
44                        config.setCodeGenerationAdvicesFile(CodeGenerationAdvice.EJB3);
45                }
46                
47                
48        }
49        
50        private boolean hasValidSensitvityVariableAttribute(String attribute) throws CoreException {
51                if (!configuration.hasAttribute(attribute))
52                        return false;
53                Object value = getStringAttribute(attribute);
54                //Anne: I sometimes get a "NO ELEMENT SELECTED" result from the LaunchConfig even if I deleted the string from the field
55                //I have no idea how to fix it directly, so I need to catch it here. 
56                //It seems to only appear in the Design Space Exploration tab. 
57                return value instanceof String && !value.equals("") && !value.equals("NO ELEMENT SELECTED");
58        }
59        
60}

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