JAVA-22075 move Blaze persistence module to Spring Boot parent two (#14196)
* JAVA-22075 move Blaze persistence module to Spring Boot parent two * JAVA-22075 remove unnecessary TestContextConfig file
This commit is contained in:
parent
28cec53e65
commit
5a1906d88c
|
@ -8,10 +8,10 @@
|
|||
<name>blaze-persistence</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<relativePath/>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencyManagement>
|
||||
|
@ -42,7 +42,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.blazebit</groupId>
|
||||
<artifactId>blaze-persistence-integration-hibernate-5.4</artifactId>
|
||||
<artifactId>blaze-persistence-integration-hibernate-5.6</artifactId>
|
||||
</dependency>
|
||||
<!-- Entity View dependencies -->
|
||||
<dependency>
|
||||
|
@ -64,7 +64,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.blazebit</groupId>
|
||||
<artifactId>blaze-persistence-integration-spring-data-2.4</artifactId>
|
||||
<artifactId>blaze-persistence-integration-spring-data-2.7</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring dependencies -->
|
||||
<dependency>
|
||||
|
@ -81,8 +81,8 @@
|
|||
</dependency>
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -7,3 +7,4 @@ spring.datasource.driverClassName=org.h2.Driver
|
|||
spring.datasource.username=sa
|
||||
spring.datasource.password=sa
|
||||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
||||
spring.jpa.defer-datasource-initialization=true
|
|
@ -1,21 +1,19 @@
|
|||
package com.baeldung;
|
||||
|
||||
import com.baeldung.model.Person;
|
||||
import com.baeldung.model.Post;
|
||||
import com.baeldung.repository.PersonRepository;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@ContextConfiguration(classes = TestContextConfig.class)
|
||||
@ExtendWith(SpringExtension.class)
|
||||
import com.baeldung.model.Person;
|
||||
import com.baeldung.model.Post;
|
||||
import com.baeldung.repository.PersonRepository;
|
||||
|
||||
@SpringBootTest
|
||||
public class PersonUnitTest {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
package com.baeldung;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import com.baeldung.model.Post;
|
||||
import com.baeldung.repository.PostRepository;
|
||||
import com.baeldung.repository.PostViewRepository;
|
||||
import com.baeldung.view.PostView;
|
||||
import com.baeldung.view.PostWithAuthorView;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@ContextConfiguration(classes = TestContextConfig.class)
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
public class PostUnitTest {
|
||||
|
||||
@Autowired
|
||||
|
@ -36,8 +34,7 @@ public class PostUnitTest {
|
|||
|
||||
@Test
|
||||
public void givenPostIdAndAuthorName_whenFind_thenReturnCorrectResult() {
|
||||
final Iterable<PostWithAuthorView> listIterable =
|
||||
postRepository.findBy("Spring", "Peter");
|
||||
final Iterable<PostWithAuthorView> listIterable = postRepository.findBy("Spring", "Peter");
|
||||
final List<PostView> list = new ArrayList<>();
|
||||
listIterable.forEach(list::add);
|
||||
assertEquals(4, list.size());
|
||||
|
@ -50,5 +47,4 @@ public class PostUnitTest {
|
|||
listIterable.forEach(list::add);
|
||||
assertEquals(7, list.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package com.baeldung;
|
||||
|
||||
import com.blazebit.persistence.integration.view.spring.EnableEntityViews;
|
||||
import com.blazebit.persistence.spring.data.repository.config.EnableBlazeRepositories;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan("com.baeldung")
|
||||
@EnableEntityViews(basePackages = {"com.baeldung.view"})
|
||||
@EnableBlazeRepositories(basePackages = "com.baeldung.repository")
|
||||
public class TestContextConfig {
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue