180 likes | 418 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 enter psw. q t perform ATM operations Aspect-Oriented Software Development (236608)
Weaving Example Pointcut-ready base model: Advice model: … ¬p … p ¬p … ¬p, r ¬p q t … ¬p, r p r ≡ pointcut Aspect-Oriented Software Development (236608)
base → aspect connections Weaving– Stage1 Aspect-Oriented Software Development (236608)
aspect → base connections Weaving– Stage2 Aspect-Oriented Software Development (236608)
remove unnecessary base edges Weaving– Stage3 Aspect-Oriented Software Development (236608)
Pointcut-ready Base Sys.(2) Pointcut (example2): wrong passw. has been entered 3 times Base system model: Pointcut-ready model: p ¬p q 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: Aspect-Oriented Software Development (236608)
Theft Protection Aspect Pointcut • Some stolen card is inserted into an ATM • Formally: Aspect-Oriented Software Development (236608)
Assumption Tableau ¬in ¬st ¬q r ¬in st ¬q ¬r ¬in ¬st ¬q ¬r 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 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 Aspect-Oriented Software Development (236608)
Weaving into the Tableau – Stage2 Aspect-Oriented Software Development (236608)
Weaving into the Tableau – Stage3 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 … … TRANS pcT = 1 -> next(pcT = 2) & next(card_in) & next(card_stolen); RETURN pcT = 2 ; … LTLSPEC --BASE … LTLSPEC --AUGMENTED … Aspect variables Pointcut description (state predicate!) Advice Assumption Guarantee Aspect-Oriented Software Development (236608)