Interest rate calculation V5. 0--testing--software engineering
1. Task Pair Companion: Name: Wang Xinming:201406114217 Blog address: http://home.cnblogs.com/u /xinmingwang/Git:https://github.com/shunc/interestratecalculation
that is, to pursue benefits, but also to face unpredictable financial investment risks, "can not put eggs in the same basket", it is necessary to make a portfolio investment. The above calculations and comparisons can help customers make investment decisions. Customer: So can you help me to record a different type of investment, and dynamically show the current value of money? 2. Development tools: IntelliJ idea 15.0.4, MySQL development language: Java-Web main functions: Compound interest calculation, simple interest calculation because the computational framework has not come and made, So the function can only be implemented in the form of simple interface. 3, Division: Cai Sun: Design of the overall framework, code writing Wang Xinming: access to relevant information, collaborative inspection code
The use of Hibernate framework to achieve Data Link summary: Due to time problems, write the test class, the specific page is not ready. the next pair will implement specific functions.
Test the asset of the user name (surname Zhang)
@Test Public voidTestcatipal () {Session session=NULL; Try { //Get SessionSession =hibernatefactory.opensession (); List<User> users = Session.createquery ("Select User from user user left join User.assets asset where user.name like '% sheet% '"). Setfirstresult (0). Setmaxresults ( the). List (); for(User user:users) { for(Asset asset:user.getAssets ()) {System. out. println (User.getname () +" "+ Asset.getcatipal () +" "+ asset.gettype () +" "+asset.getnowdate ()); } } }Catch(Exception e) {e.printstacktrace (); //Business Rollback if(Session! =NULL) session.gettransaction (). rollback (); }finally { //End of BusinessHibernatefactory.close (session); } }
Test adding users and assets
@Test Public voidTestaddasset () {Session session=NULL; Try { //Get SessionSession =hibernatefactory.opensession (); //Start Business Processingsession.begintransaction (); /** Add User 500 * Add per user asset information 0 ~ 30 **/ for(inti =0; I < -; i++) {User User=NewUser (GetUserName (), GetPassword (), GetName ()); Session.save (user); for(intj =0; J < Ran.nextint ( -) ; J + +) {Asset Asset=NewAsset (User, Getcatipal (), GetType (),NewDate ()); Session.save (asset); } } //Business Submissionsession.gettransaction (). commit (); }Catch(Exception e) {e.printstacktrace (); //Business Rollback if(Session! =NULL) session.gettransaction (). rollback (); }finally { //End of BusinessHibernatefactory.close (session); } }
Database User Table
Database Asset Table
Interest rate calculation v5.0--pair--software engineering