Tải bản đầy đủ (.pdf) (36 trang)

Kiểm chứng chương trình Java tuân thủ đặc tả UML bằng lập trình hướng khía cạnh

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (12.71 MB, 36 trang )

ĐẠI HỌC QDỎC GIA HÀ NỘI
r y i ^ - » X J > •
Tên đê tài:
Kiểm chửng chương trình Java
tuân thủ đặc tả UML
bằng lập trình hướng khía cạnh
Mã số: QC.09.06
Chủ nhiệm để tài: Truong Anh Hoàng
ĐA! HỌC QUOC GIA HA NỌI
TRUNG ÍÃM.IHÒNG TIN THƯ VIỀN
Q ồQ 6 0 0 0 0 0 J ~ d
Hà Nội - 2009
1
MỤC LỤC
I. Danh sách những người tham gia thực hiện đề tài 3
II. SUMMARY
.

.

.
4
lil. Báo cáo tổng kết 5
1. Đặt vấn đ ề 5
2. Tổng quan các vấn đề nghiên cửu 5
3. Mục tiêu và nội dung nghiên cứu 5
4. Dịa điểm, thời gian và phương pháp nghiên cứu
6
5. Kết quá nghiên cứu 6
Phần 1. Tổng quan về phương pháp 6
Phần 2. Trích thông tin của biểu đồ tuần tự trong UML 7


