コード例 #1
0
  @Test
  public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
    JournalArticleImage newJournalArticleImage = addJournalArticleImage();

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

    primaryKeys.add(newJournalArticleImage.getPrimaryKey());

    Map<Serializable, JournalArticleImage> journalArticleImages =
        _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(1, journalArticleImages.size());
    Assert.assertEquals(
        newJournalArticleImage, journalArticleImages.get(newJournalArticleImage.getPrimaryKey()));
  }
コード例 #2
0
  @Test
  public void testFetchByPrimaryKeyExisting() throws Exception {
    JournalArticleImage newJournalArticleImage = addJournalArticleImage();

    JournalArticleImage existingJournalArticleImage =
        _persistence.fetchByPrimaryKey(newJournalArticleImage.getPrimaryKey());

    Assert.assertEquals(existingJournalArticleImage, newJournalArticleImage);
  }
コード例 #3
0
  @Test
  public void testCreate() throws Exception {
    long pk = RandomTestUtil.nextLong();

    JournalArticleImage journalArticleImage = _persistence.create(pk);

    Assert.assertNotNull(journalArticleImage);

    Assert.assertEquals(journalArticleImage.getPrimaryKey(), pk);
  }
コード例 #4
0
  @Test
  public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist()
      throws Exception {
    JournalArticleImage newJournalArticleImage = addJournalArticleImage();

    long pk = RandomTestUtil.nextLong();

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

    primaryKeys.add(newJournalArticleImage.getPrimaryKey());
    primaryKeys.add(pk);

    Map<Serializable, JournalArticleImage> journalArticleImages =
        _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(1, journalArticleImages.size());
    Assert.assertEquals(
        newJournalArticleImage, journalArticleImages.get(newJournalArticleImage.getPrimaryKey()));
  }
コード例 #5
0
  @Test
  public void testRemove() throws Exception {
    JournalArticleImage newJournalArticleImage = addJournalArticleImage();

    _persistence.remove(newJournalArticleImage);

    JournalArticleImage existingJournalArticleImage =
        _persistence.fetchByPrimaryKey(newJournalArticleImage.getPrimaryKey());

    Assert.assertNull(existingJournalArticleImage);
  }
コード例 #6
0
  @Test
  public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist()
      throws Exception {
    JournalArticleImage newJournalArticleImage1 = addJournalArticleImage();
    JournalArticleImage newJournalArticleImage2 = addJournalArticleImage();

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

    primaryKeys.add(newJournalArticleImage1.getPrimaryKey());
    primaryKeys.add(newJournalArticleImage2.getPrimaryKey());

    Map<Serializable, JournalArticleImage> journalArticleImages =
        _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(2, journalArticleImages.size());
    Assert.assertEquals(
        newJournalArticleImage1, journalArticleImages.get(newJournalArticleImage1.getPrimaryKey()));
    Assert.assertEquals(
        newJournalArticleImage2, journalArticleImages.get(newJournalArticleImage2.getPrimaryKey()));
  }
コード例 #7
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    JournalArticleImage newJournalArticleImage = _persistence.create(pk);

    newJournalArticleImage.setGroupId(RandomTestUtil.nextLong());

    newJournalArticleImage.setArticleId(RandomTestUtil.randomString());

    newJournalArticleImage.setVersion(RandomTestUtil.nextDouble());

    newJournalArticleImage.setElInstanceId(RandomTestUtil.randomString());

    newJournalArticleImage.setElName(RandomTestUtil.randomString());

    newJournalArticleImage.setLanguageId(RandomTestUtil.randomString());

    newJournalArticleImage.setTempImage(RandomTestUtil.randomBoolean());

    _journalArticleImages.add(_persistence.update(newJournalArticleImage));

    JournalArticleImage existingJournalArticleImage =
        _persistence.findByPrimaryKey(newJournalArticleImage.getPrimaryKey());

    Assert.assertEquals(
        existingJournalArticleImage.getArticleImageId(),
        newJournalArticleImage.getArticleImageId());
    Assert.assertEquals(
        existingJournalArticleImage.getGroupId(), newJournalArticleImage.getGroupId());
    Assert.assertEquals(
        existingJournalArticleImage.getArticleId(), newJournalArticleImage.getArticleId());
    AssertUtils.assertEquals(
        existingJournalArticleImage.getVersion(), newJournalArticleImage.getVersion());
    Assert.assertEquals(
        existingJournalArticleImage.getElInstanceId(), newJournalArticleImage.getElInstanceId());
    Assert.assertEquals(
        existingJournalArticleImage.getElName(), newJournalArticleImage.getElName());
    Assert.assertEquals(
        existingJournalArticleImage.getLanguageId(), newJournalArticleImage.getLanguageId());
    Assert.assertEquals(
        existingJournalArticleImage.getTempImage(), newJournalArticleImage.getTempImage());
  }
コード例 #8
0
  @Test
  public void testResetOriginalValues() throws Exception {
    if (!PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
      return;
    }

    JournalArticleImage newJournalArticleImage = addJournalArticleImage();

    _persistence.clearCache();

    JournalArticleImageModelImpl existingJournalArticleImageModelImpl =
        (JournalArticleImageModelImpl)
            _persistence.findByPrimaryKey(newJournalArticleImage.getPrimaryKey());

    Assert.assertEquals(
        existingJournalArticleImageModelImpl.getGroupId(),
        existingJournalArticleImageModelImpl.getOriginalGroupId());
    Assert.assertTrue(
        Validator.equals(
            existingJournalArticleImageModelImpl.getArticleId(),
            existingJournalArticleImageModelImpl.getOriginalArticleId()));
    AssertUtils.assertEquals(
        existingJournalArticleImageModelImpl.getVersion(),
        existingJournalArticleImageModelImpl.getOriginalVersion());
    Assert.assertTrue(
        Validator.equals(
            existingJournalArticleImageModelImpl.getElInstanceId(),
            existingJournalArticleImageModelImpl.getOriginalElInstanceId()));
    Assert.assertTrue(
        Validator.equals(
            existingJournalArticleImageModelImpl.getElName(),
            existingJournalArticleImageModelImpl.getOriginalElName()));
    Assert.assertTrue(
        Validator.equals(
            existingJournalArticleImageModelImpl.getLanguageId(),
            existingJournalArticleImageModelImpl.getOriginalLanguageId()));
  }