PageRenderTime 28ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/test/persistence-test/src/testIntegration/java/com/liferay/portal/service/persistence/test/LayoutFriendlyURLPersistenceTest.java

http://github.com/liferay/liferay-portal
Java | 655 lines | 470 code | 169 blank | 16 comment | 1 complexity | 4e10c8f416d5da0d5fbe01f2cf6c9c62 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.portal.service.persistence.test;
  15. import com.liferay.arquillian.extension.junit.bridge.junit.Arquillian;
  16. import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
  17. import com.liferay.portal.kernel.dao.orm.DynamicQuery;
  18. import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
  19. import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil;
  20. import com.liferay.portal.kernel.dao.orm.QueryUtil;
  21. import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil;
  22. import com.liferay.portal.kernel.exception.NoSuchLayoutFriendlyURLException;
  23. import com.liferay.portal.kernel.model.LayoutFriendlyURL;
  24. import com.liferay.portal.kernel.service.LayoutFriendlyURLLocalServiceUtil;
  25. import com.liferay.portal.kernel.service.persistence.LayoutFriendlyURLPersistence;
  26. import com.liferay.portal.kernel.service.persistence.LayoutFriendlyURLUtil;
  27. import com.liferay.portal.kernel.test.ReflectionTestUtil;
  28. import com.liferay.portal.kernel.test.rule.AggregateTestRule;
  29. import com.liferay.portal.kernel.test.util.RandomTestUtil;
  30. import com.liferay.portal.kernel.transaction.Propagation;
  31. import com.liferay.portal.kernel.util.IntegerWrapper;
  32. import com.liferay.portal.kernel.util.OrderByComparator;
  33. import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil;
  34. import com.liferay.portal.kernel.util.Time;
  35. import com.liferay.portal.test.rule.LiferayIntegrationTestRule;
  36. import com.liferay.portal.test.rule.PersistenceTestRule;
  37. import com.liferay.portal.test.rule.TransactionalTestRule;
  38. import java.io.Serializable;
  39. import java.util.ArrayList;
  40. import java.util.HashSet;
  41. import java.util.Iterator;
  42. import java.util.List;
  43. import java.util.Map;
  44. import java.util.Objects;
  45. import java.util.Set;
  46. import org.junit.After;
  47. import org.junit.Assert;
  48. import org.junit.Before;
  49. import org.junit.ClassRule;
  50. import org.junit.Rule;
  51. import org.junit.Test;
  52. import org.junit.runner.RunWith;
  53. /**
  54. * @generated
  55. */
  56. @RunWith(Arquillian.class)
  57. public class LayoutFriendlyURLPersistenceTest {
  58. @ClassRule
  59. @Rule
  60. public static final AggregateTestRule aggregateTestRule =
  61. new AggregateTestRule(
  62. new LiferayIntegrationTestRule(), PersistenceTestRule.INSTANCE,
  63. new TransactionalTestRule(Propagation.REQUIRED));
  64. @Before
  65. public void setUp() {
  66. _persistence = LayoutFriendlyURLUtil.getPersistence();
  67. Class<?> clazz = _persistence.getClass();
  68. _dynamicQueryClassLoader = clazz.getClassLoader();
  69. }
  70. @After
  71. public void tearDown() throws Exception {
  72. Iterator<LayoutFriendlyURL> iterator = _layoutFriendlyURLs.iterator();
  73. while (iterator.hasNext()) {
  74. _persistence.remove(iterator.next());
  75. iterator.remove();
  76. }
  77. }
  78. @Test
  79. public void testCreate() throws Exception {
  80. long pk = RandomTestUtil.nextLong();
  81. LayoutFriendlyURL layoutFriendlyURL = _persistence.create(pk);
  82. Assert.assertNotNull(layoutFriendlyURL);
  83. Assert.assertEquals(layoutFriendlyURL.getPrimaryKey(), pk);
  84. }
  85. @Test
  86. public void testRemove() throws Exception {
  87. LayoutFriendlyURL newLayoutFriendlyURL = addLayoutFriendlyURL();
  88. _persistence.remove(newLayoutFriendlyURL);
  89. LayoutFriendlyURL existingLayoutFriendlyURL =
  90. _persistence.fetchByPrimaryKey(
  91. newLayoutFriendlyURL.getPrimaryKey());
  92. Assert.assertNull(existingLayoutFriendlyURL);
  93. }
  94. @Test
  95. public void testUpdateNew() throws Exception {
  96. addLayoutFriendlyURL();
  97. }
  98. @Test
  99. public void testUpdateExisting() throws Exception {
  100. long pk = RandomTestUtil.nextLong();
  101. LayoutFriendlyURL newLayoutFriendlyURL = _persistence.create(pk);
  102. newLayoutFriendlyURL.setMvccVersion(RandomTestUtil.nextLong());
  103. newLayoutFriendlyURL.setCtCollectionId(RandomTestUtil.nextLong());
  104. newLayoutFriendlyURL.setUuid(RandomTestUtil.randomString());
  105. newLayoutFriendlyURL.setGroupId(RandomTestUtil.nextLong());
  106. newLayoutFriendlyURL.setCompanyId(RandomTestUtil.nextLong());
  107. newLayoutFriendlyURL.setUserId(RandomTestUtil.nextLong());
  108. newLayoutFriendlyURL.setUserName(RandomTestUtil.randomString());
  109. newLayoutFriendlyURL.setCreateDate(RandomTestUtil.nextDate());
  110. newLayoutFriendlyURL.setModifiedDate(RandomTestUtil.nextDate());
  111. newLayoutFriendlyURL.setPlid(RandomTestUtil.nextLong());
  112. newLayoutFriendlyURL.setPrivateLayout(RandomTestUtil.randomBoolean());
  113. newLayoutFriendlyURL.setFriendlyURL(RandomTestUtil.randomString());
  114. newLayoutFriendlyURL.setLanguageId(RandomTestUtil.randomString());
  115. newLayoutFriendlyURL.setLastPublishDate(RandomTestUtil.nextDate());
  116. _layoutFriendlyURLs.add(_persistence.update(newLayoutFriendlyURL));
  117. LayoutFriendlyURL existingLayoutFriendlyURL =
  118. _persistence.findByPrimaryKey(newLayoutFriendlyURL.getPrimaryKey());
  119. Assert.assertEquals(
  120. existingLayoutFriendlyURL.getMvccVersion(),
  121. newLayoutFriendlyURL.getMvccVersion());
  122. Assert.assertEquals(
  123. existingLayoutFriendlyURL.getCtCollectionId(),
  124. newLayoutFriendlyURL.getCtCollectionId());
  125. Assert.assertEquals(
  126. existingLayoutFriendlyURL.getUuid(),
  127. newLayoutFriendlyURL.getUuid());
  128. Assert.assertEquals(
  129. existingLayoutFriendlyURL.getLayoutFriendlyURLId(),
  130. newLayoutFriendlyURL.getLayoutFriendlyURLId());
  131. Assert.assertEquals(
  132. existingLayoutFriendlyURL.getGroupId(),
  133. newLayoutFriendlyURL.getGroupId());
  134. Assert.assertEquals(
  135. existingLayoutFriendlyURL.getCompanyId(),
  136. newLayoutFriendlyURL.getCompanyId());
  137. Assert.assertEquals(
  138. existingLayoutFriendlyURL.getUserId(),
  139. newLayoutFriendlyURL.getUserId());
  140. Assert.assertEquals(
  141. existingLayoutFriendlyURL.getUserName(),
  142. newLayoutFriendlyURL.getUserName());
  143. Assert.assertEquals(
  144. Time.getShortTimestamp(existingLayoutFriendlyURL.getCreateDate()),
  145. Time.getShortTimestamp(newLayoutFriendlyURL.getCreateDate()));
  146. Assert.assertEquals(
  147. Time.getShortTimestamp(existingLayoutFriendlyURL.getModifiedDate()),
  148. Time.getShortTimestamp(newLayoutFriendlyURL.getModifiedDate()));
  149. Assert.assertEquals(
  150. existingLayoutFriendlyURL.getPlid(),
  151. newLayoutFriendlyURL.getPlid());
  152. Assert.assertEquals(
  153. existingLayoutFriendlyURL.isPrivateLayout(),
  154. newLayoutFriendlyURL.isPrivateLayout());
  155. Assert.assertEquals(
  156. existingLayoutFriendlyURL.getFriendlyURL(),
  157. newLayoutFriendlyURL.getFriendlyURL());
  158. Assert.assertEquals(
  159. existingLayoutFriendlyURL.getLanguageId(),
  160. newLayoutFriendlyURL.getLanguageId());
  161. Assert.assertEquals(
  162. Time.getShortTimestamp(
  163. existingLayoutFriendlyURL.getLastPublishDate()),
  164. Time.getShortTimestamp(newLayoutFriendlyURL.getLastPublishDate()));
  165. }
  166. @Test
  167. public void testCountByUuid() throws Exception {
  168. _persistence.countByUuid("");
  169. _persistence.countByUuid("null");
  170. _persistence.countByUuid((String)null);
  171. }
  172. @Test
  173. public void testCountByUUID_G() throws Exception {
  174. _persistence.countByUUID_G("", RandomTestUtil.nextLong());
  175. _persistence.countByUUID_G("null", 0L);
  176. _persistence.countByUUID_G((String)null, 0L);
  177. }
  178. @Test
  179. public void testCountByUuid_C() throws Exception {
  180. _persistence.countByUuid_C("", RandomTestUtil.nextLong());
  181. _persistence.countByUuid_C("null", 0L);
  182. _persistence.countByUuid_C((String)null, 0L);
  183. }
  184. @Test
  185. public void testCountByGroupId() throws Exception {
  186. _persistence.countByGroupId(RandomTestUtil.nextLong());
  187. _persistence.countByGroupId(0L);
  188. }
  189. @Test
  190. public void testCountByCompanyId() throws Exception {
  191. _persistence.countByCompanyId(RandomTestUtil.nextLong());
  192. _persistence.countByCompanyId(0L);
  193. }
  194. @Test
  195. public void testCountByPlid() throws Exception {
  196. _persistence.countByPlid(RandomTestUtil.nextLong());
  197. _persistence.countByPlid(0L);
  198. }
  199. @Test
  200. public void testCountByP_F() throws Exception {
  201. _persistence.countByP_F(RandomTestUtil.nextLong(), "");
  202. _persistence.countByP_F(0L, "null");
  203. _persistence.countByP_F(0L, (String)null);
  204. }
  205. @Test
  206. public void testCountByP_L() throws Exception {
  207. _persistence.countByP_L(RandomTestUtil.nextLong(), "");
  208. _persistence.countByP_L(0L, "null");
  209. _persistence.countByP_L(0L, (String)null);
  210. }
  211. @Test
  212. public void testCountByP_LArrayable() throws Exception {
  213. _persistence.countByP_L(
  214. new long[] {RandomTestUtil.nextLong(), 0L},
  215. RandomTestUtil.randomString());
  216. }
  217. @Test
  218. public void testCountByG_P_F() throws Exception {
  219. _persistence.countByG_P_F(
  220. RandomTestUtil.nextLong(), RandomTestUtil.randomBoolean(), "");
  221. _persistence.countByG_P_F(0L, RandomTestUtil.randomBoolean(), "null");
  222. _persistence.countByG_P_F(
  223. 0L, RandomTestUtil.randomBoolean(), (String)null);
  224. }
  225. @Test
  226. public void testCountByG_P_F_L() throws Exception {
  227. _persistence.countByG_P_F_L(
  228. RandomTestUtil.nextLong(), RandomTestUtil.randomBoolean(), "", "");
  229. _persistence.countByG_P_F_L(
  230. 0L, RandomTestUtil.randomBoolean(), "null", "null");
  231. _persistence.countByG_P_F_L(
  232. 0L, RandomTestUtil.randomBoolean(), (String)null, (String)null);
  233. }
  234. @Test
  235. public void testFindByPrimaryKeyExisting() throws Exception {
  236. LayoutFriendlyURL newLayoutFriendlyURL = addLayoutFriendlyURL();
  237. LayoutFriendlyURL existingLayoutFriendlyURL =
  238. _persistence.findByPrimaryKey(newLayoutFriendlyURL.getPrimaryKey());
  239. Assert.assertEquals(existingLayoutFriendlyURL, newLayoutFriendlyURL);
  240. }
  241. @Test(expected = NoSuchLayoutFriendlyURLException.class)
  242. public void testFindByPrimaryKeyMissing() throws Exception {
  243. long pk = RandomTestUtil.nextLong();
  244. _persistence.findByPrimaryKey(pk);
  245. }
  246. @Test
  247. public void testFindAll() throws Exception {
  248. _persistence.findAll(
  249. QueryUtil.ALL_POS, QueryUtil.ALL_POS, getOrderByComparator());
  250. }
  251. protected OrderByComparator<LayoutFriendlyURL> getOrderByComparator() {
  252. return OrderByComparatorFactoryUtil.create(
  253. "LayoutFriendlyURL", "mvccVersion", true, "ctCollectionId", true,
  254. "uuid", true, "layoutFriendlyURLId", true, "groupId", true,
  255. "companyId", true, "userId", true, "userName", true, "createDate",
  256. true, "modifiedDate", true, "plid", true, "privateLayout", true,
  257. "friendlyURL", true, "languageId", true, "lastPublishDate", true);
  258. }
  259. @Test
  260. public void testFetchByPrimaryKeyExisting() throws Exception {
  261. LayoutFriendlyURL newLayoutFriendlyURL = addLayoutFriendlyURL();
  262. LayoutFriendlyURL existingLayoutFriendlyURL =
  263. _persistence.fetchByPrimaryKey(
  264. newLayoutFriendlyURL.getPrimaryKey());
  265. Assert.assertEquals(existingLayoutFriendlyURL, newLayoutFriendlyURL);
  266. }
  267. @Test
  268. public void testFetchByPrimaryKeyMissing() throws Exception {
  269. long pk = RandomTestUtil.nextLong();
  270. LayoutFriendlyURL missingLayoutFriendlyURL =
  271. _persistence.fetchByPrimaryKey(pk);
  272. Assert.assertNull(missingLayoutFriendlyURL);
  273. }
  274. @Test
  275. public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist()
  276. throws Exception {
  277. LayoutFriendlyURL newLayoutFriendlyURL1 = addLayoutFriendlyURL();
  278. LayoutFriendlyURL newLayoutFriendlyURL2 = addLayoutFriendlyURL();
  279. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  280. primaryKeys.add(newLayoutFriendlyURL1.getPrimaryKey());
  281. primaryKeys.add(newLayoutFriendlyURL2.getPrimaryKey());
  282. Map<Serializable, LayoutFriendlyURL> layoutFriendlyURLs =
  283. _persistence.fetchByPrimaryKeys(primaryKeys);
  284. Assert.assertEquals(2, layoutFriendlyURLs.size());
  285. Assert.assertEquals(
  286. newLayoutFriendlyURL1,
  287. layoutFriendlyURLs.get(newLayoutFriendlyURL1.getPrimaryKey()));
  288. Assert.assertEquals(
  289. newLayoutFriendlyURL2,
  290. layoutFriendlyURLs.get(newLayoutFriendlyURL2.getPrimaryKey()));
  291. }
  292. @Test
  293. public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereNoPrimaryKeysExist()
  294. throws Exception {
  295. long pk1 = RandomTestUtil.nextLong();
  296. long pk2 = RandomTestUtil.nextLong();
  297. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  298. primaryKeys.add(pk1);
  299. primaryKeys.add(pk2);
  300. Map<Serializable, LayoutFriendlyURL> layoutFriendlyURLs =
  301. _persistence.fetchByPrimaryKeys(primaryKeys);
  302. Assert.assertTrue(layoutFriendlyURLs.isEmpty());
  303. }
  304. @Test
  305. public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist()
  306. throws Exception {
  307. LayoutFriendlyURL newLayoutFriendlyURL = addLayoutFriendlyURL();
  308. long pk = RandomTestUtil.nextLong();
  309. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  310. primaryKeys.add(newLayoutFriendlyURL.getPrimaryKey());
  311. primaryKeys.add(pk);
  312. Map<Serializable, LayoutFriendlyURL> layoutFriendlyURLs =
  313. _persistence.fetchByPrimaryKeys(primaryKeys);
  314. Assert.assertEquals(1, layoutFriendlyURLs.size());
  315. Assert.assertEquals(
  316. newLayoutFriendlyURL,
  317. layoutFriendlyURLs.get(newLayoutFriendlyURL.getPrimaryKey()));
  318. }
  319. @Test
  320. public void testFetchByPrimaryKeysWithNoPrimaryKeys() throws Exception {
  321. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  322. Map<Serializable, LayoutFriendlyURL> layoutFriendlyURLs =
  323. _persistence.fetchByPrimaryKeys(primaryKeys);
  324. Assert.assertTrue(layoutFriendlyURLs.isEmpty());
  325. }
  326. @Test
  327. public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
  328. LayoutFriendlyURL newLayoutFriendlyURL = addLayoutFriendlyURL();
  329. Set<Serializable> primaryKeys = new HashSet<Serializable>();
  330. primaryKeys.add(newLayoutFriendlyURL.getPrimaryKey());
  331. Map<Serializable, LayoutFriendlyURL> layoutFriendlyURLs =
  332. _persistence.fetchByPrimaryKeys(primaryKeys);
  333. Assert.assertEquals(1, layoutFriendlyURLs.size());
  334. Assert.assertEquals(
  335. newLayoutFriendlyURL,
  336. layoutFriendlyURLs.get(newLayoutFriendlyURL.getPrimaryKey()));
  337. }
  338. @Test
  339. public void testActionableDynamicQuery() throws Exception {
  340. final IntegerWrapper count = new IntegerWrapper();
  341. ActionableDynamicQuery actionableDynamicQuery =
  342. LayoutFriendlyURLLocalServiceUtil.getActionableDynamicQuery();
  343. actionableDynamicQuery.setPerformActionMethod(
  344. new ActionableDynamicQuery.PerformActionMethod
  345. <LayoutFriendlyURL>() {
  346. @Override
  347. public void performAction(LayoutFriendlyURL layoutFriendlyURL) {
  348. Assert.assertNotNull(layoutFriendlyURL);
  349. count.increment();
  350. }
  351. });
  352. actionableDynamicQuery.performActions();
  353. Assert.assertEquals(count.getValue(), _persistence.countAll());
  354. }
  355. @Test
  356. public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
  357. LayoutFriendlyURL newLayoutFriendlyURL = addLayoutFriendlyURL();
  358. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(
  359. LayoutFriendlyURL.class, _dynamicQueryClassLoader);
  360. dynamicQuery.add(
  361. RestrictionsFactoryUtil.eq(
  362. "layoutFriendlyURLId",
  363. newLayoutFriendlyURL.getLayoutFriendlyURLId()));
  364. List<LayoutFriendlyURL> result = _persistence.findWithDynamicQuery(
  365. dynamicQuery);
  366. Assert.assertEquals(1, result.size());
  367. LayoutFriendlyURL existingLayoutFriendlyURL = result.get(0);
  368. Assert.assertEquals(existingLayoutFriendlyURL, newLayoutFriendlyURL);
  369. }
  370. @Test
  371. public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
  372. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(
  373. LayoutFriendlyURL.class, _dynamicQueryClassLoader);
  374. dynamicQuery.add(
  375. RestrictionsFactoryUtil.eq(
  376. "layoutFriendlyURLId", RandomTestUtil.nextLong()));
  377. List<LayoutFriendlyURL> result = _persistence.findWithDynamicQuery(
  378. dynamicQuery);
  379. Assert.assertEquals(0, result.size());
  380. }
  381. @Test
  382. public void testDynamicQueryByProjectionExisting() throws Exception {
  383. LayoutFriendlyURL newLayoutFriendlyURL = addLayoutFriendlyURL();
  384. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(
  385. LayoutFriendlyURL.class, _dynamicQueryClassLoader);
  386. dynamicQuery.setProjection(
  387. ProjectionFactoryUtil.property("layoutFriendlyURLId"));
  388. Object newLayoutFriendlyURLId =
  389. newLayoutFriendlyURL.getLayoutFriendlyURLId();
  390. dynamicQuery.add(
  391. RestrictionsFactoryUtil.in(
  392. "layoutFriendlyURLId", new Object[] {newLayoutFriendlyURLId}));
  393. List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
  394. Assert.assertEquals(1, result.size());
  395. Object existingLayoutFriendlyURLId = result.get(0);
  396. Assert.assertEquals(
  397. existingLayoutFriendlyURLId, newLayoutFriendlyURLId);
  398. }
  399. @Test
  400. public void testDynamicQueryByProjectionMissing() throws Exception {
  401. DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(
  402. LayoutFriendlyURL.class, _dynamicQueryClassLoader);
  403. dynamicQuery.setProjection(
  404. ProjectionFactoryUtil.property("layoutFriendlyURLId"));
  405. dynamicQuery.add(
  406. RestrictionsFactoryUtil.in(
  407. "layoutFriendlyURLId",
  408. new Object[] {RandomTestUtil.nextLong()}));
  409. List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
  410. Assert.assertEquals(0, result.size());
  411. }
  412. @Test
  413. public void testResetOriginalValues() throws Exception {
  414. LayoutFriendlyURL newLayoutFriendlyURL = addLayoutFriendlyURL();
  415. _persistence.clearCache();
  416. LayoutFriendlyURL existingLayoutFriendlyURL =
  417. _persistence.findByPrimaryKey(newLayoutFriendlyURL.getPrimaryKey());
  418. Assert.assertTrue(
  419. Objects.equals(
  420. existingLayoutFriendlyURL.getUuid(),
  421. ReflectionTestUtil.invoke(
  422. existingLayoutFriendlyURL, "getOriginalUuid",
  423. new Class<?>[0])));
  424. Assert.assertEquals(
  425. Long.valueOf(existingLayoutFriendlyURL.getGroupId()),
  426. ReflectionTestUtil.<Long>invoke(
  427. existingLayoutFriendlyURL, "getOriginalGroupId",
  428. new Class<?>[0]));
  429. Assert.assertEquals(
  430. Long.valueOf(existingLayoutFriendlyURL.getPlid()),
  431. ReflectionTestUtil.<Long>invoke(
  432. existingLayoutFriendlyURL, "getOriginalPlid", new Class<?>[0]));
  433. Assert.assertTrue(
  434. Objects.equals(
  435. existingLayoutFriendlyURL.getLanguageId(),
  436. ReflectionTestUtil.invoke(
  437. existingLayoutFriendlyURL, "getOriginalLanguageId",
  438. new Class<?>[0])));
  439. Assert.assertEquals(
  440. Long.valueOf(existingLayoutFriendlyURL.getGroupId()),
  441. ReflectionTestUtil.<Long>invoke(
  442. existingLayoutFriendlyURL, "getOriginalGroupId",
  443. new Class<?>[0]));
  444. Assert.assertEquals(
  445. Boolean.valueOf(existingLayoutFriendlyURL.getPrivateLayout()),
  446. ReflectionTestUtil.<Boolean>invoke(
  447. existingLayoutFriendlyURL, "getOriginalPrivateLayout",
  448. new Class<?>[0]));
  449. Assert.assertTrue(
  450. Objects.equals(
  451. existingLayoutFriendlyURL.getFriendlyURL(),
  452. ReflectionTestUtil.invoke(
  453. existingLayoutFriendlyURL, "getOriginalFriendlyURL",
  454. new Class<?>[0])));
  455. Assert.assertTrue(
  456. Objects.equals(
  457. existingLayoutFriendlyURL.getLanguageId(),
  458. ReflectionTestUtil.invoke(
  459. existingLayoutFriendlyURL, "getOriginalLanguageId",
  460. new Class<?>[0])));
  461. }
  462. protected LayoutFriendlyURL addLayoutFriendlyURL() throws Exception {
  463. long pk = RandomTestUtil.nextLong();
  464. LayoutFriendlyURL layoutFriendlyURL = _persistence.create(pk);
  465. layoutFriendlyURL.setMvccVersion(RandomTestUtil.nextLong());
  466. layoutFriendlyURL.setCtCollectionId(RandomTestUtil.nextLong());
  467. layoutFriendlyURL.setUuid(RandomTestUtil.randomString());
  468. layoutFriendlyURL.setGroupId(RandomTestUtil.nextLong());
  469. layoutFriendlyURL.setCompanyId(RandomTestUtil.nextLong());
  470. layoutFriendlyURL.setUserId(RandomTestUtil.nextLong());
  471. layoutFriendlyURL.setUserName(RandomTestUtil.randomString());
  472. layoutFriendlyURL.setCreateDate(RandomTestUtil.nextDate());
  473. layoutFriendlyURL.setModifiedDate(RandomTestUtil.nextDate());
  474. layoutFriendlyURL.setPlid(RandomTestUtil.nextLong());
  475. layoutFriendlyURL.setPrivateLayout(RandomTestUtil.randomBoolean());
  476. layoutFriendlyURL.setFriendlyURL(RandomTestUtil.randomString());
  477. layoutFriendlyURL.setLanguageId(RandomTestUtil.randomString());
  478. layoutFriendlyURL.setLastPublishDate(RandomTestUtil.nextDate());
  479. _layoutFriendlyURLs.add(_persistence.update(layoutFriendlyURL));
  480. return layoutFriendlyURL;
  481. }
  482. private List<LayoutFriendlyURL> _layoutFriendlyURLs =
  483. new ArrayList<LayoutFriendlyURL>();
  484. private LayoutFriendlyURLPersistence _persistence;
  485. private ClassLoader _dynamicQueryClassLoader;
  486. }