EU projects MODAClouds and JUNIPER – Writing and testing transformations from abstract object oriented domain models Marcos Almeida, SOFTEAM | ModelioSoft RCIS’13 www.modeliosoft.com 1 What’s this presentation about? • This is not a presentation about solutions but about problems. • Future of Internet = Platform Fragmentation • MDE Approach = Specific Models / code Abstract Models Business Objects Transformation Transformation HDFS MySQL Transformation PROBLEM!! MongoDB Given this fragmentation: How to write and test these transformations? www.modeliosoft.com 2 Context: two FP7 projects that just started… http://www.modaclouds.eu/ - 318484 http://www.juniper-project.org/ - 318763 www.modeliosoft.com 3 What’s the “Future of Internet” for MODAClouds? The Cloud The Cloud The Cloud The Cloud The cloud? No! Multiple clouds, Multiple providers, Fragmentation! Our mission: • Develop applications in a cloud independent way • Provide support for app monitoring, adaption and migration www.modeliosoft.com 4 What’s the “Future of Internet” for JUNIPER? • The main keyword: Big Data o Multiple streams o Multiple types o Real-time constraints • Current state of the art: NoSQL o Pros • Optimized for non-relational data • Optimize query engines for performance not for expressivity o Cons • The code is “ the model” • How to deal with the different NoSQL databases? • Our mission o Modeling support for non relational & real-time big data application www.modeliosoft.com 5 The main problem is FRAGMENTATION! • Many different database management systems o Ex: • • • • • MySQL (www.mysql.com/), Big Table (http://research.google.com/archive/bigtable.html) SimpleDB (http://aws.amazon.com/simpledb/) Memcached (http://memcached.org/) … • Many underlying data representation paradigms o Ex: • • • • • Relational Databases Key-value Stores Object-oriented Databases Big Tables … www.modeliosoft.com 6 The basis of our solution is MDE… Why? Specific Models / code Abstract Models Business Objects Transformation HDFS Transformation MySQL Transformation MongoDB • Separating the problem from the solution • Fostering automation o Analysis o Code generation www.modeliosoft.com 7 What do we get from MDE? Pros • Design data once, store everywhere! • Write your transformation once, transform anything! Cons • Transformations are hard to write… • How to make sure they are CORRECT? i.e. – Is there any data/semantic loss? www.modeliosoft.com 8 Understanding the problem… Why is it so HARD? (1/3) • Target Technologies based on different paradigms • Example: JPA @Entity public class A { @Basic public B getB(){ … } … } A B SQL create table A (…) create table B (…) create table A_B (…) www.modeliosoft.com 9 Understanding the problem… Why is it so HARD? (2/3) • Target structure is variable • Example: Here A and B are independent entities ER A A B AB B NoSQL A Here, for performance reasons, B is embedded in A B www.modeliosoft.com 10 Understanding the problem… Why is it so HARD? (3/3) • Different implementations support different features • Example: JPA In JPA inheritance is usually implemented as an extra column with a type A Hibernate: ignores the column B x:int www.modeliosoft.com y:string Toplink: ignores its type Disc(?):int(?) 11 Our experience • Just in the beginning • Some experiments o Persistence Model JPA x SQL • Current approach: o Decomposing transformations o Dealing with variability by replacing sub-transformations o Unit testing sub-transformations • Automated Tests – 90 JUnit Tests • Manual Integration Test – ~100 Tests www.modeliosoft.com 12 Decomposing transformations Persistence Model JPA Entities Java Classes Identifiers Attributes … www.modeliosoft.com 13 Dealing with variability by replacing subtransformations Persistence Model JPA (JSR 317) Persistence Model JPA (Hibernate) Entities Java Classes Entities Java Classes Identifiers Attributes Identifiers Attributes … … www.modeliosoft.com 14 Unit testing sub-transformations Desired output @Basic private Integer at; Obtained output + at : Integer Input @Basic(fetch=FetchType.LAZY) private Integer at; Transformation www.modeliosoft.com Output 15 Limitations Tool 1 Input Transformation Output Tool 2 • Actual tools do not behave exactly as expected… o Each tool interprets the outputs in a different way o The range of acceptable outputs may vary from a tool to another • Integration Test Involves interfacing with complex code o Modelio, testing databases (MySQL…), Different JPA implementations (Hibernate Eclipse Link, TopLink…) www.modeliosoft.com 16 Conclusion • We focus on MDE for future of the internet applications • But in practice… MDE needs to support to the platforms supporting these applications… • Limitations, Limitations, Limitations… o Fragmentation x Integration Testing • Problems o Too many different targets • How to test such transformations? • How to interface with complex software? • How to reduce manual work? www.modeliosoft.com 17 Thank you for your attention! Marcos Almeida SOFTEAM | ModelioSoft marcos.almeida@softeam.fr SOFTEAM R&D Web Site: http://rd.softeam.com ModelioSoft Web Site: http://www.modeliosoft.com www.modeliosoft.com 18 M o d e l i n g s o l u t i o n s.