use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method testRemove.
@Test
public void testRemove() throws Exception {
Bar newBar = addBar();
_persistence.remove(newBar);
Bar existingBar = _persistence.fetchByPrimaryKey(newBar.getPrimaryKey());
Assert.assertNull(existingBar);
}
use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method testFetchByPrimaryKeyMissing.
@Test
public void testFetchByPrimaryKeyMissing() throws Exception {
long pk = RandomTestUtil.nextLong();
Bar missingBar = _persistence.fetchByPrimaryKey(pk);
Assert.assertNull(missingBar);
}
use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method testActionableDynamicQuery.
@Test
public void testActionableDynamicQuery() throws Exception {
final IntegerWrapper count = new IntegerWrapper();
ActionableDynamicQuery actionableDynamicQuery = BarLocalServiceUtil.getActionableDynamicQuery();
actionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Bar>() {
@Override
public void performAction(Bar bar) {
Assert.assertNotNull(bar);
count.increment();
}
});
actionableDynamicQuery.performActions();
Assert.assertEquals(count.getValue(), _persistence.countAll());
}
use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method addBar.
protected Bar addBar() throws Exception {
long pk = RandomTestUtil.nextLong();
Bar bar = _persistence.create(pk);
bar.setUuid(RandomTestUtil.randomString());
bar.setGroupId(RandomTestUtil.nextLong());
bar.setCompanyId(RandomTestUtil.nextLong());
bar.setUserId(RandomTestUtil.nextLong());
bar.setUserName(RandomTestUtil.randomString());
bar.setCreateDate(RandomTestUtil.nextDate());
bar.setModifiedDate(RandomTestUtil.nextDate());
bar.setField1(RandomTestUtil.randomString());
bar.setField2(RandomTestUtil.randomBoolean());
bar.setField3(RandomTestUtil.nextInt());
bar.setField4(RandomTestUtil.nextDate());
bar.setField5(RandomTestUtil.randomString());
_bars.add(_persistence.update(bar));
return bar;
}
use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist() throws Exception {
Bar newBar = addBar();
long pk = RandomTestUtil.nextLong();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newBar.getPrimaryKey());
primaryKeys.add(pk);
Map<Serializable, Bar> bars = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(1, bars.size());
Assert.assertEquals(newBar, bars.get(newBar.getPrimaryKey()));
}
Aggregations