#297 - Upgraded to Boot 2.0 and Spring Data Kay.
Bumped version number to 2.0. Upgraded to Spring Boot 2.0. Stuff disabled in the meantime: - Cassandra: needs API adaptions in configuration - JPA > Security: test fails with weird Hibernate error - Redis > Reactive: API updates needed - Solr: configration updates necessary adjust versions Updated elastic search to the new version. Fixed the reactor version to Bismuth-BUILD-SNAPSHOT. This probably should be undone when boot references the proper bom.
This commit is contained in:
@@ -38,9 +38,9 @@ public interface ItemRepository extends CrudRepository<Item, Long> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#delete(java.io.Serializable)
|
||||
* @see org.springframework.data.repository.CrudRepository#deleteById(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
void delete(Long aLong);
|
||||
void deleteById(Long aLong);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class MethodLevelSecurityTests {
|
||||
}
|
||||
|
||||
try {
|
||||
itemRepository.delete(1L);
|
||||
itemRepository.deleteById(1L);
|
||||
fail("Expected a security error");
|
||||
} catch (AuthenticationCredentialsNotFoundException e) {
|
||||
// expected
|
||||
@@ -83,7 +83,7 @@ public class MethodLevelSecurityTests {
|
||||
// expected
|
||||
}
|
||||
try {
|
||||
itemRepository.delete(1L);
|
||||
itemRepository.deleteById(1L);
|
||||
fail("Expected a security error");
|
||||
} catch (AccessDeniedException e) {
|
||||
// expected
|
||||
@@ -96,7 +96,9 @@ public class MethodLevelSecurityTests {
|
||||
SecurityUtils.runAs("system", "system", "ROLE_USER", "ROLE_ADMIN");
|
||||
|
||||
itemRepository.findAll();
|
||||
itemRepository.save(new Item("MacBook Pro"));
|
||||
itemRepository.delete(1L);
|
||||
|
||||
Item item = itemRepository.save(new Item("MacBook Pro"));
|
||||
|
||||
itemRepository.deleteById(item.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package example.springdata.rest.security;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
|
||||
|
||||
@@ -70,8 +69,7 @@ public class UrlLevelSecurityTests {
|
||||
mvc.perform(get("/").//
|
||||
accept(MediaTypes.HAL_JSON)).//
|
||||
andExpect(content().contentTypeCompatibleWith(MediaTypes.HAL_JSON)).//
|
||||
andExpect(status().isOk()).//
|
||||
andDo(print());
|
||||
andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -80,8 +78,7 @@ public class UrlLevelSecurityTests {
|
||||
mvc.perform(post("/employees").//
|
||||
content(PAYLOAD).//
|
||||
accept(MediaTypes.HAL_JSON)).//
|
||||
andExpect(status().isUnauthorized()).//
|
||||
andDo(print());
|
||||
andExpect(status().isUnauthorized());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -94,13 +91,11 @@ public class UrlLevelSecurityTests {
|
||||
mvc.perform(get("/employees").//
|
||||
headers(headers)).//
|
||||
andExpect(content().contentTypeCompatibleWith(MediaTypes.HAL_JSON)).//
|
||||
andExpect(status().isOk()).//
|
||||
andDo(print());
|
||||
andExpect(status().isOk());
|
||||
|
||||
mvc.perform(post("/employees").//
|
||||
headers(headers)).//
|
||||
andExpect(status().isForbidden()).//
|
||||
andDo(print());
|
||||
andExpect(status().isForbidden());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -113,8 +108,7 @@ public class UrlLevelSecurityTests {
|
||||
mvc.perform(get("/employees").//
|
||||
headers(headers)).//
|
||||
andExpect(content().contentTypeCompatibleWith(MediaTypes.HAL_JSON)).//
|
||||
andExpect(status().isOk()).//
|
||||
andDo(print());
|
||||
andExpect(status().isOk());
|
||||
|
||||
headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
|
||||
@@ -124,7 +118,6 @@ public class UrlLevelSecurityTests {
|
||||
headers(headers))
|
||||
.//
|
||||
andExpect(status().isCreated()).//
|
||||
andDo(print()).//
|
||||
andReturn().getResponse().getHeader(HttpHeaders.LOCATION);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Reference in New Issue
Block a user