Search in sources :

Example 26 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method testFetchByPrimaryKeyExisting.

@Test
public void testFetchByPrimaryKeyExisting() throws Exception {
    RosterMember newRosterMember = addRosterMember();
    RosterMember existingRosterMember = _persistence.fetchByPrimaryKey(newRosterMember.getPrimaryKey());
    Assert.assertEquals(existingRosterMember, newRosterMember);
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) Test(org.junit.Test)

Example 27 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method addRosterMember.

protected RosterMember addRosterMember() throws Exception {
    long pk = RandomTestUtil.nextLong();
    RosterMember rosterMember = _persistence.create(pk);
    rosterMember.setUuid(RandomTestUtil.randomString());
    rosterMember.setCreateDate(RandomTestUtil.nextDate());
    rosterMember.setModifiedDate(RandomTestUtil.nextDate());
    rosterMember.setRosterId(RandomTestUtil.nextLong());
    rosterMember.setContactId(RandomTestUtil.nextLong());
    _rosterMembers.add(_persistence.update(rosterMember));
    return rosterMember;
}
Also used : RosterMember(com.liferay.roster.model.RosterMember)

Example 28 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method testDynamicQueryByPrimaryKeyExisting.

@Test
public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    RosterMember newRosterMember = addRosterMember();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);
    dynamicQuery.add(RestrictionsFactoryUtil.eq("rosterMemberId", newRosterMember.getRosterMemberId()));
    List<RosterMember> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(1, result.size());
    RosterMember existingRosterMember = result.get(0);
    Assert.assertEquals(existingRosterMember, newRosterMember);
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) DynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Test(org.junit.Test)

Example 29 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist.

@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist() throws Exception {
    RosterMember newRosterMember1 = addRosterMember();
    RosterMember newRosterMember2 = addRosterMember();
    Set<Serializable> primaryKeys = new HashSet<Serializable>();
    primaryKeys.add(newRosterMember1.getPrimaryKey());
    primaryKeys.add(newRosterMember2.getPrimaryKey());
    Map<Serializable, RosterMember> rosterMembers = _persistence.fetchByPrimaryKeys(primaryKeys);
    Assert.assertEquals(2, rosterMembers.size());
    Assert.assertEquals(newRosterMember1, rosterMembers.get(newRosterMember1.getPrimaryKey()));
    Assert.assertEquals(newRosterMember2, rosterMembers.get(newRosterMember2.getPrimaryKey()));
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) Serializable(java.io.Serializable) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 30 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method testFetchByPrimaryKeysWithOnePrimaryKey.

@Test
public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
    RosterMember newRosterMember = addRosterMember();
    Set<Serializable> primaryKeys = new HashSet<Serializable>();
    primaryKeys.add(newRosterMember.getPrimaryKey());
    Map<Serializable, RosterMember> rosterMembers = _persistence.fetchByPrimaryKeys(primaryKeys);
    Assert.assertEquals(1, rosterMembers.size());
    Assert.assertEquals(newRosterMember, rosterMembers.get(newRosterMember.getPrimaryKey()));
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) Serializable(java.io.Serializable) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

RosterMember (com.liferay.roster.model.RosterMember)32 Test (org.junit.Test)13 NoSuchRosterMemberException (com.liferay.roster.exception.NoSuchRosterMemberException)12 StringBundler (com.liferay.portal.kernel.util.StringBundler)10 Session (com.liferay.portal.kernel.dao.orm.Session)8 Query (com.liferay.portal.kernel.dao.orm.Query)6 RosterMemberImpl (com.liferay.roster.model.impl.RosterMemberImpl)6 ActionableDynamicQuery (com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery)4 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)4 Serializable (java.io.Serializable)4 DynamicQuery (com.liferay.portal.kernel.dao.orm.DynamicQuery)3 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)3 HashSet (java.util.HashSet)3 IntegerWrapper (com.liferay.portal.kernel.util.IntegerWrapper)1 HashMap (java.util.HashMap)1 List (java.util.List)1