180 likes | 337 Views
Aspect-Oriented Software Development (AOSD) Tutorial #9. Modular Verification of Aspects. Today: Aspects Verification. Pointcut-ready models Weaving the aspect into the tableau MAVEN tool Examples. Example: Theft Protection Aspect. General description:
E N D
Aspect-Oriented Software Development (AOSD)Tutorial #9 Modular Verification of Aspects
Today: Aspects Verification • Pointcut-ready models • Weaving the aspect into the tableau • MAVEN tool • Examples Aspect-Oriented Software Development (236608)
Example: Theft Protection Aspect General description: • Can be used in a system with remote authorized access. Most useful for systems in which each user can have only one open session at a time. • Prevents identity-theft: • If a wrong password is provided in several consequent attempts of logging in, the aspect guarantees that the user is blocked. Aspect-Oriented Software Development (236608)
Theft Protection Aspect – contd. • Example system: ATM system of a bank: several ATM machines and a server. • ATM usage: (in a cycle) • insert card • enter code (repeat until the correct code or “cancel” is entered) • if permission is granted (i.e, the code was correct), enter a request for the bank operation (money withdrawal, account balance check, …) • the request is then processed by the system • Point of view of the aspect: the card serves as a user-login, and code - as a password. Aspect-Oriented Software Development (236608)
Pointcut-ready Base Sys. Model Pointcut (example): wrong passw. entered 3 times consequently Base system model: Pointcut-ready model: enter psw. p ≡ correct passw. enter psw. cancel cancel p ¬p p ¬p enter psw. ¬p q q t t perform ATM operations ¬p pointcut Aspect-Oriented Software Development (236608)
Weaving Example Pointcut-ready base model: Advice model: … ¬p, r … p ¬p … ¬p, r ¬p q t … ¬p, r p r – new predicate, to mark the pointcut Aspect-Oriented Software Development (236608)
base → aspect connections Weaving– Stage1 Pointcut-ready base model: Advice model: … ¬p, r … p ¬p … ¬p, r ¬p q t … ¬p, r p Aspect-Oriented Software Development (236608)
aspect → base connections Weaving– Stage2 Pointcut-ready base model: Advice model: … ¬p, r … p ¬p … ¬p, r ¬p q t … ¬p, r p Aspect-Oriented Software Development (236608)
remove unnecessary base edges Weaving– Stage3 Pointcut-ready base model: Advice model: … ¬p, r … p ¬p … ¬p, r ¬p q t … ¬p, r p Aspect-Oriented Software Development (236608)
Pointcut-ready Base Sys. Model Pointcut (example2): wrong passw. has been entered 3 times Base system model: Pointcut-ready model: pointcut ¬p ¬p ¬p p ¬p p p p p q t q q q q t t t t Aspect-Oriented Software Development (236608)
Theft Protection Aspect Assumption For each card and for each ATM: • There is a state predicate telling that the card is stolen (st), and a state predicate telling the card is in the ATM (in) • Whenever a card is stolen, it remains stolen forever • Formally: G (st → G (st)) Aspect-Oriented Software Development (236608)
Theft Protection Aspect Pointcut • Some stolen card is inserted into an ATM • Formally: (st ∧ in) Aspect-Oriented Software Development (236608)
Here: all the states are fair Assumption Tableau pointcut -ready? ¬in ¬st ¬q r ¬in st ¬q ¬r ¬in ¬st ¬q ¬r Yes! in st ¬q ¬r in ¬st ¬q ¬r in ¬st ¬q r st – card stolen; in – card in ATM; r,q – aux. vars; pointcut: st ∧ in pointcut Aspect-Oriented Software Development (236608)
Simple Advice Model in st ¬q ¬r in st ¬q ¬r Aspect-Oriented Software Development (236608)
Weaving into the Tableau – Stage1 ¬in ¬st ¬q r ¬in st ¬q ¬r ¬in ¬st ¬q ¬r in st ¬q ¬r in st ¬q ¬r in st ¬q ¬r in ¬st ¬q ¬r in ¬st ¬q r Aspect-Oriented Software Development (236608)
Weaving into the Tableau – Stage2 ¬in ¬st ¬q r ¬in st ¬q ¬r ¬in ¬st ¬q ¬r in st ¬q ¬r in st ¬q ¬r in st ¬q ¬r in ¬st ¬q ¬r in ¬st ¬q r Aspect-Oriented Software Development (236608)
Weaving into the Tableau – Stage3 Is the guarantee satisfied? ¬in ¬st ¬q r ¬in st ¬q ¬r ¬in ¬st ¬q ¬r in st ¬q ¬r in st ¬q ¬r in st ¬q ¬r in ¬st ¬q ¬r in ¬st ¬q r Aspect-Oriented Software Development (236608)
Card Theft Protection - Model Variables that should be calculated from the base system state – those used in the assumption, pointcut and advice VAR --BASE card_in : boolean ; card_stolen : boolean ; VAR --ASPECT pcT : 1..2 ; POINTCUT card_stolen & card_in ; … TRANS pcT = 1 -> next(pcT = 2) & next(card_in) & next(card_stolen); RETURN pcT = 2 ; … LTLSPEC --BASE G (card_stolen -> G (card_stolen)) ; LTLSPEC --AUGMENTED G ((card_in & card_stolen) -> G (card_in)) ; Aspect variables Pointcut description (state predicate!) Advice Assumption Guarantee Aspect-Oriented Software Development (236608)