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

    Region newRegion = _persistence.create(pk);

    newRegion.setMvccVersion(RandomTestUtil.nextLong());

    newRegion.setCountryId(RandomTestUtil.nextLong());

    newRegion.setRegionCode(RandomTestUtil.randomString());

    newRegion.setName(RandomTestUtil.randomString());

    newRegion.setActive(RandomTestUtil.randomBoolean());

    _persistence.update(newRegion);

    Region existingRegion = _persistence.findByPrimaryKey(newRegion.getPrimaryKey());

    Assert.assertEquals(existingRegion.getMvccVersion(), newRegion.getMvccVersion());
    Assert.assertEquals(existingRegion.getRegionId(), newRegion.getRegionId());
    Assert.assertEquals(existingRegion.getCountryId(), newRegion.getCountryId());
    Assert.assertEquals(existingRegion.getRegionCode(), newRegion.getRegionCode());
    Assert.assertEquals(existingRegion.getName(), newRegion.getName());
    Assert.assertEquals(existingRegion.getActive(), newRegion.getActive());
  }
コード例 #2
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    TrashVersion newTrashVersion = _persistence.create(pk);

    newTrashVersion.setEntryId(RandomTestUtil.nextLong());

    newTrashVersion.setClassNameId(RandomTestUtil.nextLong());

    newTrashVersion.setClassPK(RandomTestUtil.nextLong());

    newTrashVersion.setTypeSettings(RandomTestUtil.randomString());

    newTrashVersion.setStatus(RandomTestUtil.nextInt());

    _trashVersions.add(_persistence.update(newTrashVersion));

    TrashVersion existingTrashVersion =
        _persistence.findByPrimaryKey(newTrashVersion.getPrimaryKey());

    Assert.assertEquals(existingTrashVersion.getVersionId(), newTrashVersion.getVersionId());
    Assert.assertEquals(existingTrashVersion.getEntryId(), newTrashVersion.getEntryId());
    Assert.assertEquals(existingTrashVersion.getClassNameId(), newTrashVersion.getClassNameId());
    Assert.assertEquals(existingTrashVersion.getClassPK(), newTrashVersion.getClassPK());
    Assert.assertEquals(existingTrashVersion.getTypeSettings(), newTrashVersion.getTypeSettings());
    Assert.assertEquals(existingTrashVersion.getStatus(), newTrashVersion.getStatus());
  }
コード例 #3
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Portlet newPortlet = _persistence.create(pk);

    newPortlet.setMvccVersion(RandomTestUtil.nextLong());

    newPortlet.setCompanyId(RandomTestUtil.nextLong());

    newPortlet.setPortletId(RandomTestUtil.randomString());

    newPortlet.setRoles(RandomTestUtil.randomString());

    newPortlet.setActive(RandomTestUtil.randomBoolean());

    _persistence.update(newPortlet);

    Portlet existingPortlet = _persistence.findByPrimaryKey(newPortlet.getPrimaryKey());

    Assert.assertEquals(existingPortlet.getMvccVersion(), newPortlet.getMvccVersion());
    Assert.assertEquals(existingPortlet.getId(), newPortlet.getId());
    Assert.assertEquals(existingPortlet.getCompanyId(), newPortlet.getCompanyId());
    Assert.assertEquals(existingPortlet.getPortletId(), newPortlet.getPortletId());
    Assert.assertEquals(existingPortlet.getRoles(), newPortlet.getRoles());
    Assert.assertEquals(existingPortlet.getActive(), newPortlet.getActive());
  }
