Search in sources :

Example 6 with Club

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);
}
Also used : Club(com.liferay.roster.model.Club) Test(org.junit.Test)

Example 7 with Club

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);
}
Also used : Club(com.liferay.roster.model.Club) Test(org.junit.Test)

Example 8 with Club

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()));
}
Also used : Serializable(java.io.Serializable) Club(com.liferay.roster.model.Club) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 9 with Club

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());
}
Also used : Club(com.liferay.roster.model.Club) IntegerWrapper(com.liferay.portal.kernel.util.IntegerWrapper) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Test(org.junit.Test)

Example 10 with Club

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());
}
Also used : Club(com.liferay.roster.model.Club) Test(org.junit.Test)

Aggregations

Club (com.liferay.roster.model.Club)27 Test (org.junit.Test)13 NoSuchClubException (com.liferay.roster.exception.NoSuchClubException)8 Session (com.liferay.portal.kernel.dao.orm.Session)6 StringBundler (com.liferay.portal.kernel.util.StringBundler)6 ClubImpl (com.liferay.roster.model.impl.ClubImpl)5 ActionableDynamicQuery (com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery)4 Query (com.liferay.portal.kernel.dao.orm.Query)4 Serializable (java.io.Serializable)4 DynamicQuery (com.liferay.portal.kernel.dao.orm.DynamicQuery)3 HashSet (java.util.HashSet)3 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)2 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)2 IntegerWrapper (com.liferay.portal.kernel.util.IntegerWrapper)1 HashMap (java.util.HashMap)1 List (java.util.List)1