270 likes | 417 Views
Synthesizing Partial Component-Level Behavior Models. Ivo Krka. Outline. Motivation and Background The Synthesis Algorithm Discovery of Discrepancies Conclusions. Motivation. Early in a software system’s life cycle Uncertainty Incomplete (partial) information
E N D
Synthesizing Partial Component-Level Behavior Models Ivo Krka
Outline • Motivation and Background • The Synthesis Algorithm • Discovery of Discrepancies • Conclusions
Motivation • Early in a software system’s life cycle • Uncertainty • Incomplete (partial) information • Utilized behavior specifications • Intuitive and straightforward • Focused and partial • System-level • Our work leverages • Properties (OCL constraints) • Scenarios (UML sequence diagrams)
Web Cache Scenario Client Cache Server requestCache requestServer responseServer responseCache requestCache responseCache
Web Cache Constraints System domain variables cached: true if the data is cached and false otherwise pending: true if there is a pending client request for data, and false otherwise
Synthesis of Behavioral Models • Behavioral models proven useful • Validation, analysis, etc. • Complete component-level models • E.g., Whittle [1], Mäkinen [2], Damas [3] • Overlook the partiality of specs (Uchitel [4])
Modal Transition Systems (MTS) • Two types of transitions • Required and maybe (marked with ?) MTS M a b? S1 S2 S3
The Proposed Algorithm • Partial-behavior models • Behavior required by scenarios • Behavior prohibited by constraints • Behavior neither required nor prohibited • Component-level models • Better scaling with system size • Discovery of specification discrepancies
Algorithm Overview 1 2 Component Constraint Generation Initial MTS Generation OCL, SDs 3 4 Sequence Diagram Annotation Final MTS Generation Comp. MTSs
Phase 1: Component Constraint Generation Component Constraint Generation Initial MTS Generation • Not all variables affect each component • Reduction in state space size Sequence Diagram Annotation Final MTS Generation Client component pending: significant variable from Client’s perspective cached: does not directly affect Client’s behavior
Phase 2: Initial MTS Generation Component Constraint Generation Initial MTS Generation • Initial MTS captures all legal behavior Sequence Diagram Annotation Final MTS Generation MTS Cache (p,c) respServ? respServ? S1(F,F) S2(F,T) reqCache? reqCache? respCache? S3(T,F) S4(T,T) respServ? reqServ? respServ?
Phase 3: Sequence Diagram Annotation Component Constraint Generation Initial MTS Generation Cache Sequence Diagram Annotation Final MTS Generation <F,?> reqCache <T,?> <T,F> reqServ <T,F> respServ <?,?> <?,T> <T,T> annotations: <pending,cached> respCache <F,T> <F,?> reqCache <T,?> <T,T> respCache <F,T>
Phase 3: Sequence Diagram Annotation Component Constraint Generation Initial MTS Generation Cache Sequence Diagram Annotation Final MTS Generation <F,?> reqCache <T,?> <T,F> reqServ <T,F> respServ <?,?> <?,T> <T,T> annotations: <pending,cached> respCache <F,T> <F,?> reqCache <T,?> <T,T> respCache <F,T>
Phase 3: Sequence Diagram Annotation Component Constraint Generation Initial MTS Generation Cache Sequence Diagram Annotation Final MTS Generation <F,?> reqCache <T,F> <T,F> reqServ <T,F> respServ <?,?> <?,T> <T,T> annotations: <pending,cached> respCache <F,T> <F,?> reqCache <T,?> <T,T> respCache <F,T>
Phase 3: Sequence Diagram Annotation Component Constraint Generation Initial MTS Generation Cache Sequence Diagram Annotation Final MTS Generation <F,F> reqCache <T,F> <T,F> reqServ <T,F> respServ <T,F> <T,T> <T,T> annotations: <pending,cached> respCache <F,T> <F,T> reqCache <T,T> <T,T> respCache <F,T>
Phase 3: Sequence Diagram Annotation Component Constraint Generation Initial MTS Generation • We know the traversed execution states Cache Sequence Diagram Annotation Final MTS Generation <F,F> reqCache <T,F> <T,F> reqServ <T,F> respServ <T,F> <T,T> <T,T> respCache <F,T> <F,T> reqCache <T,T> <T,T> respCache <F,T>
Phase 4: Final MTS Generation Component Constraint Generation Initial MTS Generation Final MTS Generation Sequence Diagram Annotation MTS Cache respServ? respServ? S1(F,F) S2(F,T) Current invocation <F,F> reqCache reqCache? reqCache? respCache? <T,F> S3(T,F) S4(T,T) respServ? reqServ? respServ?
Phase 4: Final MTS Generation Component Constraint Generation Initial MTS Generation Final MTS Generation Sequence Diagram Annotation MTS Cache respServ? respServ? S1(F,F) S2(F,T) Current invocation <T,F> reqServ reqCache reqCache? respCache? <T,F> S3(T,F) S4(T,T) respServ? reqServ? respServ?
Phase 4: Final MTS Generation Component Constraint Generation Initial MTS Generation Final MTS Generation Sequence Diagram Annotation MTS Cache respServ? respServ? respServ? S1(F,F) S2(F,T) S2’(F,T) reqCache respCache respCache reqCache reqServ respServ S3(T,F) S3’(T,F) S4(T,T) S4’(T,T) respServ? reqServ? respServ?
Phase 4: Final MTS Generation Component Constraint Generation Initial MTS Generation • All legal behavior • Required behavior Final MTS Generation Sequence Diagram Annotation MTS Cache respServ? respServ? respServ? S1 (F,F) S2 (F,T) S2’ (F,T) reqCache respCache respCache reqCache reqServ respServ S3 (T,F) S3’ (T,F) S4 (T,T) S4’ (T,T) respServ? reqServ? respServ?
Implementation • Prototype MTSGen tool • Warns about discrepancies • Results can be visualized in MTSA • Performance evaluation • The algorithm is exponential in the worst case • Used specifications • 50 components • 300 distinct operations • 200 domain variables • 200 scenarios • Average running time 36 seconds • Models of approx. 60 states
Scenario Cannot Execute As Specified Client Cache Server Admin requestCache responseCache dataUpdate requestCache dataChanged <T,F> <T,T> requestServer responseServer responseCache
System and Component Views Differ Client Cache Server Admin requestCache requestServer responseServer System viewpoint: permission = false responseCache removePermission requestCache responseCache Cache viewpoint: permission = true
Conclusions • Novel synthesis algorithm • Inputs: constraints and scenarios • Outputs: component-level MTSs • Discovery of specification discrepancies • Prototype implementation • Future work • Support for requirements elicitation • Support in OTS component selection
References • Whittle and Schumann, ICSE 2000. • Mäkinen and Systä, ICSE 2001. • Damas et al., FSE 2006. • Uchitel et al., ESEC/FSE 2003.
Component Constraint Generation Initial MTS Generation • Authors • Ivo Krka (krka@usc.edu) • Yuriy Brun (ybrun@usc.edu) • George Edwards (gedwards@usc.edu) • Nenad Medvidovic (neno@usc.edu) • Tool download • http://www-scf.usc.edu/~krka/MTSGen.zip Sequence Diagram Annotation Final MTS Generation