コード例 #4
0
  protected MDRRuleGroup addMDRRuleGroup() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MDRRuleGroup mdrRuleGroup = _persistence.create(pk);

    mdrRuleGroup.setUuid(RandomTestUtil.randomString());

    mdrRuleGroup.setGroupId(RandomTestUtil.nextLong());

    mdrRuleGroup.setCompanyId(RandomTestUtil.nextLong());

    mdrRuleGroup.setUserId(RandomTestUtil.nextLong());

    mdrRuleGroup.setUserName(RandomTestUtil.randomString());

    mdrRuleGroup.setCreateDate(RandomTestUtil.nextDate());

    mdrRuleGroup.setModifiedDate(RandomTestUtil.nextDate());

    mdrRuleGroup.setName(RandomTestUtil.randomString());

    mdrRuleGroup.setDescription(RandomTestUtil.randomString());

    _persistence.update(mdrRuleGroup);

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

    ExpandoColumn newExpandoColumn = _persistence.create(pk);

    newExpandoColumn.setCompanyId(RandomTestUtil.nextLong());

    newExpandoColumn.setTableId(RandomTestUtil.nextLong());

    newExpandoColumn.setName(RandomTestUtil.randomString());

    newExpandoColumn.setType(RandomTestUtil.nextInt());

    newExpandoColumn.setDefaultData(RandomTestUtil.randomString());

    newExpandoColumn.setTypeSettings(RandomTestUtil.randomString());

    _expandoColumns.add(_persistence.update(newExpandoColumn));

    ExpandoColumn existingExpandoColumn =
        _persistence.findByPrimaryKey(newExpandoColumn.getPrimaryKey());

    Assert.assertEquals(existingExpandoColumn.getColumnId(), newExpandoColumn.getColumnId());
    Assert.assertEquals(existingExpandoColumn.getCompanyId(), newExpandoColumn.getCompanyId());
    Assert.assertEquals(existingExpandoColumn.getTableId(), newExpandoColumn.getTableId());
    Assert.assertEquals(existingExpandoColumn.getName(), newExpandoColumn.getName());
    Assert.assertEquals(existingExpandoColumn.getType(), newExpandoColumn.getType());
    Assert.assertEquals(existingExpandoColumn.getDefaultData(), newExpandoColumn.getDefaultData());
    Assert.assertEquals(
        existingExpandoColumn.getTypeSettings(), newExpandoColumn.getTypeSettings());
  }
コード例 #6
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    ResourceBlock newResourceBlock = _persistence.create(pk);

    newResourceBlock.setMvccVersion(RandomTestUtil.nextLong());

    newResourceBlock.setCompanyId(RandomTestUtil.nextLong());

    newResourceBlock.setGroupId(RandomTestUtil.nextLong());

    newResourceBlock.setName(RandomTestUtil.randomString());

    newResourceBlock.setPermissionsHash(RandomTestUtil.randomString());

    newResourceBlock.setReferenceCount(RandomTestUtil.nextLong());

    _resourceBlocks.add(_persistence.update(newResourceBlock));

    ResourceBlock existingResourceBlock =
        _persistence.findByPrimaryKey(newResourceBlock.getPrimaryKey());

    Assert.assertEquals(existingResourceBlock.getMvccVersion(), newResourceBlock.getMvccVersion());
    Assert.assertEquals(
        existingResourceBlock.getResourceBlockId(), newResourceBlock.getResourceBlockId());
    Assert.assertEquals(existingResourceBlock.getCompanyId(), newResourceBlock.getCompanyId());
    Assert.assertEquals(existingResourceBlock.getGroupId(), newResourceBlock.getGroupId());
    Assert.assertEquals(existingResourceBlock.getName(), newResourceBlock.getName());
    Assert.assertEquals(
        existingResourceBlock.getPermissionsHash(), newResourceBlock.getPermissionsHash());
    Assert.assertEquals(
        existingResourceBlock.getReferenceCount(), newResourceBlock.getReferenceCount());
  }
コード例 #7
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;
  }
コード例 #8
0
  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;
  }
コード例 #9
0
  protected MBMailingList addMBMailingList() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBMailingList mbMailingList = _persistence.create(pk);

    mbMailingList.setUuid(RandomTestUtil.randomString());

    mbMailingList.setGroupId(RandomTestUtil.nextLong());

    mbMailingList.setCompanyId(RandomTestUtil.nextLong());

    mbMailingList.setUserId(RandomTestUtil.nextLong());

    mbMailingList.setUserName(RandomTestUtil.randomString());

    mbMailingList.setCreateDate(RandomTestUtil.nextDate());

    mbMailingList.setModifiedDate(RandomTestUtil.nextDate());

    mbMailingList.setCategoryId(RandomTestUtil.nextLong());

    mbMailingList.setEmailAddress(RandomTestUtil.randomString());

    mbMailingList.setInProtocol(RandomTestUtil.randomString());

    mbMailingList.setInServerName(RandomTestUtil.randomString());

    mbMailingList.setInServerPort(RandomTestUtil.nextInt());

    mbMailingList.setInUseSSL(RandomTestUtil.randomBoolean());

    mbMailingList.setInUserName(RandomTestUtil.randomString());

    mbMailingList.setInPassword(RandomTestUtil.randomString());

    mbMailingList.setInReadInterval(RandomTestUtil.nextInt());

    mbMailingList.setOutEmailAddress(RandomTestUtil.randomString());

    mbMailingList.setOutCustom(RandomTestUtil.randomBoolean());

    mbMailingList.setOutServerName(RandomTestUtil.randomString());

    mbMailingList.setOutServerPort(RandomTestUtil.nextInt());

    mbMailingList.setOutUseSSL(RandomTestUtil.randomBoolean());

    mbMailingList.setOutUserName(RandomTestUtil.randomString());

    mbMailingList.setOutPassword(RandomTestUtil.randomString());

    mbMailingList.setAllowAnonymous(RandomTestUtil.randomBoolean());

    mbMailingList.setActive(RandomTestUtil.randomBoolean());

    _persistence.update(mbMailingList);

    return mbMailingList;
  }
