protected MBBan addMBBan() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBBan mbBan = _persistence.create(pk);

    mbBan.setUuid(RandomTestUtil.randomString());

    mbBan.setGroupId(RandomTestUtil.nextLong());

    mbBan.setCompanyId(RandomTestUtil.nextLong());

    mbBan.setUserId(RandomTestUtil.nextLong());

    mbBan.setUserName(RandomTestUtil.randomString());

    mbBan.setCreateDate(RandomTestUtil.nextDate());

    mbBan.setModifiedDate(RandomTestUtil.nextDate());

    mbBan.setBanUserId(RandomTestUtil.nextLong());

    _mbBans.add(_persistence.update(mbBan));

    return mbBan;
  }
示例#2
0
  /**
   * Converts the soap model instance into a normal model instance.
   *
   * @param soapModel the soap model instance to convert
   * @return the normal model instance
   */
  public static MBBan toModel(MBBanSoap soapModel) {
    MBBan model = new MBBanImpl();

    model.setBanId(soapModel.getBanId());
    model.setGroupId(soapModel.getGroupId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setUserId(soapModel.getUserId());
    model.setUserName(soapModel.getUserName());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setBanUserId(soapModel.getBanUserId());

    return model;
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBBan newMBBan = _persistence.create(pk);

    newMBBan.setUuid(RandomTestUtil.randomString());

    newMBBan.setGroupId(RandomTestUtil.nextLong());

    newMBBan.setCompanyId(RandomTestUtil.nextLong());

    newMBBan.setUserId(RandomTestUtil.nextLong());

    newMBBan.setUserName(RandomTestUtil.randomString());

    newMBBan.setCreateDate(RandomTestUtil.nextDate());

    newMBBan.setModifiedDate(RandomTestUtil.nextDate());

    newMBBan.setBanUserId(RandomTestUtil.nextLong());

    _mbBans.add(_persistence.update(newMBBan));

    MBBan existingMBBan = _persistence.findByPrimaryKey(newMBBan.getPrimaryKey());

    Assert.assertEquals(existingMBBan.getUuid(), newMBBan.getUuid());
    Assert.assertEquals(existingMBBan.getBanId(), newMBBan.getBanId());
    Assert.assertEquals(existingMBBan.getGroupId(), newMBBan.getGroupId());
    Assert.assertEquals(existingMBBan.getCompanyId(), newMBBan.getCompanyId());
    Assert.assertEquals(existingMBBan.getUserId(), newMBBan.getUserId());
    Assert.assertEquals(existingMBBan.getUserName(), newMBBan.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBBan.getCreateDate()),
        Time.getShortTimestamp(newMBBan.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBBan.getModifiedDate()),
        Time.getShortTimestamp(newMBBan.getModifiedDate()));
    Assert.assertEquals(existingMBBan.getBanUserId(), newMBBan.getBanUserId());
  }