use of com.liferay.roster.model.Club in project liferay-ide by liferay.
the class ClubPersistenceTest method testFindByPrimaryKeyExisting.
@Test
public void testFindByPrimaryKeyExisting() throws Exception {
Club newClub = addClub();
Club existingClub = _persistence.findByPrimaryKey(newClub.getPrimaryKey());
Assert.assertEquals(existingClub, newClub);
}
use of com.liferay.roster.model.Club in project liferay-ide by liferay.
the class ClubPersistenceTest method testCreate.
@Test
public void testCreate() throws Exception {
long pk = RandomTestUtil.nextLong();
Club club = _persistence.create(pk);
Assert.assertNotNull(club);
Assert.assertEquals(club.getPrimaryKey(), pk);
}
use of com.liferay.roster.model.Club in project liferay-ide by liferay.
the class ClubPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist() throws Exception {
Club newClub = addClub();
long pk = RandomTestUtil.nextLong();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newClub.getPrimaryKey());
primaryKeys.add(pk);
Map<Serializable, Club> clubs = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(1, clubs.size());
Assert.assertEquals(newClub, clubs.get(newClub.getPrimaryKey()));
}
use of com.liferay.roster.model.Club in project liferay-ide by liferay.
the class ClubPersistenceTest method testActionableDynamicQuery.
@Test
public void testActionableDynamicQuery() throws Exception {
final IntegerWrapper count = new IntegerWrapper();
ActionableDynamicQuery actionableDynamicQuery = ClubLocalServiceUtil.getActionableDynamicQuery();
actionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Club>() {
@Override
public void performAction(Club club) {
Assert.assertNotNull(club);
count.increment();
}
});
actionableDynamicQuery.performActions();
Assert.assertEquals(count.getValue(), _persistence.countAll());
}
use of com.liferay.roster.model.Club in project liferay-ide by liferay.
the class ClubPersistenceTest method testUpdateExisting.
@Test
public void testUpdateExisting() throws Exception {
long pk = RandomTestUtil.nextLong();
Club newClub = _persistence.create(pk);
newClub.setUuid(RandomTestUtil.randomString());
newClub.setCreateDate(RandomTestUtil.nextDate());
newClub.setModifiedDate(RandomTestUtil.nextDate());
newClub.setName(RandomTestUtil.randomString());
_clubs.add(_persistence.update(newClub));
Club existingClub = _persistence.findByPrimaryKey(newClub.getPrimaryKey());
Assert.assertEquals(existingClub.getUuid(), newClub.getUuid());
Assert.assertEquals(existingClub.getClubId(), newClub.getClubId());
Assert.assertEquals(Time.getShortTimestamp(existingClub.getCreateDate()), Time.getShortTimestamp(newClub.getCreateDate()));
Assert.assertEquals(Time.getShortTimestamp(existingClub.getModifiedDate()), Time.getShortTimestamp(newClub.getModifiedDate()));
Assert.assertEquals(existingClub.getName(), newClub.getName());
}
Aggregations