Search in sources :

Example 21 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxPersistenceTest method testRemove.

@Test
public void testRemove() throws Exception {
    Qux newQux = addQux();
    _persistence.remove(newQux);
    Qux existingQux = _persistence.fetchByPrimaryKey(newQux.getPrimaryKey());
    Assert.assertNull(existingQux);
}
Also used : Qux(com.liferay.blade.workflow.asset.model.Qux) Test(org.junit.Test)

Example 22 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxPersistenceTest method testFindByPrimaryKeyExisting.

@Test
public void testFindByPrimaryKeyExisting() throws Exception {
    Qux newQux = addQux();
    Qux existingQux = _persistence.findByPrimaryKey(newQux.getPrimaryKey());
    Assert.assertEquals(existingQux, newQux);
}
Also used : Qux(com.liferay.blade.workflow.asset.model.Qux) Test(org.junit.Test)

Example 23 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxPersistenceTest method testDynamicQueryByProjectionExisting.

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    Qux newQux = addQux();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Qux.class, _dynamicQueryClassLoader);
    dynamicQuery.setProjection(ProjectionFactoryUtil.property("quxId"));
    Object newQuxId = newQux.getQuxId();
    dynamicQuery.add(RestrictionsFactoryUtil.in("quxId", new Object[] { newQuxId }));
    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(1, result.size());
    Object existingQuxId = result.get(0);
    Assert.assertEquals(existingQuxId, newQuxId);
}
Also used : Qux(com.liferay.blade.workflow.asset.model.Qux) DynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Test(org.junit.Test)

Example 24 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxPersistenceTest method addQux.

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

Example 25 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist.

@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist() throws Exception {
    Qux newQux = addQux();
    long pk = RandomTestUtil.nextLong();
    Set<Serializable> primaryKeys = new HashSet<Serializable>();
    primaryKeys.add(newQux.getPrimaryKey());
    primaryKeys.add(pk);
    Map<Serializable, Qux> quxs = _persistence.fetchByPrimaryKeys(primaryKeys);
    Assert.assertEquals(1, quxs.size());
    Assert.assertEquals(newQux, quxs.get(newQux.getPrimaryKey()));
}
Also used : Serializable(java.io.Serializable) Qux(com.liferay.blade.workflow.asset.model.Qux) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Qux (com.liferay.blade.workflow.asset.model.Qux)39 Test (org.junit.Test)14 StringBundler (com.liferay.petra.string.StringBundler)13 NoSuchQuxException (com.liferay.blade.workflow.asset.exception.NoSuchQuxException)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 QuxImpl (com.liferay.blade.workflow.asset.model.impl.QuxImpl)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