use of com.liferay.roster.model.Roster 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);
}
use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterPersistenceTest method testActionableDynamicQuery.
@Test
public void testActionableDynamicQuery() throws Exception {
final IntegerWrapper count = new IntegerWrapper();
ActionableDynamicQuery actionableDynamicQuery = RosterLocalServiceUtil.getActionableDynamicQuery();
actionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Roster>() {
@Override
public void performAction(Roster roster) {
Assert.assertNotNull(roster);
count.increment();
}
});
actionableDynamicQuery.performActions();
Assert.assertEquals(count.getValue(), _persistence.countAll());
}
use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterPersistenceTest method testDynamicQueryByPrimaryKeyMissing.
@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Roster.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("rosterId", RandomTestUtil.nextLong()));
List<Roster> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(0, result.size());
}
use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterPersistenceTest method testUpdateExisting.
@Test
public void testUpdateExisting() throws Exception {
long pk = RandomTestUtil.nextLong();
Roster newRoster = _persistence.create(pk);
newRoster.setUuid(RandomTestUtil.randomString());
newRoster.setCreateDate(RandomTestUtil.nextDate());
newRoster.setModifiedDate(RandomTestUtil.nextDate());
newRoster.setClubId(RandomTestUtil.nextLong());
newRoster.setName(RandomTestUtil.randomString());
_rosters.add(_persistence.update(newRoster));
Roster existingRoster = _persistence.findByPrimaryKey(newRoster.getPrimaryKey());
Assert.assertEquals(existingRoster.getUuid(), newRoster.getUuid());
Assert.assertEquals(existingRoster.getRosterId(), newRoster.getRosterId());
Assert.assertEquals(Time.getShortTimestamp(existingRoster.getCreateDate()), Time.getShortTimestamp(newRoster.getCreateDate()));
Assert.assertEquals(Time.getShortTimestamp(existingRoster.getModifiedDate()), Time.getShortTimestamp(newRoster.getModifiedDate()));
Assert.assertEquals(existingRoster.getClubId(), newRoster.getClubId());
Assert.assertEquals(existingRoster.getName(), newRoster.getName());
}
use of com.liferay.roster.model.Roster in project liferay-ide by liferay.
the class RosterModelImpl method toModel.
/**
* Converts the soap model instance into a normal model instance.
*
* @param soapModel the soap model instance to convert
* @return the normal model instance
*/
public static Roster toModel(RosterSoap soapModel) {
if (soapModel == null) {
return null;
}
Roster model = new RosterImpl();
model.setUuid(soapModel.getUuid());
model.setRosterId(soapModel.getRosterId());
model.setCreateDate(soapModel.getCreateDate());
model.setModifiedDate(soapModel.getModifiedDate());
model.setClubId(soapModel.getClubId());
model.setName(soapModel.getName());
return model;
}
Aggregations