fix: add embedded properties to tests (#12714)

This commit is contained in:
lucaCambi77 2022-09-11 11:54:49 +02:00 committed by GitHub
parent 66944937b5
commit eebbdf82d9
8 changed files with 18 additions and 8 deletions

View File

@ -7,7 +7,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@SpringBootApplication(exclude = EmbeddedMongoAutoConfiguration.class)
@SpringBootApplication
@PropertySource("classpath:boot.collection.name/app.properties")
@EnableMongoRepositories(basePackages = { "com.baeldung.boot.collection.name" })
public class SpringBootCollectionNameApplication {

View File

@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@SpringBootApplication(exclude = EmbeddedMongoAutoConfiguration.class)
@SpringBootApplication
@EnableMongoRepositories(basePackages = { "com.baeldung.boot.composite.key" })
public class SpringBootCompositeKeyApplication {
public static void main(String... args) {

View File

@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@SpringBootApplication(exclude = EmbeddedMongoAutoConfiguration.class)
@SpringBootApplication
@EnableMongoRepositories(basePackages = { "com.baeldung.boot.count" })
public class SpringBootCountApplication {
public static void main(String... args) {

View File

@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoCo
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@SpringBootApplication(exclude = EmbeddedMongoAutoConfiguration.class)
@SpringBootApplication
@PropertySource("classpath:boot.unique.field/app.properties")
@EnableMongoRepositories(basePackages = { "com.baeldung.boot.unique.field" })
public class SpringBootUniqueFieldApplication {

View File

@ -10,16 +10,19 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.boot.collection.name.SpringBootCollectionNameApplication;
import com.baeldung.boot.collection.name.data.Compilation;
import com.baeldung.boot.collection.name.data.MusicAlbum;
import com.baeldung.boot.collection.name.data.MusicTrack;
import com.baeldung.boot.collection.name.data.Store;
@SpringBootTest
@SpringBootTest(classes = SpringBootCollectionNameApplication.class)
@DirtiesContext
@RunWith(SpringRunner.class)
@TestPropertySource("/embedded.properties")
public class MusicStoreServiceIntegrationTest {
@Autowired
private MusicStoreService service;

View File

@ -12,15 +12,17 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.boot.composite.key.data.Ticket;
import com.baeldung.boot.composite.key.data.TicketId;
import com.baeldung.boot.composite.key.service.CustomerService;
@SpringBootTest
@SpringBootTest(classes = SpringBootCompositeKeyApplication.class)
@DirtiesContext
@RunWith(SpringRunner.class)
@TestPropertySource("/embedded.properties")
public class CustomerServiceIntegrationTest {
@Autowired
private CustomerService service;

View File

@ -10,13 +10,16 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.boot.count.SpringBootCountApplication;
import com.baeldung.boot.count.data.Car;
@SpringBootTest
@SpringBootTest(classes = SpringBootCountApplication.class)
@DirtiesContext
@RunWith(SpringRunner.class)
@TestPropertySource("/embedded.properties")
public class CountCarServiceIntegrationTest {
@Autowired
private CountCarService service;

View File

@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.boot.unique.field.dao.AssetRepository;
@ -20,9 +21,10 @@ import com.baeldung.boot.unique.field.data.Customer;
import com.baeldung.boot.unique.field.data.Sale;
import com.baeldung.boot.unique.field.data.SaleId;
@SpringBootTest
@SpringBootTest(classes = SpringBootUniqueFieldApplication.class)
@DirtiesContext
@RunWith(SpringRunner.class)
@TestPropertySource("/embedded.properties")
public class UniqueFieldIntegrationTest {
@Autowired
private SaleRepository saleRepo;