List of usage examples for com.liferay.portal.kernel.util Time getShortTimestamp
public static String getShortTimestamp(Date date)
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:ch.inofix.referencemanager.service.persistence.test.ReferencePersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); Reference newReference = _persistence.create(pk); newReference.setUuid(RandomTestUtil.randomString()); newReference.setGroupId(RandomTestUtil.nextLong()); newReference.setCompanyId(RandomTestUtil.nextLong()); newReference.setUserId(RandomTestUtil.nextLong()); newReference.setUserName(RandomTestUtil.randomString()); newReference.setCreateDate(RandomTestUtil.nextDate()); newReference.setModifiedDate(RandomTestUtil.nextDate()); newReference.setBibtex(RandomTestUtil.randomString()); newReference.setStatus(RandomTestUtil.nextInt()); _references.add(_persistence.update(newReference)); Reference existingReference = _persistence.findByPrimaryKey(newReference.getPrimaryKey()); Assert.assertEquals(existingReference.getUuid(), newReference.getUuid()); Assert.assertEquals(existingReference.getReferenceId(), newReference.getReferenceId()); Assert.assertEquals(existingReference.getGroupId(), newReference.getGroupId()); Assert.assertEquals(existingReference.getCompanyId(), newReference.getCompanyId()); Assert.assertEquals(existingReference.getUserId(), newReference.getUserId()); Assert.assertEquals(existingReference.getUserName(), newReference.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingReference.getCreateDate()), Time.getShortTimestamp(newReference.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingReference.getModifiedDate()), Time.getShortTimestamp(newReference.getModifiedDate())); Assert.assertEquals(existingReference.getBibtex(), newReference.getBibtex()); Assert.assertEquals(existingReference.getStatus(), newReference.getStatus()); }
From source file:com.bemis.portal.customer.service.persistence.test.CustomerLocationPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); CustomerLocation newCustomerLocation = _persistence.create(pk); newCustomerLocation.setCompanyId(RandomTestUtil.nextLong()); newCustomerLocation.setUserId(RandomTestUtil.nextLong()); newCustomerLocation.setUserName(RandomTestUtil.randomString()); newCustomerLocation.setCreateDate(RandomTestUtil.nextDate()); newCustomerLocation.setModifiedDate(RandomTestUtil.nextDate()); newCustomerLocation.setBemisCustomerId(RandomTestUtil.randomString()); newCustomerLocation.setBemisParentId(RandomTestUtil.randomString()); newCustomerLocation.setCustomerName(RandomTestUtil.randomString()); newCustomerLocation.setCustomerAddress1(RandomTestUtil.randomString()); newCustomerLocation.setCustomerAddress2(RandomTestUtil.randomString()); newCustomerLocation.setCustomerAddress3(RandomTestUtil.randomString()); newCustomerLocation.setCustomerCity(RandomTestUtil.randomString()); newCustomerLocation.setCustomerState(RandomTestUtil.randomString()); newCustomerLocation.setCustomerPostalCde(RandomTestUtil.randomString()); newCustomerLocation.setCustomerCountry(RandomTestUtil.randomString()); newCustomerLocation.setCustomerPhoneNbr(RandomTestUtil.randomString()); newCustomerLocation.setCustomerPoBox(RandomTestUtil.randomString()); newCustomerLocation.setCustomerPoCity(RandomTestUtil.randomString()); newCustomerLocation.setCustomerPoState(RandomTestUtil.randomString()); newCustomerLocation.setCustomerPoPostalCde(RandomTestUtil.randomString()); newCustomerLocation.setCustomerActiveStatusCde(RandomTestUtil.randomString()); _customerLocations.add(_persistence.update(newCustomerLocation)); CustomerLocation existingCustomerLocation = _persistence .findByPrimaryKey(newCustomerLocation.getPrimaryKey()); Assert.assertEquals(existingCustomerLocation.getCustomerLocationId(), newCustomerLocation.getCustomerLocationId()); Assert.assertEquals(existingCustomerLocation.getCompanyId(), newCustomerLocation.getCompanyId()); Assert.assertEquals(existingCustomerLocation.getUserId(), newCustomerLocation.getUserId()); Assert.assertEquals(existingCustomerLocation.getUserName(), newCustomerLocation.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingCustomerLocation.getCreateDate()), Time.getShortTimestamp(newCustomerLocation.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingCustomerLocation.getModifiedDate()), Time.getShortTimestamp(newCustomerLocation.getModifiedDate())); Assert.assertEquals(existingCustomerLocation.getBemisCustomerId(), newCustomerLocation.getBemisCustomerId()); Assert.assertEquals(existingCustomerLocation.getBemisParentId(), newCustomerLocation.getBemisParentId()); Assert.assertEquals(existingCustomerLocation.getCustomerName(), newCustomerLocation.getCustomerName()); Assert.assertEquals(existingCustomerLocation.getCustomerAddress1(), newCustomerLocation.getCustomerAddress1()); Assert.assertEquals(existingCustomerLocation.getCustomerAddress2(), newCustomerLocation.getCustomerAddress2()); Assert.assertEquals(existingCustomerLocation.getCustomerAddress3(), newCustomerLocation.getCustomerAddress3()); Assert.assertEquals(existingCustomerLocation.getCustomerCity(), newCustomerLocation.getCustomerCity()); Assert.assertEquals(existingCustomerLocation.getCustomerState(), newCustomerLocation.getCustomerState()); Assert.assertEquals(existingCustomerLocation.getCustomerPostalCde(), newCustomerLocation.getCustomerPostalCde()); Assert.assertEquals(existingCustomerLocation.getCustomerCountry(), newCustomerLocation.getCustomerCountry()); Assert.assertEquals(existingCustomerLocation.getCustomerPhoneNbr(), newCustomerLocation.getCustomerPhoneNbr()); Assert.assertEquals(existingCustomerLocation.getCustomerPoBox(), newCustomerLocation.getCustomerPoBox()); Assert.assertEquals(existingCustomerLocation.getCustomerPoCity(), newCustomerLocation.getCustomerPoCity()); Assert.assertEquals(existingCustomerLocation.getCustomerPoState(), newCustomerLocation.getCustomerPoState()); Assert.assertEquals(existingCustomerLocation.getCustomerPoPostalCde(), newCustomerLocation.getCustomerPoPostalCde()); Assert.assertEquals(existingCustomerLocation.getCustomerActiveStatusCde(), newCustomerLocation.getCustomerActiveStatusCde()); }
From source file:com.bemis.portal.inventory.service.persistence.test.InventoryPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); Inventory newInventory = _persistence.create(pk); newInventory.setGroupId(RandomTestUtil.nextLong()); newInventory.setCompanyId(RandomTestUtil.nextLong()); newInventory.setUserId(RandomTestUtil.nextLong()); newInventory.setUserName(RandomTestUtil.randomString()); newInventory.setCreateDate(RandomTestUtil.nextDate()); newInventory.setModifiedDate(RandomTestUtil.nextDate()); newInventory.setSourceMaterialNbr(RandomTestUtil.randomString()); newInventory.setSpecialStockCde(RandomTestUtil.randomString()); _inventories.add(_persistence.update(newInventory)); Inventory existingInventory = _persistence.findByPrimaryKey(newInventory.getPrimaryKey()); Assert.assertEquals(existingInventory.getInventoryId(), newInventory.getInventoryId()); Assert.assertEquals(existingInventory.getGroupId(), newInventory.getGroupId()); Assert.assertEquals(existingInventory.getCompanyId(), newInventory.getCompanyId()); Assert.assertEquals(existingInventory.getUserId(), newInventory.getUserId()); Assert.assertEquals(existingInventory.getUserName(), newInventory.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingInventory.getCreateDate()), Time.getShortTimestamp(newInventory.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingInventory.getModifiedDate()), Time.getShortTimestamp(newInventory.getModifiedDate())); Assert.assertEquals(existingInventory.getSourceMaterialNbr(), newInventory.getSourceMaterialNbr()); Assert.assertEquals(existingInventory.getSpecialStockCde(), newInventory.getSpecialStockCde()); }
From source file:com.bemis.portal.order.service.persistence.test.OrderPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); Order newOrder = _persistence.create(pk); newOrder.setGroupId(RandomTestUtil.nextLong()); newOrder.setCompanyId(RandomTestUtil.nextLong()); newOrder.setUserId(RandomTestUtil.nextLong()); newOrder.setUserName(RandomTestUtil.randomString()); newOrder.setCreateDate(RandomTestUtil.nextDate()); newOrder.setModifiedDate(RandomTestUtil.nextDate()); newOrder.setItemNo(RandomTestUtil.randomString()); newOrder.setBemisProductId(RandomTestUtil.randomString()); newOrder.setProdDesc(RandomTestUtil.randomString()); newOrder.setPurchaseOrderNo(RandomTestUtil.randomString()); newOrder.setBemisOrderNo(RandomTestUtil.randomString()); newOrder.setLineNumber(RandomTestUtil.nextInt()); newOrder.setUom(RandomTestUtil.randomString()); newOrder.setOrderDate(RandomTestUtil.nextDate()); newOrder.setOrderedQty(RandomTestUtil.nextInt()); newOrder.setRequestedDate(RandomTestUtil.nextDate()); newOrder.setMaterialAvailDate(RandomTestUtil.nextDate()); newOrder.setOnHandQty(RandomTestUtil.nextInt()); newOrder.setProducedQty(RandomTestUtil.nextInt()); newOrder.setScheduledReleases(RandomTestUtil.nextInt()); newOrder.setAvailQty(RandomTestUtil.nextInt()); newOrder.setShippedQty(RandomTestUtil.nextInt()); newOrder.setShipToId(RandomTestUtil.randomString()); newOrder.setBemisCustId(RandomTestUtil.randomString()); _orders.add(_persistence.update(newOrder)); Order existingOrder = _persistence.findByPrimaryKey(newOrder.getPrimaryKey()); Assert.assertEquals(existingOrder.getOrderId(), newOrder.getOrderId()); Assert.assertEquals(existingOrder.getGroupId(), newOrder.getGroupId()); Assert.assertEquals(existingOrder.getCompanyId(), newOrder.getCompanyId()); Assert.assertEquals(existingOrder.getUserId(), newOrder.getUserId()); Assert.assertEquals(existingOrder.getUserName(), newOrder.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingOrder.getCreateDate()), Time.getShortTimestamp(newOrder.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingOrder.getModifiedDate()), Time.getShortTimestamp(newOrder.getModifiedDate())); Assert.assertEquals(existingOrder.getItemNo(), newOrder.getItemNo()); Assert.assertEquals(existingOrder.getBemisProductId(), newOrder.getBemisProductId()); Assert.assertEquals(existingOrder.getProdDesc(), newOrder.getProdDesc()); Assert.assertEquals(existingOrder.getPurchaseOrderNo(), newOrder.getPurchaseOrderNo()); Assert.assertEquals(existingOrder.getBemisOrderNo(), newOrder.getBemisOrderNo()); Assert.assertEquals(existingOrder.getLineNumber(), newOrder.getLineNumber()); Assert.assertEquals(existingOrder.getUom(), newOrder.getUom()); Assert.assertEquals(Time.getShortTimestamp(existingOrder.getOrderDate()), Time.getShortTimestamp(newOrder.getOrderDate())); Assert.assertEquals(existingOrder.getOrderedQty(), newOrder.getOrderedQty()); Assert.assertEquals(Time.getShortTimestamp(existingOrder.getRequestedDate()), Time.getShortTimestamp(newOrder.getRequestedDate())); Assert.assertEquals(Time.getShortTimestamp(existingOrder.getMaterialAvailDate()), Time.getShortTimestamp(newOrder.getMaterialAvailDate())); Assert.assertEquals(existingOrder.getOnHandQty(), newOrder.getOnHandQty()); Assert.assertEquals(existingOrder.getProducedQty(), newOrder.getProducedQty()); Assert.assertEquals(existingOrder.getScheduledReleases(), newOrder.getScheduledReleases()); Assert.assertEquals(existingOrder.getAvailQty(), newOrder.getAvailQty()); Assert.assertEquals(existingOrder.getShippedQty(), newOrder.getShippedQty()); Assert.assertEquals(existingOrder.getShipToId(), newOrder.getShipToId()); Assert.assertEquals(existingOrder.getBemisCustId(), newOrder.getBemisCustId()); }
From source file:com.bemis.portal.order.service.persistence.test.OrderRequestPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); OrderRequest newOrderRequest = _persistence.create(pk); newOrderRequest.setGroupId(RandomTestUtil.nextLong()); newOrderRequest.setCompanyId(RandomTestUtil.nextLong()); newOrderRequest.setUserId(RandomTestUtil.nextLong()); newOrderRequest.setUserName(RandomTestUtil.randomString()); newOrderRequest.setCreateDate(RandomTestUtil.nextDate()); newOrderRequest.setModifiedDate(RandomTestUtil.nextDate()); newOrderRequest.setOrderId(RandomTestUtil.nextLong()); newOrderRequest.setConfirmedQty(RandomTestUtil.nextInt()); newOrderRequest.setRequestedDate(RandomTestUtil.nextDate()); newOrderRequest.setMaterialAvailDate(RandomTestUtil.nextDate()); _orderRequests.add(_persistence.update(newOrderRequest)); OrderRequest existingOrderRequest = _persistence.findByPrimaryKey(newOrderRequest.getPrimaryKey()); Assert.assertEquals(existingOrderRequest.getOrderRequestId(), newOrderRequest.getOrderRequestId()); Assert.assertEquals(existingOrderRequest.getGroupId(), newOrderRequest.getGroupId()); Assert.assertEquals(existingOrderRequest.getCompanyId(), newOrderRequest.getCompanyId()); Assert.assertEquals(existingOrderRequest.getUserId(), newOrderRequest.getUserId()); Assert.assertEquals(existingOrderRequest.getUserName(), newOrderRequest.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingOrderRequest.getCreateDate()), Time.getShortTimestamp(newOrderRequest.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingOrderRequest.getModifiedDate()), Time.getShortTimestamp(newOrderRequest.getModifiedDate())); Assert.assertEquals(existingOrderRequest.getOrderId(), newOrderRequest.getOrderId()); Assert.assertEquals(existingOrderRequest.getConfirmedQty(), newOrderRequest.getConfirmedQty()); Assert.assertEquals(Time.getShortTimestamp(existingOrderRequest.getRequestedDate()), Time.getShortTimestamp(newOrderRequest.getRequestedDate())); Assert.assertEquals(Time.getShortTimestamp(existingOrderRequest.getMaterialAvailDate()), Time.getShortTimestamp(newOrderRequest.getMaterialAvailDate())); }
From source file:com.bemis.portal.shipment.service.persistence.test.ShipmentPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); Shipment newShipment = _persistence.create(pk); newShipment.setGroupId(RandomTestUtil.nextLong()); newShipment.setCompanyId(RandomTestUtil.nextLong()); newShipment.setUserId(RandomTestUtil.nextLong()); newShipment.setUserName(RandomTestUtil.randomString()); newShipment.setCreateDate(RandomTestUtil.nextDate()); newShipment.setModifiedDate(RandomTestUtil.nextDate()); newShipment.setOrderId(RandomTestUtil.nextLong()); newShipment.setReleaseId(RandomTestUtil.nextLong()); newShipment.setShipmentDate(RandomTestUtil.nextDate()); newShipment.setShipmentQty(RandomTestUtil.nextInt()); newShipment.setShipmentUom(RandomTestUtil.randomString()); newShipment.setPalletQty(RandomTestUtil.nextInt()); newShipment.setInvoiceNo(RandomTestUtil.nextLong()); newShipment.setBolNo(RandomTestUtil.nextLong()); newShipment.setCarrierName(RandomTestUtil.randomString()); newShipment.setProNo(RandomTestUtil.randomString()); newShipment.setShipToId(RandomTestUtil.randomString()); newShipment.setDeliveryNbr(RandomTestUtil.randomString()); _shipments.add(_persistence.update(newShipment)); Shipment existingShipment = _persistence.findByPrimaryKey(newShipment.getPrimaryKey()); Assert.assertEquals(existingShipment.getShipmentId(), newShipment.getShipmentId()); Assert.assertEquals(existingShipment.getGroupId(), newShipment.getGroupId()); Assert.assertEquals(existingShipment.getCompanyId(), newShipment.getCompanyId()); Assert.assertEquals(existingShipment.getUserId(), newShipment.getUserId()); Assert.assertEquals(existingShipment.getUserName(), newShipment.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingShipment.getCreateDate()), Time.getShortTimestamp(newShipment.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingShipment.getModifiedDate()), Time.getShortTimestamp(newShipment.getModifiedDate())); Assert.assertEquals(existingShipment.getOrderId(), newShipment.getOrderId()); Assert.assertEquals(existingShipment.getReleaseId(), newShipment.getReleaseId()); Assert.assertEquals(Time.getShortTimestamp(existingShipment.getShipmentDate()), Time.getShortTimestamp(newShipment.getShipmentDate())); Assert.assertEquals(existingShipment.getShipmentQty(), newShipment.getShipmentQty()); Assert.assertEquals(existingShipment.getShipmentUom(), newShipment.getShipmentUom()); Assert.assertEquals(existingShipment.getPalletQty(), newShipment.getPalletQty()); Assert.assertEquals(existingShipment.getInvoiceNo(), newShipment.getInvoiceNo()); Assert.assertEquals(existingShipment.getBolNo(), newShipment.getBolNo()); Assert.assertEquals(existingShipment.getCarrierName(), newShipment.getCarrierName()); Assert.assertEquals(existingShipment.getProNo(), newShipment.getProNo()); Assert.assertEquals(existingShipment.getShipToId(), newShipment.getShipToId()); Assert.assertEquals(existingShipment.getDeliveryNbr(), newShipment.getDeliveryNbr()); }
From source file:com.liferay.adaptive.media.image.service.persistence.test.AdaptiveMediaImageEntryPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); AdaptiveMediaImageEntry newAdaptiveMediaImageEntry = _persistence.create(pk); newAdaptiveMediaImageEntry.setUuid(RandomTestUtil.randomString()); newAdaptiveMediaImageEntry.setGroupId(RandomTestUtil.nextLong()); newAdaptiveMediaImageEntry.setCompanyId(RandomTestUtil.nextLong()); newAdaptiveMediaImageEntry.setCreateDate(RandomTestUtil.nextDate()); newAdaptiveMediaImageEntry.setConfigurationUuid(RandomTestUtil.randomString()); newAdaptiveMediaImageEntry.setFileVersionId(RandomTestUtil.nextLong()); newAdaptiveMediaImageEntry.setMimeType(RandomTestUtil.randomString()); newAdaptiveMediaImageEntry.setHeight(RandomTestUtil.nextInt()); newAdaptiveMediaImageEntry.setWidth(RandomTestUtil.nextInt()); newAdaptiveMediaImageEntry.setSize(RandomTestUtil.nextLong()); _adaptiveMediaImageEntries.add(_persistence.update(newAdaptiveMediaImageEntry)); AdaptiveMediaImageEntry existingAdaptiveMediaImageEntry = _persistence .findByPrimaryKey(newAdaptiveMediaImageEntry.getPrimaryKey()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getUuid(), newAdaptiveMediaImageEntry.getUuid()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getAdaptiveMediaImageEntryId(), newAdaptiveMediaImageEntry.getAdaptiveMediaImageEntryId()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getGroupId(), newAdaptiveMediaImageEntry.getGroupId()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getCompanyId(), newAdaptiveMediaImageEntry.getCompanyId()); Assert.assertEquals(Time.getShortTimestamp(existingAdaptiveMediaImageEntry.getCreateDate()), Time.getShortTimestamp(newAdaptiveMediaImageEntry.getCreateDate())); Assert.assertEquals(existingAdaptiveMediaImageEntry.getConfigurationUuid(), newAdaptiveMediaImageEntry.getConfigurationUuid()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getFileVersionId(), newAdaptiveMediaImageEntry.getFileVersionId()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getMimeType(), newAdaptiveMediaImageEntry.getMimeType()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getHeight(), newAdaptiveMediaImageEntry.getHeight()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getWidth(), newAdaptiveMediaImageEntry.getWidth()); Assert.assertEquals(existingAdaptiveMediaImageEntry.getSize(), newAdaptiveMediaImageEntry.getSize()); }
From source file:com.liferay.adaptive.media.image.service.persistence.test.AMImageEntryPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); AMImageEntry newAMImageEntry = _persistence.create(pk); newAMImageEntry.setUuid(RandomTestUtil.randomString()); newAMImageEntry.setGroupId(RandomTestUtil.nextLong()); newAMImageEntry.setCompanyId(RandomTestUtil.nextLong()); newAMImageEntry.setCreateDate(RandomTestUtil.nextDate()); newAMImageEntry.setConfigurationUuid(RandomTestUtil.randomString()); newAMImageEntry.setFileVersionId(RandomTestUtil.nextLong()); newAMImageEntry.setMimeType(RandomTestUtil.randomString()); newAMImageEntry.setHeight(RandomTestUtil.nextInt()); newAMImageEntry.setWidth(RandomTestUtil.nextInt()); newAMImageEntry.setSize(RandomTestUtil.nextLong()); _amImageEntries.add(_persistence.update(newAMImageEntry)); AMImageEntry existingAMImageEntry = _persistence.findByPrimaryKey(newAMImageEntry.getPrimaryKey()); Assert.assertEquals(existingAMImageEntry.getUuid(), newAMImageEntry.getUuid()); Assert.assertEquals(existingAMImageEntry.getAmImageEntryId(), newAMImageEntry.getAmImageEntryId()); Assert.assertEquals(existingAMImageEntry.getGroupId(), newAMImageEntry.getGroupId()); Assert.assertEquals(existingAMImageEntry.getCompanyId(), newAMImageEntry.getCompanyId()); Assert.assertEquals(Time.getShortTimestamp(existingAMImageEntry.getCreateDate()), Time.getShortTimestamp(newAMImageEntry.getCreateDate())); Assert.assertEquals(existingAMImageEntry.getConfigurationUuid(), newAMImageEntry.getConfigurationUuid()); Assert.assertEquals(existingAMImageEntry.getFileVersionId(), newAMImageEntry.getFileVersionId()); Assert.assertEquals(existingAMImageEntry.getMimeType(), newAMImageEntry.getMimeType()); Assert.assertEquals(existingAMImageEntry.getHeight(), newAMImageEntry.getHeight()); Assert.assertEquals(existingAMImageEntry.getWidth(), newAMImageEntry.getWidth()); Assert.assertEquals(existingAMImageEntry.getSize(), newAMImageEntry.getSize()); }
From source file:com.liferay.asset.category.property.service.persistence.test.AssetCategoryPropertyPersistenceTest.java
License:Open Source License
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); AssetCategoryProperty newAssetCategoryProperty = _persistence.create(pk); newAssetCategoryProperty.setCompanyId(RandomTestUtil.nextLong()); newAssetCategoryProperty.setUserId(RandomTestUtil.nextLong()); newAssetCategoryProperty.setUserName(RandomTestUtil.randomString()); newAssetCategoryProperty.setCreateDate(RandomTestUtil.nextDate()); newAssetCategoryProperty.setModifiedDate(RandomTestUtil.nextDate()); newAssetCategoryProperty.setCategoryId(RandomTestUtil.nextLong()); newAssetCategoryProperty.setKey(RandomTestUtil.randomString()); newAssetCategoryProperty.setValue(RandomTestUtil.randomString()); _assetCategoryProperties.add(_persistence.update(newAssetCategoryProperty)); AssetCategoryProperty existingAssetCategoryProperty = _persistence .findByPrimaryKey(newAssetCategoryProperty.getPrimaryKey()); Assert.assertEquals(existingAssetCategoryProperty.getCategoryPropertyId(), newAssetCategoryProperty.getCategoryPropertyId()); Assert.assertEquals(existingAssetCategoryProperty.getCompanyId(), newAssetCategoryProperty.getCompanyId()); Assert.assertEquals(existingAssetCategoryProperty.getUserId(), newAssetCategoryProperty.getUserId()); Assert.assertEquals(existingAssetCategoryProperty.getUserName(), newAssetCategoryProperty.getUserName()); Assert.assertEquals(Time.getShortTimestamp(existingAssetCategoryProperty.getCreateDate()), Time.getShortTimestamp(newAssetCategoryProperty.getCreateDate())); Assert.assertEquals(Time.getShortTimestamp(existingAssetCategoryProperty.getModifiedDate()), Time.getShortTimestamp(newAssetCategoryProperty.getModifiedDate())); Assert.assertEquals(existingAssetCategoryProperty.getCategoryId(), newAssetCategoryProperty.getCategoryId()); Assert.assertEquals(existingAssetCategoryProperty.getKey(), newAssetCategoryProperty.getKey()); Assert.assertEquals(existingAssetCategoryProperty.getValue(), newAssetCategoryProperty.getValue()); }