Search in sources :

Example 6 with Qux

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

the class QuxPersistenceTest method testActionableDynamicQuery.

@Test
public void testActionableDynamicQuery() throws Exception {
    final IntegerWrapper count = new IntegerWrapper();
    ActionableDynamicQuery actionableDynamicQuery = QuxLocalServiceUtil.getActionableDynamicQuery();
    actionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Qux>() {

        @Override
        public void performAction(Qux qux) {
            Assert.assertNotNull(qux);
            count.increment();
        }
    });
    actionableDynamicQuery.performActions();
    Assert.assertEquals(count.getValue(), _persistence.countAll());
}
Also used : Qux(com.liferay.blade.workflow.asset.model.Qux) IntegerWrapper(com.liferay.portal.kernel.util.IntegerWrapper) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Test(org.junit.Test)

Example 7 with Qux

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

the class QuxPersistenceTest method testFetchByPrimaryKeyMissing.

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

Example 8 with Qux

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

the class QuxPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist.

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

Example 9 with Qux

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

the class QuxPersistenceTest method testDynamicQueryByPrimaryKeyExisting.

@Test
public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    Qux newQux = addQux();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Qux.class, _dynamicQueryClassLoader);
    dynamicQuery.add(RestrictionsFactoryUtil.eq("quxId", newQux.getQuxId()));
    List<Qux> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(1, result.size());
    Qux existingQux = result.get(0);
    Assert.assertEquals(existingQux, newQux);
}
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 10 with Qux

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

the class QuxPersistenceTest method testCreate.

@Test
public void testCreate() throws Exception {
    long pk = RandomTestUtil.nextLong();
    Qux qux = _persistence.create(pk);
    Assert.assertNotNull(qux);
    Assert.assertEquals(qux.getPrimaryKey(), pk);
}
Also used : Qux(com.liferay.blade.workflow.asset.model.Qux) 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