()
| 696 | } |
| 697 | |
| 698 | @Test |
| 699 | public void testUpdatePassword() |
| 700 | { |
| 701 | log.debug("Testing update Password"); |
| 702 | String userName = new String("updatePassword"); |
| 703 | String currentPass = new String(); |
| 704 | String newPass = new String(); |
| 705 | boolean loggedIn = false; |
| 706 | try |
| 707 | { |
| 708 | try |
| 709 | { |
| 710 | currentPass = userName; |
| 711 | newPass = userName+userName; |
| 712 | log.debug("Logging in with default Pass"); |
| 713 | loggedIn = GetterTest.verifyTestUser(applicationRoot, userName, currentPass); |
| 714 | } |
| 715 | catch(Exception e) |
| 716 | { |
| 717 | newPass = userName; |
| 718 | currentPass = userName+userName; |
| 719 | log.debug("Could not log in with default pass: " + e.toString()); |
| 720 | log.debug("Logging in with alternative pass: " + currentPass); |
| 721 | String[] auth = Getter.authUser(applicationRoot, userName, currentPass); |
| 722 | loggedIn = auth != null; |
| 723 | } |
| 724 | if(!loggedIn) |
| 725 | { |
| 726 | log.debug("Could not sign in with any pass."); |
| 727 | fail("Could not Verify User"); |
| 728 | } |
| 729 | else |
| 730 | { |
| 731 | log.debug("Logged in! Updating Password now"); |
| 732 | if(!Setter.updatePassword(applicationRoot, userName, currentPass, newPass)) |
| 733 | { |
| 734 | log.debug("Could not update password"); |
| 735 | fail("Could not update password"); |
| 736 | } |
| 737 | else |
| 738 | { |
| 739 | log.debug("Password Updated. Authenticating with new pass: " + newPass); |
| 740 | String[] auth = Getter.authUser(applicationRoot, userName, newPass); |
| 741 | if(auth == null) |
| 742 | { |
| 743 | fail("Could Not Auth With New Pass"); |
| 744 | } |
| 745 | else |
| 746 | { |
| 747 | return; //PASS: Authenticated With New Pass |
| 748 | } |
| 749 | } |
| 750 | } |
| 751 | } |
| 752 | catch(Exception e) |
| 753 | { |
| 754 | log.fatal("Could not complete testUpdatePassword: " + e.toString()); |
| 755 | fail("Could not complete testUpdatePassword"); |
nothing calls this directly
no test coverage detected