Commit 601a2a36 authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza

Enable @Validation in the service layer

parent c4557538
...@@ -619,11 +619,6 @@ ...@@ -619,11 +619,6 @@
<artifactId>jna</artifactId> <artifactId>jna</artifactId>
<version>4.5.2</version> <version>4.5.2</version>
</dependency> </dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId> <artifactId>hibernate-validator</artifactId>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.genesys.catalog.model.dataset; package org.genesys.catalog.model.dataset;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.Size;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -112,10 +113,12 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub ...@@ -112,10 +113,12 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub
private List<DatasetLocation> locations; private List<DatasetLocation> locations;
/** The min start date of all locations */ /** The min start date of all locations */
@Size(max = 8)
@Column(length = 8) @Column(length = 8)
private String startDate; private String startDate;
/** The max end date of all locations */ /** The max end date of all locations */
@Size(max = 8)
@Column(length = 8) @Column(length = 8)
private String endDate; private String endDate;
...@@ -176,6 +179,7 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub ...@@ -176,6 +179,7 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub
private String source; private String source;
/** Information about time of creation of the dataset. */ /** Information about time of creation of the dataset. */
@Size(max = 200)
@Column(nullable = true, length = 200) @Column(nullable = true, length = 200)
private String created; private String created;
......
...@@ -21,6 +21,8 @@ import org.genesys.catalog.annotations.PublishValidation; ...@@ -21,6 +21,8 @@ import org.genesys.catalog.annotations.PublishValidation;
import org.genesys.catalog.service.PublishValidationInterface; import org.genesys.catalog.service.PublishValidationInterface;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Map; import java.util.Map;
/** /**
...@@ -57,6 +59,8 @@ public class DatasetCreator extends UuidModel implements PublishValidationInterf ...@@ -57,6 +59,8 @@ public class DatasetCreator extends UuidModel implements PublishValidationInterf
/** The full name. */ /** The full name. */
@PublishValidation @PublishValidation
@NotNull
@Size(max = 200)
@Column(length = 200, nullable = false) @Column(length = 200, nullable = false)
private String fullName; private String fullName;
......
...@@ -22,6 +22,7 @@ import org.genesys.catalog.service.PublishValidationInterface; ...@@ -22,6 +22,7 @@ import org.genesys.catalog.service.PublishValidationInterface;
import org.genesys2.util.MCPDUtil; import org.genesys2.util.MCPDUtil;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.Size;
import java.util.Map; import java.util.Map;
/** /**
...@@ -68,14 +69,17 @@ public class DatasetLocation extends UuidModel implements PublishValidationInter ...@@ -68,14 +69,17 @@ public class DatasetLocation extends UuidModel implements PublishValidationInter
private Double decimalLongitude; private Double decimalLongitude;
/** ISO3 country code of the location */ /** ISO3 country code of the location */
@Size(max = 3)
@Column(length = 3) @Column(length = 3)
private String countryCode; private String countryCode;
/** The start date */ /** The start date */
@Size(max = 8)
@Column(length = 8) @Column(length = 8)
private String startDate; private String startDate;
/** The end date */ /** The end date */
@Size(max = 8)
@Column(length = 8) @Column(length = 8)
private String endDate; private String endDate;
......
...@@ -40,6 +40,8 @@ import org.springframework.data.domain.Page; ...@@ -40,6 +40,8 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
/** /**
* The Interface DatasetService. * The Interface DatasetService.
*/ */
...@@ -54,7 +56,7 @@ public interface DatasetService { ...@@ -54,7 +56,7 @@ public interface DatasetService {
* @param input new Dataset * @param input new Dataset
* @return saved Dataset in db. * @return saved Dataset in db.
*/ */
Dataset createDataset(Dataset input); Dataset createDataset(@Valid Dataset input);
/** /**
* Method updating Dataset. * Method updating Dataset.
...@@ -62,7 +64,7 @@ public interface DatasetService { ...@@ -62,7 +64,7 @@ public interface DatasetService {
* @param input new Dataset * @param input new Dataset
* @return updated Dataset in db. * @return updated Dataset in db.
*/ */
Dataset updateDataset(Dataset input); Dataset updateDataset(@Valid Dataset input);
/** /**
* Method updating accessionRefs in Dataset. * Method updating accessionRefs in Dataset.
...@@ -71,7 +73,7 @@ public interface DatasetService { ...@@ -71,7 +73,7 @@ public interface DatasetService {
* @param accessionRefs new accessionRefs * @param accessionRefs new accessionRefs
* @return updated Dataset in db. * @return updated Dataset in db.
*/ */
Dataset updateAccessionRefs(Dataset dataset, Set<AccessionRef> accessionRefs); Dataset updateAccessionRefs(Dataset dataset, @Valid Set<AccessionRef> accessionRefs);
/** /**
* Method adding new descriptor to Dataset. * Method adding new descriptor to Dataset.
...@@ -219,7 +221,7 @@ public interface DatasetService { ...@@ -219,7 +221,7 @@ public interface DatasetService {
* @return updated Dataset * @return updated Dataset
* @throws NotFoundElement the not found element * @throws NotFoundElement the not found element
*/ */
Dataset upsertAccessions(Dataset dataset, Set<AccessionRef> accessionRefs) throws NotFoundElement; Dataset upsertAccessions(Dataset dataset, @Valid Set<AccessionRef> accessionRefs) throws NotFoundElement;
/** /**
* Puts the dataset into the Review state to be reviewed by admin. * Puts the dataset into the Review state to be reviewed by admin.
...@@ -293,7 +295,7 @@ public interface DatasetService { ...@@ -293,7 +295,7 @@ public interface DatasetService {
* @return created DatasetCreator * @return created DatasetCreator
* @throws NotFoundElement throws if don't match the version * @throws NotFoundElement throws if don't match the version
*/ */
DatasetCreator createDatasetCreator(Dataset dataset, DatasetCreator input) throws NotFoundElement; DatasetCreator createDatasetCreator(Dataset dataset, @Valid DatasetCreator input) throws NotFoundElement;
/** /**
* Remove DatasetCreator of Dataset. * Remove DatasetCreator of Dataset.
...@@ -349,7 +351,7 @@ public interface DatasetService { ...@@ -349,7 +351,7 @@ public interface DatasetService {
* @return the dataset creator * @return the dataset creator
* @throws NotFoundElement the not found element * @throws NotFoundElement the not found element
*/ */
DatasetCreator updateDatasetCreator(Dataset dataset, DatasetCreator datasetCreator) throws NotFoundElement; DatasetCreator updateDatasetCreator(Dataset dataset, @Valid DatasetCreator datasetCreator) throws NotFoundElement;
/** /**
* Autocomplete creators. * Autocomplete creators.
...@@ -368,7 +370,7 @@ public interface DatasetService { ...@@ -368,7 +370,7 @@ public interface DatasetService {
* @return added DatasetLocation * @return added DatasetLocation
* @throws NotFoundElement the not found element * @throws NotFoundElement the not found element
*/ */
DatasetLocation createLocation(Dataset dataset, DatasetLocation input) throws NotFoundElement; DatasetLocation createLocation(Dataset dataset, @Valid DatasetLocation input) throws NotFoundElement;
/** /**
* Method for remove DatasetLocation of Dataset. * Method for remove DatasetLocation of Dataset.
...@@ -424,7 +426,7 @@ public interface DatasetService { ...@@ -424,7 +426,7 @@ public interface DatasetService {
* @return updated location * @return updated location
* @throws NotFoundElement the not found element * @throws NotFoundElement the not found element
*/ */
DatasetLocation updateLocation(Dataset dataset, DatasetLocation input) throws NotFoundElement; DatasetLocation updateLocation(Dataset dataset, @Valid DatasetLocation input) throws NotFoundElement;
/** /**
* Clear accession references across all Datasets for specified accessions. * Clear accession references across all Datasets for specified accessions.
......
...@@ -85,6 +85,7 @@ import org.springframework.stereotype.Service; ...@@ -85,6 +85,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -96,6 +97,7 @@ import com.querydsl.core.types.Predicate; ...@@ -96,6 +97,7 @@ import com.querydsl.core.types.Predicate;
*/ */
@Service("catalogDatasetService") @Service("catalogDatasetService")
@Transactional(readOnly = true) @Transactional(readOnly = true)
@Validated
public class DatasetServiceImpl implements DatasetService { public class DatasetServiceImpl implements DatasetService {
/** The dataset versions repository. */ /** The dataset versions repository. */
......
...@@ -35,7 +35,6 @@ import javax.persistence.OneToMany; ...@@ -35,7 +35,6 @@ import javax.persistence.OneToMany;
import javax.persistence.PrePersist; import javax.persistence.PrePersist;
import javax.persistence.PreUpdate; import javax.persistence.PreUpdate;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
...@@ -85,7 +84,6 @@ public class Subset extends UuidModel implements AclAwareModel, SelfCleaning { ...@@ -85,7 +84,6 @@ public class Subset extends UuidModel implements AclAwareModel, SelfCleaning {
@Column(length = 100) @Column(length = 100)
protected String dateCreated; protected String dateCreated;
/** The wiews code. */ /** The wiews code. */
@NotNull @NotNull
@Size(max = 8) @Size(max = 8)
...@@ -93,7 +91,6 @@ public class Subset extends UuidModel implements AclAwareModel, SelfCleaning { ...@@ -93,7 +91,6 @@ public class Subset extends UuidModel implements AclAwareModel, SelfCleaning {
private String wiewsCode; private String wiewsCode;
/** The institute. */ /** The institute. */
@NotNull
@ManyToOne(cascade = {}, optional = false) @ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "institute_id", updatable = false) @JoinColumn(name = "institute_id", updatable = false)
@JsonView({ JsonViews.Public.class }) @JsonView({ JsonViews.Public.class })
...@@ -106,7 +103,6 @@ public class Subset extends UuidModel implements AclAwareModel, SelfCleaning { ...@@ -106,7 +103,6 @@ public class Subset extends UuidModel implements AclAwareModel, SelfCleaning {
indexes = { @Index(columnList = "subsetId, instCode, acceNumb"), @Index(columnList = "subsetId, genus") }) indexes = { @Index(columnList = "subsetId, instCode, acceNumb"), @Index(columnList = "subsetId, genus") })
@Field(type = FieldType.Object) @Field(type = FieldType.Object)
@JsonIgnore @JsonIgnore
@Valid
private Set<AccessionRef> accessionRefs; private Set<AccessionRef> accessionRefs;
/** The accession count. */ /** The accession count. */
......
...@@ -21,6 +21,8 @@ import org.genesys.catalog.annotations.PublishValidation; ...@@ -21,6 +21,8 @@ import org.genesys.catalog.annotations.PublishValidation;
import org.genesys.catalog.service.PublishValidationInterface; import org.genesys.catalog.service.PublishValidationInterface;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Map; import java.util.Map;
/** /**
...@@ -57,6 +59,8 @@ public class SubsetCreator extends UuidModel implements PublishValidationInterfa ...@@ -57,6 +59,8 @@ public class SubsetCreator extends UuidModel implements PublishValidationInterfa
/** The full name. */ /** The full name. */
@PublishValidation @PublishValidation
@NotNull
@Size(max = 200)
@Column(length = 200, nullable = false) @Column(length = 200, nullable = false)
private String fullName; private String fullName;
......
...@@ -28,6 +28,8 @@ import org.genesys2.server.model.kpi.Observation; ...@@ -28,6 +28,8 @@ import org.genesys2.server.model.kpi.Observation;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import javax.validation.Valid;
public interface KPIService { public interface KPIService {
KPIParameter save(KPIParameter parameter); KPIParameter save(KPIParameter parameter);
...@@ -38,7 +40,7 @@ public interface KPIService { ...@@ -38,7 +40,7 @@ public interface KPIService {
KPIParameter delete(KPIParameter parameter); KPIParameter delete(KPIParameter parameter);
<T extends Dimension<?>> T save(T dimension); <T extends Dimension<?>> T save(@Valid T dimension);
Dimension<?> getDimension(long id); Dimension<?> getDimension(long id);
...@@ -48,7 +50,7 @@ public interface KPIService { ...@@ -48,7 +50,7 @@ public interface KPIService {
<T> Set<T> getValues(Dimension<T> loadedJpa); <T> Set<T> getValues(Dimension<T> loadedJpa);
Execution save(Execution execution); Execution save(@Valid Execution execution);
Execution getExecution(long id); Execution getExecution(long id);
......
...@@ -31,6 +31,8 @@ import org.genesys2.server.service.filter.SubsetFilter; ...@@ -31,6 +31,8 @@ import org.genesys2.server.service.filter.SubsetFilter;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import javax.validation.Valid;
/** /**
* @author Maxym Borodenko * @author Maxym Borodenko
*/ */
...@@ -78,7 +80,7 @@ public interface SubsetService { ...@@ -78,7 +80,7 @@ public interface SubsetService {
* @param source the source * @param source the source
* @return saved Subset in db. * @return saved Subset in db.
*/ */
Subset create(FaoInstitute institute, Subset source); Subset create(FaoInstitute institute, @Valid Subset source);
/** /**
* Load subset based on identifiers and version provided in the input. * Load subset based on identifiers and version provided in the input.
...@@ -111,7 +113,7 @@ public interface SubsetService { ...@@ -111,7 +113,7 @@ public interface SubsetService {
* @param subset new Subset * @param subset new Subset
* @return updated Subset in db. * @return updated Subset in db.
*/ */
Subset update(Subset subset); Subset update(@Valid Subset subset);
/** /**
* Remove subset. * Remove subset.
...@@ -175,7 +177,7 @@ public interface SubsetService { ...@@ -175,7 +177,7 @@ public interface SubsetService {
* @return created SubsetCreator * @return created SubsetCreator
* @throws NotFoundElement throws if don't match the version * @throws NotFoundElement throws if don't match the version
*/ */
SubsetCreator createSubsetCreator(Subset Subset, SubsetCreator input) throws NotFoundElement; SubsetCreator createSubsetCreator(Subset Subset, @Valid SubsetCreator input) throws NotFoundElement;
/** /**
* Remove SubsetCreator of Subset. * Remove SubsetCreator of Subset.
...@@ -241,7 +243,7 @@ public interface SubsetService { ...@@ -241,7 +243,7 @@ public interface SubsetService {
* @return the Subset creator * @return the Subset creator
* @throws NotFoundElement the not found element * @throws NotFoundElement the not found element
*/ */
SubsetCreator updateSubsetCreator(Subset Subset, SubsetCreator SubsetCreator) throws NotFoundElement; SubsetCreator updateSubsetCreator(Subset Subset, @Valid SubsetCreator SubsetCreator) throws NotFoundElement;
/** /**
* Autocomplete creators. * Autocomplete creators.
......
...@@ -52,6 +52,7 @@ import org.slf4j.Logger; ...@@ -52,6 +52,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -83,6 +84,7 @@ public class AccessionServiceImpl implements AccessionService { ...@@ -83,6 +84,7 @@ public class AccessionServiceImpl implements AccessionService {
@Autowired @Autowired
private JPAQueryFactory jpaQueryFactory; private JPAQueryFactory jpaQueryFactory;
@Lazy
@Autowired @Autowired
private DatasetService datasetService; private DatasetService datasetService;
......
...@@ -60,6 +60,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -60,6 +60,7 @@ import org.springframework.validation.annotation.Validated;
@Service @Service
@Transactional(readOnly = true) @Transactional(readOnly = true)
@Validated
public class KPIServiceImpl implements KPIService { public class KPIServiceImpl implements KPIService {
public static final Logger LOG = LoggerFactory.getLogger(KPIServiceImpl.class); public static final Logger LOG = LoggerFactory.getLogger(KPIServiceImpl.class);
...@@ -118,8 +119,7 @@ public class KPIServiceImpl implements KPIService { ...@@ -118,8 +119,7 @@ public class KPIServiceImpl implements KPIService {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#dimension, 'ADMINISTRATION')") @PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#dimension, 'ADMINISTRATION')")
@Override @Override
@Transactional @Transactional
@Validated public <T extends Dimension<?>> T save(T dimension) {
public <T extends Dimension<?>> T save(@Valid T dimension) {
LOG.debug("Persising dimension {}", dimension); LOG.debug("Persising dimension {}", dimension);
return lazyLoad(dimensionRepository.save(dimension)); return lazyLoad(dimensionRepository.save(dimension));
} }
...@@ -174,8 +174,7 @@ public class KPIServiceImpl implements KPIService { ...@@ -174,8 +174,7 @@ public class KPIServiceImpl implements KPIService {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#execution, 'ADMINISTRATION')") @PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#execution, 'ADMINISTRATION')")
@Override @Override
@Transactional @Transactional
@Validated public Execution save(Execution execution) {
public Execution save(@Valid Execution execution) {
Execution target = executionRepository.findByName(execution.getName()); Execution target = executionRepository.findByName(execution.getName());
if (target == null) { if (target == null) {
target = execution; target = execution;
......
...@@ -69,7 +69,6 @@ import org.springframework.validation.annotation.Validated; ...@@ -69,7 +69,6 @@ import org.springframework.validation.annotation.Validated;
import com.querydsl.core.BooleanBuilder; import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate; import com.querydsl.core.types.Predicate;
import javax.validation.Valid;
/** /**
* The Class SubsetServiceImpl. * The Class SubsetServiceImpl.
...@@ -78,6 +77,7 @@ import javax.validation.Valid; ...@@ -78,6 +77,7 @@ import javax.validation.Valid;
*/ */
@Service @Service
@Transactional(readOnly = true) @Transactional(readOnly = true)
@Validated
public class SubsetServiceImpl implements SubsetService { public class SubsetServiceImpl implements SubsetService {
private static final Logger LOG = LoggerFactory.getLogger(SubsetServiceImpl.class); private static final Logger LOG = LoggerFactory.getLogger(SubsetServiceImpl.class);
...@@ -152,8 +152,7 @@ public class SubsetServiceImpl implements SubsetService { ...@@ -152,8 +152,7 @@ public class SubsetServiceImpl implements SubsetService {
@Override @Override
@Transactional @Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#institute, 'WRITE')") @PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#institute, 'WRITE')")
@Validated public Subset create(final FaoInstitute institute, final Subset source) {
public Subset create(final FaoInstitute institute, @Valid final Subset source) {
LOG.info("Create Subset."); LOG.info("Create Subset.");
if (! StringUtils.equals(institute.getCode(), source.getWiewsCode())) { if (! StringUtils.equals(institute.getCode(), source.getWiewsCode())) {
throw new InvalidApiUsageException("Institute code of the subset does not match the code of Institute"); throw new InvalidApiUsageException("Institute code of the subset does not match the code of Institute");
...@@ -254,8 +253,7 @@ public class SubsetServiceImpl implements SubsetService { ...@@ -254,8 +253,7 @@ public class SubsetServiceImpl implements SubsetService {
@Override @Override
@Transactional @Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#source, 'WRITE')") @PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#source, 'WRITE')")
@Validated public Subset update(final Subset source) {
public Subset update(@Valid final Subset source) {
LOG.info("Update Subset."); LOG.info("Update Subset.");
final Subset subset = loadSubset(source); final Subset subset = loadSubset(source);
copyValues(subset, source); copyValues(subset, source);
......
...@@ -42,6 +42,7 @@ import org.springframework.core.io.FileSystemResource; ...@@ -42,6 +42,7 @@ import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
@Configuration @Configuration
@Import({ HazelcastConfig.class, CommonConfig.class, SchedulerConfig.class, DatabaseConfig.class, TemplatingConfig.class, MailConfig.class, OAuth2ServerConfig.class, SecurityConfig.class, CacheConfig.class, @Import({ HazelcastConfig.class, CommonConfig.class, SchedulerConfig.class, DatabaseConfig.class, TemplatingConfig.class, MailConfig.class, OAuth2ServerConfig.class, SecurityConfig.class, CacheConfig.class,
...@@ -127,4 +128,9 @@ public class ApplicationConfig { ...@@ -127,4 +128,9 @@ public class ApplicationConfig {
// This provides static access to current application context // This provides static access to current application context
return new CurrentApplicationContext(); return new CurrentApplicationContext();
} }
@Bean
public MethodValidationPostProcessor methodValidationPostProcessor() {
return new MethodValidationPostProcessor();
}
} }
...@@ -208,11 +208,11 @@ public class SubsetServiceTest extends CatalogServiceTest { ...@@ -208,11 +208,11 @@ public class SubsetServiceTest extends CatalogServiceTest {
private Subset createSubset(UUID uuid) { private Subset createSubset(UUID uuid) {
subset = new Subset(); subset = new Subset();
subset.setTitle("Subset"); subset.setTitle("Subset");
subset.setWiewsCode("TEST"); subset.setWiewsCode("0000");
subset.setInstitute(faoInstitute); subset.setInstitute(faoInstitute);
subset.setUuid(uuid); subset.setUuid(uuid);
return subsetRepository.save(subset); return subsetService.create(faoInstitute, subset);
} }
private FaoInstitute createInstitute() { private FaoInstitute createInstitute() {
......
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