List of usage examples for com.liferay.portal.kernel.test.util RandomTestUtil randomBoolean
public static boolean randomBoolean()
From source file:blade.servicebuilder.service.persistence.test.FooPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); Foo newFoo = _persistence.create(pk); newFoo.setUuid(RandomTestUtil.randomString()); newFoo.setGroupId(RandomTestUtil.nextLong()); newFoo.setCompanyId(RandomTestUtil.nextLong()); newFoo.setUserId(RandomTestUtil.nextLong()); newFoo.setUserName(RandomTestUtil.randomString()); newFoo.setCreateDate(RandomTestUtil.nextDate()); newFoo.setModifiedDate(RandomTestUtil.nextDate()); newFoo.setField1(RandomTestUtil.randomString()); newFoo.setField2(RandomTestUtil.randomBoolean()); newFoo.setField3(RandomTestUtil.nextInt()); newFoo.setField4(RandomTestUtil.nextDate()); newFoo.setField5(RandomTestUtil.randomString()); _foos.add(_persistence.update(newFoo)); Foo existingFoo = _persistence.findByPrimaryKey(newFoo.getPrimaryKey()); Assert.assertEquals(existingFoo.getUuid(), newFoo.getUuid()); Assert.assertEquals(existingFoo.getFooId(), newFoo.getFooId()); Assert.assertEquals(existingFoo.getGroupId(), newFoo.getGroupId()); Assert.assertEquals(existingFoo.getCompanyId(), newFoo.getCompanyId()); Assert.assertEquals(existingFoo.getUserId(), newFoo.getUserId()); Assert.assertEquals(existingFoo.getUserName(), newFoo.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingFoo.getCreateDate()), Time.getShortTimestamp(newFoo.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingFoo.getModifiedDate()), Time.getShortTimestamp(newFoo.getModifiedDate())); Assert.assertEquals(existingFoo.getField1(), newFoo.getField1()); Assert.assertEquals(existingFoo.getField2(), newFoo.getField2()); Assert.assertEquals(existingFoo.getField3(), newFoo.getField3()); Assert.assertEquals(Time.getShortTimestamp(existingFoo.getField4()), Time.getShortTimestamp(newFoo.getField4())); Assert.assertEquals(existingFoo.getField5(), newFoo.getField5()); }
From source file:blade.servicebuilder.service.persistence.test.FooPersistenceTest.java
License:Open Source License
@Test public void testCountByField2() throws Exception { _persistence.countByField2(RandomTestUtil.randomBoolean()); _persistence.countByField2(RandomTestUtil.randomBoolean()); }
From source file:blade.servicebuilder.service.persistence.test.FooPersistenceTest.java
License:Open Source License
protected Foo addFoo() throws Exception { long pk = RandomTestUtil.nextLong(); Foo foo = _persistence.create(pk);//from ww w . j a v a 2 s .c om foo.setUuid(RandomTestUtil.randomString()); foo.setGroupId(RandomTestUtil.nextLong()); foo.setCompanyId(RandomTestUtil.nextLong()); foo.setUserId(RandomTestUtil.nextLong()); foo.setUserName(RandomTestUtil.randomString()); foo.setCreateDate(RandomTestUtil.nextDate()); foo.setModifiedDate(RandomTestUtil.nextDate()); foo.setField1(RandomTestUtil.randomString()); foo.setField2(RandomTestUtil.randomBoolean()); foo.setField3(RandomTestUtil.nextInt()); foo.setField4(RandomTestUtil.nextDate()); foo.setField5(RandomTestUtil.randomString()); _foos.add(_persistence.update(foo)); return foo; }
From source file:com.liferay.asset.display.template.service.persistence.test.AssetDisplayTemplatePersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); AssetDisplayTemplate newAssetDisplayTemplate = _persistence.create(pk); newAssetDisplayTemplate.setGroupId(RandomTestUtil.nextLong()); newAssetDisplayTemplate.setCompanyId(RandomTestUtil.nextLong()); newAssetDisplayTemplate.setUserId(RandomTestUtil.nextLong()); newAssetDisplayTemplate.setUserName(RandomTestUtil.randomString()); newAssetDisplayTemplate.setCreateDate(RandomTestUtil.nextDate()); newAssetDisplayTemplate.setModifiedDate(RandomTestUtil.nextDate()); newAssetDisplayTemplate.setName(RandomTestUtil.randomString()); newAssetDisplayTemplate.setClassNameId(RandomTestUtil.nextLong()); newAssetDisplayTemplate.setDDMTemplateId(RandomTestUtil.nextLong()); newAssetDisplayTemplate.setMain(RandomTestUtil.randomBoolean()); _assetDisplayTemplates.add(_persistence.update(newAssetDisplayTemplate)); AssetDisplayTemplate existingAssetDisplayTemplate = _persistence .findByPrimaryKey(newAssetDisplayTemplate.getPrimaryKey()); Assert.assertEquals(existingAssetDisplayTemplate.getAssetDisplayTemplateId(), newAssetDisplayTemplate.getAssetDisplayTemplateId()); Assert.assertEquals(existingAssetDisplayTemplate.getGroupId(), newAssetDisplayTemplate.getGroupId()); Assert.assertEquals(existingAssetDisplayTemplate.getCompanyId(), newAssetDisplayTemplate.getCompanyId()); Assert.assertEquals(existingAssetDisplayTemplate.getUserId(), newAssetDisplayTemplate.getUserId()); Assert.assertEquals(existingAssetDisplayTemplate.getUserName(), newAssetDisplayTemplate.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingAssetDisplayTemplate.getCreateDate()), Time.getShortTimestamp(newAssetDisplayTemplate.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingAssetDisplayTemplate.getModifiedDate()), Time.getShortTimestamp(newAssetDisplayTemplate.getModifiedDate())); Assert.assertEquals(existingAssetDisplayTemplate.getName(), newAssetDisplayTemplate.getName()); Assert.assertEquals(existingAssetDisplayTemplate.getClassNameId(), newAssetDisplayTemplate.getClassNameId()); Assert.assertEquals(existingAssetDisplayTemplate.getDDMTemplateId(), newAssetDisplayTemplate.getDDMTemplateId()); Assert.assertEquals(existingAssetDisplayTemplate.getMain(), newAssetDisplayTemplate.getMain()); }
From source file:com.liferay.asset.display.template.service.persistence.test.AssetDisplayTemplatePersistenceTest.java
License:Open Source License
protected AssetDisplayTemplate addAssetDisplayTemplate() throws Exception { long pk = RandomTestUtil.nextLong(); AssetDisplayTemplate assetDisplayTemplate = _persistence.create(pk); assetDisplayTemplate.setGroupId(RandomTestUtil.nextLong()); assetDisplayTemplate.setCompanyId(RandomTestUtil.nextLong()); assetDisplayTemplate.setUserId(RandomTestUtil.nextLong()); assetDisplayTemplate.setUserName(RandomTestUtil.randomString()); assetDisplayTemplate.setCreateDate(RandomTestUtil.nextDate()); assetDisplayTemplate.setModifiedDate(RandomTestUtil.nextDate()); assetDisplayTemplate.setName(RandomTestUtil.randomString()); assetDisplayTemplate.setClassNameId(RandomTestUtil.nextLong()); assetDisplayTemplate.setDDMTemplateId(RandomTestUtil.nextLong()); assetDisplayTemplate.setMain(RandomTestUtil.randomBoolean()); _assetDisplayTemplates.add(_persistence.update(assetDisplayTemplate)); return assetDisplayTemplate; }
From source file:com.liferay.blade.samples.servicebuilder.adq.service.persistence.test.BarPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); Bar newBar = _persistence.create(pk); newBar.setUuid(RandomTestUtil.randomString()); newBar.setGroupId(RandomTestUtil.nextLong()); newBar.setCompanyId(RandomTestUtil.nextLong()); newBar.setUserId(RandomTestUtil.nextLong()); newBar.setUserName(RandomTestUtil.randomString()); newBar.setCreateDate(RandomTestUtil.nextDate()); newBar.setModifiedDate(RandomTestUtil.nextDate()); newBar.setField1(RandomTestUtil.randomString()); newBar.setField2(RandomTestUtil.randomBoolean()); newBar.setField3(RandomTestUtil.nextInt()); newBar.setField4(RandomTestUtil.nextDate()); newBar.setField5(RandomTestUtil.randomString()); _bars.add(_persistence.update(newBar)); Bar existingBar = _persistence.findByPrimaryKey(newBar.getPrimaryKey()); Assert.assertEquals(existingBar.getUuid(), newBar.getUuid()); Assert.assertEquals(existingBar.getBarId(), newBar.getBarId()); Assert.assertEquals(existingBar.getGroupId(), newBar.getGroupId()); Assert.assertEquals(existingBar.getCompanyId(), newBar.getCompanyId()); Assert.assertEquals(existingBar.getUserId(), newBar.getUserId()); Assert.assertEquals(existingBar.getUserName(), newBar.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingBar.getCreateDate()), Time.getShortTimestamp(newBar.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingBar.getModifiedDate()), Time.getShortTimestamp(newBar.getModifiedDate())); Assert.assertEquals(existingBar.getField1(), newBar.getField1()); Assert.assertEquals(existingBar.getField2(), newBar.getField2()); Assert.assertEquals(existingBar.getField3(), newBar.getField3()); Assert.assertEquals(Time.getShortTimestamp(existingBar.getField4()), Time.getShortTimestamp(newBar.getField4())); Assert.assertEquals(existingBar.getField5(), newBar.getField5()); }
From source file:com.liferay.blade.samples.servicebuilder.adq.service.persistence.test.BarPersistenceTest.java
License:Open Source License
protected Bar addBar() throws Exception { long pk = RandomTestUtil.nextLong(); Bar bar = _persistence.create(pk);//from www .j a v a2 s .co m bar.setUuid(RandomTestUtil.randomString()); bar.setGroupId(RandomTestUtil.nextLong()); bar.setCompanyId(RandomTestUtil.nextLong()); bar.setUserId(RandomTestUtil.nextLong()); bar.setUserName(RandomTestUtil.randomString()); bar.setCreateDate(RandomTestUtil.nextDate()); bar.setModifiedDate(RandomTestUtil.nextDate()); bar.setField1(RandomTestUtil.randomString()); bar.setField2(RandomTestUtil.randomBoolean()); bar.setField3(RandomTestUtil.nextInt()); bar.setField4(RandomTestUtil.nextDate()); bar.setField5(RandomTestUtil.randomString()); _bars.add(_persistence.update(bar)); return bar; }
From source file:com.liferay.blade.samples.servicebuilder.service.persistence.test.BarPersistenceTest.java
License:Apache License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); Bar newBar = _persistence.create(pk); newBar.setUuid(RandomTestUtil.randomString()); newBar.setGroupId(RandomTestUtil.nextLong()); newBar.setCompanyId(RandomTestUtil.nextLong()); newBar.setUserId(RandomTestUtil.nextLong()); newBar.setUserName(RandomTestUtil.randomString()); newBar.setCreateDate(RandomTestUtil.nextDate()); newBar.setModifiedDate(RandomTestUtil.nextDate()); newBar.setField1(RandomTestUtil.randomString()); newBar.setField2(RandomTestUtil.randomBoolean()); newBar.setField3(RandomTestUtil.nextInt()); newBar.setField4(RandomTestUtil.nextDate()); newBar.setField5(RandomTestUtil.randomString()); _bars.add(_persistence.update(newBar)); Bar existingBar = _persistence.findByPrimaryKey(newBar.getPrimaryKey()); Assert.assertEquals(existingBar.getUuid(), newBar.getUuid()); Assert.assertEquals(existingBar.getBarId(), newBar.getBarId()); Assert.assertEquals(existingBar.getGroupId(), newBar.getGroupId()); Assert.assertEquals(existingBar.getCompanyId(), newBar.getCompanyId()); Assert.assertEquals(existingBar.getUserId(), newBar.getUserId()); Assert.assertEquals(existingBar.getUserName(), newBar.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingBar.getCreateDate()), Time.getShortTimestamp(newBar.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingBar.getModifiedDate()), Time.getShortTimestamp(newBar.getModifiedDate())); Assert.assertEquals(existingBar.getField1(), newBar.getField1()); Assert.assertEquals(existingBar.isField2(), newBar.isField2()); Assert.assertEquals(existingBar.getField3(), newBar.getField3()); Assert.assertEquals(Time.getShortTimestamp(existingBar.getField4()), Time.getShortTimestamp(newBar.getField4())); Assert.assertEquals(existingBar.getField5(), newBar.getField5()); }
From source file:com.liferay.blogs.service.persistence.test.BlogsEntryPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); BlogsEntry newBlogsEntry = _persistence.create(pk); newBlogsEntry.setUuid(RandomTestUtil.randomString()); newBlogsEntry.setGroupId(RandomTestUtil.nextLong()); newBlogsEntry.setCompanyId(RandomTestUtil.nextLong()); newBlogsEntry.setUserId(RandomTestUtil.nextLong()); newBlogsEntry.setUserName(RandomTestUtil.randomString()); newBlogsEntry.setCreateDate(RandomTestUtil.nextDate()); newBlogsEntry.setModifiedDate(RandomTestUtil.nextDate()); newBlogsEntry.setTitle(RandomTestUtil.randomString()); newBlogsEntry.setSubtitle(RandomTestUtil.randomString()); newBlogsEntry.setUrlTitle(RandomTestUtil.randomString()); newBlogsEntry.setDescription(RandomTestUtil.randomString()); newBlogsEntry.setContent(RandomTestUtil.randomString()); newBlogsEntry.setDisplayDate(RandomTestUtil.nextDate()); newBlogsEntry.setAllowPingbacks(RandomTestUtil.randomBoolean()); newBlogsEntry.setAllowTrackbacks(RandomTestUtil.randomBoolean()); newBlogsEntry.setTrackbacks(RandomTestUtil.randomString()); newBlogsEntry.setCoverImageCaption(RandomTestUtil.randomString()); newBlogsEntry.setCoverImageFileEntryId(RandomTestUtil.nextLong()); newBlogsEntry.setCoverImageURL(RandomTestUtil.randomString()); newBlogsEntry.setSmallImage(RandomTestUtil.randomBoolean()); newBlogsEntry.setSmallImageFileEntryId(RandomTestUtil.nextLong()); newBlogsEntry.setSmallImageId(RandomTestUtil.nextLong()); newBlogsEntry.setSmallImageURL(RandomTestUtil.randomString()); newBlogsEntry.setLastPublishDate(RandomTestUtil.nextDate()); newBlogsEntry.setStatus(RandomTestUtil.nextInt()); newBlogsEntry.setStatusByUserId(RandomTestUtil.nextLong()); newBlogsEntry.setStatusByUserName(RandomTestUtil.randomString()); newBlogsEntry.setStatusDate(RandomTestUtil.nextDate()); _blogsEntries.add(_persistence.update(newBlogsEntry)); BlogsEntry existingBlogsEntry = _persistence.findByPrimaryKey(newBlogsEntry.getPrimaryKey()); Assert.assertEquals(existingBlogsEntry.getUuid(), newBlogsEntry.getUuid()); Assert.assertEquals(existingBlogsEntry.getEntryId(), newBlogsEntry.getEntryId()); Assert.assertEquals(existingBlogsEntry.getGroupId(), newBlogsEntry.getGroupId()); Assert.assertEquals(existingBlogsEntry.getCompanyId(), newBlogsEntry.getCompanyId()); Assert.assertEquals(existingBlogsEntry.getUserId(), newBlogsEntry.getUserId()); Assert.assertEquals(existingBlogsEntry.getUserName(), newBlogsEntry.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingBlogsEntry.getCreateDate()), Time.getShortTimestamp(newBlogsEntry.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingBlogsEntry.getModifiedDate()), Time.getShortTimestamp(newBlogsEntry.getModifiedDate())); Assert.assertEquals(existingBlogsEntry.getTitle(), newBlogsEntry.getTitle()); Assert.assertEquals(existingBlogsEntry.getSubtitle(), newBlogsEntry.getSubtitle()); Assert.assertEquals(existingBlogsEntry.getUrlTitle(), newBlogsEntry.getUrlTitle()); Assert.assertEquals(existingBlogsEntry.getDescription(), newBlogsEntry.getDescription()); Assert.assertEquals(existingBlogsEntry.getContent(), newBlogsEntry.getContent()); Assert.assertEquals(Time.getShortTimestamp(existingBlogsEntry.getDisplayDate()), Time.getShortTimestamp(newBlogsEntry.getDisplayDate())); Assert.assertEquals(existingBlogsEntry.getAllowPingbacks(), newBlogsEntry.getAllowPingbacks()); Assert.assertEquals(existingBlogsEntry.getAllowTrackbacks(), newBlogsEntry.getAllowTrackbacks()); Assert.assertEquals(existingBlogsEntry.getTrackbacks(), newBlogsEntry.getTrackbacks()); Assert.assertEquals(existingBlogsEntry.getCoverImageCaption(), newBlogsEntry.getCoverImageCaption()); Assert.assertEquals(existingBlogsEntry.getCoverImageFileEntryId(), newBlogsEntry.getCoverImageFileEntryId()); Assert.assertEquals(existingBlogsEntry.getCoverImageURL(), newBlogsEntry.getCoverImageURL()); Assert.assertEquals(existingBlogsEntry.getSmallImage(), newBlogsEntry.getSmallImage()); Assert.assertEquals(existingBlogsEntry.getSmallImageFileEntryId(), newBlogsEntry.getSmallImageFileEntryId()); Assert.assertEquals(existingBlogsEntry.getSmallImageId(), newBlogsEntry.getSmallImageId()); Assert.assertEquals(existingBlogsEntry.getSmallImageURL(), newBlogsEntry.getSmallImageURL()); Assert.assertEquals(Time.getShortTimestamp(existingBlogsEntry.getLastPublishDate()), Time.getShortTimestamp(newBlogsEntry.getLastPublishDate())); Assert.assertEquals(existingBlogsEntry.getStatus(), newBlogsEntry.getStatus()); Assert.assertEquals(existingBlogsEntry.getStatusByUserId(), newBlogsEntry.getStatusByUserId()); Assert.assertEquals(existingBlogsEntry.getStatusByUserName(), newBlogsEntry.getStatusByUserName()); Assert.assertEquals(Time.getShortTimestamp(existingBlogsEntry.getStatusDate()), Time.getShortTimestamp(newBlogsEntry.getStatusDate())); }
From source file:com.liferay.blogs.service.persistence.test.BlogsEntryPersistenceTest.java
License:Open Source License
protected BlogsEntry addBlogsEntry() throws Exception { long pk = RandomTestUtil.nextLong(); BlogsEntry blogsEntry = _persistence.create(pk); blogsEntry.setUuid(RandomTestUtil.randomString()); blogsEntry.setGroupId(RandomTestUtil.nextLong()); blogsEntry.setCompanyId(RandomTestUtil.nextLong()); blogsEntry.setUserId(RandomTestUtil.nextLong()); blogsEntry.setUserName(RandomTestUtil.randomString()); blogsEntry.setCreateDate(RandomTestUtil.nextDate()); blogsEntry.setModifiedDate(RandomTestUtil.nextDate()); blogsEntry.setTitle(RandomTestUtil.randomString()); blogsEntry.setSubtitle(RandomTestUtil.randomString()); blogsEntry.setUrlTitle(RandomTestUtil.randomString()); blogsEntry.setDescription(RandomTestUtil.randomString()); blogsEntry.setContent(RandomTestUtil.randomString()); blogsEntry.setDisplayDate(RandomTestUtil.nextDate()); blogsEntry.setAllowPingbacks(RandomTestUtil.randomBoolean()); blogsEntry.setAllowTrackbacks(RandomTestUtil.randomBoolean()); blogsEntry.setTrackbacks(RandomTestUtil.randomString()); blogsEntry.setCoverImageCaption(RandomTestUtil.randomString()); blogsEntry.setCoverImageFileEntryId(RandomTestUtil.nextLong()); blogsEntry.setCoverImageURL(RandomTestUtil.randomString()); blogsEntry.setSmallImage(RandomTestUtil.randomBoolean()); blogsEntry.setSmallImageFileEntryId(RandomTestUtil.nextLong()); blogsEntry.setSmallImageId(RandomTestUtil.nextLong()); blogsEntry.setSmallImageURL(RandomTestUtil.randomString()); blogsEntry.setLastPublishDate(RandomTestUtil.nextDate()); blogsEntry.setStatus(RandomTestUtil.nextInt()); blogsEntry.setStatusByUserId(RandomTestUtil.nextLong()); blogsEntry.setStatusByUserName(RandomTestUtil.randomString()); blogsEntry.setStatusDate(RandomTestUtil.nextDate()); _blogsEntries.add(_persistence.update(blogsEntry)); return blogsEntry; }