Exemplo n.º 1
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 LayoutSet toModel(LayoutSetSoap soapModel) {
    if (soapModel == null) {
      return null;
    }

    LayoutSet model = new LayoutSetImpl();

    model.setLayoutSetId(soapModel.getLayoutSetId());
    model.setGroupId(soapModel.getGroupId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setPrivateLayout(soapModel.getPrivateLayout());
    model.setLogo(soapModel.getLogo());
    model.setLogoId(soapModel.getLogoId());
    model.setThemeId(soapModel.getThemeId());
    model.setColorSchemeId(soapModel.getColorSchemeId());
    model.setWapThemeId(soapModel.getWapThemeId());
    model.setWapColorSchemeId(soapModel.getWapColorSchemeId());
    model.setCss(soapModel.getCss());
    model.setPageCount(soapModel.getPageCount());
    model.setSettings(soapModel.getSettings());
    model.setLayoutSetPrototypeUuid(soapModel.getLayoutSetPrototypeUuid());
    model.setLayoutSetPrototypeLinkEnabled(soapModel.getLayoutSetPrototypeLinkEnabled());

    return model;
  }
  protected LayoutSet addLayoutSet() throws Exception {
    long pk = RandomTestUtil.nextLong();

    LayoutSet layoutSet = _persistence.create(pk);

    layoutSet.setMvccVersion(RandomTestUtil.nextLong());

    layoutSet.setGroupId(RandomTestUtil.nextLong());

    layoutSet.setCompanyId(RandomTestUtil.nextLong());

    layoutSet.setCreateDate(RandomTestUtil.nextDate());

    layoutSet.setModifiedDate(RandomTestUtil.nextDate());

    layoutSet.setPrivateLayout(RandomTestUtil.randomBoolean());

    layoutSet.setLogoId(RandomTestUtil.nextLong());

    layoutSet.setThemeId(RandomTestUtil.randomString());

    layoutSet.setColorSchemeId(RandomTestUtil.randomString());

    layoutSet.setWapThemeId(RandomTestUtil.randomString());

    layoutSet.setWapColorSchemeId(RandomTestUtil.randomString());

    layoutSet.setCss(RandomTestUtil.randomString());

    layoutSet.setPageCount(RandomTestUtil.nextInt());

    layoutSet.setSettings(RandomTestUtil.randomString());

    layoutSet.setLayoutSetPrototypeUuid(RandomTestUtil.randomString());

    layoutSet.setLayoutSetPrototypeLinkEnabled(RandomTestUtil.randomBoolean());

    _layoutSets.add(_persistence.update(layoutSet));

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

    LayoutSet newLayoutSet = _persistence.create(pk);

    newLayoutSet.setMvccVersion(RandomTestUtil.nextLong());

    newLayoutSet.setGroupId(RandomTestUtil.nextLong());

    newLayoutSet.setCompanyId(RandomTestUtil.nextLong());

    newLayoutSet.setCreateDate(RandomTestUtil.nextDate());

    newLayoutSet.setModifiedDate(RandomTestUtil.nextDate());

    newLayoutSet.setPrivateLayout(RandomTestUtil.randomBoolean());

    newLayoutSet.setLogoId(RandomTestUtil.nextLong());

    newLayoutSet.setThemeId(RandomTestUtil.randomString());

    newLayoutSet.setColorSchemeId(RandomTestUtil.randomString());

    newLayoutSet.setWapThemeId(RandomTestUtil.randomString());

    newLayoutSet.setWapColorSchemeId(RandomTestUtil.randomString());

    newLayoutSet.setCss(RandomTestUtil.randomString());

    newLayoutSet.setPageCount(RandomTestUtil.nextInt());

    newLayoutSet.setSettings(RandomTestUtil.randomString());

    newLayoutSet.setLayoutSetPrototypeUuid(RandomTestUtil.randomString());

    newLayoutSet.setLayoutSetPrototypeLinkEnabled(RandomTestUtil.randomBoolean());

    _layoutSets.add(_persistence.update(newLayoutSet));

    LayoutSet existingLayoutSet = _persistence.findByPrimaryKey(newLayoutSet.getPrimaryKey());

    Assert.assertEquals(existingLayoutSet.getMvccVersion(), newLayoutSet.getMvccVersion());
    Assert.assertEquals(existingLayoutSet.getLayoutSetId(), newLayoutSet.getLayoutSetId());
    Assert.assertEquals(existingLayoutSet.getGroupId(), newLayoutSet.getGroupId());
    Assert.assertEquals(existingLayoutSet.getCompanyId(), newLayoutSet.getCompanyId());
    Assert.assertEquals(
        Time.getShortTimestamp(existingLayoutSet.getCreateDate()),
        Time.getShortTimestamp(newLayoutSet.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingLayoutSet.getModifiedDate()),
        Time.getShortTimestamp(newLayoutSet.getModifiedDate()));
    Assert.assertEquals(existingLayoutSet.getPrivateLayout(), newLayoutSet.getPrivateLayout());
    Assert.assertEquals(existingLayoutSet.getLogoId(), newLayoutSet.getLogoId());
    Assert.assertEquals(existingLayoutSet.getThemeId(), newLayoutSet.getThemeId());
    Assert.assertEquals(existingLayoutSet.getColorSchemeId(), newLayoutSet.getColorSchemeId());
    Assert.assertEquals(existingLayoutSet.getWapThemeId(), newLayoutSet.getWapThemeId());
    Assert.assertEquals(
        existingLayoutSet.getWapColorSchemeId(), newLayoutSet.getWapColorSchemeId());
    Assert.assertEquals(existingLayoutSet.getCss(), newLayoutSet.getCss());
    Assert.assertEquals(existingLayoutSet.getPageCount(), newLayoutSet.getPageCount());
    Assert.assertEquals(existingLayoutSet.getSettings(), newLayoutSet.getSettings());
    Assert.assertEquals(
        existingLayoutSet.getLayoutSetPrototypeUuid(), newLayoutSet.getLayoutSetPrototypeUuid());
    Assert.assertEquals(
        existingLayoutSet.getLayoutSetPrototypeLinkEnabled(),
        newLayoutSet.getLayoutSetPrototypeLinkEnabled());
  }