1 package org.tigris.scarab; 2 3 48 49 import java.util.Date ; 50 51 import org.apache.fulcrum.security.TurbineSecurity; 52 import org.apache.fulcrum.security.entity.Role; 53 import org.apache.fulcrum.security.entity.User; 54 import org.tigris.scarab.om.ScarabModule; 55 import org.tigris.scarab.om.ScarabUserManager; 56 import org.tigris.scarab.test.BaseScarabTestCase; 57 58 64 public class SecurityTest extends BaseScarabTestCase 65 { 66 public void testCreateAssignDeleteUser() throws Exception 67 { 68 String username = "test" + new Date ().getTime(); 69 ScarabModule sm = (ScarabModule)getModule(); 70 User user = ScarabUserManager.getInstance(); user.setEmail("test@test.com"); 72 user.setConfirmed("CONFIRMED"); 73 user.setFirstName("test"); 74 user.setLastName("test"); 75 user.setUserName(username); 76 TurbineSecurity.addUser(user,"test"); 77 user = TurbineSecurity.getAuthenticatedUser(username,"test"); 78 assertNotNull(user); 79 Role role = TurbineSecurity.getRole("Project Owner"); 80 81 assertNotNull(role); 82 assertNotNull(user); 83 assertNotNull(sm); 84 99 100 101 102 } 103 104 105 } 106 | Popular Tags |