use of com.liferay.blade.samples.servicebuilder.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testCreate.
@Test
public void testCreate() throws Exception {
long pk = RandomTestUtil.nextLong();
Foo foo = _persistence.create(pk);
Assert.assertNotNull(foo);
Assert.assertEquals(foo.getPrimaryKey(), pk);
}
use of com.liferay.blade.samples.servicebuilder.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testFindByPrimaryKeyExisting.
@Test
public void testFindByPrimaryKeyExisting() throws Exception {
Foo newFoo = addFoo();
Foo existingFoo = _persistence.findByPrimaryKey(newFoo.getPrimaryKey());
Assert.assertEquals(existingFoo, newFoo);
}
use of com.liferay.blade.samples.servicebuilder.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist() throws Exception {
Foo newFoo = addFoo();
long pk = RandomTestUtil.nextLong();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newFoo.getPrimaryKey());
primaryKeys.add(pk);
Map<Serializable, Foo> foos = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(1, foos.size());
Assert.assertEquals(newFoo, foos.get(newFoo.getPrimaryKey()));
}
use of com.liferay.blade.samples.servicebuilder.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testDynamicQueryByPrimaryKeyExisting.
@Test
public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
Foo newFoo = addFoo();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Foo.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("fooId", newFoo.getFooId()));
List<Foo> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Foo existingFoo = result.get(0);
Assert.assertEquals(existingFoo, newFoo);
}
use of com.liferay.blade.samples.servicebuilder.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testFetchByPrimaryKeysWithOnePrimaryKey.
@Test
public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
Foo newFoo = addFoo();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newFoo.getPrimaryKey());
Map<Serializable, Foo> foos = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(1, foos.size());
Assert.assertEquals(newFoo, foos.get(newFoo.getPrimaryKey()));
}
Aggregations