use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.
the class BazPersistenceTest method testActionableDynamicQuery.
@Test
public void testActionableDynamicQuery() throws Exception {
final IntegerWrapper count = new IntegerWrapper();
ActionableDynamicQuery actionableDynamicQuery = BazLocalServiceUtil.getActionableDynamicQuery();
actionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Baz>() {
@Override
public void performAction(Baz baz) {
Assert.assertNotNull(baz);
count.increment();
}
});
actionableDynamicQuery.performActions();
Assert.assertEquals(count.getValue(), _persistence.countAll());
}
use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.
the class BazPersistenceTest method testUpdateExisting.
@Test
public void testUpdateExisting() throws Exception {
long pk = RandomTestUtil.nextLong();
Baz newBaz = _persistence.create(pk);
newBaz.setUuid(RandomTestUtil.randomString());
newBaz.setGroupId(RandomTestUtil.nextLong());
newBaz.setCompanyId(RandomTestUtil.nextLong());
newBaz.setUserId(RandomTestUtil.nextLong());
newBaz.setUserName(RandomTestUtil.randomString());
newBaz.setCreateDate(RandomTestUtil.nextDate());
newBaz.setModifiedDate(RandomTestUtil.nextDate());
newBaz.setStatus(RandomTestUtil.nextInt());
newBaz.setStatusByUserId(RandomTestUtil.nextLong());
newBaz.setStatusByUserName(RandomTestUtil.randomString());
newBaz.setStatusDate(RandomTestUtil.nextDate());
_bazs.add(_persistence.update(newBaz));
Baz existingBaz = _persistence.findByPrimaryKey(newBaz.getPrimaryKey());
Assert.assertEquals(existingBaz.getUuid(), newBaz.getUuid());
Assert.assertEquals(existingBaz.getBazId(), newBaz.getBazId());
Assert.assertEquals(existingBaz.getGroupId(), newBaz.getGroupId());
Assert.assertEquals(existingBaz.getCompanyId(), newBaz.getCompanyId());
Assert.assertEquals(existingBaz.getUserId(), newBaz.getUserId());
Assert.assertEquals(existingBaz.getUserName(), newBaz.getUserName());
Assert.assertEquals(Time.getShortTimestamp(existingBaz.getCreateDate()), Time.getShortTimestamp(newBaz.getCreateDate()));
Assert.assertEquals(Time.getShortTimestamp(existingBaz.getModifiedDate()), Time.getShortTimestamp(newBaz.getModifiedDate()));
Assert.assertEquals(existingBaz.getStatus(), newBaz.getStatus());
Assert.assertEquals(existingBaz.getStatusByUserId(), newBaz.getStatusByUserId());
Assert.assertEquals(existingBaz.getStatusByUserName(), newBaz.getStatusByUserName());
Assert.assertEquals(Time.getShortTimestamp(existingBaz.getStatusDate()), Time.getShortTimestamp(newBaz.getStatusDate()));
}
use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.
the class BazPersistenceTest method testRemove.
@Test
public void testRemove() throws Exception {
Baz newBaz = addBaz();
_persistence.remove(newBaz);
Baz existingBaz = _persistence.fetchByPrimaryKey(newBaz.getPrimaryKey());
Assert.assertNull(existingBaz);
}
use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.
the class BazPersistenceTest method testResetOriginalValues.
@Test
public void testResetOriginalValues() throws Exception {
Baz newBaz = addBaz();
_persistence.clearCache();
Baz existingBaz = _persistence.findByPrimaryKey(newBaz.getPrimaryKey());
Assert.assertTrue(Objects.equals(existingBaz.getUuid(), ReflectionTestUtil.invoke(existingBaz, "getOriginalUuid", new Class<?>[0])));
Assert.assertEquals(Long.valueOf(existingBaz.getGroupId()), ReflectionTestUtil.<Long>invoke(existingBaz, "getOriginalGroupId", new Class<?>[0]));
}
use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.
the class BazPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist() throws Exception {
Baz newBaz1 = addBaz();
Baz newBaz2 = addBaz();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newBaz1.getPrimaryKey());
primaryKeys.add(newBaz2.getPrimaryKey());
Map<Serializable, Baz> bazs = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(2, bazs.size());
Assert.assertEquals(newBaz1, bazs.get(newBaz1.getPrimaryKey()));
Assert.assertEquals(newBaz2, bazs.get(newBaz2.getPrimaryKey()));
}
Aggregations