| | |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | import com.yeshi.buwan.service.inter.vip.VIPPriceService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.util.HttpUtil; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | //@RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | //@ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | //@WebAppConfiguration |
| | | public class VIPTest { |
| | | |
| | | @Resource |
| | |
| | | @Test |
| | | public void addVIPPrice() { |
| | | VIPPrice price = new VIPPrice(); |
| | | price.setPrice(new BigDecimal(8)); |
| | | price.setPrice(new BigDecimal("14.8")); |
| | | price.setType(VIPPriceType.month); |
| | | price.setPptvGoodsNo("DA7559531560894"); |
| | | price.setShow(true); |
| | |
| | | } |
| | | |
| | | price = new VIPPrice(); |
| | | price.setPrice(new BigDecimal(24)); |
| | | price.setPrice(new BigDecimal("37.8")); |
| | | price.setType(VIPPriceType.season); |
| | | price.setPptvGoodsNo("DA7559574625089"); |
| | | price.setShow(true); |
| | |
| | | |
| | | |
| | | price = new VIPPrice(); |
| | | price.setPrice(new BigDecimal(45)); |
| | | price.setPrice(new BigDecimal("68.8")); |
| | | price.setType(VIPPriceType.halfYear); |
| | | price.setPptvGoodsNo("DA6989580247516"); |
| | | price.setShow(true); |
| | |
| | | |
| | | |
| | | price = new VIPPrice(); |
| | | price.setPrice(new BigDecimal(88)); |
| | | price.setPrice(new BigDecimal("128.8")); |
| | | price.setType(VIPPriceType.year); |
| | | price.setPptvGoodsNo("DA8129574268091"); |
| | | price.setShow(true); |
| | |
| | | @Test |
| | | public void paySuccess() { |
| | | try { |
| | | vipService.paySuccess("2", VIPOrderRecord.PAY_WAY_ALIPAY, new BigDecimal("2.99"), new Date()); |
| | | } catch (VIPException e) { |
| | | vipService.checkOrderPayState(23 + ""); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | for (int i = 0; i < 20; i++) { |
| | | final int p=i; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | HttpUtil.get("http://192.168.3.122:8080/BuWan/test/vipPay?id=27"); |
| | | System.out.println("执行完成:"+p); |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |