Search in sources :

Example 1 with Baz

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

the class BazPersistenceTest method testActionableDynamicQuery.

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

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

Example 2 with Baz

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

the class BazPersistenceTest method testUpdateExisting.

@Test
public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();
    Baz newBaz = _persistence.create(pk);
    newBaz.setUuid(RandomTestUtil.randomString());
    newBaz.setGroupId(RandomTestUtil.nextLong());
    newBaz.setCompanyId(RandomTestUtil.nextLong());
    newBaz.setUserId(RandomTestUtil.nextLong());
    newBaz.setUserName(RandomTestUtil.randomString());
    newBaz.setCreateDate(RandomTestUtil.nextDate());
    newBaz.setModifiedDate(RandomTestUtil.nextDate());
    newBaz.setStatus(RandomTestUtil.nextInt());
    newBaz.setStatusByUserId(RandomTestUtil.nextLong());
    newBaz.setStatusByUserName(RandomTestUtil.randomString());
    newBaz.setStatusDate(RandomTestUtil.nextDate());
    _bazs.add(_persistence.update(newBaz));
    Baz existingBaz = _persistence.findByPrimaryKey(newBaz.getPrimaryKey());
    Assert.assertEquals(existingBaz.getUuid(), newBaz.getUuid());
    Assert.assertEquals(existingBaz.getBazId(), newBaz.getBazId());
    Assert.assertEquals(existingBaz.getGroupId(), newBaz.getGroupId());
    Assert.assertEquals(existingBaz.getCompanyId(), newBaz.getCompanyId());
    Assert.assertEquals(existingBaz.getUserId(), newBaz.getUserId());
    Assert.assertEquals(existingBaz.getUserName(), newBaz.getUserName());
    Assert.assertEquals(Time.getShortTimestamp(existingBaz.getCreateDate()), Time.getShortTimestamp(newBaz.getCreateDate()));
    Assert.assertEquals(Time.getShortTimestamp(existingBaz.getModifiedDate()), Time.getShortTimestamp(newBaz.getModifiedDate()));
    Assert.assertEquals(existingBaz.getStatus(), newBaz.getStatus());
    Assert.assertEquals(existingBaz.getStatusByUserId(), newBaz.getStatusByUserId());
    Assert.assertEquals(existingBaz.getStatusByUserName(), newBaz.getStatusByUserName());
    Assert.assertEquals(Time.getShortTimestamp(existingBaz.getStatusDate()), Time.getShortTimestamp(newBaz.getStatusDate()));
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz) Test(org.junit.Test)

Example 3 with Baz

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

the class BazPersistenceTest method testRemove.

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

Example 4 with Baz

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

the class BazPersistenceTest method testResetOriginalValues.

@Test
public void testResetOriginalValues() throws Exception {
    Baz newBaz = addBaz();
    _persistence.clearCache();
    Baz existingBaz = _persistence.findByPrimaryKey(newBaz.getPrimaryKey());
    Assert.assertTrue(Objects.equals(existingBaz.getUuid(), ReflectionTestUtil.invoke(existingBaz, "getOriginalUuid", new Class<?>[0])));
    Assert.assertEquals(Long.valueOf(existingBaz.getGroupId()), ReflectionTestUtil.<Long>invoke(existingBaz, "getOriginalGroupId", new Class<?>[0]));
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz) Test(org.junit.Test)

Example 5 with Baz

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

the class BazPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist.

@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist() throws Exception {
    Baz newBaz1 = addBaz();
    Baz newBaz2 = addBaz();
    Set<Serializable> primaryKeys = new HashSet<Serializable>();
    primaryKeys.add(newBaz1.getPrimaryKey());
    primaryKeys.add(newBaz2.getPrimaryKey());
    Map<Serializable, Baz> bazs = _persistence.fetchByPrimaryKeys(primaryKeys);
    Assert.assertEquals(2, bazs.size());
    Assert.assertEquals(newBaz1, bazs.get(newBaz1.getPrimaryKey()));
    Assert.assertEquals(newBaz2, bazs.get(newBaz2.getPrimaryKey()));
}
Also used : Serializable(java.io.Serializable) Baz(com.liferay.blade.workflow.basic.model.Baz) HashSet(java.util.HashSet) Test(org.junit.Test)

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