Example usage for com.liferay.portal.kernel.test.util RandomTestUtil nextDate

List of usage examples for com.liferay.portal.kernel.test.util RandomTestUtil nextDate

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.test.util RandomTestUtil nextDate.

Prototype

public static Date nextDate() 

Source Link

Usage

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

protected Foo addFoo() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Foo foo = _persistence.create(pk);//  www .j a  v a2s  .  com

    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: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:ch.inofix.referencemanager.service.persistence.test.ReferencePersistenceTest.java

License:Open Source License

protected Reference addReference() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Reference reference = _persistence.create(pk);

    reference.setUuid(RandomTestUtil.randomString());

    reference.setGroupId(RandomTestUtil.nextLong());

    reference.setCompanyId(RandomTestUtil.nextLong());

    reference.setUserId(RandomTestUtil.nextLong());

    reference.setUserName(RandomTestUtil.randomString());

    reference.setCreateDate(RandomTestUtil.nextDate());

    reference.setModifiedDate(RandomTestUtil.nextDate());

    reference.setBibtex(RandomTestUtil.randomString());

    reference.setStatus(RandomTestUtil.nextInt());

    _references.add(_persistence.update(reference));

    return reference;
}

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.customer.service.persistence.test.CustomerLocationPersistenceTest.java

License:Open Source License

protected CustomerLocation addCustomerLocation() throws Exception {
    long pk = RandomTestUtil.nextLong();

    CustomerLocation customerLocation = _persistence.create(pk);

    customerLocation.setCompanyId(RandomTestUtil.nextLong());

    customerLocation.setUserId(RandomTestUtil.nextLong());

    customerLocation.setUserName(RandomTestUtil.randomString());

    customerLocation.setCreateDate(RandomTestUtil.nextDate());

    customerLocation.setModifiedDate(RandomTestUtil.nextDate());

    customerLocation.setBemisCustomerId(RandomTestUtil.randomString());

    customerLocation.setBemisParentId(RandomTestUtil.randomString());

    customerLocation.setCustomerName(RandomTestUtil.randomString());

    customerLocation.setCustomerAddress1(RandomTestUtil.randomString());

    customerLocation.setCustomerAddress2(RandomTestUtil.randomString());

    customerLocation.setCustomerAddress3(RandomTestUtil.randomString());

    customerLocation.setCustomerCity(RandomTestUtil.randomString());

    customerLocation.setCustomerState(RandomTestUtil.randomString());

    customerLocation.setCustomerPostalCde(RandomTestUtil.randomString());

    customerLocation.setCustomerCountry(RandomTestUtil.randomString());

    customerLocation.setCustomerPhoneNbr(RandomTestUtil.randomString());

    customerLocation.setCustomerPoBox(RandomTestUtil.randomString());

    customerLocation.setCustomerPoCity(RandomTestUtil.randomString());

    customerLocation.setCustomerPoState(RandomTestUtil.randomString());

    customerLocation.setCustomerPoPostalCde(RandomTestUtil.randomString());

    customerLocation.setCustomerActiveStatusCde(RandomTestUtil.randomString());

    _customerLocations.add(_persistence.update(customerLocation));

    return customerLocation;
}

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.inventory.service.persistence.test.InventoryPersistenceTest.java

License:Open Source License

protected Inventory addInventory() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Inventory inventory = _persistence.create(pk);

    inventory.setGroupId(RandomTestUtil.nextLong());

    inventory.setCompanyId(RandomTestUtil.nextLong());

    inventory.setUserId(RandomTestUtil.nextLong());

    inventory.setUserName(RandomTestUtil.randomString());

    inventory.setCreateDate(RandomTestUtil.nextDate());

    inventory.setModifiedDate(RandomTestUtil.nextDate());

    inventory.setSourceMaterialNbr(RandomTestUtil.randomString());

    inventory.setSpecialStockCde(RandomTestUtil.randomString());

    _inventories.add(_persistence.update(inventory));

    return inventory;
}

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.OrderPersistenceTest.java

License:Open Source License

protected Order addOrder() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Order order = _persistence.create(pk);

    order.setGroupId(RandomTestUtil.nextLong());

    order.setCompanyId(RandomTestUtil.nextLong());

    order.setUserId(RandomTestUtil.nextLong());

    order.setUserName(RandomTestUtil.randomString());

    order.setCreateDate(RandomTestUtil.nextDate());

    order.setModifiedDate(RandomTestUtil.nextDate());

    order.setItemNo(RandomTestUtil.randomString());

    order.setBemisProductId(RandomTestUtil.randomString());

    order.setProdDesc(RandomTestUtil.randomString());

    order.setPurchaseOrderNo(RandomTestUtil.randomString());

    order.setBemisOrderNo(RandomTestUtil.randomString());

    order.setLineNumber(RandomTestUtil.nextInt());

    order.setUom(RandomTestUtil.randomString());

    order.setOrderDate(RandomTestUtil.nextDate());

    order.setOrderedQty(RandomTestUtil.nextInt());

    order.setRequestedDate(RandomTestUtil.nextDate());

    order.setMaterialAvailDate(RandomTestUtil.nextDate());

    order.setOnHandQty(RandomTestUtil.nextInt());

    order.setProducedQty(RandomTestUtil.nextInt());

    order.setScheduledReleases(RandomTestUtil.nextInt());

    order.setAvailQty(RandomTestUtil.nextInt());

    order.setShippedQty(RandomTestUtil.nextInt());

    order.setShipToId(RandomTestUtil.randomString());

    order.setBemisCustId(RandomTestUtil.randomString());

    _orders.add(_persistence.update(order));

    return order;
}