Applied MyEclipse and JUnit to do Hibernate Code Gen and Testing
Upcoming SlideShare
Loading in...5
×
 

Applied MyEclipse and JUnit to do Hibernate Code Gen and Testing

on

  • 5,561 views

 

Statistics

Views

Total Views
5,561
Views on SlideShare
5,533
Embed Views
28

Actions

Likes
2
Downloads
109
Comments
1

3 Embeds 28

http://localhost 19
http://www.slideshare.net 8
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Applied MyEclipse and JUnit to do Hibernate Code Gen and Testing Applied MyEclipse and JUnit to do Hibernate Code Gen and Testing Presentation Transcript

  • Applied MyEclipse and JUnit to do Hibernate Code Gen and Testing Albert Guo [email_address]
  • Agenda
    • High Level Picture
    • Hibernate Code Generation
        • Code Gen Process
        • Generate DAO for the four tables
        • Artifacts
        • Spring Configuration File
        • Sequence Diagram
    • Apply JUnit to do DAOs Test
        • JUnit Framework
        • How to Test with JUnit?
        • Simplified Workflow of Applying JUnit
        • Testing Process
        • Generate Unit Test Result via Ant
  • High Level Picture Application Context DAO Classes ApplicationContext.xml Hibernate Mapping files Client Layer Business Layer Persistence Layer Spring – IOC Container Hibernate Session Mgt. Business Service Classes Hibernate Windchill Workflow Data Source / Connection Pool
  • Code Gen Process including POJOs, DAOs, hibernate mapping files and Spring configuration file
  • Filled in connection info. Add MS SQL driver Save password, then you do not need to type in again
  • Click Test Driver to test database connection If you connect to database successfully, then you can see this popup window
  • Generate DAO for the four tables
  • Select tables which we would like to do code gen. Click Hibernate Reverse Engineering
  • Assign destination Generate hibernate mapping file Generate POJO Generate Spring DAO
  • Select ID Generator
  • Artifacts We had generated POJOs, hibernate mapping files, and DAOs
  • Spring Configuration File Inject webSiteDataSource into sessionFactory
  • Spring Configuration File – cont. Inject sessionFactory into each DAOs.
  • Sequence Diagram
  • Apply Junit to do DAOs Test
  • JUnit Framework
  • How to Test with JUnit? WipPortingDAO junit TestCase exercise 1..* TestRunner run 1..* WipPortingDAOTest test 1 test 2 …
  • Simplified Workflow of Applying JUnit Class files Test Cases Test Methods Test Suites Test Runner
  • Testing Process Overrides setUp() and/or tearDown() Writes test methods, ex. test…() Uses Assert.assert … () Writes suite() and/or main()
  • Create Fixture via MyEclipse
  • Create Fixture via MyEclipse – cont.
  • Create Fixture via MyEclipse – cont.
  • Create Fixture via MyEclipse – cont.
  • Exercise & Verify
  • Exercise & Verify – cont.
  • Suit Management
  • Suit Management
  • Generate Unit Test Result via Ant
  • Generate Unit Test Result via Ant