コード例 #1
0
  protected Team addTeam() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Team team = _persistence.create(pk);

    team.setMvccVersion(RandomTestUtil.nextLong());

    team.setCompanyId(RandomTestUtil.nextLong());

    team.setUserId(RandomTestUtil.nextLong());

    team.setUserName(RandomTestUtil.randomString());

    team.setCreateDate(RandomTestUtil.nextDate());

    team.setModifiedDate(RandomTestUtil.nextDate());

    team.setGroupId(RandomTestUtil.nextLong());

    team.setName(RandomTestUtil.randomString());

    team.setDescription(RandomTestUtil.randomString());

    _teams.add(_persistence.update(team));

    return team;
  }
コード例 #2
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Team newTeam = _persistence.create(pk);

    newTeam.setMvccVersion(RandomTestUtil.nextLong());

    newTeam.setCompanyId(RandomTestUtil.nextLong());

    newTeam.setUserId(RandomTestUtil.nextLong());

    newTeam.setUserName(RandomTestUtil.randomString());

    newTeam.setCreateDate(RandomTestUtil.nextDate());

    newTeam.setModifiedDate(RandomTestUtil.nextDate());

    newTeam.setGroupId(RandomTestUtil.nextLong());

    newTeam.setName(RandomTestUtil.randomString());

    newTeam.setDescription(RandomTestUtil.randomString());

    _teams.add(_persistence.update(newTeam));

    Team existingTeam = _persistence.findByPrimaryKey(newTeam.getPrimaryKey());

    Assert.assertEquals(existingTeam.getMvccVersion(), newTeam.getMvccVersion());
    Assert.assertEquals(existingTeam.getTeamId(), newTeam.getTeamId());
    Assert.assertEquals(existingTeam.getCompanyId(), newTeam.getCompanyId());
    Assert.assertEquals(existingTeam.getUserId(), newTeam.getUserId());
    Assert.assertEquals(existingTeam.getUserName(), newTeam.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingTeam.getCreateDate()),
        Time.getShortTimestamp(newTeam.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingTeam.getModifiedDate()),
        Time.getShortTimestamp(newTeam.getModifiedDate()));
    Assert.assertEquals(existingTeam.getGroupId(), newTeam.getGroupId());
    Assert.assertEquals(existingTeam.getName(), newTeam.getName());
    Assert.assertEquals(existingTeam.getDescription(), newTeam.getDescription());
  }
コード例 #3
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 Team toModel(TeamSoap soapModel) {
    if (soapModel == null) {
      return null;
    }

    Team model = new TeamImpl();

    model.setMvccVersion(soapModel.getMvccVersion());
    model.setTeamId(soapModel.getTeamId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setUserId(soapModel.getUserId());
    model.setUserName(soapModel.getUserName());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setGroupId(soapModel.getGroupId());
    model.setName(soapModel.getName());
    model.setDescription(soapModel.getDescription());

    return model;
  }