use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceTest method testRemove.
@Test
public void testRemove() throws Exception {
Qux newQux = addQux();
_persistence.remove(newQux);
Qux existingQux = _persistence.fetchByPrimaryKey(newQux.getPrimaryKey());
Assert.assertNull(existingQux);
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceTest method testFindByPrimaryKeyExisting.
@Test
public void testFindByPrimaryKeyExisting() throws Exception {
Qux newQux = addQux();
Qux existingQux = _persistence.findByPrimaryKey(newQux.getPrimaryKey());
Assert.assertEquals(existingQux, newQux);
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceTest method testDynamicQueryByProjectionExisting.
@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
Qux newQux = addQux();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Qux.class, _dynamicQueryClassLoader);
dynamicQuery.setProjection(ProjectionFactoryUtil.property("quxId"));
Object newQuxId = newQux.getQuxId();
dynamicQuery.add(RestrictionsFactoryUtil.in("quxId", new Object[] { newQuxId }));
List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Object existingQuxId = result.get(0);
Assert.assertEquals(existingQuxId, newQuxId);
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceTest method addQux.
protected Qux addQux() throws Exception {
long pk = RandomTestUtil.nextLong();
Qux qux = _persistence.create(pk);
qux.setUuid(RandomTestUtil.randomString());
qux.setGroupId(RandomTestUtil.nextLong());
qux.setCompanyId(RandomTestUtil.nextLong());
qux.setUserId(RandomTestUtil.nextLong());
qux.setUserName(RandomTestUtil.randomString());
qux.setCreateDate(RandomTestUtil.nextDate());
qux.setModifiedDate(RandomTestUtil.nextDate());
qux.setStatus(RandomTestUtil.nextInt());
qux.setStatusByUserId(RandomTestUtil.nextLong());
qux.setStatusByUserName(RandomTestUtil.randomString());
qux.setStatusDate(RandomTestUtil.nextDate());
_quxs.add(_persistence.update(qux));
return qux;
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist() throws Exception {
Qux newQux = addQux();
long pk = RandomTestUtil.nextLong();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newQux.getPrimaryKey());
primaryKeys.add(pk);
Map<Serializable, Qux> quxs = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(1, quxs.size());
Assert.assertEquals(newQux, quxs.get(newQux.getPrimaryKey()));
}
Aggregations