コード例 #10
0
  protected DLFileVersion addDLFileVersion() throws Exception {
    long pk = RandomTestUtil.nextLong();

    DLFileVersion dlFileVersion = _persistence.create(pk);

    dlFileVersion.setUuid(RandomTestUtil.randomString());

    dlFileVersion.setGroupId(RandomTestUtil.nextLong());

    dlFileVersion.setCompanyId(RandomTestUtil.nextLong());

    dlFileVersion.setUserId(RandomTestUtil.nextLong());

    dlFileVersion.setUserName(RandomTestUtil.randomString());

    dlFileVersion.setCreateDate(RandomTestUtil.nextDate());

    dlFileVersion.setModifiedDate(RandomTestUtil.nextDate());

    dlFileVersion.setRepositoryId(RandomTestUtil.nextLong());

    dlFileVersion.setFolderId(RandomTestUtil.nextLong());

    dlFileVersion.setFileEntryId(RandomTestUtil.nextLong());

    dlFileVersion.setTreePath(RandomTestUtil.randomString());

    dlFileVersion.setExtension(RandomTestUtil.randomString());

    dlFileVersion.setMimeType(RandomTestUtil.randomString());

    dlFileVersion.setTitle(RandomTestUtil.randomString());

    dlFileVersion.setDescription(RandomTestUtil.randomString());

    dlFileVersion.setChangeLog(RandomTestUtil.randomString());

    dlFileVersion.setExtraSettings(RandomTestUtil.randomString());

    dlFileVersion.setFileEntryTypeId(RandomTestUtil.nextLong());

    dlFileVersion.setVersion(RandomTestUtil.randomString());

    dlFileVersion.setSize(RandomTestUtil.nextLong());

    dlFileVersion.setChecksum(RandomTestUtil.randomString());

    dlFileVersion.setStatus(RandomTestUtil.nextInt());

    dlFileVersion.setStatusByUserId(RandomTestUtil.nextLong());

    dlFileVersion.setStatusByUserName(RandomTestUtil.randomString());

    dlFileVersion.setStatusDate(RandomTestUtil.nextDate());

    _persistence.update(dlFileVersion);

    return dlFileVersion;
  }
コード例 #11
0
 @Test
 public void testCountByU_CArrayable() {
   try {
     _persistence.countByU_C(
         RandomTestUtil.nextLong(), new long[] {RandomTestUtil.nextLong(), 0L});
   } catch (Exception e) {
     Assert.fail(e.getMessage());
   }
 }
コード例 #12
0
  @Test
  public void testFetchByPrimaryKeyMissing() throws Exception {
    OrgGroupRolePK pk =
        new OrgGroupRolePK(
            RandomTestUtil.nextLong(), RandomTestUtil.nextLong(), RandomTestUtil.nextLong());

    OrgGroupRole missingOrgGroupRole = _persistence.fetchByPrimaryKey(pk);

    Assert.assertNull(missingOrgGroupRole);
  }
コード例 #13
0
  @Test
  public void testCountByG_B() {
    try {
      _persistence.countByG_B(RandomTestUtil.nextLong(), RandomTestUtil.nextLong());

      _persistence.countByG_B(0L, 0L);
    } catch (Exception e) {
      Assert.fail(e.getMessage());
    }
  }