Phần 3. Xây dựng máy trạng thái hữu hạn đơn định 8
Phần 4. Kiểm tra lỗi dựa trên AOP 9
Phần 5. Thử nghiệm và đánh giá 9
Phàn 6. Kết luận 9
6. Ket quà dào tạo 10
7. Kết quả ứng dụng 10
8. Thào luận, kết luận và kiến nghị 10
9. Tài liệu tham khảo
.
10
[V. Phụ lục ;

.
:ll
V. Tóm tắt các kết quả nghiên cứu chỉnh của đề tà i
12
2
I. Danh sách nhũng nguôi tham gia thực hiện đề tài
• Chu nhiệm: Trương Anh Hoàng
o 1 lọc vị: Tiến SV, Chuyên ngành đào tạo: Công nghệ thông tin.
o Dơn vị: Khoa CNTT, trường ĐHCN, DI IQG Hà nội.
o l.iên hệ: email: hoangtatá'V11 u.cdu.vn. tcl: 0915539368.
• Những người tham gia
TT
Họ và tên
Học vị
Chuyên
ngành
Co quan công tác
1

Trương Ninh Thuận
TS CNTT
Trường ĐHCN, DHQGHN
1
Nguyền Việt 1 là
TS
CNTT
ViệnCNTT. DMQGHN

3
Trịnh Thanh Bình
NCS
CNTT
Trường ĐH 1 lài phòng
4
Đặng Văn Hưng
TS
C N 'rr
Trường ĐHCN, DHQGHN
5
Nguyễn thị Thu Trang
ThS
CNTT
Trường ĐỈI Bách khoa I IN
3
II. SUMMARY
Project Title: Specifying and Cheeking Interface Interaction Protocols Using Aspect-
oriented Programming
Code number: ỌC.09.06
Coordinator: Trương Anh Hoàng

Implementing Institution: University of Engineering and Technology - VNU, Hanoi
Cooperating Institution: University of Engineering, and Technology - VNIJ. Hanoi
Duration: from 09/2008 to 12/2009
1. Objectives: Specifying and checking the conformance of implementation to the
specification.
2. Main contents:
We Iniill a tool that takes UML sequence diagrams and their Implementation as the inputs
and check if the implementation obeys the sequences of messages specified in the diagrams.
The approach is inspired from the practical aspects of software development where UML is
extensively used to document the software design and to guide the programmers to write the
code. The tool is based on aspect-oriented programming for checking the implementation at
runtime.
3. Results obtained:
We published one paper in the International Conference on Advanced Computing and
Applications (ACOMP 2010) March 3-5, 2010 Ho Chi Minh City, Vietnam
( In the paper, we present an approach to check
UML sequence diagrams using aspect-oriented programming.
We arc submitting another paper on using JPF to explore a software module lo dctccl any
inconsistencies between the module and its ỤML sequence diagrams as specification.
4
III. Báo Clio tổng kết
/. Đặt vân đẻ
Bài toán dặc tà và kiểm chứng sự nhất quán giữa cài dặt và đặc tà là hài toán chính trong
trong kiềm chứng phần mèm. Tuy nhiên các phương pháp dặc là cũ và kiểm chứng thường
khó khăn dể úp dụng do chủng gắn vào chương trình phần niềm do người lập trình thường
phủi học và viết lại các dặc là dưới dạng hình thức hơn. Từ việc UML dang được sử dụng
rộn tỉ rãi trong mô tà ihicl kế phần mềm, chủng tôi sử dụng chúng dể kiểm chứng sự đúng đan
cua một module phần mèm cài dặt các đặc tủ này. Cách tiếp cận này dõi hỏi ít công sức phái
làm thêm trong dự án vì 11Ó không đòi hỏi đặc tả lại các dặc tả không hình thức thường đã có
dưới dạng các biểu dồ UML. Đề xuất của chúng tôi cũng đang dược phát triển liếp sử dụng

Java Pathi’inder (JPI*') cic tự xác dinh các lỗi (nếu có và trong khả năng của JPF) mà không
cần bộ kiếm Ihĩr hay kiềm thử viên thực thi chương trình mới tìm ra lồi.
2. Tôn% quan các vân đẽ nghiên cửu
Trong dề tài này chúng tôi dã nghiên cứu về một sổ vấn dề sau:
- Ngữ nghĩa chuẩn cùa các biếu đồ tuần tự trong UML
- Phương pháp phân tích và dọc định dạng XMI của các biểu dồ UM1- này để trích
ra các thỏnụ tin ngữ nghĩa và biến chúng thành cấu trúc dử liệu thuận tiện cho việc
kiềm tra sự tuân thù.
- Nghiên cứu JPF và cài đặt chức năng kiểm chứng tự dộng các dãy lời gụi xem
chúng có tuân thù đặc tả hay không.
- Nghiên cứu khả năng kiểm tra các đường còn lại trong chương trình mà JPF chưa
thăm dò (lược.
3. Mục tiêu và nội (lung nglìiên cửu
ĐÒ tài hướni> tới mục tiều áp dụng dược vào thực tể, nôn chúng tôi dà chọn hướng thuận'lợi
cho người phái irién nhất, không đòi hỏi thêm nhiều công sức do chúng lôi hướng den sứ
dụng những gì dã có trong các dự án phát triển phần mềm: dặc tà, cài đặt, và bộ kiếm thử.
Nội dung nghiên cứu tlico các mục đã chỉ ra trong phần trên:
- Ngữ nghĩa chuẩn của các biểu đồ tuần lự trong ƯML. Chúng tôi tập trung vào
thông tin trực quan, hình học của các phần từ trong biểu đồ tie phân tích, lấy thông
lin ngữ nghĩa của chúng.
- Phương pháp phân tích và dọc định dạng XMI của các biều dồ ƯML này để trích
IU các thông tin ngữ nghĩa và biến chúng thành các máy trạng thái xác định để
kiểm chứng dược thuận tiện trong birớc tiếp theo.
- Nghicn cứu lập trình hướng khía cạnh và cài dặt chức năng kiểm chứng tự dộng
các dãy lời gọi xem chúng có tuân thù đặc tà hay không. Chúng tôi theo dõi
5
chương trình khi chúng được thực hiện và phát hiện các lỗi khi chủng không tuân
thu máy trạne thái dã xây dựng ờ bước trên.
-Ị. Dịa diêm, thời gian và phương pháp nghiên củv
Nghiên cứu dược thực hiện tại bộ môn Công nghệ Phần mèm, trường Đ11CN, ĐHQGHN, sử

dụng các trang bị hiện cỏ và phần mềm miễn phí trên Internet: Sun lỉclipse. Các tài liệu tham
kháo phần lớn dược tìm trên Internet.
5. Kèl quà nglĩién cứu
Kcl quà nghiên cứu chính của dề tài là
1. Thư viện dọc file XM1 chứa các biểu đồ tuần tự theo chuẩn UML 2.0.
2. Chương trinh phát hiện các lỗi không tuân thù đặc tà biểu dồ tuần tự ƯML 2.0 cùa
clurơng trình.
3. Cài dặt plurime pháp kiếm tra động dựa trên A01\
Kct quả dã dược thổ hiện trong 01 hài báo với tiêu đề "Checking implementation of UML 2
sequence diagram", do các tác già: Trương Anh Iloàng và Nguyễn Dinh Phúc và Lưu Trung
Tuyển viết và dã dược dăng tại hội nghị ACOMP 2010 (International Conference on
Advanced Computing and Applications) tồ chức tại thành phố Hồ Chi Minh. Việt Nam. từ
ngày 3-5 tháng 03 năm 2010. Bán sao cùa bài báo cỏ trong Phụ lục.
Nội dung nghiên cửu cụ thể cùa đề tài được báo cáo chi tiết trong các phần sau đây. Phần I
kháo sál các nghiên cứu liên quan. Phần 2 mô tả cách phân tích và trích thông tin của biểu dồ
tuần lự trong IJML Phần 3 mô tả cách xây dựng máy trạng Ihái từ đặc tà UML để sinh mã
kiểm chứng. Phần 4 mô là việc sử dụng AOP clể kiểm tra tính đúng dan cùa chương trình khi
nó dược Ihựe thi. Phần 5 nêu một số thực nghiệm và thảo luận đánh giá. Phần 6 nêu một số
két luận chính.
Phần I. Tổnj» quan về phương pháp
I lộ thốim dược mô tá chi tiết trong hình sau. Đầu vào là các tệp XMI mô tá các biểu dồ tuần
tự. Chúng tu sẽ phân tích tệp này và biểu diễn chúng dưới dạng một máy trạng thái hữu hạn
dơn tlịnh trong Java. Từ dó chúng ta cỏ ihể sinh mà kiếm chứng trên ngôn ngữ AspectJ và
dùng mà này theo dõi chương trình cài đặt biểu đồ tuần tự dó và phát hiện lồi nếu chướng
trình này không luân thủ đặc tả chi ra trong biểu dồ tuần tự. Hệ thống sỗ cần bộ kiểm thừ tốt,
có độ bao phú các dường di trong chương trình cao, dổ phát hiện dược các lồi có thể có trong
chương trình. •
6
Sequence
Implement

ị '

diagrams
Java classes
Test suite
.
J
Generate
Weave
Checking
aspect
Compile
Application
w / runtime
checking
Execute
Report
Chú V dây là phương pháp kiểm chứng động, dựa trên việc thực thi chương trinh để phát
hiện lỗi. Nốu hệ thong không có các dự án kiểm thử tự dộng đi kèm như JUnit thì người sử
dụng sẽ phải kiểm thử trực tiếp và hệ thống SC theo dõi. báo lồi dựa trên các đường chạy cụ
thê cùa chương trình.
Phần 2. Trích thông tin của biểu đồ tuần tự trong UML
Trong tệp XMI mà ta xử lý có hai phần tử chính là <Diagrams> và <uml:Package> chứa các
thông tin về các thành phần trong biểu đồ tuần tự.
Truy xuất các đườngg đời (lifeline)
Một dường dời cỏ thẻ là <lifeline> trong đó.chứa hai thuộc tính chúng la cần quan tâm là id
và name, '['rong name ta chi quan tâm tới tên lứp (nhớ lại quy tắc tên một lifeline là
objeclNamc:ClassName ) tức là sau dấu hai chắm còn bò di tên đối tượng. Vi trong một biểu
dồ có thể có nhiều lifeline có cùng tên lớp nhưng khác nhau tên đối Urợng do vậy, mỗi khi ta
Iruy xuất thêm một lifeline mới ta lại phải kiểm tra xem trước dó dã có lifeline nào cùng lớp

với I1Ó hay chưa nếu có rồi thi tên dối tưựng sỗ dược đặt theo quy tắc sau: object 1, object2,
v.v. Sau khi lưu hết các phần tử này, kết quà ta sẽ có dược một vector các đường đời vẽ trên
sa dồ.
Truy xuất các thông điệp (messagej
Một thông điệp có thè là <message> trong dó ta quan tâm lới thuộc tính id, name, sendEvent,
recciveEvent và messageSort. Tên của Ihuộc tính ta sẽ chi lấy lại tên của method còn bỏ di
phần tham số. Từ hai thuộc tính scndEvent và receiveEvent, thông qua Element <fragment>
inà có ihuộc tính xmi:type= uuml:MessageOccurrenccSpecification ta sê tỉm ra lifeline
nguồn và đích cùa thông diệp đấy. Từ thuộc tính messageSort ta sẽ biết dược thông điệp đấy
thuộc loại nào trong bày loại thông diệp dã nêu trcn.
Kct quà ta sẽ thu được một vector các thôiig diệp. Tuy nhiên có một vấn dề là Ihứ tự các
thông điệp sẽ là thông điệp nào dược vẽ trước sẽ có thứ tụ trước chứ không theo thứ tự thông
điệp bên trên sè có thứ tự trước. Do vậy ta phủi dựa vào tọa độ của các thông diệp đẻ sáp xếp
lại danh sách các thông điệp theo dúng trình tự của chủng trên biểu đồ. Thù tục thực hiện là
ta phái tìm trong Element có thó <guiDiagramLink> id cùa thông diệp sau đó tính tọa dộ rồi
7
sắp xếp lại theo thử tự các tọa độ. Cuối cùng ta SC có một vector các thông diệp llieo dủng
thú lự mong muốn.
Truy xuất cóc đoạn gộp (combined fragment)
Các đoạn gộp được truy xual như sau. Giả sừ đoạn gộp cỏ Interaction Operator là loop thì
trong tệp XMI sẽ nam trong Element có thè <fragment> mà có thuộc tinh
\mi:typc=‘'uml:CombinedFragmcnt'’ và thuộc tính interactionOperator= “loop". Từ Element
này ta sẽ lấy ra thuộc tinh id và tìm trong phần diagrams element <guiDiagramGuiLink> nào
có thuộc tính guiLinkíỉlement trùng với id cùa loop. Qua đó. loop sè có các tọa cỉộ về vị trí,
chiều cao, chiều rộng. Rồi ta sẽ tìm xem các thông diệp nào có tọa độ nam trong loop thì sẽ
Ill'Ll lại. dánh dấu thông điệp dầu liên và cuối cùng hên trong loop. Ta cần lưu thêm thông
diệp ngay sau loop mà không phải là một thông diệp trả lời vi cần thiết cho việc xây dựng
máy trạng thái sau này.
Những (loạn gộp khác như Option và Break ta cũng làm tương tự như với loop chi khác là ở
thuộc tính interactionOperator bây giờ sẽ là "opt" hay “break". Dổi với những Combined

Fragment có nhiều Interaction Operand như Alternative thì bước đầu tiên ta cũng làm tương
tự nhu với bên trên với thuộc tính interactionOper.'Uor=“alt'\ Sau dó khi lấy các tọa độ về
kích líurớc thì ta phải lấy thêm tọa dộ cùa các dường thẳng phân cách giữa các Interaction
Operand. Từ dấy ta sẽ xác định các thông diệp bôn trong đoạn gộp thuộc về Operand nào,
thông điệp nào là mở đầu và thông diệp nào là kết thúc Operand đó. Ngoài ra ta phải xác
dịnh thêm thông điộp đầu liên không phải thông diệp trà lời sau đoạn gộp này.
Phần 3. Xây dựng máy trạng thái hữu hạn đon định
Từ việc lấy các thông tin trong file XMI ờ phần trên ta có thể xây dựng máy trạng thái hữu
hạn trong Java theo các bước sau. Ta gọi tập hợp các trạng thái (State) là s = {s0, S|, s2,
s„}, tập các thồng điệp {không tính thông điệp trù lời) là M = {nio, nil, ni2, nij mn}. Đâu
tiên ta lạo ra trạng thái S(), dặt nó là trạng thái khởi dầu. Với mỗi thông diệp thứ niị, ta tạo ra
Slate s, I I và tạo ra Transition (Sj, irtj, Sj+|) nối từ State thứ i tới State thứ i + 1 có Event tương
ứng với thông diệp thứ i. riếp đó la lưu tên các State Sj và Sj
+ 1 vào trong thông diệp m, như là
trạng thái nguồn và đích cùa thông diệp thứ i dê sau này làm việc với các Combined
Fragment ncu có. Cuỏi cùng ta dặt trạng thái cuôi cùng tạo ra là trạng thái kct thúc. Ncu
không có các Combined Fragment thì coi như công \ iệc dà hoàn thành.
Nếu có đoạn gộp loop, alt, hoặc opt, ta biến I1Ó thành các đoạn tuần tự bang cách thêm các
cạnh lằn lượt như hình dưới dây. Khi các đoạn gộp lồng nhau, ta sẽ tháo các cấu trúc này từ
trong ra ngoài. Cuôi cùng máy trạng thái nhận dược có thê không đơn định. Va có thỏ dê
dàng chuyển chúng về dạng đan dịnh nhờ ihuật loán trong [12].
r ±
I loop
r
r i -1
LT J
seq
8
Phần 4. Kiềm tra lỗi dựa trên AOP
Phân kiêm chứng chúng tôi vân dựa trên lặp trinh hướng khia cạnh như trong dà trình bày

irons ị 14Ị. V tương chính của phương pháp vần là dựa trên một máy trạne thái hữu hạn
(FSM) chúne ta tìm các phưưng thức cần theo dõi trong quá trình chạy, và dùnu một biến lúc
dầu ứ trạng thái bat dầu cùa FSM và nó sẽ di chuvển Iron tỉ máv trạng thái mồi khi một
phươna thức hạp lệ dược gọi. Nếu phương ihức được gọi không hợp lệ. phần mã kiểm chứng
sẽ ihông báo lỗi.
Trong bài háo Ị14 ị chúnu tôi bắt dầu từ một dặc tả riêng, bang ngữ pháp dơn giàn. Illume
cũng chuyến về máy trạng thái hữu hạn trước khi thực hiện các cône, lioạn sinh mã aspect, ờ
bài toán này. dữ liệu dầu vào là các tài liệu phần mềm cụ thẻ thường tlã cỏ san. nên người
phát Iricn không can phái viết thêm các dặc tà.
Phương pháp này cũng cho phép kiểm tra các biểu đồ tuần tự có nhiều đối lượng của cùng
một lớp trôn mộl hiểu dồ. cũng như việc cỏ nhiều các luồng chương trình chạy song song.
Bàn chất của clìất lượng kiếm chứng tuy nhiên phụ thuộc vào chat lượng cua bộ dữ liệu kiếm
thư có hao phú dược nhiều khá năng chạy cùa chương trình hay không. Nhưng việc kiềm thừ
với độ bao phú cao là yêu cầu vốn cần có của mọi chương trình phần mêm, nên phương pháp
cùa chúng tôi rất có ý nghĩa thực tể ờ điềm nó tận dụng những gì các dự án phần mỏm dã có
và vần dang làm. Công cụ chỉ tham gia và không gây ảnh lurởng gì dến cấu trúc qui trình
phát triển vốn có nhưng lại có thẻ phát hiện các lỗi mà con người vẫn phải lùm hang tay vói
chất lượng không cao và ton còng sức thủ còng.
Một trong những iru diếin cùa phương pháp dựa trên AOP là ta có the kiềm tra mà không cần
dên mà nguôn cùa chương trình. Diều này cũng có nghTa người phút triên không cẩn phài sửa
dồi gì đốn chương trình dỏ áp dụng phương, pháp này.
Phần 5. Thử nghiệm và đánh giá
Chúng lôi (lã cài dặt và tliir nghiệm chương trình với một số ví dụ tliển hình. Tính dúng dan
của plurơng pháp này khá rõ ràng vì phương pháp dựa trên việc kiểm tra dộng - cách kiểm
tra luôn mang lại kết quà chính xác và phán ánh đúng lỗi thật, không phái các cảnh háo như
phần lớn các phương pháp tình thường gặp phải.
về ánh hưởng của mã aspect den tóc độ chương trình không phái lủ yếu lố quan trọng, vì ờ
dây chúng la kiềm tra trong giai đoạn kiểm thử dơn vị hoặc kiếm thứ tích hợp. Ilưn nữa các
doạn mã aspect dược sinh ra khá ngan và dơn giản nên ánh hường của cluing không phái là
vấn đề lớn.

Phần 6. Kct luận „
Xuất phát từ bài toán rất thực tế và dựa trên những đặc tà bán hình llúrc (UM1.) đang dược sử
đụng rộng rãi trong các dự án phần mềm chúng tôi dã dề xuất và cài dặt plurưng pháp kiểm
chửng dặc tả biểu dồ tuần lự UML 2.0 cùa chương trình phần mèm. Cách tiếp cận tuy dồi hỏi
phái thực thi chương trinh để tim ra lỗi nhưng vẫn mang tính thực liền cao và các lồi phát
hiện dêu chính xác. Các phần mềm đều phải trải qua công, doạn kiêm thử kỳ lưỡng nên việc
kiêm thử tỉộim này không đòi hỏi thêm công sức của người phát triển huy dội kiểm tliir.
9
Chúng tôi cũng dang nghiên cứu việc áp dụng kiềm chứng mô hình, dựa trên Java
Path Finder dể tự động kiểm chứng với chất lượng bao phủ cao.
6. Kết quả đào tạo
Học viên Vương Văn Trường đang thực hiện khóa luận tốt nghiệp theo hướng nghiên cửu
này.
7. Kết quả ứng dụng
Công cụ có thể sử dụng đê tìm lỗi trong các phần mềm viết trên Java và có đặc tả bằng các
biểu dồ tuần tự chi tiết cùa UML
8. Thảo luận, kết luận và kiến nghị
Chúng tôi thấy đà hoàn thành các mục tiêu đã dặt ra và thay dề tài cỏ khả năne mở rộng cho
các biểu đồ khác trong UML.
9. Tài liệu tham khảo
!. Chris Allan, Pavel Avgustinov, Askc Simon Christensen, Laurie Hendren, Sascha
Kuzins, OncTej Lhot'k, Oege de Moor, Damien Sereni, Ganesh Sittampalam, and
Julian Tibbie. Adding trace matching with free variables to AspectJ. In OOPSLA’05:
Proceedings of the 20th annual ACM SIGPLAN conference on Objcct oriented
programming, systems, languages, and applications, pages 345-364, New York, NY,
USA, 2005. ACM. k
2. M.A. Ameedeen and B. Bordbar. A model driven approach to represent sequence
diagrams as free choice petri nets. In Enterprise Distributed Object Computing
Conference, 2008. EDOC ’08. 12th International IEEE, pages 213-221, Sept. 2008.
3. Aritra Bandyopadhyay and Sudipto Ghosh, lest input generation using uml sequence

and slate machines models. Software Testing, Verification, and Validation, 2008
international Conference on, 0:121-130, 2009.
4. Lilian I ill rely, Yoonsik Cheon, David Cok, Michael D. Ernst, Joe Kiniry, Gary T.
Leavens, K. Rustan M. Leino, and Erik Poll. An overview of JML tools and
applications. Software Tools for Technology Transfer, 7(3):212-232, June 2005,
5. Yoonsik Cheon and Ashaveena Perumandla. Specifying and checking method call
sequences in JML. In Hamid R. Arabnia and Hassan Reza, editors, Software
Engineering Research and Practice, pages 511-516. CSREA Press, 2005. '
6. R. DeLine and M. Fahndrich. The fugue protocol checker: Is your software baroque,
2004. ‘
7. Ying Jin. Formal verification of protocol properties of sequential Java programs. In
Proceedings of the 31st Annual International Computer Software and Applications
Conference - Vol. 1, pages 475-482, Washington, DC, USA, 2007. IEEE Computer
Society.
10
8. G. Kiczales. Aspcct-oricntcd programming. ACM C’omput. Surv page 154, 2001. 9.
Gregor Kiczales, Lỉrik Hilsdale, Jim llugunin, Mik Kersten, Jeffrey Palm, and William
G. Griswold. An overview of aspectj. in ECOOP '01: Proceedings of the 15th
European Conference on Object-Oriented Programming, pas.es 327-353, London, UK,
2001. Springer-Verlag.
10. Xiaoshan Li, Zhiming Liu, and He J if eng. A formal semantics of UML sequence
diagrams. In Proc. of Australian Software Engineering Conference (ASWEC’2004),
13-16 April 2004, Melbourne, Australia, 2004. IEEE Computer Society.
11. Object Management Group. Omg unified modeling language (omg uml),
superstructure, v2.2. February 2009.
12. M. 0. Rabin and D. Scott. Finite automata and their decision problems. IBM Journal of
Research and Development, April 1959.
13. Hui Shen, Aliya Virani, and Jianwei Niu. Formalize uml 2 sequence diagrams, 2008.
14. Anh-Hoang Truong, Thanh-Binh Trinh, Dang Van Hung, Viet-Ha Nguyen, Nguyen
'['hi Thu Trang, and Pham Dinh Hung. Checking interface interaction protocols using

aspect-oriented programming. In SKFM’08: Proceedings of the 2008 Sixth IEEE
International Conference on Software Engineering and Formal Methods, pages 382
386, Washington, DC, USA, 2008. IEEE Computer Society.
15. Muhammad Usman, Aainer Nadeem, and Tai hoon Kim. Ujector: A tool for executable
code generation from uml models. Advanced Software Engineering and Its
Applications, 0:165-170, 2008.
16. Muhammad Usman, Aamer Nadeem, Tai boon Kim, and Eun suk Cho. A survey of
consistency checking techniques for uml models. Advanced Software Engineering and
Its Applications, 0:57-62,2008. •
IV. Phụ lục
1. Báo cáo tóm tat. .
2. Bài báo dăng tại ACOMP 2010 (bìa, mục lục, và nội durig bài báo).
3. Dĩa CD chửa công cụ phần mềm.
4. Bản sao Đe cương và Iĩợp đồng thực hiện đề tài nghiên cứu đã được phê duyệt.
5. Email xác nhận bài báo được nhận dăng trên tạp chí. „
V. Tóm tắt các kết quả nghiên cứu chính của đề tài
- Kct quả về khoa học: Đề tài dã khai thác dặc tả UML và các phương pháp phát hiện lồi
không làm đúng đặc lả của chương trình. Kết quả nghiên cửu đã dược đăng trên 01 bài
báo tại hội thào quốc tc “International Conference on Advanced Computing and
Applications” to chức tháng 3 năm 2010 tại TP. Hồ Chí Minh.
- Ket quà phục vụ thực tế: Sản phẩm (chương trình phần mềm) có thể dùng để phát hiện
lồi sai đặc tả biểu đồ tuần tự ƯML của chương trình Java.
- Kết quả đào tạo: 02 sinh viên nghiên cứu khoa học theo hướng của đề tài. 01 sinh viên
đang làm khóa luận theo hướng của đề tài.
- Kết quả nâng cao tiềm lực khoa học: Đe tài đã giúp nâng cao kiển thức của sinh viên
và nghiên cứu sinh tham gia trực tiếp vào đề tài và kiến thức chung cho các cán bộ tại
Bộ môn Công nghệ Phần mềm. Kết quả đang dự định sẽ được sủ dụng thử trên thực tế
tại công ty Mitani Sangyo Co. Ltd., Nhật bản.
SA! HỌC ỠUỔC GIA HA NÓI
tftUN© TẦM THÔNG TIN THƯ VIÊN

0 0 0 6 0 0 0 0 0 2 . %
12
inK^ncHional C unferu'ct- •
Advanced Com puting and Applicatio
Ho Chi Minh City University ofTechnology
Ho Chi Minh Gtv, Vietnam March 3-5-2010
.X f
I
t
1
»
lỉuynlì Bao Trong, Nguyen Cao Dal, and Nguyen Thanh Son


289
Extensible Grid Information Service in Ĩ N-Gnd
1
Anh-Hoang Truong. Dinh-Phuo Nguyen, and Chung-Tuycn L.UU

299
Checking implementation o f I 'ML 2 sequence diagram
Ĩ
I ran (’ông Tu and Thoai Nam


309
Scheduling Parameter Sweep Apphcatmns on Grid
Ngu> on Duy Anh Tuãn, Bui Trung I lieu, anil Tran Ngoc Thinh
'18
BB1‘ A Bloom-Htoomier Filter for Pattern A tatchtn% in (. ’lam Antivirus

. !•
Phitong Vo-Tan. Khoi I’han-Dinh. ami Anh-Vn limh-Duc

?28 :
l,an;e scale Automatic Vehicic Location System using ZigRee fj
I
Wai Will Zin, Them Than Thwiti, Aye Myal Nyo, Hnin Wint Khaing, Thandnr Su
Ngc Hlwe, and Than Naing S o e

338
Secure Aiiillipcirlies Computation based on DSA digital signature and RSA
cryptosystem
Cam Nguyen Tan, Son Dang Truong, and Tan Cao Dang

,

348
Earlv Abnormal Overload Detection And The Solution On Content
Delivery Network
I
I
Nguyen Thanh Son and Angelika Ounse-Gcrstncr



358’
Cubic Spline Interpolation Based Parametric AioJcl Order Reduction
Thanh Tran Nguyen, Thai Hoang 1,0, and Bac Honi L c 368!
keystroke Dynamics Extraction bv Independent Component Analysts and
ỉ3io-itiarnx for ther Atifhenticnficn

K
I

j
]
Gumci
IBM India R
c> Huo, J., L»u, L , L iu, L., Yang, V . and Li, L. 2007 A Sludy on D istributed Resource
Inform ation Service
1 1 1
Grid System In P roceedings of (he 31*1 Annual international
C o m puter S o ftw are and A p plication s C o nfcrcn cc - V olum e 01 (July 24 - 27, 2007)
C O M PS AC* IEE E C o m puter S ociety. W ashington , DC* 613*618
7 Sun. H . Zh ang , Y . H u. c \. an d H uai. J 2004. A N ew A rch itecture for O GS A-bascd Grid
ỉn in rm uho n Servjcc In Proceed ings o f the 2004 IE EE in ternationa l C onference on Service*
C o m putin g (Scpicm bci 15 - 18, 20Ơ4) IEE E C o m puter S ociety. W ash in gton, D C , 575-578
ii Pclei Diiitiu and D o ng Lu Fasl C om positiona l Q ueries in a R elational G rid lnfonnation
S en I C C J Jo urnal o f G rid Com puting Ỉ -2 (June. 2 005), 131-150
9 C lolm s T o o lk itfM 4 http./W W W g lob us orgy
ỈỨ Kciii. Toil
14
Ka Iok D ev eloping W eb Services w ilh A p achc Ax is. 1411 670 329 Lulu Prwj
(Ju ne 200<>)
Checking im plem en tation of U M L 2 sequence
diagram
Allli-HotUlg Truong. Diuli-Phuc Nguyeu, aud Chung-Tuven Luu
U n iversity of E ng ine erin g a n d Techno logy, VN U
144 X uiin T huy, H anoi
h o a n g ta O v n u . e d u . vn
A bstract. The sequence diagrams of the U nified Modeling Language

(UML) ai l; the specifications for the programmers to implement, the COI-
rtfS po m iing iuu dn ltA . Tli*i J»1 u g m u imel'S us u a lly hiiv*i to m n nu ally 'íii.suI*:
th a t th eir im plem en ta tion follow s th e sp ecification expressed in th e d ia 
gram s. T h e m an u al ta s k is lab o rio u s and difficult for com plex diag ra m s,
especially with the inUoducGion of cojnbmtid fragment* 1.0 ƯML 2.0 se
q u e n c e d ia g r a m s r e c e n tly T h t a t j f o r e c u i t o i i i d t i i i g th is c h « c k i i: g pio C B S N is
wssential. w * pro p o se a. m ethod th a t first tran sfo rm s ƯM L 2.0 Siscjueni.'*
diagrams to deterministic finite state machines and then generate aspect
co de w hich c an be used to check if a Java m od u le is c o rre ctly im ple
m en ted w ith tewprtTt to th e se<iunnr«* diag ram s. W e hav<» im plem en ted
t h e a p p r o a c h t h a t h a u d l - i s t h r « e f r e q u e n t l y U itid c o m b i n e d f r a g m e n ts o f
u ív!L 2.0 sequence diagrams: loop, optional, and alternative.
1 Introduction
The Unified Modeling Language (UiVIL) 1 is widely used to specify, visualize,
and document the design of a software system. One of the m ost commonly used
types of diagrams is sequence diagrams. They speciiy how n m odule or som etim es
a function should be implemented to carry out the tasks. In particular, they
usually describe the sequence of messages or method calls among a group of
objects When implementing the module, the programmers need to make surt-
that tli«* r.oiie they ar<j writing follows tilt* semantics of till' sttqui'iiw diagrams
However since this is a manual task, it is not easy for the programmers to
make sure that their im plementation is correct with respect to a sequence dia
gram. Errors may be introduced when the programmers sim ply forget a message
ill the sequence diagram or send the message to a wrong object of the sam e class
When the sequence diagram is complex, the programmers may have to create
several functions or extra classes to implement the specification and this makes
checking the correct oilier ut messages in the sequence diagram harder. Further
more, a module may need to follow more than one sequence diagram (e.g. from
different viewpoints), the task IS thus more challenging since It is difficult to
combine ail the relevant views and loliow them ail at the same time. Therefore

ones used to autom ate this checking task.
1 />vvwuMy Mii^/icniiciitaiiuii UI UIVIU mi sequence ŨU
•oacii overview
i

uposc a method tu chvck ttt liiutime if tt module follow a specification
l>y some sequence diagrams. The approach is based on aspect oriented 4 ■
ling |8j, 111 particular Asp**ctJ [9|, awl we assume that the software is
Java I In* umili idna is t.lirtt. w>- analyzf n giv»*n ƯML w-fjUHiicH diagram
to its semantics and generate checking aspect, code. Tile »euerated
Uluru tor only the method calls or messages specified ill the diagram
li the sequence of method calls file valid US specifier! in the sequence
Wt* leport errors when the sequence of method calls dues not match
lice specified by the diagram.
-ork advances our previous work on interaction protocol conformance
14i wlit'it* We check tile correct usage of interfaces auioug a uumber
Many works on checking protocol usage or method call sequences
41 are also relevant to this work. However, our main contributions
[OIII Hi hsju-rt. .since* UML ill gt*ipral find sHqitfiic** (iingrtiin ill
alt? widely used as Softwure design documents. Our approach works
general protocol as in ihe related work and detail ƯML sequence
Sequence diagrams can be viewer! a.s tt S[>ecmliz«< 1, refined version of
MlJ they HU- applied ill specific places while protocol should U- obeyed
c*.
some ndvniitiigtf.s of directly using UML diagrams to check the cor-
thf soltWiirt. First, tlitsrtj is almost no extra Wolk required since Wf
WML specification and Its implementation Second, our approach also
solidatiiiR the UML documents if they are not up-to late or not really
LliH ( I11T(-Iit hiipl«iufutHti«iit. It <«11 rtl». UII.'OVHI tl, finws in lỈMiigu
when the sequence diagrams have conflicts ox inconsistencies. Tills

b e c a u s e M l i m p l e m e n t a t i o n c a n b e v i e w e d a s a m e r g i n g o f a l l o f its
it of this paper is organized as follows. Section ‘2 presents the "eueral
of our approach- Section 3 explains how we build a state machine
tL sequence diagram. Section 4 discusses our method to monitor and
implementation of sequence liiagi suns auU som e experiment results
rized in Section 5. Related Works are compared in Section 6. Section 7
Hid outlines our future directions.
project or a test suite ill software development projects, we only need
all the test cases to Gild problems in the implementation.
escrilte* I lie architecture of the system. The top left box is a set of
?nce dirtgi’ftms which ur« the specification of the Java classes ill the
Ix.x - the impi<*meiit.rtiion Wi- t,<> verity Hint Mu- impli'iut-lltrttir.u
sppoifioal H>u
architecture, our main work deals with analyzing the UML sequence
lil t.lir-n Ui-nriat.ing As|>(‘< ( ) <:i>i1h. Till- ivst is lifiegrtfail til Aspect,!
Innlij a version of soft wan• lhat includes rhecking Clide Lu detect any
»i lilt* sp<?i ihculion Si net? It IS very coiỉiíTKTt nowadays t o have a ti*5t
Ũ
Sequence
dia&r&jn*
huplcm-nn
r"~
Jnva cias>c>
Test »uitc
Generate
Checking
ttsgcci
Compile
Application
« joutmie

chcck.11 IS
Report
.FSguil J iSerview
Note that our approach requires very little additional cost to the s
velopment process because UML specification and its implementation
a test project or a test suite already exist ill most software developme:
We only require the programmer to specify the link between a sequen
and its implementation That is the programmer need to provide wh
implements wliicli specification. It uo link is specified, then the spe<
applied everywhere, just like general interaction protocols [14].
A major difference between general protocols and ƯML sequence
that the protocols are respected everywhere, for example a file should
before any read/wiit* and closed in the end, w ilik the ƯML sequent
are applied case by case, for example in one module, say A, a fi!*i
opened, then a nuniher ol reads only (no write operation), and the:
allot her module, say B, the file should be opened for writing only,
specify that module A and B implement the corresponding spe.JiJii
they still both obey the general protocol
Using asjx-ct orifiit**'! programming «u<i Aspwt.J ill J>arti( u!«r »i
proacli additional advantages First, we emi weave the aspect cod
time, compile time, or runtime (load time), so our approach does nut
source code ot the implementation. That means the Java code ill tl
bo\ iu Figure 1 call be replaced by a release/compiled application Fi
Aspect.] allows us to get the exact location (file name and line nun
statement under execution. As a result, we can report the exact fill
line number ill tljrt.1 file when- the *»rrnr is iỉ<-tM:t.wỉ.
The next section explains the main contribution of this Wurk VVỈ1
lyze a UML 2.0 sequence diagram and then convert it to a finite sta
After that we follow a similar approach of Truong [14] to geneva
aspect.

3 Building FSM for sequence diagrams
Sequence diagrams contain three basic types OÍ elements: lifelines,
changes, and com bined fragments. T he lifelines are objects that CO
tig iT ÍỈK L A i i i i i g i o i n f o r l i a lti n c t í q u e l V.
. . u ĩ \ .'111 t i:t- V.«.slv I h i- / l i t . s s a i / e s K jH ’i ' i l y til* * t e m p o r a l I t n i f r u i ỉi i H t ỉ i o d r tỉ ỉ L s tlid ỉ
(if f u.g. imiiK-fs Itmst !■ 1ÍOK Sequence diagrams in ƯML 2.0 may coutaitt so
• ilie.) i-t'1 'ibitirii fragments, which are regions on the diagrams and they specify
cue hehrtvii.ur of the: raeftriuges in the regions. Among eleven types of combined
iioguu-ids, I II: cumm-'Uiy list'd uues w«* a.lteru«tiw, option a.nd loop. Fraguifuts
• bin ftfc;. 1 <• li stud. hi this paper we focus on the three types of fragments. Other
n.igiii I T Villi b*> haihlle-i in a similar wav and this is our future work.
St-qm.'ix r- diagram s iiavc staudarij sem antics described iu Ịll). Accordiug to
t !:•- seniani i.:s, tin? sim ple example ill Figure 2 specifies that after queryBalanceO
>j>ei->ri.ni |) ' User object is called, the getA ccountsO operation of an Account
i.> OlHeti itii'i i Ilfli tilt* getB alanceO operation of th e sam e Account object
can be Ciillud i* mnnber '."I timiw After that the lo g() operation of the Us«r
>lijr»i-t is < „ n «i
T h e hcigm<-u! say s that we lepf&t th e gotB alance C) for every account of
t f f u sei T il" Ị>1 Ig iaium ers w ill uud erstand that. getB alancoO should be called n
times will-IV II IS cIk' ivtmner! value of tile previous call gatAccountsC). However
V. - vv iii .'SliY < h f k g e t B a l a n c e C) Ititn III' I 'r t ii e il z s i o o r m o r e t i m e s b e c a u s e tile
.1 If* "i«.1 -H. ii ■ in thí* diagram lb .(list a text in natural language. We
. ■»., • it with mole precise specification oil the number of tim es we have
I k:.ov> i \ -sr.mt? IniIll/ll notation such ns using OGL hut we leave it for future
' 'Ĩ In
BcK'-t- -iescrihutR till? procedure u> Imilf.i a finite state* machine from a se-
ijii.’iiif liat’,!am, WI- lm in nli/e sume uutuliuus. W f denote sequence diagram by
■ II,s I.»i.*I: t.y C' nil I its e x d ia iig e d m essa ges tiy M . A n o b je c t o h a s t h e form
wi.i-1 . < i> ; tie fUentKv tti the o l‘i*ci, whi«"h call h i om itted, and c is the
.i.i.s-, /. i!i AI lifts .the loi III O ' , sir/ ,O rt where O ’ .O'* are source

ill. I í.ii ii .»t>(«.••:«Si, re s p e c tiv ely a n d f-iy is I Ilf s ig n a tu r e OÍ t h e o p e r a tio n of
.‘11 ;1U|'ieiiìtínLaUuli óí D lỉ. denoted l>v Ỉ
s -I",.lirtguu;: D > Mit.niiis /.••!.• . .1 111**!*-* Irugiitf'Ut.s Eii< h il rigMi'-'llt, f’OD-
lain: AU operation specificttUun such as loop, alt, opt and a list of
UR\s'.:agi:-s v.'tiii/li i a n li * e m p ty N o te that. H. m e s sa g e is ill a frag m e n t, if t h e w hole
message is ill the flagmtfUt. If a message is ill several nested fragments, then the
message belongs to the inner most (sm allest) containing fragment. We denote
the set of fragments by F.
To extract the all the above elements of a sequence diagram, we first export,
the diagram to XM Ĩ- (XML M etadata Interchange) format and then parse the
XMI file to get necessary information. For exam ple lifelines are the elements
witli tag lif e lin e . Tilt* messages ale ill tag <UML:Message> which (Xilltams mes
sage name aatl chilli elem ents <UHL:TaggedValue> specifying types of arguments
and the return type To determ ine the elements of a fragment, we base on the
geometry attributes ot t lit-* hnguient it]II1 the lUHMsHgf.s.
After parsing n XMI file to get all information of ft diagram D we build a
finite st.rtti- liiat hiuH Ulrti. <<'litmus nil possible spipieiHT- (if metỈKMÌ I nils sjifi ili>-il
111 u . Recall that for a message of the form 0 “, sig,O d, the signature sig is an
operation of Od■ T h« process to build the state machine is as follows.
First w*? create an m itial state and set a current sta te variable II to this IWVJ
state. Then for each nsessage of the form 0 i ,siy< 0 we create a new state and
a transition o .siq from ti to the new state and then upfiate II to the new state
Note tlittt we ignore Uitr return messages (da-sli a llow s ill Figure 2) for simplicity.
■ The last state created ib set to be the final sta te of the state machine, if D has
no fragments the state machine is <lone. Otherwise, we neetj to make additional
m odifications to tht* st-Hi.f mnrhiut* liejifin ln ig 1 11! till' tyi*M» (if fchf* !ragiuijiit.
For a loop fragment, suppose that the first message and the last, message are
o J, sir/ị, O'! an<l Oĩ. KĨfi2,0‘ỉ, respectively, we can see that after calling oi.siffi-
it is possible to go buck to the beginning of the loop and call O ị.siyI, so Wti
need to create a transition O'/.sic/1 from th e destination sta te of O'.i .SÚ/2 to the

destination state oi Of.sifi] 111 a special case, a loop contains only one message,
we create Slilf-ioop ill tilt* stale machine. A loop may also be skipped (loop zero
times), so we need to duplicate the transition after the k>op but with the source is
the source of Oị .sÌỊii. T ile state machine of the diagram in Figure 2 is described
in Figure 3
Alternative fragments are list'd to specify tt mutually exclusive di'H .e heT.\\v n
two or more m essage sequences, simitar to the class!' "if then elst>" construct,
ill most programming lmigutigtiss. Fur this type of fragments, tlit'iv MV luulUp!"*
sections am! the execution will take only one of them. So we update the St .it#*
machine hv changing ail transitions that go from one section to the next by two
new transitions. One transition is hum tile sour Cl- of the first JUfssttgi- ill tilt* first
section to tile destination of the first message in tile all other sections with the
label of the first message in the section. The other transition is updated with
th<* destination b«*mg r];v> -ii'st.i nation of T.hp inst mfSSAgt* ill thf“ Inst section r>f
tile fmgUK-nt.
Opt.ion h'ftgmenls Mì' used to modi'! a sequence that will OCCU1 if a certain
condition is met, otherwise. I,]It- Sfqueiice does not occur. All option is used to
mudei a simple ’ if t.h<?b" statement. Fur this type fragment we first treat it like
all alternative fragment, then we crefite a new transition from the last stnte
nrg/spw /XM I/
I'vk'ir til':' Iirtguiein to til*- first state »(U t the flagmen!., to allow skipping the
•sequence inside the fragment
Note I lull th e finite s t a t e machine constructed by the above algorithm may
II*11 I ’V >1 ‘ m i l i i s t i i n u t ' w « ( n i l I'iiijiJ y r t i n V M l . fi H O H -I l i - t e n n i l l i. s tjr (iiiifcR s t n tp
Hicu .'111 lie* t*j H determ inistic out* according to Ị1-Ị. For otlitT types t>f frtigineut
\w m il huil'l the sta le Iiuiclnne in a similar way. depending Mil the semantics of
h type of ti Agn»t*nt.
:*0
J - P
7Í \

:. .*'i i »- :*i> - **■ - s ■
•ilk)*'. to a S iiin t? o f l.iu litn c e q u e r y 111 f i g u r e 2
Si I I.v umil,y2 ing t lie XMI representation of a sequence <1 ingrain we can build a
s t . n l t* 111 11 ' h i m * I I l r t l 1 1 | ' I ll.s a l l possilil<- S i - q l l H - l l t i v * l i t I l N - '. V S r t g e t j i > f t i l e N H l j t l t ' l l o
i l i a j i '.t t i t i s . F r m n t h i s f i n i t e s t a l e l j it i c h u i v . W f c a n e a s i l y monitor tiU t i c lu i c k i f ail
uiipU'iiiriitauoii conform s to the sequence diagram as will he shown in the next
S v . 1 l 'I I
•i G eneral lag aspect
v * u r I lU il ĩ i i K - w i i f i l n t i o i i rtj> ]i|O rti:li i s t i l m o i i i t o i n i l ( iH 'ii n n > t.lio < i c a l l s . O n e
•si.raig.il) way III do th is task is bv 1 averting m onito ring code to th e source code
.>1 iiy using I'I<.tiling tools. Our approach base on ttspect-oru-nted programming,
w ii i i ii l e s u i t s 111 m n i c c o n v e n i e n c e ÍO I t h e d e v e l o p e r s HS W e ( f i l l i n s t r u m e n t th e
I ođẹ fit iicsig.il time, compile time. 1)1 ruutiiiif (k»mj tiiue). and It works with
I ill Si-uri.f cucle anil liytectxlf (after Cuinpilalioii)
1 lti.oiitoi nil tnet'itxl calls of the state machine, we generate HU aspect that
t ‘.'H iỉiU i.s n J i u i i i t .i u t w i t h t w o advices - b e f o r e a n d a l t e r t u j v ic e s . T he p u i u t c u t
Nj ••> !!!• - that- uv will intercept. to all m eth od ‘-alls that, app ear in th e sequence
• Jmgrmt) I ’ 'Du* ]X >1 m « 111 also allow s IIS to restrict th e a m i s in the source code
I tirti tt'niiv lit monitor, see Ị14j. In particular, we Just collet t all transitions of
< !.’ - lit I i u u l i i l it - U il* ‘ a s t i l a i l'] ( h e l l a U 'im U .' I I k -111 I V O R ( I I } o f
■Ì J '1 1 * j’hi’ |»>iuu:ut l'<r the sta le machine in Figujv 3 will be:
J. > 1 a I I {>v it
'iii '* liter ;|U« rylislar, ceO 'licallt* Account, get Accounts ())
I íỉll i>«ccount . glitBalitnce o ) I 1 call (• User, log ( ) ) ;
. V i i - I I lKTfiling I 111' p.imwul, v.e specify I wo advices: 1 i-it.re advice and ai-
U.IVI *- WhfiM'Wj a Mit-l-lioiJ appearing ill till-* poinLcut IS invoked, ilie before
Checking imDÍementatson of UML 2 sequence diagram 305
mlvice is executed ami we will check if tile call makes a valid transition ill the
state machine. To do this we simply create a current state variable that initial
ized to the entry state of the state machine. After that the advice will cheek if

froiii fch*» iv.invnt slat t* fiit-TH is H r.mnsition I.Urtt ninl.cht'W t in' aiHtlioti signature
being invoked. if there* is no such transition WI' log mi error with detail location
information. The alter ai I vice will update the current slate to th e destination of
the found transition
l u t h e b e l o w c o d * .' l i s t i n g t i l e i SD i s t h e f i n i t e s t a t e m a c h i n e b u i l t f r y 111
the UML sequence diagram and its two methods isV a lidS ta te in before ad
vice checks the curvent method call is rt valid transition in the state machine,
/UiiJ s e tS h a re d S ta te ill rtlĩt
-1
Milvicf" s t'ts t lx> t-iin v n l. stut** vnntthl** !>f -stuff
machine to the new Ni.iUv
befo re ( ) : pc o {
O bject o “ t h i s J o i n P o i n t . g e t T a r g e t o ;
i f ( !Í sm. i sB in d a d (o ) ) fSB.bind ( o ) ;
S t r in g s » t h ĩ s J o i n P o
1
n t . g e t s
1
g n a t u r e ( ) . c o S t r
1
n g ( ) ;
if (Ị i s V a l i d S t a t e (o , s)5 {
l o g ( " V i o 1 a t i o n ■ " +
f s m . g e t S h a r e d 3 t a t e ( o ) . g e t S t a t e ( ) + “ : " + s );
l o g ( t h i s J o i n P o i n t ) ;
)
V
after o : pc ( ) {
S tr i n g s = t h i s J o in P o in t . g e t s l g n a t u r e c)• t o S t r 1 ng ( ) ;
O b ject o = t b i s Jo m P o in t . g« tT a r g e t o ;

fSB s o t S h a r e d S t a t e (o , s ) ;
}
N ote that rt sequem e ùiitgiHin usually involves um lrjple I.’lrtsscs H]I>! there call
tie several in stan ces of a class Tile sLal.tr' m achine am i the cuiTtMil vm iótblt'
.should be shared and accessible by these classes so that every object ill the
sequence diagram call check tviifi u p date th e current St at f‘ poin ter ThtfVt-fore.
method bind at.t.rirhi's 1,11e- tie.sli objprt. t." I'.]II-* strit.f m achine wlic'11 it. is H free
object (does Dot belong t<j any diagrams yet), i.e. f SO). isBindedCo) == true More
details of these po intful and fid vices can be found in our previous work 'i'i]
Auiil.lii-r with UML specification is that, a HH'iliile CHU Ilf* spt'cii'iwl
by sew ral sequence diagrams Fur exainpk1 a sequence diagram mav be used
to specify interface protocol. •>! ii)U>r!fir.e usage, which in essence describing all
valid sequences of' method calls for objects OĨ a class. For exam ple nil files need
to be upeiii'ij before Ifirj/w rite and 0 ÌO6Í' after use. T his call be specified by
a sequenci* diagram Tht* specification may contain another sequence diagram
describing the process of file copy Foj- an im plem entation of file copy, we need
fji lu n k i* s u r e il i i t i i i i i l 'U i s II I I x i t l i f i m g r n m . s . Il l o u r «]>]>r<>M<li W f tt l i o w <T i‘r tt in g
several stale machines and each has a current state pointer, then the chucking
can be done as usual
ir-i&.Mịi ji-Kmii «■* • Imư.i.iiii
5 im plem en tation and experim ent
\\V- built .1 pi'nifitype liMti I licit reads a XMI file containing UML 2.0 se-
• I«se*m • - •iinxmins \Vi‘ list'll lilt XM! torinrtt. geiiernte<l by Altova UModel 3
Ait. I parsing I In- XMI f« 1— We build the finite state mtu.li:Jit- as described ill
tii<- pri-vu.us set t li.II lietore generating thf aspect checking code we convert the
lii.'ii-'ltrifrnitiiist.il' hnitt* stfttf Iiuicliiiii' to deterministic one for efficiency and
II Iiirtiii <■ >!unn" li’stuig,
\\>- liaw le.sti'11 our tuul with all cuinl'iuatiun UÍ [raim ents and (or zero, om>
*1 H < ! n i l I f t ! > i i n l » - i o f m e s s a g e s i l l e a c h f r M g m e n t . A t e s t d i a g r a m i s i l l F i g u r e 4
wln»n> tli i*’ Hit- t wo objects III < Irtss 01, whi'li if Imwili'il carefnliv v>y the pro-

gm uitiie is will I II scut tu ft vviung ob ject. F*JI a ll till.' Itibt.s th a t <Jo not conform
I., til' -q 1 1 lici.itii.11. mtr tool Imports the extu t location of the wrong method
■ nils ia i Ilf inipl im-iitatióii. with /ile liftIIIf mill line numl'*ir as well as the stack
{•I it* •
; imp rt’ww iiltnvil • iiiii/uiiMiiM lilml
6 Related work
One class of relevant works are those ul protocol checking ị 14, 7, tí, 5, 4Ị but Ill'll*-
of them tak es UM L sequence diagram s as specification. Ailftii et III. |i] introd uce
traueinatches which tire sequences of events and an advice is executed when a
is i'oiiixi. Conversely, our liiethcxi notifies at. miy invrtliil s^rpu'Hi t s,
which is nut simple to be described by ft tracematch
Recently there ale som e works trying to formalize ƯML 2.0 sequeucf dia
grams. Ameedeen ft III [2j ulso converts UML 2.0 sequence diagram s into Petri
Nets. They break a sequence diagram into fragments according to their hier
archical structure mil! ti'Ahstnnn each h fvgment bottom -up. hut. the paper does
ttot provide- ill details how llic processing i.s etui led out. SlitiU fl ill. [13Ị try to
formalize sem antics ijf iimv ieat iires 'li UML 2.0 sequence diagrams and it is a
goorl source for us to implement t he lest of our tool. Before that is the work of
Li at III. [10] b u t it m ily d u a ls w ith U M L 1.0, w ith o u t I:lie C uin S'iued f r a g m e n ts
of UML 2 0.
Usmau ft at. [16] give a survey about <letcctmg iu< ■< •H-sist tutiuUK UML
models. Our ap|>iv>tii:l! IS Minong tho Iiionti .1 Rilfi fli'-ckinft ntfiini't, which ar*'
often used technique for ssu.h problems ll'.wevei r'lu vvnvk focuses IS on check hip
th<* inn nil" I I.Ill' I-Oiillii t.s (if UML ino'll’i.s aiv IIIH' <|| I.Svt■ il'Mivvit
results. In aiK‘llier Wink. I'Mimn >•/ ill. 11 /»• prewiii. ft method to ft (If
from UML liiftgi'ttins. T iiis typ»» lA work already exists in many UML tools
ƯML diagrams art? also used to generate test, cases autom atically. A recent
work of BcimJvoptulhynv anil Ghosh |3j IS an example of this path, Their paper
hLsii O'lers I* I ninny work I'll Li'st. I'asf gf'in'ial.i<in from ƯML >iii*gvaiii.s
7 Conclusion and acknowledgment

We have presented a» approach for checking the consistency between U,\iL 2.0
sequence diagrams and th<iir im plem entation. As ƯML is wifJelj used ill m od
eling arid documenting software projects, our approach is ahk> to detect the
inconsistencies between impk'Uieiitalion mid its specifications as ƯML sequence
diagrams. In addition, given the common use of testin g project to tost a devel
oping project, otir approach requires aim ost no additional work from the devel
opers. We haw .shown tile correctness of our approach by building ti tool fur
the three types of combined fragments in ƯML sequence diagrams and testing it
with all typical .sequence diagrams. The results are promising aiul we believe the
npproHt'h is applicable to other combined fragments R1U.1 other types oi diagrams.
In the future, we plan ti> address the remaining CO mb 11 led fragm ents aud handle
advanced features of UML, like guard conditions.
This work was partly supported by the research project QC.Ụ9.06 granted
by Vietnam National University. Hanoi arid M itani Suugyu Co., Ltd.
I ( ’111IS Allan, Pavel Avgiistiiiov, Aske Simon Christensen, Laurie Hendren. Sascha
K uzins, OrnJi*:j L lx .ltik, Oegfi fie M oor, D am ie n Se ren i, G anebl) Sittam palani, and
Julian Tibbie Adding ticU'-tf maiclung with free variable* to AspectJ. In OOPSLẠ
■|/.v Prof r:rihm/s of thr 2UUt nimwU ACM SIGPLAN ctnt/ertfnt.n mi ObjHt f oriented
f'i <U/1 uiiiin iny, sy s te m s, ianợuuyeJ». and ap p licatio ns, pagfiS 3 4 5 -3 6 4, New York NY
I 'SA. -00 :> ACM
M A A nu^etiw ii liiul B Bi. nib.Aỉ A m odel d riv e n a pp ro ac h to
1
**Present, sequence
• •mis .ts f I ftf ptftri I Hits, in E n tri-jnts tỉ D isti-ihuhid O bject Computing
( ‘tinjeren-ce, su u s. K D O O Oti. 12th. In tern atio n al JE E E, p ages 213 -22 1, Sept. 2U08
s Aim a B«iẳiílvopa«Jl)Vi-iy awl Sudipto Ghosh. Test input generation using uml Be-
• |U‘ Ji< <• .'iiiil si.I’ll f* !Urirhini*s mortals Snjhttarti Trshny, Venfii tUton, nntL V'uhfintion
'OIKS Ịiiic I Juititm ul C 'o n je t'tn tr on , 0 : 121' 1 Ml, '21HÌ9 -
4 Lilicii* B un iy, Y‘>onsik Clitfon, D avid C*ok, M ich ael D. E rn st , Ju e K iniry, Gary T
L avt-‘ii*v. K. R ust an M L«?ino. a n d Erik Pull An ov erview of JM L tools and

.1Ị •[•lii *t i> »ns S n fttm trr 1 *00is J o r T e c h n olo g y T ra n sfe r , 7 ( 3 ):21 2 - 2 3 2 , .1 line 2005
.'•» Y o on sjk • 'lie o n • IỈ 1<i A sh tivfttiin I V | um andJn S pe c ify in g a n d ch ec k in g m eth o d call
| 1| Ii< r»rj 111 JMI. Jn H am i'l l< A ra l Hi ia a n d H a ss a il ftu z a . e d ito rs , Software
l\ ỈTIỊỈ fit stttrvh anti Practice* ịiAges 5 i ỉ - 5 ỉ 1 ► C’SR E A P re ss, 2005
• J\ 1 ‘••Luir; .«11« I M Krtlwuii ich. T l f h»gu«i |>1 oL<x*iil th».'ck* i Is y ou r soitwrn*? l»r\X(jt]tu*
-4HM
7 Ymv. Jin For null Vfi ifi. at
1
» in 1*1 proiiJio ] pi t»pei tie s o f sequ e n tial Jcw a progi rtin» In
I Ii>( rr tliinjs of /ỉn V/.S-/ Anru.ii International O oinputer SoJ1-warn find Applications
\niiti rtii.1 - \ 'nl J, |>ết£«ỉN 47f> IK2, VVri.shin£i.oi», D C . U SA , 200 7 IE E E OcJitkpnter
Sni’icly
vS Ct Kuzcilt**. A sp ‘*i t -OI ieiitcd piofcitim m m** A C M C or n p n t. S uj u., pa£t? 154, *2001.
V < ĨI**£. I K u ^ a l ^ is , E l i k H ilsvi.il**. l i ’.ii H i t g i i u in . M ik K * irst* *u , .J*-J!r*iv IJa li n , a m i
W illiam <)
(,»1
ISW(»l»i An o verview of asp«*'tj. ỉn E C O O P V I: Proceedings of
the J5ih E uropean Conferenc e on O bject-O rie n ted Proyrarnm intft pag es 327-353
L‘>iul<>n, U K . ‘2001. S p ring e r-V erla g
hi \i.t«»s!i.tu 1.1, Zluhim g, Liu, .111*1 H»* lilr-iiu A lo iittal sf'iiirin tits of UM L HH<|U»ÌIIC»Ỉ
• iliiis ill prot o j AustrtU ian S oftw a re E ny i lite r in y C o n ferenc e (A SW EV 2(H t4)
J 9 Jo A p r il 2 0 0 4 . M elbourne , A u stra lia, 2004 I E B B C o nipII Lei Society.
11 MA.n»\g»*ni«*nr. O lo iip O m g unified m od e ling langua&H (oliig nniJ), supur-
‘.II lit lu i'i, v'J 12. l»it|> ://w w w .o in«.urg/ijoi*s/li> riiirtl/0i:^02-02 p«il, F*ibiuaiy *2009.
1 '1 M o Kahin ami D. Scott Finite automata anrj tiieir dei isit»n problems. ỈHM
■ h'urn til of Research and Development, A pril 1959.
1J
1 1

111

Sli»rỉỉ, A ỉiy.t V ii.iiu, >t
11
> 1 Niu. F o ru iitli^
12
IU I '2 Ni>H|u*ítiCỉ «lirigr»iiikHt
■juofc
t J A nil Ht»anp. T lm nh-B in li Trinli, Danp; Villi Hung,. V iet-H rt N gu y«n % Nftuyen
T ill 1'lni TVang. rtiKi Ihh il If»mg. c Clerking, H \ ion prot.i>-
<•»!*• Ih iu g itsfMM |'U»P
§1
^m illing In Sl'JFAi '(ỈS: PrtM&rtltnys o f tJiti Ề00H
S ixth IE E E In te rn a tio na l C onferen ce on S oftw are E n g ine er tnq and F o n n u l iVleth’
Otis. |»aR«?s 3 8 ’J-3S i». WVtshuiRlo il. D C , U S A . 200 8 I E È E C o m p u t e r S oi'ieiy .
i c> M U.Nhiar N < v W iu , TVti lio o n K im l A toi>l fur
• \ i 't lit rtl•!« ritii.M i It I fill U liil III! 1 «l**i*s. A d v m u t d SujlwuJr: E n y u ttcim y and
//.*» A Ị>plĩi.ữlii?fìiit (> Hi5“ 170, 2008
ih M nh.ujiniiic) U sin.tn, A a im r NrHi«*t>ni, Till litjon K im , an d Kim silk C lio. A survey
III » o h ’> )Nl»-:ih y « l h 'i'k m g ; I>*t fi »1 m i l l H i iM Ìr íl.s A iiixn u tfii S u jt HHLÌ r Siiyitirr.riíig
ịitìtl Ịt> . [I'L’l i L u t ti*, u 5 7 -» » « , !Ỉ(II)Ổ
H t-iereiices
Sched uling Pa ram eter Sweep A p p lica tions on G rid
Tran Cong Tu 1 and Thoai Nam 2
* Facu lty o f Inform atio n T ech no log y, H o C h i M m h U niv ersity o f Te ch n ical E d uca tion
JFacu!ry o f Com pu ter S cienc c and En g ince nn g , H o C hi M inh city U n iversity o f T echnolog y
tu tũ tô tâl.ỉicm ute.c du .v n , n am to 'csc.h cm ut edu vn
A b s tra c t. For m eeting a need o f schedu ling on com pu tationa l grid , th ere w ere
m an y rescarchc s ami sugg estio ns abou t sched uling algo rith m s H ow eve r, there
arc m an y kinds o f app lication on g rid and m o st o f algorith m s do no t g o into
detail o f a pp lica tion characteristic u> find the best so lutio n and fusi try to solve
as well as they can for all kinds o f application. T his pap er focuses on p ara m eter

sw eep a pplic atio ns and the sch edu ling algorithm D S uffc racc is p rop ose d 7’hc
alg orithm allo w s app lications to be com ple te d earlie r bv u iilt/m e resou rces
I. INTRODUCTION
Nowadays, computer is applied widely to many fields, attending to computation needs
is an example Moreover, the demand of computing power IS more and more
increased because of many complicated problems. To satisfy the demand of
oomputing power, parallel computing technique was introduced with main idea to use
many processors in order to solve a problem. Multi-processor computers, cluster
systems and grids are developed following ihis Ireiid. People can use grid to share,
collect and sclcct the d istribu te d resources to solve big problems However. It IS a
challenging problem becausc resources arc very heterogeneous, distnb.ii-ĩđ an.::
independent tasks may share common data files.
This paper refers to parameter sweep applications in which the .<=»!•:. - ‘ức IS run
multiple times using unique sets of input parameter values (4]. And we propose an
adaptive scheduling algorithm named DSufferage for parameter sweep applications
on the arid which achieves (1 ) Completion time o f applications IS low and (2)
Mapping all tasks o f an application to one resource to optimize access lime of
applications and manage easily. Results o f experiment show that the average
completion time of applications applying DSuff'crage is lower than those using Min
in m, Max-nun. Sufferage
The rest o f the paper is organized as follows The related works in scheduling
algorithm for parameter sweep application arc discussed in Section 2. Section 3
presents an adaptive scheduling algorithm proposed ill tills paper In Section 4. we
evaluate the perfomancc o f DSufferage against Max-min. Min-min ajid Sufferagc
through simulations. The final section presents the conclusions and future work,

×