All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.codeages.framework.BaseTest Maven / Gradle / Ivy

There is a newer version: 1.0.7-RELEASE
Show newest version
package test.codeages.framework;

import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = {BaseTest.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@EntityScan({"test.codeages", "com.codeages"})
@EnableJpaRepositories({"test.codeages", "com.codeages"})
@ComponentScan(basePackages={"test.codeages","com.codeages" })
@EnableJpaAuditing
@EnableCaching
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
@ActiveProfiles("test")
public class BaseTest {

    @Autowired
    private MigrationStrategy migrationStrategy;

    @Autowired
    private RedisConnectionFactory connectionFactory;

    @Before
    public void setUp() {
        migrationStrategy.migrate();
        connectionFactory.getConnection().flushAll();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy