use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class ClubPersistenceTest method testDynamicQueryByProjectionMissing.
@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Club.class, _dynamicQueryClassLoader);
dynamicQuery.setProjection(ProjectionFactoryUtil.property("clubId"));
dynamicQuery.add(RestrictionsFactoryUtil.in("clubId", new Object[] { RandomTestUtil.nextLong() }));
List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(0, result.size());
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class RosterMemberPersistenceTest method testDynamicQueryByProjectionExisting.
@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
RosterMember newRosterMember = addRosterMember();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);
dynamicQuery.setProjection(ProjectionFactoryUtil.property("rosterMemberId"));
Object newRosterMemberId = newRosterMember.getRosterMemberId();
dynamicQuery.add(RestrictionsFactoryUtil.in("rosterMemberId", new Object[] { newRosterMemberId }));
List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Object existingRosterMemberId = result.get(0);
Assert.assertEquals(existingRosterMemberId, newRosterMemberId);
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class RosterMemberPersistenceTest method testDynamicQueryByPrimaryKeyMissing.
@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("rosterMemberId", RandomTestUtil.nextLong()));
List<RosterMember> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(0, result.size());
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class RosterMemberPersistenceTest method testDynamicQueryByProjectionMissing.
@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);
dynamicQuery.setProjection(ProjectionFactoryUtil.property("rosterMemberId"));
dynamicQuery.add(RestrictionsFactoryUtil.in("rosterMemberId", new Object[] { RandomTestUtil.nextLong() }));
List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(0, result.size());
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class RosterPersistenceTest method testDynamicQueryByPrimaryKeyExisting.
@Test
public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
Roster newRoster = addRoster();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Roster.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("rosterId", newRoster.getRosterId()));
List<Roster> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Roster existingRoster = result.get(0);
Assert.assertEquals(existingRoster, newRoster);
}
Aggregations