PageRenderTime 60ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/test/persistence-test/src/testIntegration/java/com/liferay/portlet/asset/service/persistence/test/AssetEntryPersistenceTest.java

http://github.com/liferay/liferay-portal
Java | 672 lines | 468 code | 188 blank | 16 comment | 1 complexity | 3261e9979f58dd6ff7fb8585b35dc39f MD5 | raw file
Possible License(s): LGPL-2.0
  1. /**
  2. * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. package com.liferay.portlet.asset.service.persistence.test;
  15. import com.liferay.arquillian.extension.junit.bridge.junit.Arquillian;
  16. import com.liferay.asset.kernel.exception.NoSuchEntryException;
  17. import com.liferay.asset.kernel.model.AssetEntry;
  18. import com.liferay.asset.kernel.service.AssetEntryLocalServiceUtil;
  19. import com.liferay.asset.kernel.service.persistence.AssetEntryPersistence;
  20. import com.liferay.asset.kernel.service.persistence.AssetEntryUtil;
  21. import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
  22. import com.liferay.portal.kernel.dao.orm.DynamicQuery;
  23. import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
  24. import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil;
  25. import com.liferay.portal.kernel.dao.orm.QueryUtil;
  26. import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil;
  27. import com.liferay.portal.kernel.test.AssertUtils;
  28. import com.liferay.portal.kernel.test.ReflectionTestUtil;
  29. import com.liferay.portal.kernel.test.rule.AggregateTestRule;
  30. import com.liferay.portal.kernel.test.util.RandomTestUtil;
  31. import com.liferay.portal.kernel.transaction.Propagation;
  32. import com.liferay.portal.kernel.util.IntegerWrapper;
  33. import com.liferay.portal.kernel.util.OrderByComparator;
  34. import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil;
  35. import com.liferay.portal.kernel.util.Time;
  36. import com.liferay.portal.test.rule.LiferayIntegrationTestRule;
  37. import com.liferay.portal.test.rule.PersistenceTestRule;
  38. import com.liferay.portal.test.rule.TransactionalTestRule;
  39. import java.io.Serializable;
  40. import java.util.ArrayList;
  41. import java.util.HashSet;
  42. import java.util.Iterator;
  43. import java.util.List;
  44. import java.util.Map;
  45. import java.util.Objects;
  46. import java.util.Set;
  47. import org.junit.After;
  48. import org.junit.Assert;
  49. import org.junit.Before;
  50. import org.junit.ClassRule;
  51. import org.junit.Rule;
  52. import org.junit.Test;
  53. import org.junit.runner.RunWith;
  54. /**
  55. * @generated
  56. */
  57. @RunWith(Arquillian.class)
  58. public class AssetEntryPersistenceTest {
  59. @ClassRule
  60. @Rule
  61. public static final AggregateTestRule aggregateTestRule =
  62. new AggregateTestRule(
  63. new LiferayIntegrationTestRule(), PersistenceTestRule.INSTANCE,
  64. new TransactionalTestRule(Propagation.REQUIRED));
  65. @Before
  66. public void setUp() {
  67. _persistence = AssetEntryUtil.getPersistence();
  68. Class<?> clazz = _persistence.getClass();
  69. _dynamicQueryClassLoader = clazz.getClassLoader();
  70. }
  71. @After
  72. public void tearDown() throws Exception {
  73. Iterator<AssetEntry> iterator = _assetEntries.iterator();
  74. while (iterator.hasNext()) {
  75. _persistence.remove(iterator.next());
  76. iterator.remove();
  77. }
  78. }
  79. @Test
  80. public void testCreate() throws Exception {
  81. long pk = RandomTestUtil.nextLong();
  82. AssetEntry assetEntry = _persistence.create(pk);
  83. Assert.assertNotNull(assetEntry);
  84. Assert.assertEquals(assetEntry.getPrimaryKey(), pk);
  85. }
  86. @Test
  87. public void testRemove() throws Exception {
  88. AssetEntry newAssetEntry = addAssetEntry();
  89. _persistence.remove(newAssetEntry);
  90. AssetEntry existingAssetEntry = _persistence.fetchByPrimaryKey(
  91. newAssetEntry.getPrimaryKey());
  92. Assert.assertNull(existingAssetEntry);
  93. }
  94. @Test
  95. public void testUpdateNew() throws Exception {
  96. addAssetEntry();
  97. }
  98. @Test
  99. public void testUpdateExisting() throws Exception {
  100. long pk = RandomTestUtil.nextLong();
  101. AssetEntry newAssetEntry = _persistence.create(pk);
  102. newAssetEntry.setMvccVersion(RandomTestUtil.nextLong());
  103. newAssetEntry.setCtCollectionId(RandomTestUtil.nextLong());
  104. newAssetEntry.setGroupId(RandomTestUtil.nextLong());
  105. newAssetEntry.setCompanyId(RandomTestUtil.nextLong());
  106. newAssetEntry.setUserId(RandomTestUtil.nextLong());
  107. newAssetEntry.setUserName(RandomTestUtil.randomString());
  108. newAssetEntry.setCreateDate(RandomTestUtil.nextDate());
  109. newAssetEntry.setModifiedDate(RandomTestUtil.nextDate());
  110. newAssetEntry.setClassNameId(RandomTestUtil.nextLong());
  111. newAssetEntry.setClassPK(RandomTestUtil.nextLong());
  112. newAssetEntry.setClassUuid(RandomTestUtil.randomString());
  113. newAssetEntry.setClassTypeId(RandomTestUtil.nextLong());
  114. newAssetEntry.setListable(RandomTestUtil.randomBoolean());
  115. newAssetEntry.setVisible(RandomTestUtil.randomBoolean());
  116. newAssetEntry.setStartDate(RandomTestUtil.nextDate());
  117. newAssetEntry.setEndDate(RandomTestUtil.nextDate());
  118. newAssetEntry.setPublishDate(RandomTestUtil.nextDate());
  119. newAssetEntry.setExpirationDate(RandomTestUtil.nextDate());
  120. newAssetEntry.setMimeType(RandomTestUtil.randomString());
  121. newAssetEntry.setTitle(RandomTestUtil.randomString());
  122. newAssetEntry.setDescription(RandomTestUtil.randomString());
  123. newAssetEntry.setSummary(RandomTestUtil.randomString());
  124. newAssetEntry.setUrl(RandomTestUtil.randomString());
  125. newAssetEntry.setLayoutUuid(RandomTestUtil.randomString());
  126. newAssetEntry.setHeight(RandomTestUtil.nextInt());
  127. newAssetEntry.setWidth(RandomTestUtil.nextInt());
  128. newAssetEntry.setPriority(RandomTestUtil.nextDouble());
  129. _assetEntries.add(_persistence.update(newAssetEntry));
  130. AssetEntry existingAssetEntry = _persistence.findByPrimaryKey(
  131. newAssetEntry.getPrimaryKey());
  132. Assert.assertEquals(
  133. existingAssetEntry.getMvccVersion(),
  134. newAssetEntry.getMvccVersion());
  135. Assert.assertEquals(
  136. existingAssetEntry.getCtCollectionId(),
  137. newAssetEntry.getCtCollectionId());
  138. Assert.assertEquals(
  139. existingAssetEntry.getEntryId(), newAssetEntry.getEntryId());
  140. Assert.assertEquals(
  141. existingAssetEntry.getGroupId(), newAssetEntry.getGroupId());
  142. Assert.assertEquals(
  143. existingAssetEntry.getCompanyId(), newAssetEntry.getCompanyId());
  144. Assert.assertEquals(
  145. existingAssetEntry.getUserId(), newAssetEntry.getUserId());
  146. Assert.assertEquals(
  147. existingAssetEntry.getUserName(), newAssetEntry.getUserName());
  148. Assert.assertEquals(
  149. Time.getShortTimestamp(existingAssetEntry.getCreateDate()),
  150. Time.getShortTimestamp(newAssetEntry.getCreateDate()));
  151. Assert.assertEquals(
  152. Time.getShortTimestamp(existingAssetEntry.getModifiedDate()),
  153. Time.getShortTimestamp(newAssetEntry.getModifiedDate()));
  154. Assert.assertEquals(
  155. existingAssetEntry.getClassNameId(),
  156. newAssetEntry.getClassNameId());
  157. Assert.assertEquals(
  158. existingAssetEntry.getClassPK(), newAssetEntry.getClassPK());
  159. Assert.assertEquals(
  160. existingAssetEntry.getClassUuid(), newAssetEntry.getClassUuid());
  161. Assert.assertEquals(
  162. existingAssetEntry.getClassTypeId(),
  163. newAssetEntry.getClassTypeId());
  164. Assert.assertEquals(
  165. existingAssetEntry.isListable(), newAssetEntry.isListable());
  166. Assert.assertEquals(
  167. existingAssetEntry.isVisible(), newAssetEntry.isVisible());
  168. Assert.assertEquals(
  169. Time.getShortTimestamp(existingAssetEntry.getStartDate()),
  170. Time.getShortTimestamp(newAssetEntry.getStartDate()));
  171. Assert.assertEquals(
  172. Time.getShortTimestamp(existingAssetEntry.getEndDate()),
  173. Time.getShortTimestamp(newAssetEntry.getEndDate()));
  174. Assert.assertEquals(
  175. Time.getShortTimestamp(existingAssetEntry.getPublishDate()),
  176. Time.getShortTimestamp(newAssetEntry.getPublishDate()));
  177. Assert.assertEquals(
  178. Time.getShortTimestamp(existingAssetEntry.getExpirationDate()),
  179. Time.getShortTimestamp(newAssetEntry.getExpirationDate()));
  180. Assert.assertEquals(
  181. existingAssetEntry.getMimeType(), newAssetEntry.getMimeType());
  182. Assert.assertEquals(
  183. existingAssetEntry.getTitle(), newAssetEntry.getTitle());
  184. Assert.assertEquals(
  185. existingAssetEntry.getDescription(),
  186. newAssetEntry.getDescription());
  187. Assert.assertEquals(
  188. existingAssetEntry.getSummary(), newAssetEntry.getSummary());
  189. Assert.assertEquals(
  190. existingAssetEntry.getUrl(), newAssetEntry.getUrl());
  191. Assert.assertEquals(
  192. existingAssetEntry.getLayoutUuid(), newAssetEntry.getLayoutUuid());
  193. Assert.assertEquals(
  194. existingAssetEntry.getHeight(), newAssetEntry.getHeight());
  195. Assert.assertEquals(
  196. existingAssetEntry.getWidth(), newAssetEntry.getWidth());
  197. AssertUtils.assertEquals(
  198. existingAssetEntry.getPriority(), newAssetEntry.getPriority());
  199. }
  200. @Test
  201. public void testCountByGroupId() throws Exception {
  202. _persistence.countByGroupId(RandomTestUtil.nextLong());
  203. _persistence.countByGroupId(0L);
  204. }
  205. @Test
  206. public void testCountByCompanyId() throws Exception {
  207. _persistence.countByCompanyId(RandomTestUtil.nextLong());
  208. _persistence.countByCompanyId(0L);
  209. }
  210. @Test
  211. public void testCountByVisible() throws Exception {
  212. _persistence.countByVisible(RandomTestUtil.randomBoolean());
  213. _persistence.countByVisible(RandomTestUtil.randomBoolean());
  214. }
  215. @Test
  216. public void testCountByPublishDate() throws Exception {
  217. _persistence.countByPublishDate(RandomTestUtil.nextDate());
  218. _persistence.countByPublishDate(RandomTestUtil.nextDate());
  219. }
  220. @Test
  221. public void testCountByExpirationDate() throws Exception {
  222. _persistence.countByExpirationDate(RandomTestUtil.nextDate());
  223. _persistence.countByExpirationDate(RandomTestUtil.nextDate());
  224. }
  225. @Test
  226. public void testCountByLayoutUuid() throws Exception {
  227. _persistence.countByLayoutUuid("");
  228. _persistence.countByLayoutUuid("null");
  229. _persistence.countByLayoutUuid((String)null);
  230. }
  231. @Test
  232. public void testCountByG_CU() throws Exception {
  233. _persistence.countByG_CU(RandomTestUtil.nextLong(), "");
  234. _persistence.countByG_CU(0L, "null");
  235. _persistence.countByG_CU(0L, (String)null);
  236. }
  237. @Test
  238. public void testCountByC_C() throws Exception {
  239. _persistence.countByC_C(
  240. RandomTestUtil.nextLong(), RandomTestUtil.nextLong());
  241. _persistence.countByC_C(0L, 0L);
  242. }
  243. @Test
  244. public void testCountByG_C_V() throws Exception {
  245. _persistence.countByG_C_V(
  246. RandomTestUtil.nextLong(), RandomTestUtil.nextLong(),
  247. RandomTestUtil.randomBoolean());
  248. _persistence.countByG_C_V(0L, 0L, RandomTestUtil.randomBoolean());
  249. }
  250. @Test
  251. public void testCountByG_C_P_E() throws Exception {
  252. _persistence.countByG_C_P_E(
  253. RandomTestUtil.nextLong(), RandomTestUtil.nextLong(),
  254. RandomTestUtil.nextDate(), RandomTestUtil.nextDate());
  255. _persistence.countByG_C_P_E(
  256. 0L, 0L, RandomTestUtil.nextDate(), RandomTestUtil.nextDate());
  257. }
  258. @Test
  259. public void testFindByPrimaryKeyExisting() throws Exception {
  260. AssetEntry newAssetEntry = addAssetEntry();
  261. AssetEntry existingAssetEntry = _persistence.findByPrimaryKey(
  262. newAssetEntry.getPrimaryKey());
  263. Assert.assertEquals(existingAssetEntry, newAssetEntry);
  264. }
  265. @Test(expected = NoSuchEntryException.class)
  266. public void testFindByPrimaryKeyMissing() throws Exception {
  267. long pk = RandomTestUtil.nextLong();
  268. _persistence.findByPrimaryKey(pk);
  269. }
  270. @Test
  271. public void testFindAll() throws Exception {
  272. _persistence.findAll(
  273. QueryUtil.ALL_POS, QueryUtil.ALL_POS, getOrderByComparator());
  274. }
  275. protected OrderByComparator<AssetEntry> getOrderByComparator() {
  276. return OrderByComparatorFactoryUtil.create(
  277. "AssetEntry", "mvccVersion", true, "ctCollectionId", true,
  278. "entryId", true, "groupId", true, "companyId", true, "userId", true,
  279. "userName", true, "createDate", true, "modifiedDate", true,
  280. "classNameId", true, "classPK", true, "classUuid", true,
  281. "classTypeId", true, "listable", true, "visible", true, "startDate",
  282. true, "endDate", true, "publishDate", true, "expirationDate", true,
  283. "mimeType", true, "title", true, "url", true, "layoutUuid", true,
  284. "height", true, "width", true, "priority", true);
  285. }
  286. @Test
  287. public void testFetchByPrimaryKeyExisting() throws Exception {
  288. AssetEntry newAssetEntry = addAssetEntry();
  289. AssetEntry existingAssetEntry = _persistence.fetchByPrimaryKey(
  290. newAssetEntry.getPrimaryKey());
  291. Assert.assertEquals(existingAssetEntry, newAssetEntry);
  292. }
  293. @Test
  294. public void testFetchByPrimaryKeyMissing() throws Exception {
  295. long pk = RandomTestUtil.nextLong();
  296. AssetEntry missingAssetEntry = _persistence.fetchByPrimaryKey(pk);
  297. Assert.assertNull(missingAssetEntry);
  298. }
  299. @Test
  300. public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist()
  301. throws Exception {
  302. AssetEntry newAssetEntry1 = addAssetEntry();
  303. AssetEntry newAssetEntry2 = addAssetEntry();
  304. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  305. primaryKeys.add(newAssetEntry1.getPrimaryKey());
  306. primaryKeys.add(newAssetEntry2.getPrimaryKey());
  307. Map<Serializable, AssetEntry> assetEntries =
  308. _persistence.fetchByPrimaryKeys(primaryKeys);
  309. Assert.assertEquals(2, assetEntries.size());
  310. Assert.assertEquals(
  311. newAssetEntry1, assetEntries.get(newAssetEntry1.getPrimaryKey()));
  312. Assert.assertEquals(
  313. newAssetEntry2, assetEntries.get(newAssetEntry2.getPrimaryKey()));
  314. }
  315. @Test
  316. public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereNoPrimaryKeysExist()
  317. throws Exception {
  318. long pk1 = RandomTestUtil.nextLong();
  319. long pk2 = RandomTestUtil.nextLong();
  320. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  321. primaryKeys.add(pk1);
  322. primaryKeys.add(pk2);
  323. Map<Serializable, AssetEntry> assetEntries =
  324. _persistence.fetchByPrimaryKeys(primaryKeys);
  325. Assert.assertTrue(assetEntries.isEmpty());
  326. }
  327. @Test
  328. public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist()
  329. throws Exception {
  330. AssetEntry newAssetEntry = addAssetEntry();
  331. long pk = RandomTestUtil.nextLong();
  332. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  333. primaryKeys.add(newAssetEntry.getPrimaryKey());
  334. primaryKeys.add(pk);
  335. Map<Serializable, AssetEntry> assetEntries =
  336. _persistence.fetchByPrimaryKeys(primaryKeys);
  337. Assert.assertEquals(1, assetEntries.size());
  338. Assert.assertEquals(
  339. newAssetEntry, assetEntries.get(newAssetEntry.getPrimaryKey()));
  340. }
  341. @Test
  342. public void testFetchByPrimaryKeysWithNoPrimaryKeys() throws Exception {
  343. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  344. Map<Serializable, AssetEntry> assetEntries =
  345. _persistence.fetchByPrimaryKeys(primaryKeys);
  346. Assert.assertTrue(assetEntries.isEmpty());
  347. }
  348. @Test
  349. public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
  350. AssetEntry newAssetEntry = addAssetEntry();
  351. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  352. primaryKeys.add(newAssetEntry.getPrimaryKey());
  353. Map<Serializable, AssetEntry> assetEntries =
  354. _persistence.fetchByPrimaryKeys(primaryKeys);
  355. Assert.assertEquals(1, assetEntries.size());
  356. Assert.assertEquals(
  357. newAssetEntry, assetEntries.get(newAssetEntry.getPrimaryKey()));
  358. }
  359. @Test
  360. public void testActionableDynamicQuery() throws Exception {
  361. final IntegerWrapper count = new IntegerWrapper();
  362. ActionableDynamicQuery actionableDynamicQuery =
  363. AssetEntryLocalServiceUtil.getActionableDynamicQuery();
  364. actionableDynamicQuery.setPerformActionMethod(
  365. new ActionableDynamicQuery.PerformActionMethod<AssetEntry>() {
  366. @Override
  367. public void performAction(AssetEntry assetEntry) {
  368. Assert.assertNotNull(assetEntry);
  369. count.increment();
  370. }
  371. });
  372. actionableDynamicQuery.performActions();
  373. Assert.assertEquals(count.getValue(), _persistence.countAll());
  374. }
  375. @Test
  376. public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
  377. AssetEntry newAssetEntry = addAssetEntry();
  378. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(
  379. AssetEntry.class, _dynamicQueryClassLoader);
  380. dynamicQuery.add(
  381. RestrictionsFactoryUtil.eq("entryId", newAssetEntry.getEntryId()));
  382. List<AssetEntry> result = _persistence.findWithDynamicQuery(
  383. dynamicQuery);
  384. Assert.assertEquals(1, result.size());
  385. AssetEntry existingAssetEntry = result.get(0);
  386. Assert.assertEquals(existingAssetEntry, newAssetEntry);
  387. }
  388. @Test
  389. public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
  390. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(
  391. AssetEntry.class, _dynamicQueryClassLoader);
  392. dynamicQuery.add(
  393. RestrictionsFactoryUtil.eq("entryId", RandomTestUtil.nextLong()));
  394. List<AssetEntry> result = _persistence.findWithDynamicQuery(
  395. dynamicQuery);
  396. Assert.assertEquals(0, result.size());
  397. }
  398. @Test
  399. public void testDynamicQueryByProjectionExisting() throws Exception {
  400. AssetEntry newAssetEntry = addAssetEntry();
  401. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(
  402. AssetEntry.class, _dynamicQueryClassLoader);
  403. dynamicQuery.setProjection(ProjectionFactoryUtil.property("entryId"));
  404. Object newEntryId = newAssetEntry.getEntryId();
  405. dynamicQuery.add(
  406. RestrictionsFactoryUtil.in("entryId", new Object[] {newEntryId}));
  407. List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
  408. Assert.assertEquals(1, result.size());
  409. Object existingEntryId = result.get(0);
  410. Assert.assertEquals(existingEntryId, newEntryId);
  411. }
  412. @Test
  413. public void testDynamicQueryByProjectionMissing() throws Exception {
  414. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(
  415. AssetEntry.class, _dynamicQueryClassLoader);
  416. dynamicQuery.setProjection(ProjectionFactoryUtil.property("entryId"));
  417. dynamicQuery.add(
  418. RestrictionsFactoryUtil.in(
  419. "entryId", new Object[] {RandomTestUtil.nextLong()}));
  420. List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
  421. Assert.assertEquals(0, result.size());
  422. }
  423. @Test
  424. public void testResetOriginalValues() throws Exception {
  425. AssetEntry newAssetEntry = addAssetEntry();
  426. _persistence.clearCache();
  427. AssetEntry existingAssetEntry = _persistence.findByPrimaryKey(
  428. newAssetEntry.getPrimaryKey());
  429. Assert.assertEquals(
  430. Long.valueOf(existingAssetEntry.getGroupId()),
  431. ReflectionTestUtil.<Long>invoke(
  432. existingAssetEntry, "getOriginalGroupId", new Class<?>[0]));
  433. Assert.assertTrue(
  434. Objects.equals(
  435. existingAssetEntry.getClassUuid(),
  436. ReflectionTestUtil.invoke(
  437. existingAssetEntry, "getOriginalClassUuid",
  438. new Class<?>[0])));
  439. Assert.assertEquals(
  440. Long.valueOf(existingAssetEntry.getClassNameId()),
  441. ReflectionTestUtil.<Long>invoke(
  442. existingAssetEntry, "getOriginalClassNameId", new Class<?>[0]));
  443. Assert.assertEquals(
  444. Long.valueOf(existingAssetEntry.getClassPK()),
  445. ReflectionTestUtil.<Long>invoke(
  446. existingAssetEntry, "getOriginalClassPK", new Class<?>[0]));
  447. }
  448. protected AssetEntry addAssetEntry() throws Exception {
  449. long pk = RandomTestUtil.nextLong();
  450. AssetEntry assetEntry = _persistence.create(pk);
  451. assetEntry.setMvccVersion(RandomTestUtil.nextLong());
  452. assetEntry.setCtCollectionId(RandomTestUtil.nextLong());
  453. assetEntry.setGroupId(RandomTestUtil.nextLong());
  454. assetEntry.setCompanyId(RandomTestUtil.nextLong());
  455. assetEntry.setUserId(RandomTestUtil.nextLong());
  456. assetEntry.setUserName(RandomTestUtil.randomString());
  457. assetEntry.setCreateDate(RandomTestUtil.nextDate());
  458. assetEntry.setModifiedDate(RandomTestUtil.nextDate());
  459. assetEntry.setClassNameId(RandomTestUtil.nextLong());
  460. assetEntry.setClassPK(RandomTestUtil.nextLong());
  461. assetEntry.setClassUuid(RandomTestUtil.randomString());
  462. assetEntry.setClassTypeId(RandomTestUtil.nextLong());
  463. assetEntry.setListable(RandomTestUtil.randomBoolean());
  464. assetEntry.setVisible(RandomTestUtil.randomBoolean());
  465. assetEntry.setStartDate(RandomTestUtil.nextDate());
  466. assetEntry.setEndDate(RandomTestUtil.nextDate());
  467. assetEntry.setPublishDate(RandomTestUtil.nextDate());
  468. assetEntry.setExpirationDate(RandomTestUtil.nextDate());
  469. assetEntry.setMimeType(RandomTestUtil.randomString());
  470. assetEntry.setTitle(RandomTestUtil.randomString());
  471. assetEntry.setDescription(RandomTestUtil.randomString());
  472. assetEntry.setSummary(RandomTestUtil.randomString());
  473. assetEntry.setUrl(RandomTestUtil.randomString());
  474. assetEntry.setLayoutUuid(RandomTestUtil.randomString());
  475. assetEntry.setHeight(RandomTestUtil.nextInt());
  476. assetEntry.setWidth(RandomTestUtil.nextInt());
  477. assetEntry.setPriority(RandomTestUtil.nextDouble());
  478. _assetEntries.add(_persistence.update(assetEntry));
  479. return assetEntry;
  480. }
  481. private List<AssetEntry> _assetEntries = new ArrayList<AssetEntry>();
  482. private AssetEntryPersistence _persistence;
  483. private ClassLoader _dynamicQueryClassLoader;
  484. }