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

COVERAGE SUMMARY FOR SOURCE FILE [MiddlewareCallingComponentBuilder.java]

nameclass, %method, %block, %line, %
MiddlewareCallingComponentBuilder.java0%   (0/1)0%   (0/4)0%   (0/116)0%   (0/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MiddlewareCallingComponentBuilder0%   (0/1)0%   (0/4)0%   (0/116)0%   (0/28)
MiddlewareCallingComponentBuilder (PCMAndCompletionModelHolder, OperationInte... 0%   (0/1)0%   (0/29)0%   (0/4)
createVariableUsage (String, VariableCharacterisationType, String): VariableU... 0%   (0/1)0%   (0/33)0%   (0/10)
findService (OperationInterface, String): OperationSignature 0%   (0/1)0%   (0/24)0%   (0/4)
getSeffBuilder (): DelegatorComponentSeffBuilder 0%   (0/1)0%   (0/30)0%   (0/10)

1package de.uka.ipd.sdq.pcm.transformations.builder.infrastructure;
2 
3import de.uka.ipd.sdq.pcm.core.CoreFactory;
4import de.uka.ipd.sdq.pcm.parameter.ParameterFactory;
5import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisation;
6import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisationType;
7import de.uka.ipd.sdq.pcm.parameter.VariableUsage;
8import de.uka.ipd.sdq.pcm.repository.OperationInterface;
9import de.uka.ipd.sdq.pcm.repository.OperationSignature;
10import de.uka.ipd.sdq.pcm.repository.Signature;
11import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceContainer;
12import de.uka.ipd.sdq.pcm.transformations.builder.seff.DelegatorComponentSeffBuilder;
13import de.uka.ipd.sdq.pcm.transformations.builder.seff.MiddlewareComponentSeffBuilder;
14import de.uka.ipd.sdq.pcm.transformations.builder.seff.SetVariableActionDescriptor;
15import de.uka.ipd.sdq.pcm.transformations.builder.util.PCMAndCompletionModelHolder;
16import de.uka.ipd.sdq.stoex.StoexFactory;
17import de.uka.ipd.sdq.stoex.VariableReference;
18 
19public class MiddlewareCallingComponentBuilder extends
20                BasicMiddlewareComponentBuilder {
21 
22        private OperationSignature preSignature;
23        private OperationSignature postSignature;
24        
25        public MiddlewareCallingComponentBuilder(
26                        PCMAndCompletionModelHolder models, 
27                        OperationInterface providedIf,
28                        OperationInterface requiredIf, 
29                        OperationInterface middlewareInterface,
30                        ResourceContainer container,
31                        String preServiceName,
32                        String postServiceName) {
33                super(models, providedIf, requiredIf, middlewareInterface, container, "MiddlewareCallingComponent");
34                this.preSignature = preServiceName == null ? null : findService(middlewareInterface,preServiceName);
35                this.postSignature = postServiceName == null ? null : findService(middlewareInterface,postServiceName);
36        }
37 
38        @Override
39        protected DelegatorComponentSeffBuilder getSeffBuilder() {
40                MiddlewareComponentSeffBuilder builder = (MiddlewareComponentSeffBuilder) super.getSeffBuilder();
41                if (preSignature != null)
42                        builder.appendPreMiddlewareCall(
43                                preSignature);
44                if (postSignature != null)
45                        builder.appendPostMiddlewareCall(
46                                postSignature);
47                builder.appendPostAction(new SetVariableActionDescriptor(
48                                createVariableUsage("stream", VariableCharacterisationType.BYTESIZE, "stream.BYTESIZE")));
49 
50                return builder;
51        }
52 
53        private OperationSignature findService(OperationInterface middlewareInterface,
54                        String preServiceName) {
55                for (OperationSignature sig : middlewareInterface.getSignatures__OperationInterface()){
56                        if (sig.getEntityName().equals(preServiceName))
57                                return sig;
58                }
59                throw new RuntimeException("Required middleware service not found in middleware interface");
60        }
61 
62        protected VariableUsage createVariableUsage(String variableName, VariableCharacterisationType type, String spec) {
63                VariableUsage usage = ParameterFactory.eINSTANCE.createVariableUsage();
64                VariableCharacterisation characterisation = ParameterFactory.eINSTANCE.createVariableCharacterisation();
65                VariableReference name = StoexFactory.eINSTANCE.createVariableReference();
66                name.setReferenceName(variableName);
67                characterisation.setSpecification_VariableCharacterisation(CoreFactory.eINSTANCE.createPCMRandomVariable());
68                characterisation.getSpecification_VariableCharacterisation().setSpecification(spec);
69                characterisation.setType(type);
70                usage.setNamedReference__VariableUsage(name);
71                usage.getVariableCharacterisation_VariableUsage().add(characterisation);
72                
73                return usage;
74        }        
75}

[all classes][de.uka.ipd.sdq.pcm.transformations.builder.infrastructure]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov