|
|
package com.yohoufo.order.bid;
|
|
|
|
|
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
|
|
import com.yohoufo.dal.order.BuyerOrderMapper;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrder;
|
|
|
import com.yohoufo.order.BaseWebTest;
|
|
|
import com.yohoufo.order.common.Operator;
|
|
|
import com.yohoufo.order.model.RequestedCancelEventStatusChangeBuyerOrder;
|
|
|
import com.yohoufo.order.service.BuyerOrderStateChangers;
|
|
|
import com.yohoufo.order.service.listener.BuyerOrderChangeEvent;
|
|
|
import com.yohoufo.order.service.listener.OrderChangeListenerContainer;
|
|
|
import org.junit.Test;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.test.context.web.WebAppConfiguration;
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@WebAppConfiguration("src/main/resources")
|
|
|
public class BuyerBidOrderServiceTest extends BaseWebTest {
|
|
|
|
|
|
@Autowired
|
|
|
private OrderChangeListenerContainer orderChangeListenerContainer;
|
|
|
|
|
|
@Autowired
|
|
|
BuyerOrderMapper buyerOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
BuyerOrderStateChangers buyerOrderStateChangers;
|
|
|
|
|
|
int uid = 500031116;
|
|
|
|
|
|
@Test
|
|
|
public void test_refundDeposit_when_paySuccess() throws Exception {
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCodeUid(10018031345472L, uid);
|
|
|
//订单事件
|
|
|
orderChangeListenerContainer.fireAsyncEvent(new BuyerOrderChangeEvent(buyerOrder, BuyerOrderChangeEvent.BizCase.PAY_SUCCESS));
|
|
|
|
|
|
TimeUnit.SECONDS.sleep(100);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void test_deposit_pay_success() {
|
|
|
long orderCode = 10033859845960L;
|
|
|
buyerOrderStateChangers.selectOneToChange(uid, orderCode, OrderStatus.WAITING_PAY_DEPOSIT, OrderStatus.BIDING);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void test_buyer_close_bid() throws Exception {
|
|
|
long orderCode = 10029406388043L;
|
|
|
buyerOrderStateChangers.selectOneToChange(uid, orderCode,OrderStatus.BIDING,OrderStatus.BUYER_CLOSE_BID);
|
|
|
TimeUnit.SECONDS.sleep(100);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void test_buyer_pay_timeout() throws Exception {
|
|
|
long orderCode = 10029406388043L;
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCodeUid(orderCode, uid);
|
|
|
RequestedCancelEventStatusChangeBuyerOrder statusChangeBuyerOrder = new RequestedCancelEventStatusChangeBuyerOrder(buyerOrder,
|
|
|
OrderStatus.WAITING_PAY,
|
|
|
OrderStatus.BUYER_BID_PAY_TIMEOUT,
|
|
|
Operator.SYSTEM,
|
|
|
null);
|
|
|
buyerOrderStateChangers.selectOneToChange(statusChangeBuyerOrder);
|
|
|
TimeUnit.SECONDS.sleep(100);
|
|
|
}
|
|
|
} |
...
|
...
|
|