Search in sources :

Example 16 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method addRegion.

protected Region addRegion() throws Exception {
    long pk = RandomTestUtil.nextLong();
    Region region = _persistence.create(pk);
    region.setRegionName(RandomTestUtil.randomString());
    _regions.add(_persistence.update(region));
    return region;
}
Also used : Region(com.liferay.blade.samples.jndiservicebuilder.model.Region)

Example 17 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method testFetchByPrimaryKeyExisting.

@Test
public void testFetchByPrimaryKeyExisting() throws Exception {
    Region newRegion = addRegion();
    Region existingRegion = _persistence.fetchByPrimaryKey(newRegion.getPrimaryKey());
    Assert.assertEquals(existingRegion, newRegion);
}
Also used : Region(com.liferay.blade.samples.jndiservicebuilder.model.Region) Test(org.junit.Test)

Example 18 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method testFindByPrimaryKeyExisting.

@Test
public void testFindByPrimaryKeyExisting() throws Exception {
    Region newRegion = addRegion();
    Region existingRegion = _persistence.findByPrimaryKey(newRegion.getPrimaryKey());
    Assert.assertEquals(existingRegion, newRegion);
}
Also used : Region(com.liferay.blade.samples.jndiservicebuilder.model.Region) Test(org.junit.Test)

Example 19 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method testCreate.

@Test
public void testCreate() throws Exception {
    long pk = RandomTestUtil.nextLong();
    Region region = _persistence.create(pk);
    Assert.assertNotNull(region);
    Assert.assertEquals(region.getPrimaryKey(), pk);
}
Also used : Region(com.liferay.blade.samples.jndiservicebuilder.model.Region) Test(org.junit.Test)

Example 20 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method testFetchByPrimaryKeysWithOnePrimaryKey.

@Test
public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
    Region newRegion = addRegion();
    Set<Serializable> primaryKeys = new HashSet<Serializable>();
    primaryKeys.add(newRegion.getPrimaryKey());
    Map<Serializable, Region> regions = _persistence.fetchByPrimaryKeys(primaryKeys);
    Assert.assertEquals(1, regions.size());
    Assert.assertEquals(newRegion, regions.get(newRegion.getPrimaryKey()));
}
Also used : Serializable(java.io.Serializable) Region(com.liferay.blade.samples.jndiservicebuilder.model.Region) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Region (com.liferay.blade.samples.jndiservicebuilder.model.Region)23 Test (org.junit.Test)13 Serializable (java.io.Serializable)5 NoSuchRegionException (com.liferay.blade.samples.jndiservicebuilder.exception.NoSuchRegionException)4 ActionableDynamicQuery (com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery)4 Session (com.liferay.portal.kernel.dao.orm.Session)4 RegionImpl (com.liferay.blade.samples.jndiservicebuilder.model.impl.RegionImpl)3 StringBundler (com.liferay.petra.string.StringBundler)3 DynamicQuery (com.liferay.portal.kernel.dao.orm.DynamicQuery)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Query (com.liferay.portal.kernel.dao.orm.Query)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Function (java.util.function.Function)2 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)1 IntegerWrapper (com.liferay.portal.kernel.util.IntegerWrapper)1 StringBundler (com.liferay.portal.kernel.util.StringBundler)1 List (java.util.List)1