Search in sources :

Example 26 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method testFetchByPrimaryKeyMissing.

@Test
public void testFetchByPrimaryKeyMissing() throws Exception {
    long pk = RandomTestUtil.nextLong();
    Baz missingBaz = _persistence.fetchByPrimaryKey(pk);
    Assert.assertNull(missingBaz);
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz) Test(org.junit.Test)

Example 27 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method testDynamicQueryByProjectionExisting.

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    Baz newBaz = addBaz();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Baz.class, _dynamicQueryClassLoader);
    dynamicQuery.setProjection(ProjectionFactoryUtil.property("bazId"));
    Object newBazId = newBaz.getBazId();
    dynamicQuery.add(RestrictionsFactoryUtil.in("bazId", new Object[] { newBazId }));
    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(1, result.size());
    Object existingBazId = result.get(0);
    Assert.assertEquals(existingBazId, newBazId);
}
Also used : DynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Baz(com.liferay.blade.workflow.basic.model.Baz) Test(org.junit.Test)

Example 28 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method testFetchByPrimaryKeyExisting.

@Test
public void testFetchByPrimaryKeyExisting() throws Exception {
    Baz newBaz = addBaz();
    Baz existingBaz = _persistence.fetchByPrimaryKey(newBaz.getPrimaryKey());
    Assert.assertEquals(existingBaz, newBaz);
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz) Test(org.junit.Test)

Example 29 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method testFindByPrimaryKeyExisting.

@Test
public void testFindByPrimaryKeyExisting() throws Exception {
    Baz newBaz = addBaz();
    Baz existingBaz = _persistence.findByPrimaryKey(newBaz.getPrimaryKey());
    Assert.assertEquals(existingBaz, newBaz);
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz) Test(org.junit.Test)

Example 30 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method addBaz.

protected Baz addBaz() throws Exception {
    long pk = RandomTestUtil.nextLong();
    Baz baz = _persistence.create(pk);
    baz.setUuid(RandomTestUtil.randomString());
    baz.setGroupId(RandomTestUtil.nextLong());
    baz.setCompanyId(RandomTestUtil.nextLong());
    baz.setUserId(RandomTestUtil.nextLong());
    baz.setUserName(RandomTestUtil.randomString());
    baz.setCreateDate(RandomTestUtil.nextDate());
    baz.setModifiedDate(RandomTestUtil.nextDate());
    baz.setStatus(RandomTestUtil.nextInt());
    baz.setStatusByUserId(RandomTestUtil.nextLong());
    baz.setStatusByUserName(RandomTestUtil.randomString());
    baz.setStatusDate(RandomTestUtil.nextDate());
    _bazs.add(_persistence.update(baz));
    return baz;
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz)

Aggregations

Baz (com.liferay.blade.workflow.basic.model.Baz)39 Test (org.junit.Test)14 StringBundler (com.liferay.petra.string.StringBundler)13 NoSuchBazException (com.liferay.blade.workflow.basic.exception.NoSuchBazException)12 Session (com.liferay.portal.kernel.dao.orm.Session)7 Query (com.liferay.portal.kernel.dao.orm.Query)6 ActionableDynamicQuery (com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery)5 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)5 BazImpl (com.liferay.blade.workflow.basic.model.impl.BazImpl)4 DynamicQuery (com.liferay.portal.kernel.dao.orm.DynamicQuery)4 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)3 Serializable (java.io.Serializable)3 HashSet (java.util.HashSet)3 User (com.liferay.portal.kernel.model.User)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Function (java.util.function.Function)2 ManifestSummary (com.liferay.exportimport.kernel.lar.ManifestSummary)1 StagedModelDataHandler (com.liferay.exportimport.kernel.lar.StagedModelDataHandler)1