Package it.hotel.model.user

Examples of it.hotel.model.user.User


  public MockHttpServletResponse resp = new MockHttpServletResponse();
 
  @Override
  protected void onSetUp() throws Exception {
    super.onSetUp();
    User user = new User();
    Role role = new Role();
    role.setDescription("test");
    role.setName("test");
    user.setRole(role);
    user.setStructureId(1);
    userContainer.setUser(user);
  }
View Full Code Here


   * @return
   */
  @Override
  protected Map referenceData (HttpServletRequest req) throws Exception{
    Map map = new HashMap ();
    User user = userContainer.getUser();
    int hotelId = user.getStructureId();
    Structure hotel = (Structure) structureManager.get(hotelId);
        Gallery gallery = (Gallery) galleryManager.get(hotel.getGallery().getId());
    Set<Photo> photos = gallery.getPhotos();
    map.put("hotel", hotel);
    map.put("photos", photos);
View Full Code Here

    session = request.getSession();
    ServletContext context = session.getServletContext();
    String path = context.getRealPath("/");
    namePhoto = java.util.UUID.randomUUID().toString();
    photo.setName(namePhoto);
    User user = userContainer.getUser();
    int hotelId = user.getStructureId();
    Structure hotel = (Structure) structureManager.get(hotelId);
    ImageUtils.upload(namePhoto, path, image, hotelId, hotelId, 400, 400, "big");
    baseUrlPhoto =ImageUtils.upload(namePhoto, path, image, hotelId, hotelId, 50, 50, "small");
    photo.setUrl(baseUrlPhoto);
    photo.setGallery(hotel.getGallery());
View Full Code Here

    assertTrue(user.isGuest());
 
  }
 
  public void testHasPermissionAsSuperUser() throws Exception {
    IUser user = new User();
   
    Role role = new Role();
    role.setDescription("something");
    role.setName("something");
    role.addPermission(Permission.SUPERUSER);
    user.setRole(role);
    assertTrue(user.hasPermission("blah"));
   
  }
View Full Code Here

    assertTrue(user.hasPermission("blah"));
   
  }
 
  public void testHasPermission() throws Exception {
    IUser user = new User();
   
    Role role = new Role();
    role.setDescription("something");
    role.setName("something");
    role.addPermission("blah");
    user.setRole(role);
    assertTrue(user.hasPermission("blah"));
  }
View Full Code Here

    assertTrue(user.hasPermission("blah"));
  }
 
  public void testClone() throws Exception {
   
    IUser user = new User();
    user.setEmail("blah@mail.com");
    user.setStructureId(2);
    user.setName("dharmesh");
    user.setPassword("password");
    user.setPasswordConfirm("password");
    Role role = new Role();
    role.setDescription("guest");
    role.setName("guest");
    user.setRole(role);
    user.setUserName("dappers");
    user.setSurname("dillip");
    user.setLanguage("it");
   
    IUser user2 = (IUser) user.clone();
    assertEquals("blah@mail.com",user2.getEmail());
    assertEquals(2,user2.getStructureId());
    assertEquals("dharmesh", user2.getName());
    assertEquals("password", user2.getPassword());
    assertEquals("password", user2.getPasswordConfirm());
View Full Code Here

   
  }
 
  private void createUser(){
   
    user1 = new User();
    user1.setName(null);
    user1.setPassword("password");
    user1.setPasswordConfirm("password1");
    user1.setUserName("username");
     
View Full Code Here

  public MockHttpServletResponse resp = new MockHttpServletResponse();
 
  @Override
  protected void onSetUp() throws Exception {
    super.onSetUp();
    User user = new User();
    Role role = new Role();
    role.setDescription("test");
    role.setName("test");
    user.setRole(role);
    user.setStructureId(1);
    userContainer.setUser(user);
  }
View Full Code Here

   * @throws
   * @return
   */
  protected Map referenceData (HttpServletRequest req) throws Exception{
    Map map = new HashMap();
    User user = userContainer.getUser();
    int id = user.getStructureId();
    Structure hotel = (Structure) structureManager.get(id);
    ArrayList<Structure> hotels = new ArrayList<Structure>();
   
    hotels.add(hotel);
    map.put("hotels", hotels);
View Full Code Here

import junit.framework.TestCase;

public class TestUser extends TestCase{

  public void testUser() throws Exception {
    IUser user = new User();
    user.setEmail("blah@mail.com");
    user.setStructureId(2);
    user.setName("dharmesh");
    user.setPassword("password");
    user.setPasswordConfirm("password");
    Role role = new Role();
    role.setDescription("guest");
    role.setName("guest");
    user.setRole(role);
    user.setUserName("dappers");
    user.setSurname("dillip");
    user.setLanguage("it");
   
    assertEquals("blah@mail.com",user.getEmail());
    assertEquals(2,user.getStructureId());
    assertEquals("dharmesh", user.getName());
    assertEquals("password", user.getPassword());
    assertEquals("password", user.getPasswordConfirm());
    assertEquals(role, user.getRole());
    assertEquals("dillip", user.getSurname());
    assertEquals("it",user.getLanguage());
    assertTrue(user.isGuest());
 
  }
View Full Code Here

TOP

Related Classes of it.hotel.model.user.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.