Package com.pv.sdm.user.db.model

Examples of com.pv.sdm.user.db.model.User


   ////
  
  
   public void buildTest(){
      IUpdateOrmBuilder p = null;
      User u = p.mock(User.class);
      p.execute();
     
   }
View Full Code Here


  
   @Test
   public void buildSelect() {
     
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      User user = builder.mock(User.class);
     
      builder.columns(user.getId(), user.getUserName());
     
      builder.and(user.getId(), 1L);
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "SELECT user.id,user.userName FROM user_mx_14.user WHERE user.id = ?",
            statment.getSql());
View Full Code Here

   @Test
   @Ignore
   public void buildSelect_MultiObject() {
     
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      User user = builder.mock(User.class);
     
      builder.columns(user.getId(), user.getUserName());
      builder.and(user.getId(), 1L);
     
      user = builder.mock(User.class);
     
      Assert.assertEquals("pvxuser", user.getUserName());
     
//      Assert.assertEquals("SELECT id FROM user_mx_14.user WHERE  id = ?  ", statment);
//      Assert.assertArrayEquals(new Object[] {1L}, sql.getParameters());
   }
View Full Code Here

   }
  
   @Test
   public void columns() {
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      User user = builder.mock(User.class);
     
      builder.columns(user.getId(), user.getUserName());
      Set<ColumnMetadata> columns = builder.getQuery().getColumns();
      Assert.assertEquals(2, columns.size());
      Assert.assertTrue(columns.contains(
            new ColumnMetadata(User.ID)));
      Assert.assertTrue(columns.contains(
            new ColumnMetadata(User.USER_NAME)));
     
      builder.columns(user.getPassword());
      columns = builder.getQuery().getColumns();
      Assert.assertEquals(3, columns.size());
      Assert.assertTrue(columns.contains(
            new ColumnMetadata(User.PASSWORD)));
   }
View Full Code Here

  
   @Test
   @Ignore
   public void columnsMultiline() {
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      User user = builder.mock(User.class);
     
      user.getId();
      user.getUserName();
      builder.columns();
     
      Set<ColumnMetadata> columns = builder.getQuery().getColumns();
      Assert.assertEquals(2, columns.size());
      Assert.assertTrue(columns.contains(
            new ColumnMetadata(User.ID)));
      Assert.assertTrue(columns.contains(
            new ColumnMetadata(User.USER_NAME)));
     
      user.getPassword();
      builder.columns();
      columns = builder.getQuery().getColumns();
      Assert.assertEquals(3, columns.size());
      Assert.assertTrue(columns.contains(
            new ColumnMetadata(User.PASSWORD)));
View Full Code Here

    * settings.
    */
   @Test
   public void columnsEmpty_pass() {
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      User user = builder.mock(User.class);
     
      user = builder.mock(User.class);
     
      builder.columns();
   }
View Full Code Here

    */
   @Test(expected=IllegalStateException.class)
   @Ignore
   public void columnsEmpty_fail() {
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      User user = builder.mock(User.class);
     
      user = builder.mock(User.class);
     
      builder.columns();
   }
View Full Code Here

  
   @Test
   public void columnsOneToOne() {
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      builder.setCascade(Boolean.TRUE);
      User user = builder.mock(User.class);
     
      builder.columns(user.getId(), user.getUserDetails().getEmail());
     
      builder.and(user.getId(), 1L);
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "SELECT user_details.email,user.id FROM user_mx_14.user_role,user_mx_14.user_details,user_mx_14.user WHERE user_role.userId = ? AND user_details.userId = ? AND user.id = ?",
            statment.getSql());
View Full Code Here

  
   @Test
   public void columnsOneToMany() {
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      builder.setCascade(Boolean.TRUE);
      User user = builder.mock(User.class);
      UserRoleTestVO userRole = builder.mock(UserRoleTestVO.class);
//     
      builder.columns(user.getId(), userRole.getRoleId(),
            userRole.getUserId());
     
//      builder.columns(user.getId(),
//            builder.normalize(user.getRoles()).getRoleId(),
//            builder.normalize(user.getRoles()).getUserId());
     
      builder.and(user.getId(), 1L);
     
      IQuery statment = builder.build();
      Assert.assertEquals(
//            "SELECT user_role.roleId,user_role.userId,user.id FROM user_mx_14.user_role,user_mx_14.user WHERE user_role.userId = ? AND user.id = ?",
            "SELECT user.id,user_role.userId,user_role.roleId FROM user_mx_14.user_role,user_mx_14.user_details,user_mx_14.user WHERE user_role.userId = ? AND user_details.userId = ? AND user.id = ?",
View Full Code Here

   }
  
   @Test
   public void and() {
      SelectBuilder builder = (SelectBuilder)_annotationFactory.select();
      User user = builder.mock(User.class);
     
      builder.columns(user.getId(), user.getUserName());
     
      builder.and(user.getId(),new Long(1L));
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "SELECT user.id,user.userName FROM user_mx_14.user WHERE user.id = ?",
            statment.getSql());
View Full Code Here

TOP

Related Classes of com.pv.sdm.user.db.model.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.