Commit 275b6b70 authored by Matija Obreza's avatar Matija Obreza

Merge branch '28-hibernate-5' into 'master'

Resolve "Hibernate 5"

Closes #28

See merge request !40
parents cddd03ff 1c3080b9
# Changelog # Changelog
## 1.2 Release
April 14, 2020
1.2 is a service release that changes entity inheritance type to JOINED
for improved query performance. See file-repository-core/src/main/resources/liquibase/liquibase-changeLog.yml
for database upgrades.
- cc20fbe JOINED inheritance strategy
## 1.1 Release ## 1.1 Release
April 2, 2020 April 2, 2020
......
...@@ -20,14 +20,13 @@ ...@@ -20,14 +20,13 @@
<parent> <parent>
<groupId>org.genesys-pgr</groupId> <groupId>org.genesys-pgr</groupId>
<artifactId>file-repository</artifactId> <artifactId>file-repository</artifactId>
<version>1.2-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>file-repository-core</artifactId> <artifactId>file-repository-core</artifactId>
<name>Genesys File Repository</name> <name>Genesys File Repository</name>
<description>Simple DublinCore file repository</description> <description>Simple DublinCore file repository</description>
<properties> <properties>
<commons.io.version>2.4</commons.io.version>
<tika.version>1.14</tika.version> <tika.version>1.14</tika.version>
</properties> </properties>
...@@ -125,6 +124,13 @@ ...@@ -125,6 +124,13 @@
<version>${spring.security.version}</version> <version>${spring.security.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${org.hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId> <artifactId>spring-security-test</artifactId>
...@@ -162,7 +168,7 @@ ...@@ -162,7 +168,7 @@
<dependency> <dependency>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId> <artifactId>spring-data-elasticsearch</artifactId>
<version>2.1.15.RELEASE</version> <version>3.2.5.RELEASE</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
...@@ -175,7 +181,7 @@ ...@@ -175,7 +181,7 @@
<!-- Hibernate dependencies --> <!-- Hibernate dependencies -->
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId> <artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version> <version>${hibernate.version}</version>
</dependency> </dependency>
...@@ -204,7 +210,7 @@ ...@@ -204,7 +210,7 @@
<dependency> <dependency>
<groupId>org.genesys-pgr</groupId> <groupId>org.genesys-pgr</groupId>
<artifactId>application-blocks-security</artifactId> <artifactId>application-blocks-security</artifactId>
<version>1.7-SNAPSHOT</version> <version>${application.blocks.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.tika</groupId> <groupId>org.apache.tika</groupId>
...@@ -219,7 +225,12 @@ ...@@ -219,7 +225,12 @@
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.8.8</version> <version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
......
...@@ -72,7 +72,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements Ac ...@@ -72,7 +72,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements Ac
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -4816923593950502695L; private static final long serialVersionUID = -4816923593950502695L;
public static final Sort DEFAULT_SORT = new Sort("originalFilename"); public static final Sort DEFAULT_SORT = Sort.by("originalFilename");
/** The id. */ /** The id. */
@Id @Id
......
...@@ -61,7 +61,7 @@ public class RepositoryFolder extends UuidModel implements AclAwareModel { ...@@ -61,7 +61,7 @@ public class RepositoryFolder extends UuidModel implements AclAwareModel {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -7947000802758739238L; private static final long serialVersionUID = -7947000802758739238L;
public static final Sort DEFAULT_SORT = new Sort("name"); public static final Sort DEFAULT_SORT = Sort.by("name");
/** /**
* Reference to parent Folder. Root folders have this set to null. This * Reference to parent Folder. Root folders have this set to null. This
......
...@@ -19,14 +19,14 @@ package org.genesys.filerepository.persistence; ...@@ -19,14 +19,14 @@ package org.genesys.filerepository.persistence;
import org.genesys.filerepository.model.ImageGallery; import org.genesys.filerepository.model.ImageGallery;
import org.genesys.filerepository.model.RepositoryFolder; import org.genesys.filerepository.model.RepositoryFolder;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
* The Interface ImageGalleryPersistence. * The Interface ImageGalleryPersistence.
*/ */
@Repository @Repository
public interface ImageGalleryPersistence extends JpaRepository<ImageGallery, Long>, QueryDslPredicateExecutor<ImageGallery> { public interface ImageGalleryPersistence extends JpaRepository<ImageGallery, Long>, QuerydslPredicateExecutor<ImageGallery> {
/** /**
* Find gallery for specified path. * Find gallery for specified path.
......
...@@ -23,7 +23,7 @@ import org.genesys.filerepository.RepositoryPersistence; ...@@ -23,7 +23,7 @@ import org.genesys.filerepository.RepositoryPersistence;
import org.genesys.filerepository.model.RepositoryFile; import org.genesys.filerepository.model.RepositoryFile;
import org.genesys.filerepository.model.RepositoryFolder; import org.genesys.filerepository.model.RepositoryFolder;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
...@@ -34,7 +34,7 @@ import org.springframework.stereotype.Repository; ...@@ -34,7 +34,7 @@ import org.springframework.stereotype.Repository;
* *
*/ */
@Repository @Repository
public interface RepositoryFilePersistence extends RepositoryPersistence<RepositoryFile>, QueryDslPredicateExecutor<RepositoryFile> { public interface RepositoryFilePersistence extends RepositoryPersistence<RepositoryFile>, QuerydslPredicateExecutor<RepositoryFile> {
/** /**
* Find by uuid. * Find by uuid.
......
...@@ -22,14 +22,14 @@ import java.util.UUID; ...@@ -22,14 +22,14 @@ import java.util.UUID;
import org.genesys.filerepository.RepositoryPersistence; import org.genesys.filerepository.RepositoryPersistence;
import org.genesys.filerepository.model.RepositoryFolder; import org.genesys.filerepository.model.RepositoryFolder;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
* JPA Repository for {@link RepositoryFolder} * JPA Repository for {@link RepositoryFolder}
*/ */
@Repository @Repository
public interface RepositoryFolderRepository extends RepositoryPersistence<RepositoryFolder>, QueryDslPredicateExecutor<RepositoryFolder> { public interface RepositoryFolderRepository extends RepositoryPersistence<RepositoryFolder>, QuerydslPredicateExecutor<RepositoryFolder> {
/** /**
* Find by uuid. * Find by uuid.
......
...@@ -23,14 +23,14 @@ import org.genesys.filerepository.RepositoryPersistence; ...@@ -23,14 +23,14 @@ import org.genesys.filerepository.RepositoryPersistence;
import org.genesys.filerepository.model.RepositoryFolder; import org.genesys.filerepository.model.RepositoryFolder;
import org.genesys.filerepository.model.RepositoryImage; import org.genesys.filerepository.model.RepositoryImage;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
* The Interface RepositoryImagePersistence. * The Interface RepositoryImagePersistence.
*/ */
@Repository @Repository
public interface RepositoryImagePersistence extends RepositoryPersistence<RepositoryImage>, QueryDslPredicateExecutor<RepositoryImage> { public interface RepositoryImagePersistence extends RepositoryPersistence<RepositoryImage>, QuerydslPredicateExecutor<RepositoryImage> {
/** /**
* Find by uuid. * Find by uuid.
......
...@@ -56,6 +56,8 @@ import org.springframework.util.CollectionUtils; ...@@ -56,6 +56,8 @@ import org.springframework.util.CollectionUtils;
import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQuery;
import com.querydsl.jpa.impl.JPAQueryFactory; import com.querydsl.jpa.impl.JPAQueryFactory;
import javax.persistence.EntityNotFoundException;
/** /**
* Image Gallery service. * Image Gallery service.
*/ */
...@@ -235,7 +237,7 @@ public class ImageGalleryServiceImpl implements ImageGalleryService { ...@@ -235,7 +237,7 @@ public class ImageGalleryServiceImpl implements ImageGalleryService {
@Transactional @Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#imageGallery, 'write')") @PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#imageGallery, 'write')")
public ImageGallery updateImageGalery(final ImageGallery imageGallery, final String title, final String description) { public ImageGallery updateImageGalery(final ImageGallery imageGallery, final String title, final String description) {
final ImageGallery imageGallery2 = imageGalleryPersistence.findOne(imageGallery.getId()); final ImageGallery imageGallery2 = imageGalleryPersistence.findById(imageGallery.getId()).orElseThrow(() -> new EntityNotFoundException("Record not found."));
imageGallery2.setTitle(title); imageGallery2.setTitle(title);
imageGallery2.setDescription(description); imageGallery2.setDescription(description);
...@@ -254,7 +256,7 @@ public class ImageGalleryServiceImpl implements ImageGalleryService { ...@@ -254,7 +256,7 @@ public class ImageGalleryServiceImpl implements ImageGalleryService {
@Transactional @Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#imageGallery, 'write')") @PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#imageGallery, 'write')")
public ImageGallery saveImageOrder(final ImageGallery imageGallery) { public ImageGallery saveImageOrder(final ImageGallery imageGallery) {
final ImageGallery imageGallery2 = imageGalleryPersistence.findOne(imageGallery.getId()); final ImageGallery imageGallery2 = imageGalleryPersistence.findById(imageGallery.getId()).orElseThrow(() -> new EntityNotFoundException("Record not found."));
imageGallery2.setImages(imageGallery.getImages()); imageGallery2.setImages(imageGallery.getImages());
imageGalleryPersistence.save(imageGallery2); imageGalleryPersistence.save(imageGallery2);
...@@ -266,7 +268,7 @@ public class ImageGalleryServiceImpl implements ImageGalleryService { ...@@ -266,7 +268,7 @@ public class ImageGalleryServiceImpl implements ImageGalleryService {
@Override @Override
public void ensureThumbnails(final ImageGallery imageGallery) { public void ensureThumbnails(final ImageGallery imageGallery) {
final ImageGallery imageGallery2 = imageGalleryPersistence.findOne(imageGallery.getId()); final ImageGallery imageGallery2 = imageGalleryPersistence.findById(imageGallery.getId()).orElseThrow(() -> new EntityNotFoundException("Record not found."));
if (CollectionUtils.isEmpty(imageGallery2.getImages())) { if (CollectionUtils.isEmpty(imageGallery2.getImages())) {
LOG.debug("ImageGallery has no images, skipping thumbnail generation for path=" + imageGallery2.getPath()); LOG.debug("ImageGallery has no images, skipping thumbnail generation for path=" + imageGallery2.getPath());
...@@ -325,7 +327,7 @@ public class ImageGalleryServiceImpl implements ImageGalleryService { ...@@ -325,7 +327,7 @@ public class ImageGalleryServiceImpl implements ImageGalleryService {
@Override @Override
public void ensureThumbnails(final ImageGallery imageGallery, final Integer width, final Integer height) { public void ensureThumbnails(final ImageGallery imageGallery, final Integer width, final Integer height) {
final ImageGallery imageGallery2 = imageGalleryPersistence.findOne(imageGallery.getId()); final ImageGallery imageGallery2 = imageGalleryPersistence.findById(imageGallery.getId()).orElseThrow(() -> new EntityNotFoundException("Record not found."));
if (CollectionUtils.isEmpty(imageGallery2.getImages())) { if (CollectionUtils.isEmpty(imageGallery2.getImages())) {
LOG.debug("ImageGallery has no images, skipping thumbnail generation for path=" + imageGallery2.getPath()); LOG.debug("ImageGallery has no images, skipping thumbnail generation for path=" + imageGallery2.getPath());
......
...@@ -33,7 +33,7 @@ import org.springframework.dao.support.PersistenceExceptionTranslator; ...@@ -33,7 +33,7 @@ import org.springframework.dao.support.PersistenceExceptionTranslator;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate4.HibernateExceptionTranslator; import org.springframework.orm.hibernate5.HibernateExceptionTranslator;
import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
......
...@@ -35,13 +35,11 @@ import org.genesys.filerepository.service.impl.S3StorageServiceImpl; ...@@ -35,13 +35,11 @@ import org.genesys.filerepository.service.impl.S3StorageServiceImpl;
import org.genesys.filerepository.service.impl.ThumbnailGenerator1; import org.genesys.filerepository.service.impl.ThumbnailGenerator1;
import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
// TODO: Auto-generated Javadoc // TODO: Auto-generated Javadoc
/** /**
...@@ -74,13 +72,13 @@ public class ServiceBeanConfig implements InitializingBean, DisposableBean { ...@@ -74,13 +72,13 @@ public class ServiceBeanConfig implements InitializingBean, DisposableBean {
* @return the property placeholder configurer * @return the property placeholder configurer
*/ */
@Bean @Bean
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
final PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer(); final PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
// Need to ignore "genesys.properties" if not found // Need to ignore "genesys.properties" if not found
propertyPlaceholderConfigurer.setIgnoreResourceNotFound(true); propertyPlaceholderConfigurer.setIgnoreResourceNotFound(true);
propertyPlaceholderConfigurer.setFileEncoding("utf-8"); propertyPlaceholderConfigurer.setFileEncoding("utf-8");
propertyPlaceholderConfigurer.setLocations(new Resource[] { new ClassPathResource("spring/spring.properties") }); propertyPlaceholderConfigurer.setLocations(new ClassPathResource("spring/spring.properties"));
return propertyPlaceholderConfigurer; return propertyPlaceholderConfigurer;
} }
......
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
package org.genesys.filerepository.service; package org.genesys.filerepository.service;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
package org.genesys.filerepository.service; package org.genesys.filerepository.service;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
......
...@@ -20,7 +20,7 @@ import static org.hamcrest.CoreMatchers.equalTo; ...@@ -20,7 +20,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
package org.genesys.filerepository.service; package org.genesys.filerepository.service;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
package org.genesys.filerepository.service; package org.genesys.filerepository.service;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
package org.genesys.filerepository.service; package org.genesys.filerepository.service;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
...@@ -26,6 +26,7 @@ import java.util.ArrayList; ...@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import javax.persistence.EntityNotFoundException;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import org.genesys.filerepository.InvalidRepositoryFileDataException; import org.genesys.filerepository.InvalidRepositoryFileDataException;
...@@ -150,7 +151,7 @@ public class ImageGalleryTest extends RepositoryServiceTest { ...@@ -150,7 +151,7 @@ public class ImageGalleryTest extends RepositoryServiceTest {
/** /**
* Update gallery blah null. * Update gallery blah null.
*/ */
@Test(expected = NullPointerException.class) @Test(expected = EntityNotFoundException.class)
public void updateGalleryBlahNull() { public void updateGalleryBlahNull() {
imageGalleryService.updateImageGalery(new ImageGallery(), null, null); imageGalleryService.updateImageGalery(new ImageGallery(), null, null);
} }
...@@ -409,19 +410,19 @@ public class ImageGalleryTest extends RepositoryServiceTest { ...@@ -409,19 +410,19 @@ public class ImageGalleryTest extends RepositoryServiceTest {
imageGalleryService.createImageGallery(initialPath.resolve("gallery2"), DEFAULT_GALLERY_TITLE, DEFAULT_GALLERY_DESCRIPTION); imageGalleryService.createImageGallery(initialPath.resolve("gallery2"), DEFAULT_GALLERY_TITLE, DEFAULT_GALLERY_DESCRIPTION);
imageGalleryService.createImageGallery(initialPath.resolve("sub/gallery3"), DEFAULT_GALLERY_TITLE, DEFAULT_GALLERY_DESCRIPTION); imageGalleryService.createImageGallery(initialPath.resolve("sub/gallery3"), DEFAULT_GALLERY_TITLE, DEFAULT_GALLERY_DESCRIPTION);
Page<ImageGallery> page = imageGalleryService.listImageGalleries(new PageRequest(0, 3)); Page<ImageGallery> page = imageGalleryService.listImageGalleries(PageRequest.of(0, 3));
assertThat(page.getContent().size(), is(3)); assertThat(page.getContent().size(), is(3));
assertThat(page.getTotalElements(), is(3l)); assertThat(page.getTotalElements(), is(3l));
page = imageGalleryService.listImageGalleries(new PageRequest(0, 2)); page = imageGalleryService.listImageGalleries(PageRequest.of(0, 2));
assertThat(page.getContent().size(), is(2)); assertThat(page.getContent().size(), is(2));
assertThat(page.getTotalElements(), is(3l)); assertThat(page.getTotalElements(), is(3l));
page = imageGalleryService.listImageGalleries(initialPath, new PageRequest(0, 3)); page = imageGalleryService.listImageGalleries(initialPath, PageRequest.of(0, 3));
assertThat(page.getContent().size(), is(3)); assertThat(page.getContent().size(), is(3));
assertThat(page.getTotalElements(), is(3l)); assertThat(page.getTotalElements(), is(3l));
page = imageGalleryService.listImageGalleries(initialPath.resolve("sub"), new PageRequest(0, 3)); page = imageGalleryService.listImageGalleries(initialPath.resolve("sub"), PageRequest.of(0, 3));
assertThat(page.getContent().size(), is(1)); assertThat(page.getContent().size(), is(1));
assertThat(page.getTotalElements(), is(1l)); assertThat(page.getTotalElements(), is(1l));
} }
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
package org.genesys.filerepository.service; package org.genesys.filerepository.service;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
......