Commit 0d222104 authored by Maxym Borodenko's avatar Maxym Borodenko

Upgrade to Spring Data JPA 2.2.5 and Hibernate 5.4

parent c83715cf
......@@ -112,7 +112,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<scope>provided</scope>
</dependency>
......
......@@ -22,7 +22,7 @@ import org.genesys.blocks.auditlog.model.AuditLog;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;
/**
......@@ -31,7 +31,7 @@ import org.springframework.stereotype.Repository;
* @author Matija Obreza
*/
@Repository
public interface AuditLogRepository extends AuditLogCustomRepository, JpaRepository<AuditLog, Long>, QueryDslPredicateExecutor<AuditLog> {
public interface AuditLogRepository extends AuditLogCustomRepository, JpaRepository<AuditLog, Long>, QuerydslPredicateExecutor<AuditLog> {
/**
* List audit log entries in descending order (most recent first).
......
......@@ -69,7 +69,7 @@ public class AuditLogRepositoryCustomImpl implements AuditLogCustomRepository {
*/
@Override
public AuditLog getLastAuditLog(final EntityId entity) {
final List<AuditLog> l = repository.listAuditLogs(entity.getClass().getName(), entity.getId(), new PageRequest(0, 1));
final List<AuditLog> l = repository.listAuditLogs(entity.getClass().getName(), entity.getId(), PageRequest.of(0, 1));
return (l == null) || l.isEmpty() ? null : l.get(0);
}
......@@ -80,7 +80,7 @@ public class AuditLogRepositoryCustomImpl implements AuditLogCustomRepository {
*/
@Override
public AuditLog getLastAuditLog(final EntityId entity, final String propertyName) {
final List<AuditLog> l = repository.listAuditLogs(entity.getClass().getName(), entity.getId(), propertyName, new PageRequest(0, 1));
final List<AuditLog> l = repository.listAuditLogs(entity.getClass().getName(), entity.getId(), propertyName, PageRequest.of(0, 1));
return (l == null) || l.isEmpty() ? null : l.get(0);
}
......
......@@ -72,7 +72,7 @@ public class AuditTrailServiceImpl implements AuditTrailService {
@Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED)
public List<AuditLog> addAuditLogs(final Set<TransactionAuditLog> auditLogs) {
return auditLogRepository.save(auditLogs.stream().map(tlog -> toAuditLog(tlog)).collect(Collectors.toList()));
return auditLogRepository.saveAll(auditLogs.stream().map(tlog -> toAuditLog(tlog)).collect(Collectors.toList()));
}
/*
......
......@@ -15,6 +15,8 @@
*/
package org.genesys.blocks.auditlog.service.impl;
import java.util.Optional;
import javax.persistence.PersistenceException;
import org.genesys.blocks.auditlog.service.ClassPKService;
......@@ -96,8 +98,8 @@ public class ClassPKServiceImpl implements ClassPKService {
@Override
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRES_NEW)
public String getClassName(final Long id) {
final ClassPK classPK = classPkRepository.findOne(id);
return classPK.getClassname();
Optional<ClassPK> classPK = classPkRepository.findById(id);
return classPK.map(ClassPK::getClassname).orElse(null);
}
/*
......
......@@ -71,7 +71,7 @@ public class AuditLogEntityTest extends EntityTest<AuditLog, AuditLogRepository>
repository.save(log);
assertThat(log.getId(), not(nullValue()));
final AuditLog l = repository.findOne(log.getId());
final AuditLog l = repository.findById(log.getId()).orElse(null);
assertThat(l, not(nullValue()));
assertThat(l.getId(), equalTo(log.getId()));
assertThat(l.getClassPk(), not(nullValue()));
......
......@@ -16,6 +16,7 @@
package org.genesys.blocks.auditlog.model;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import org.genesys.blocks.auditlog.test.EntityTest;
......@@ -60,7 +61,8 @@ public class ClassPKEntityTest extends EntityTest<ClassPK, ClassPKRepository> {
public void successfulPersist() {
final ClassPK cpk = repository.save(makeClassPK(Long.class));
final ClassPK l = repository.findOne(cpk.getId());
final ClassPK l = repository.findById(cpk.getId()).orElse(null);
assertThat(l, notNullValue());
assertThat(l.getId(), equalTo(cpk.getId()));
assertThat(l.getClassname(), equalTo(cpk.getClassname()));
}
......
......@@ -64,7 +64,7 @@ public class ExampleAuditedEntityServiceImpl implements ExampleAuditedEntityServ
@Override
public ExampleAuditedEntity get(Long id) {
return exampleAuditedEntityRepository.findOne(id);
return exampleAuditedEntityRepository.findById(id).orElse(null);
}
}
......@@ -105,7 +105,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<scope>provided</scope>
</dependency>
......
......@@ -40,14 +40,15 @@
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
<jackson.version>2.9.8</jackson.version>
<spring.version>4.3.22.RELEASE</spring.version>
<spring.data.version>1.11.18.RELEASE</spring.data.version>
<spring.security.oauth2.version>2.3.3.RELEASE</spring.security.oauth2.version>
<querydsl.version>4.1.4</querydsl.version>
<spring.security.version>4.2.11.RELEASE</spring.security.version>
<hibernate.version>5.2.17.Final</hibernate.version>
<hsqldb.version>2.4.1</hsqldb.version>
<jackson.version>2.10.1</jackson.version>
<spring.version>5.2.4.RELEASE</spring.version>
<spring.data.version>2.2.5.RELEASE</spring.data.version>
<spring.security.oauth2.version>2.3.4.RELEASE</spring.security.oauth2.version>
<querydsl.version>4.2.1</querydsl.version>
<spring.security.version>5.2.2.RELEASE</spring.security.version>
<!--<hibernate.version>5.3.15.Final</hibernate.version>-->
<hibernate.version>5.4.12.Final</hibernate.version>
<hsqldb.version>2.5.0</hsqldb.version>
<tomcat-jdbc.version>8.5.8</tomcat-jdbc.version>
</properties>
......
......@@ -85,7 +85,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<scope>provided</scope>
</dependency>
......@@ -104,6 +104,13 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
......@@ -139,6 +146,13 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
......
......@@ -19,14 +19,14 @@ import org.genesys.blocks.oauth.model.OAuthClient;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;
/**
* The Interface OAuthClientRepository.
*/
@Repository
public interface OAuthClientRepository extends JpaRepository<OAuthClient, Long>, QueryDslPredicateExecutor<OAuthClient> {
public interface OAuthClientRepository extends JpaRepository<OAuthClient, Long>, QuerydslPredicateExecutor<OAuthClient> {
/**
* Find by client id.
......
......@@ -97,7 +97,7 @@ public class OAuthServiceImpl implements OAuthClientDetailsService {
*/
@Override
public List<OAuthClient> listClientDetails() {
return oauthClientRepository.findAll(new Sort("clientId"));
return oauthClientRepository.findAll(Sort.by("clientId"));
}
@Override
......@@ -212,14 +212,14 @@ public class OAuthServiceImpl implements OAuthClientDetailsService {
// description contains
.or(QOAuthClient.oAuthClient.description.contains(term));
return oauthClientRepository.findAll(predicate, new PageRequest(0, Math.min(100, limit), new Sort("title"))).getContent();
return oauthClientRepository.findAll(predicate, PageRequest.of(0, Math.min(100, limit), Sort.by("title"))).getContent();
}
@Override
@Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#oauthClient, 'ADMINISTRATION')")
public final String resetSecret(OAuthClient oauthClient) {
oauthClient = oauthClientRepository.findOne(oauthClient.getId());
oauthClient = oauthClientRepository.findById(oauthClient.getId()).orElse(oauthClient);
String oldHash = oauthClient.getClientSecret();
String newHash = null;
......@@ -238,7 +238,7 @@ public class OAuthServiceImpl implements OAuthClientDetailsService {
@Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#oauthClient, 'ADMINISTRATION')")
public final OAuthClient removeSecret(OAuthClient oauthClient) {
oauthClient = oauthClientRepository.findOne(oauthClient.getId());
oauthClient = oauthClientRepository.findById(oauthClient.getId()).orElse(oauthClient);
if (oauthClient.getAuthorizedGrantTypes().contains("client_credentials")) {
throw new RuntimeException("OAuth Client with client_credentials grant must have a secret");
}
......
......@@ -15,6 +15,8 @@
*/
package org.genesys.blocks.security;
import java.util.Optional;
import org.genesys.blocks.security.model.AclSid;
import org.genesys.blocks.security.service.CustomAclService;
import org.slf4j.Logger;
......@@ -42,22 +44,22 @@ public class SpringSecurityAuditorAware implements AuditorAware<Long> {
* @see org.springframework.data.domain.AuditorAware#getCurrentAuditor()
*/
@Override
public Long getCurrentAuditor() {
public Optional<Long> getCurrentAuditor() {
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
Object principal = authentication.getPrincipal();
if (principal instanceof AclSid) {
return ((AclSid) principal).getId();
return Optional.of(((AclSid) principal).getId());
} else if (principal instanceof String) {
return aclService.getSidId((String) principal);
return Optional.of(aclService.getSidId((String) principal));
} else {
LOG.warn("Principal {} is not AclSid, but type {}. Auth of type {}", principal, principal.getClass(), authentication.getClass());
}
}
LOG.info("No security principal available.");
return null;
return Optional.empty();
}
}
......@@ -60,7 +60,7 @@ public class AclAssignerAspect {
* @param result the result
* @return the object
*/
@AfterReturning(pointcut = "execution(* org.springframework.data.repository.*.save(..)) || execution(* org.springframework.data.jpa.repository.*.save(..)) || execution(* org.springframework.data.jpa.repository.*.saveAndFlush(..))", returning = "result")
@AfterReturning(pointcut = "execution(* org.springframework.data.repository.*.save(..)) || execution(* org.springframework.data.repository.*.saveAll(..)) || execution(* org.springframework.data.jpa.repository.*.save(..)) || execution(* org.springframework.data.jpa.repository.*.saveAndFlush(..))", returning = "result")
public Object afterSaveAclObject(final Object result) {
final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
......@@ -99,8 +99,11 @@ public class AclAssignerAspect {
*
* @param joinPoint the join point
*/
@Before("execution(* org.springframework.data.repository.*.delete(..)) || execution(* org.springframework.data.jpa.repository.*.deleteInBatch(..))")
@Before("execution(* org.springframework.data.repository.*.delete(..)) || execution(* org.springframework.data.repository.*.deleteAll(..)) || execution(* org.springframework.data.jpa.repository.*.deleteInBatch(..))")
public void afterDeleteAclObject(final JoinPoint joinPoint) {
if (joinPoint.getArgs().length == 0) {
return;
}
final Object arg0 = joinPoint.getArgs()[0];
try {
......
......@@ -21,13 +21,13 @@ import org.genesys.blocks.security.model.AclObjectIdentity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.query.Param;
/**
* The Interface AclObjectIdentityPersistence.
*/
public interface AclObjectIdentityPersistence extends JpaRepository<AclObjectIdentity, Long>, QueryDslPredicateExecutor<AclObjectIdentity> {
public interface AclObjectIdentityPersistence extends JpaRepository<AclObjectIdentity, Long>, QuerydslPredicateExecutor<AclObjectIdentity> {
/**
* Find by object id identity and class name.
......
......@@ -174,7 +174,7 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
*/
@Override
public T getUser(final long id) {
final T user = _repository.findOne(id);
final T user = _repository.findById(id).orElse(null);
return deepLoad(user);
}
......@@ -203,7 +203,7 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
@PreAuthorize("hasRole('ADMINISTRATOR') || principal.id == #user.id")
public T updateUser(T user, final String email, final String fullName) throws NotUniqueUserException, UserException {
// reload
user = _repository.findOne(user.getId());
user = _repository.findById(user.getId()).orElse(user);
if (!StringUtils.equals(email, user.getEmail()) && getUserByEmail(email) != null) {
throw new NotUniqueUserException("Email address already registered");
......@@ -237,7 +237,7 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
@Override
@Transactional
public T setRoles(T user, final Set<R> newRoles) {
user = _repository.findOne(user.getId());
user = _repository.findById(user.getId()).orElse(user);
// Remove transient roles
newRoles.removeAll(getDefaultUserRoles());
......@@ -345,7 +345,7 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
@Override
@Transactional
public T setAccountType(T user, AccountType accountType) {
T u = _repository.findOne(user.getId());
T u = _repository.findById(user.getId()).orElse(user);
u.setAccountType(accountType);
if (accountType != AccountType.LOCAL) {
......
......@@ -96,7 +96,7 @@ public class CustomAclServiceImpl implements CustomAclService {
@Override
@Transactional(readOnly = true)
public AclSid getSid(Long id) {
return aclSidPersistence.findOne(id);
return aclSidPersistence.findById(id).orElse(null);
}
......@@ -104,7 +104,7 @@ public class CustomAclServiceImpl implements CustomAclService {
@Transactional(readOnly = true)
@Cacheable(cacheNames = { "aclSidNames" }, key = "#id", unless = "#result == null")
public String getSidName(long id) {
AclSid sid = aclSidPersistence.findOne(id);
AclSid sid = aclSidPersistence.findById(id).orElse(null);
return sid == null ? null : sid.getSid();
}
......@@ -238,7 +238,7 @@ public class CustomAclServiceImpl implements CustomAclService {
@Override
@PreAuthorize("hasRole('ADMINISTRATOR')")
public AclObjectIdentity updateInheriting(final long objectIdIdentity, final boolean entriesInheriting) {
final AclObjectIdentity objectIdentity = aclObjectIdentityPersistence.findOne(objectIdIdentity);
final AclObjectIdentity objectIdentity = aclObjectIdentityPersistence.findById(objectIdIdentity).orElse(null);
if (objectIdentity == null) {
LOG.warn("ACL object identity not found by id={}", objectIdIdentity);
return null;
......@@ -269,13 +269,13 @@ public class CustomAclServiceImpl implements CustomAclService {
@Override
@PreAuthorize("hasRole('ADMINISTRATOR')")
public AclObjectIdentity updateParentObject(final long objectIdIdentity, final long parentObjectId) {
final AclObjectIdentity objectIdentity = aclObjectIdentityPersistence.findOne(objectIdIdentity);
final AclObjectIdentity objectIdentity = aclObjectIdentityPersistence.findById(objectIdIdentity).orElse(null);
if (objectIdentity == null) {
LOG.warn("ACL object identity not found by id={}", objectIdIdentity);
return null;
}
final AclObjectIdentity parentIdentity = aclObjectIdentityPersistence.findOne(parentObjectId);
final AclObjectIdentity parentIdentity = aclObjectIdentityPersistence.findById(parentObjectId).orElse(null);
if (parentIdentity == null) {
LOG.warn("ACL object identity not found by id={}", objectIdIdentity);
return null;
......@@ -321,7 +321,7 @@ public class CustomAclServiceImpl implements CustomAclService {
LOG.info("Deleting ACL data of {}", target);
final List<AclEntry> aclEntries = aclEntryPersistence.findByObjectIdentity(aclObjectIdentity);
if (aclEntries != null) {
aclEntryPersistence.delete(aclEntries);
aclEntryPersistence.deleteAll(aclEntries);
}
aclObjectIdentityPersistence.delete(aclObjectIdentity);
}
......@@ -382,7 +382,7 @@ public class CustomAclServiceImpl implements CustomAclService {
aclEntries.add(aclEntry);
}
// save ACL
aclEntryPersistence.save(aclEntries);
aclEntryPersistence.saveAll(aclEntries);
return getObjectIdentity(objectIdentity.getId());
} finally {
clearAclCache();
......@@ -476,7 +476,7 @@ public class CustomAclServiceImpl implements CustomAclService {
@Transactional(readOnly = true)
@PostAuthorize("returnObject==null or hasRole('ADMINISTRATOR') or hasPermission(#returnObject.objectIdIdentity, #returnObject.aclClass.aclClass, 'READ')")
public AclObjectIdentity getObjectIdentity(final long id) {
return aclObjectIdentityPersistence.findOne(id);
return aclObjectIdentityPersistence.findById(id).orElse(null);
}
/*
......@@ -614,7 +614,7 @@ public class CustomAclServiceImpl implements CustomAclService {
aclEntry.setGranting(permissions.isGranting(aclEntry.getMask()));
}
LOG.info("Saving " + aclEntries);
aclEntryPersistence.save(aclEntries);
aclEntryPersistence.saveAll(aclEntries);
return getObjectIdentity(objectIdentity.getId());
}
......@@ -656,7 +656,7 @@ public class CustomAclServiceImpl implements CustomAclService {
final List<AclEntry> aclEntries = aclEntryPersistence.findBySidAndObjectIdentity(sid, objectIdentity);
// delete ACL entries for sid
LOG.debug("Deleting {} AclEntries for {}", aclEntries.size(), sid);
aclEntryPersistence.delete(aclEntries);
aclEntryPersistence.deleteAll(aclEntries);
return getObjectIdentity(objectIdentity.getId());
} finally {
......@@ -812,7 +812,7 @@ public class CustomAclServiceImpl implements CustomAclService {
LOG.info("{} with OID={} no longer exists, clearing ACL", clazz.getName(), OID.getObjectIdIdentity());
final List<AclEntry> aclEntries = aclEntryPersistence.findByObjectIdentity(OID);
if (aclEntries != null) {
aclEntryPersistence.delete(aclEntries);
aclEntryPersistence.deleteAll(aclEntries);
}
aclObjectIdentityPersistence.resetChildrenOfOID(OID);
aclObjectIdentityPersistence.delete(OID);
......@@ -821,7 +821,7 @@ public class CustomAclServiceImpl implements CustomAclService {
LOG.info("{} for OID={} no longer exists, clearing ACL", OID.getAclClass().getAclClass(), OID.getObjectIdIdentity());
final List<AclEntry> aclEntries = aclEntryPersistence.findByObjectIdentity(OID);
if (aclEntries != null) {
aclEntryPersistence.delete(aclEntries);
aclEntryPersistence.deleteAll(aclEntries);
}
aclObjectIdentityPersistence.resetChildrenOfOID(OID);
aclObjectIdentityPersistence.delete(OID);
......
......@@ -90,7 +90,7 @@ public class OAuth2GrantTypeTest extends AbstractRestTest {
client = oAuthClientRepository.save(client);
assertThat("OAuthClient#id must be generated", client.getId(), not(nullValue()));
final OAuthClient storedClient = oAuthClientRepository.findOne(client.getId());
final OAuthClient storedClient = oAuthClientRepository.findById(client.getId()).orElse(null);
assertThat("Could not load persisted OAuthClient", storedClient, not(nullValue()));
assertThat("OAuthClient#id does not match", storedClient.getId(), equalTo(client.getId()));
......@@ -119,7 +119,7 @@ public class OAuth2GrantTypeTest extends AbstractRestTest {
final OAuthClient client = new OAuthClient();
client.setTitle("JUnit OAuth client");
client.setClientId(DEFAULT_CLIENT_ID);
client.setClientSecret(DEFAULT_CLIENT_SECRET);
client.setClientSecret(passwordEncoder.encode(DEFAULT_CLIENT_SECRET));
client.getAuthorizedGrantTypes().add("client_credentials");
client.getRoles().add(OAuthRole.CLIENT);
client.getScope().add("read");
......
......@@ -49,7 +49,7 @@ public class OAuthClientTest extends AbstractRestTest {
assertThat("OAuthClient#clientSecret must be generated", client.getClientSecret(), not(nullValue()));
assertThat("OAuthClient#clientSecret must be hashed", client.getClientSecret(), startsWith("$2a$"));
final OAuthClient storedClient = oAuthClientRepository.findOne(client.getId());
final OAuthClient storedClient = oAuthClientRepository.findById(client.getId()).orElse(null);
assertThat("Could not load persisted OAuthClient", storedClient, not(nullValue()));
assertThat("OAuthClient#id does not match", storedClient.getId(), equalTo(client.getId()));
......
......@@ -131,7 +131,7 @@ public class AclAssignerTest extends BaseTest {
assertThat(aclService.getAclEntries(acl1), hasSize(greaterThan(0)));
LOG.info("Removing entity by ID");
aclEntityPersistence.delete(acl1.getId());
aclEntityPersistence.deleteById(acl1.getId());
LOG.info("Removed entity");
assertThat(aclEntryPersistence.count(), equalTo(0l));
assertThat(aclObjectIdentityPersistence.count(), equalTo(0l));
......@@ -168,11 +168,11 @@ public class AclAssignerTest extends BaseTest {
final AclEntity acl2 = new AclEntity();
acl2.setName("Test 2");
final List<AclEntity> saved = aclEntityPersistence.save(Lists.newArrayList(acl1, acl2));
final List<AclEntity> saved = aclEntityPersistence.saveAll(Lists.newArrayList(acl1, acl2));
assertThat(aclService.getAclEntries(saved.get(0)), hasSize(greaterThan(0)));
LOG.info("Removing entities");
aclEntityPersistence.delete(aclEntityPersistence.findAll());
aclEntityPersistence.deleteAll(aclEntityPersistence.findAll());
LOG.info("Removed entities");
assertThat(aclEntryPersistence.count(), equalTo(0l));
assertThat(aclObjectIdentityPersistence.count(), equalTo(0l));
......@@ -190,7 +190,7 @@ public class AclAssignerTest extends BaseTest {
final AclEntity acl2 = new AclEntity();
acl2.setName("Test 2");
final List<AclEntity> saved = aclEntityPersistence.save(Lists.newArrayList(acl1, acl2));
final List<AclEntity> saved = aclEntityPersistence.saveAll(Lists.newArrayList(acl1, acl2));
assertThat(aclService.getAclEntries(saved.get(0)), hasSize(greaterThan(0)));
LOG.info("Removing entities");
......
......@@ -36,7 +36,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* The Class AbstractRestTest.
......@@ -54,7 +54,7 @@ public abstract class AbstractRestTest extends ServiceTest {
@Configuration
@EnableWebMvc
@DirtiesContext(hierarchyMode = HierarchyMode.CURRENT_LEVEL, classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public static class Config extends WebMvcConfigurerAdapter {
public static class Config implements WebMvcConfigurer {
/**
* Jackson message converter.
......@@ -83,7 +83,6 @@ public abstract class AbstractRestTest extends ServiceTest {
converters.add(jacksonMessageConverter());
// Raw request body -- needed for uploading raw files
converters.add(new ByteArrayHttpMessageConverter());
super.configureMessageConverters(converters);
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment