package cn.wise.sc.energy.power.plant.business.service.impl;

import com.playtika.test.common.spring.EmbeddedContainersShutdownAutoConfiguration;
import com.playtika.test.mysql.EmbeddedMySQLBootstrapConfiguration;
import com.playtika.test.mysql.EmbeddedMySQLDependenciesAutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;

/**
 * @description: 基础测试注解依赖
 * @author: qh
 * @create: 2020-07-22 11:12
 **/
@DataJpaTest
@EnableAutoConfiguration
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@ComponentScan(basePackageClasses = BaseServiceImpl.class)
@Import({
        //扫描TestContainer组件的配置文件 去com.playtika.test.组件名 下找配置文件
        EmbeddedMySQLDependenciesAutoConfiguration.class,  //配置一些依赖项,如Mysql的Datasource
        EmbeddedMySQLBootstrapConfiguration.class, //Docker镜像的初始化和启动
        EmbeddedContainersShutdownAutoConfiguration.class,//解决AllContainers这个Bean扫描不进去
        TestContainerDependenciesConfig.class //配置EmbeddedMySQLDependenciesAutoConfiguration的依赖项datasource
})
@ContextConfiguration
@TestPropertySource(properties = "embedded.mysql.enabled:true")
public class BaseTestAnnotation {
}
