Detail

Publication date: 1 de June, 2021

J-USE (Model-driven Java code and JUnit tests generator)



Introduction

J-USE
is a model-driven Java code and JUnit test cases generator that takes as input
a domain model produced and validated with the 
USE (UML-based Specification Environment).
The latter allows to specify models using features found in UML class diagrams
(classes, associations, etc.), enriched with expressions in OCL (Object
Constraint Language) to specify both integrity and business constraints. J-USE
is particularly suited for developing BIS (business information systems)
applications, providing a quick prototyping framework. Generated code maps the
navigations on class diagrams allowable in OCL, therefore increasing
traceability between model and code and reversely. A seamlessness approach to
persistence, based on a pure object-oriented database, is used.

Code
generator

The
generated code is organized in three layers: the business layer, the
presentation layer and the persistence layer, that will be described herein.

Business
Layer

This
layer includes a Java class for each UML class in the domain model, holding the
same name. Each generated class has one private attribute for every attribute
and for every association in the domain model. Besides, it contains public
constructors, selectors and modifiers for all attributes and associations (one
to one, one to many, many to many, association class to their members and
vice-versa) in the domain model. Object serializers and comparators are
provided as well. The syntax of the generated code follows OCL naming
conventions. Chosen Java collection types (
Set/HashSetList/ArrayListSortedSet/TreeSet and Queue/ArrayDeque)
match closely the ones found in OCL (
SetBag,OrderedSet and Sequence).
A public static 
allInstances() selector
allows retrieving all instances of this class from the object oriented
database.

Presentation
Layer

This
layer includes a simple Swing interface that allows performing basic CRUD
operations on all classes of the problem domain. This layer includes the class 
Main_<domainModelName> that
contains the 
main() method.

Persistence
Layer

This
layer provides a façade to interface Database for Objects (DB4O), an open
source object database engine available at 
http://www.db4o.comThis
façade provides basic CRUD (create, read, update and delete) capabilities,
along with cleanup and lookup ones.

Test
cases generator

This
generator produces JUnit test cases that exercise all of the generated Java
code. In other words, the generated test cases provide a 100% coverage.

About

The
JUSE toolkit was developed by 
Fernando Brito e Abreu and
has been used for teaching Software Engineering and MDD (model-driven
development) topics at the university where he serves as a teaching staff
member. J-USE includes a facade (API) that allows any Java program to interact
with the USE tool. This API has been used as a middleware component of several
research projects such as:

 

Authors

Fernando Brito e Abreu,

URL http://code.google.com/p/j-use/
Date 01/02/2012