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

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

Introduction

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

Prototype

public static int nextInt() 

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);//from   w  w w.  j  a  v a  2s . c  o m

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

@Test
public void testCountByItemNo_ProductId_LineNo_BOrderNo() throws Exception {
    _persistence.countByItemNo_ProductId_LineNo_BOrderNo(StringPool.BLANK, StringPool.BLANK, StringPool.BLANK,
            RandomTestUtil.nextInt());

    _persistence.countByItemNo_ProductId_LineNo_BOrderNo(StringPool.NULL, StringPool.NULL, StringPool.NULL, 0);

    _persistence.countByItemNo_ProductId_LineNo_BOrderNo((String) null, (String) null, (String) null, 0);
}

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;
}

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.order.service.persistence.test.OrderRequestPersistenceTest.java

License:Open Source License

protected OrderRequest addOrderRequest() throws Exception {
    long pk = RandomTestUtil.nextLong();

    OrderRequest orderRequest = _persistence.create(pk);

    orderRequest.setGroupId(RandomTestUtil.nextLong());

    orderRequest.setCompanyId(RandomTestUtil.nextLong());

    orderRequest.setUserId(RandomTestUtil.nextLong());

    orderRequest.setUserName(RandomTestUtil.randomString());

    orderRequest.setCreateDate(RandomTestUtil.nextDate());

    orderRequest.setModifiedDate(RandomTestUtil.nextDate());

    orderRequest.setOrderId(RandomTestUtil.nextLong());

    orderRequest.setConfirmedQty(RandomTestUtil.nextInt());

    orderRequest.setRequestedDate(RandomTestUtil.nextDate());

    orderRequest.setMaterialAvailDate(RandomTestUtil.nextDate());

    _orderRequests.add(_persistence.update(orderRequest));

    return orderRequest;
}

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());
}