DubboServiceTest.java 2.47 KB
package cn.com.glsx.admin.modules.service;

import cn.com.glsx.Application;
import cn.hutool.json.JSONUtil;
import com.glsx.biz.common.base.entity.CarBrandSelected;
import com.glsx.biz.common.base.entity.Carbrand;
import com.glsx.biz.common.base.entity.Carseries;
import com.glsx.biz.common.base.entity.Cartype;
import com.glsx.biz.common.base.service.CarbrandService;
import com.glsx.biz.common.base.service.CarseriesService;
import com.glsx.biz.common.base.service.CartypeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DubboServiceTest {


    @DubboReference(version = "2.2.0")
    private CarbrandService carbrandService;

    @DubboReference(version = "2.2.0")
    private CarseriesService carseriesService;

    @DubboReference(version = "2.2.0")
    private CartypeService cartypeService;

    @Test
    public void getAllCarbrand() {
//        List<Carbrand> carbrandList = carbrandService.getParentCarbrandList();
//        System.out.println(JSONUtil.toJsonStr(carbrandList));

//        List<Carbrand> carbrandList2 = carbrandService.listSubCarbrandByParentId(2165);
//        System.out.println(JSONUtil.toJsonStr(carbrandList2));

        List<CarBrandSelected> carbrandList3 = carbrandService.getCarInfoCompleteForSelected();
        System.out.println(JSONUtil.toJsonStr(carbrandList3));

//        List<Carbrand> carbrandList22 = carbrandService.findByBraLetter("东风本田");
//        List<Carbrand> carbrandList23 = carbrandService.findByName("东风本田");
//        System.out.println(JSONUtil.toJsonStr(carbrandList22));
//        System.out.println(JSONUtil.toJsonStr(carbrandList23));
    }

    @Test
    public void getCarseries() {
        List<Carseries> carseriesList = carseriesService.getByCarbrandId(2167);
        System.out.println(JSONUtil.toJsonStr(carseriesList));
    }

    @Test
    public void getCartype() {
        List<Cartype> cartypeList = cartypeService.getBySeiesId(1145108);
        System.out.println(JSONUtil.toJsonStr(cartypeList));

//        Cartype cartype1 =  cartypeService.getByCarTypeId(Math.toIntExact(43083L));
//        System.out.println(111);
    }

}