コード例 #14
0
 @Test
 public void testCountByG_F_STArrayable() {
   try {
     _persistence.countByG_F_ST(
         RandomTestUtil.nextLong(),
         RandomTestUtil.nextLong(),
         new int[] {RandomTestUtil.nextInt(), 0});
   } catch (Exception e) {
     Assert.fail(e.getMessage());
   }
 }
コード例 #15
0
  @Test
  public void testCreate() throws Exception {
    OrgGroupRolePK pk =
        new OrgGroupRolePK(
            RandomTestUtil.nextLong(), RandomTestUtil.nextLong(), RandomTestUtil.nextLong());

    OrgGroupRole orgGroupRole = _persistence.create(pk);

    Assert.assertNotNull(orgGroupRole);

    Assert.assertEquals(orgGroupRole.getPrimaryKey(), pk);
  }
コード例 #16
0
  protected CalEvent addCalEvent() throws Exception {
    long pk = RandomTestUtil.nextLong();

    CalEvent calEvent = _persistence.create(pk);

    calEvent.setUuid(RandomTestUtil.randomString());

    calEvent.setGroupId(RandomTestUtil.nextLong());

    calEvent.setCompanyId(RandomTestUtil.nextLong());

    calEvent.setUserId(RandomTestUtil.nextLong());

    calEvent.setUserName(RandomTestUtil.randomString());

    calEvent.setCreateDate(RandomTestUtil.nextDate());

    calEvent.setModifiedDate(RandomTestUtil.nextDate());

    calEvent.setTitle(RandomTestUtil.randomString());

    calEvent.setDescription(RandomTestUtil.randomString());

    calEvent.setLocation(RandomTestUtil.randomString());

    calEvent.setStartDate(RandomTestUtil.nextDate());

    calEvent.setEndDate(RandomTestUtil.nextDate());

    calEvent.setDurationHour(RandomTestUtil.nextInt());

    calEvent.setDurationMinute(RandomTestUtil.nextInt());

    calEvent.setAllDay(RandomTestUtil.randomBoolean());

    calEvent.setTimeZoneSensitive(RandomTestUtil.randomBoolean());

    calEvent.setType(RandomTestUtil.randomString());

    calEvent.setRepeating(RandomTestUtil.randomBoolean());

    calEvent.setRecurrence(RandomTestUtil.randomString());

    calEvent.setRemindBy(RandomTestUtil.nextInt());

    calEvent.setFirstReminder(RandomTestUtil.nextInt());

    calEvent.setSecondReminder(RandomTestUtil.nextInt());

    _persistence.update(calEvent);

    return calEvent;
  }
コード例 #17
0
  protected OrgGroupRole addOrgGroupRole() throws Exception {
    OrgGroupRolePK pk =
        new OrgGroupRolePK(
            RandomTestUtil.nextLong(), RandomTestUtil.nextLong(), RandomTestUtil.nextLong());

    OrgGroupRole orgGroupRole = _persistence.create(pk);

    orgGroupRole.setMvccVersion(RandomTestUtil.nextLong());

    _persistence.update(orgGroupRole);

    return orgGroupRole;
  }
コード例 #18
0
  @Test
  public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(OrgGroupRole.class, OrgGroupRole.class.getClassLoader());

    dynamicQuery.add(RestrictionsFactoryUtil.eq("id.organizationId", RandomTestUtil.nextLong()));
    dynamicQuery.add(RestrictionsFactoryUtil.eq("id.groupId", RandomTestUtil.nextLong()));
    dynamicQuery.add(RestrictionsFactoryUtil.eq("id.roleId", RandomTestUtil.nextLong()));

    List<OrgGroupRole> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(0, result.size());
  }
コード例 #19
0
  @Test
  public void testFindByPrimaryKeyMissing() throws Exception {
    OrgGroupRolePK pk =
        new OrgGroupRolePK(
            RandomTestUtil.nextLong(), RandomTestUtil.nextLong(), RandomTestUtil.nextLong());

    try {
      _persistence.findByPrimaryKey(pk);

      Assert.fail("Missing entity did not throw NoSuchOrgGroupRoleException");
    } catch (NoSuchOrgGroupRoleException nsee) {
    }
  }
コード例 #20
0
  @Test
  public void testCountByG_F_T_V() {
    try {
      _persistence.countByG_F_T_V(
          RandomTestUtil.nextLong(), RandomTestUtil.nextLong(), StringPool.BLANK, StringPool.BLANK);

      _persistence.countByG_F_T_V(0L, 0L, StringPool.NULL, StringPool.NULL);

      _persistence.countByG_F_T_V(0L, 0L, (String) null, (String) null);
    } catch (Exception e) {
      Assert.fail(e.getMessage());
    }
  }
コード例 #21
0
  @Test
  public void testCountByG_F_A_S() {
    try {
      _persistence.countByG_F_A_S(
          RandomTestUtil.nextLong(),
          RandomTestUtil.nextLong(),
          RandomTestUtil.randomBoolean(),
          RandomTestUtil.nextInt());

      _persistence.countByG_F_A_S(0L, 0L, RandomTestUtil.randomBoolean(), 0);
    } catch (Exception e) {
      Assert.fail(e.getMessage());
    }
  }
コード例 #22
0
  protected SocialActivitySet addSocialActivitySet() throws Exception {
    long pk = RandomTestUtil.nextLong();

    SocialActivitySet socialActivitySet = _persistence.create(pk);

    socialActivitySet.setGroupId(RandomTestUtil.nextLong());

    socialActivitySet.setCompanyId(RandomTestUtil.nextLong());

    socialActivitySet.setUserId(RandomTestUtil.nextLong());

    socialActivitySet.setCreateDate(RandomTestUtil.nextLong());

    socialActivitySet.setModifiedDate(RandomTestUtil.nextLong());

    socialActivitySet.setClassNameId(RandomTestUtil.nextLong());

    socialActivitySet.setClassPK(RandomTestUtil.nextLong());

    socialActivitySet.setType(RandomTestUtil.nextInt());

    socialActivitySet.setExtraData(RandomTestUtil.randomString());

    socialActivitySet.setActivityCount(RandomTestUtil.nextInt());

    _socialActivitySets.add(_persistence.update(socialActivitySet));

    return socialActivitySet;
  }
コード例 #23
0
  @Test
  public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereNoPrimaryKeysExist()
      throws Exception {
    long pk1 = RandomTestUtil.nextLong();

    long pk2 = RandomTestUtil.nextLong();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(pk1);
    primaryKeys.add(pk2);

    Map<Serializable, MBBan> mbBans = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertTrue(mbBans.isEmpty());
  }
コード例 #24
0
  @Test
  public void testFetchByPrimaryKeyMissing() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBBan missingMBBan = _persistence.fetchByPrimaryKey(pk);

    Assert.assertNull(missingMBBan);
  }
コード例 #25
0
  @Test
  public void testFetchByPrimaryKeyMissing() throws Exception {
    long pk = RandomTestUtil.nextLong();

    DLFileShortcut missingDLFileShortcut = _persistence.fetchByPrimaryKey(pk);

    Assert.assertNull(missingDLFileShortcut);
  }
コード例 #26
0
  @Test
  public void testFetchByPrimaryKeyMissing() throws Exception {
    long pk = RandomTestUtil.nextLong();

    ResourceBlock missingResourceBlock = _persistence.fetchByPrimaryKey(pk);

    Assert.assertNull(missingResourceBlock);
  }
コード例 #27
0
  @Test
  public void testFetchByPrimaryKeyMissing() throws Exception {
    long pk = RandomTestUtil.nextLong();

    JournalArticleImage missingJournalArticleImage = _persistence.fetchByPrimaryKey(pk);

    Assert.assertNull(missingJournalArticleImage);
  }
コード例 #28
0
  protected VirtualHost addVirtualHost() throws Exception {
    long pk = RandomTestUtil.nextLong();

    VirtualHost virtualHost = _persistence.create(pk);

    virtualHost.setMvccVersion(RandomTestUtil.nextLong());

    virtualHost.setCompanyId(RandomTestUtil.nextLong());

    virtualHost.setLayoutSetId(RandomTestUtil.nextLong());

    virtualHost.setHostname(RandomTestUtil.randomString());

    _virtualHosts.add(_persistence.update(virtualHost));

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

    SocialActivitySet missingSocialActivitySet = _persistence.fetchByPrimaryKey(pk);

    Assert.assertNull(missingSocialActivitySet);
  }
コード例 #30
0
  @Test
  public void testFetchByPrimaryKeyMissing() throws Exception {
    long pk = RandomTestUtil.nextLong();

    VirtualHost missingVirtualHost = _persistence.fetchByPrimaryKey(pk);

    Assert.assertNull(missingVirtualHost);
  }