use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterPersistenceTest method testDynamicQueryByProjectionExisting.
@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
Roster newRoster = addRoster();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Roster.class, _dynamicQueryClassLoader);
dynamicQuery.setProjection(ProjectionFactoryUtil.property("rosterId"));
Object newRosterId = newRoster.getRosterId();
dynamicQuery.add(RestrictionsFactoryUtil.in("rosterId", new Object[] { newRosterId }));
List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Object existingRosterId = result.get(0);
Assert.assertEquals(existingRosterId, newRosterId);
}
use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterPersistenceTest method testFetchByPrimaryKeyExisting.
@Test
public void testFetchByPrimaryKeyExisting() throws Exception {
Roster newRoster = addRoster();
Roster existingRoster = _persistence.fetchByPrimaryKey(newRoster.getPrimaryKey());
Assert.assertEquals(existingRoster, newRoster);
}
use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterPersistenceTest method testFetchByPrimaryKeyMissing.
@Test
public void testFetchByPrimaryKeyMissing() throws Exception {
long pk = RandomTestUtil.nextLong();
Roster missingRoster = _persistence.fetchByPrimaryKey(pk);
Assert.assertNull(missingRoster);
}
use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist() throws Exception {
Roster newRoster1 = addRoster();
Roster newRoster2 = addRoster();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newRoster1.getPrimaryKey());
primaryKeys.add(newRoster2.getPrimaryKey());
Map<Serializable, Roster> rosters = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(2, rosters.size());
Assert.assertEquals(newRoster1, rosters.get(newRoster1.getPrimaryKey()));
Assert.assertEquals(newRoster2, rosters.get(newRoster2.getPrimaryKey()));
}
use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist() throws Exception {
Roster newRoster = addRoster();
long pk = RandomTestUtil.nextLong();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newRoster.getPrimaryKey());
primaryKeys.add(pk);
Map<Serializable, Roster> rosters = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(1, rosters.size());
Assert.assertEquals(newRoster, rosters.get(newRoster.getPrimaryKey()));
}
Aggregations