use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method testResetOriginalValues.
@Test
public void testResetOriginalValues() throws Exception {
Bar newBar = addBar();
_persistence.clearCache();
Bar existingBar = _persistence.findByPrimaryKey(newBar.getPrimaryKey());
Assert.assertTrue(Objects.equals(existingBar.getUuid(), ReflectionTestUtil.invoke(existingBar, "getOriginalUuid", new Class<?>[0])));
Assert.assertEquals(Long.valueOf(existingBar.getGroupId()), ReflectionTestUtil.<Long>invoke(existingBar, "getOriginalGroupId", new Class<?>[0]));
}
use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method testDynamicQueryByPrimaryKeyExisting.
@Test
public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
Bar newBar = addBar();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Bar.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("barId", newBar.getBarId()));
List<Bar> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Bar existingBar = result.get(0);
Assert.assertEquals(existingBar, newBar);
}
use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method testFetchByPrimaryKeyExisting.
@Test
public void testFetchByPrimaryKeyExisting() throws Exception {
Bar newBar = addBar();
Bar existingBar = _persistence.fetchByPrimaryKey(newBar.getPrimaryKey());
Assert.assertEquals(existingBar, newBar);
}
use of com.liferay.blade.samples.servicebuilder.adq.model.Bar in project liferay-blade-samples by liferay.
the class BarPersistenceTest method testDynamicQueryByPrimaryKeyMissing.
@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Bar.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("barId", RandomTestUtil.nextLong()));
List<Bar> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(0, result.size());
}
Aggregations