@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package example.springdata.cassandra.streamoptional;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import example.springdata.cassandra.util.CassandraKeyspace;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@@ -35,13 +35,6 @@
|
||||
<artifactId>spring-boot-starter-data-cassandra</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Required for Embedded Cassandra -->
|
||||
<dependency>
|
||||
<groupId>com.codahale.metrics</groupId>
|
||||
<artifactId>metrics-core</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -18,10 +18,10 @@
|
||||
|
||||
<modules>
|
||||
<module>bom</module>
|
||||
<!-- <module>couchbase</module> -->
|
||||
<!-- <module>couchbase</module> Bug in Couchbase SDK -->
|
||||
<module>cassandra</module>
|
||||
<module>elasticsearch</module>
|
||||
<!-- <module>geode</module> -->
|
||||
<!-- <module>geode</module> Geode isn't Java 16-ready -->
|
||||
<module>jdbc</module>
|
||||
<module>jpa</module>
|
||||
<module>ldap</module>
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package example.springdata.rest.headers;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -30,7 +30,7 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
public class Address {
|
||||
|
||||
@GeneratedValue @Id//
|
||||
@GeneratedValue @Id //
|
||||
private Long id;
|
||||
private final String street, zipCode, city, state;
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package example.springdata.rest.headers;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
@@ -25,9 +28,6 @@ import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Version;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Customer {
|
||||
private final String firstname, lastname;
|
||||
private final Gender gender;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)//
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) //
|
||||
private final Address address;
|
||||
|
||||
Customer() {
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package example.springdata.rest.headers;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests to bootstrap the application.
|
||||
*
|
||||
|
||||
@@ -21,13 +21,11 @@ import static org.springframework.restdocs.RestDocumentation.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.restdocs.config.RestDocumentationConfigurer;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package example.springdata.multistore.person;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* A person.
|
||||
*
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package example.springdata.rest.projections;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -30,7 +30,7 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
public class Address {
|
||||
|
||||
@GeneratedValue @Id//
|
||||
@GeneratedValue @Id //
|
||||
private Long id;
|
||||
private final String street, zipCode, city, state;
|
||||
|
||||
|
||||
@@ -15,15 +15,15 @@
|
||||
*/
|
||||
package example.springdata.rest.projections;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ public class Customer {
|
||||
private final String firstname, lastname;
|
||||
private final Gender gender;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)//
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) //
|
||||
private final Address address;
|
||||
|
||||
Customer() {
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
*/
|
||||
package example.springdata.rest.projections;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package example.springdata.rest.projections;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,8 +27,6 @@ import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -34,13 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class Order {
|
||||
|
||||
@Id @GeneratedValue//
|
||||
@Id @GeneratedValue //
|
||||
private Long id;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)//
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) //
|
||||
private List<LineItem> items = new ArrayList<>();
|
||||
|
||||
@ManyToOne//
|
||||
@ManyToOne //
|
||||
private Customer customer;
|
||||
|
||||
public Order add(LineItem item) {
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
*/
|
||||
package example.springdata.rest.projections;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests to bootstrap the application.
|
||||
*
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package example.springdata.rest.projections;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -24,8 +26,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.projection.ProjectionFactory;
|
||||
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test cases showing the programatic use of a {@link ProjectionFactory}.
|
||||
*
|
||||
|
||||
@@ -29,8 +29,6 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.User.UserBuilder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
|
||||
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package example.springdata.rest.security;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package example.springdata.rest.security;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Domain object for an item managed by the company.
|
||||
*
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package example.springdata.rest.security;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -26,9 +26,6 @@ import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* Collection of test cases used to verify method-level security.
|
||||
*
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package example.springdata.rest.security;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.mongodb.core.MongoOperations;
|
||||
import org.springframework.data.mongodb.core.index.IndexDefinition;
|
||||
import org.springframework.data.mongodb.core.index.IndexResolver;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -53,8 +52,7 @@ public class StoreInitializer {
|
||||
return;
|
||||
}
|
||||
|
||||
var indexDefinitions = IndexResolver
|
||||
.create(operations.getConverter().getMappingContext())
|
||||
var indexDefinitions = IndexResolver.create(operations.getConverter().getMappingContext())
|
||||
.resolveIndexFor(Store.class);
|
||||
|
||||
indexDefinitions.forEach(operations.indexOps(Store.class)::ensureIndex);
|
||||
|
||||
@@ -22,13 +22,10 @@ import example.springdata.rest.stores.StoreRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.geo.Distance;
|
||||
import org.springframework.data.geo.Metrics;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Random port for embedded MongoDB
|
||||
spring.data.mongodb.port=0
|
||||
|
||||
# Spring Data REST
|
||||
spring.data.rest.base-path=/api
|
||||
|
||||
@@ -97,7 +97,6 @@ class StarbucksClient {
|
||||
forEach(store -> log.info("{} - {}", store.name, store.address));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void accessServiceUsingRestTemplate() {
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package example.springdata.rest.stores;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import example.springdata.rest.stores.Store.Address;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -22,16 +24,14 @@ import java.util.UUID;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.geo.Distance;
|
||||
import org.springframework.data.geo.Metrics;
|
||||
import org.springframework.data.geo.Point;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link StoreRepository}.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user