package test.com.izouma.awesomeadmin.datasource;


import com.izouma.awesomeadmin.datasource.DataService;
import com.izouma.awesomeadmin.dto.Page;
import com.izouma.awesomeadmin.model.SqlServerTest;
import com.izouma.awesomeadmin.model.SuperUser;
import com.izouma.awesomeadmin.model.Zouma;
import com.izouma.awesomeadmin.service.SuperUserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

/**
 * 配置spring和junit整合，junit启动时加载springIOC容器
 * spring-test,junit
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring/applicationContext.xml"})
public class ServiceTest {

    @Autowired
    DataService dataService;

    @Autowired
    SuperUserService superUserService;

    @Test
    public void test() {

        List<SuperUser> superUserList = dataService.getSuperUserList();

        System.out.println(superUserList.toString());

        List<Zouma> zoumaList = dataService.getZoumaList();

        System.out.println(zoumaList.toString());

        Page page = new Page();
        List<SqlServerTest> sqlServerTestList = dataService.getSqlServerTestByPage(page);

        System.out.println(page);
        System.out.println(sqlServerTestList.toString());


        List<SuperUser> superUserList1 = superUserService.getSuperUserByPage(page);

        System.out.println(superUserList1.toString());
    }


}



