From c5f21e566f530d3166151cd3f141d84be5ca7b27 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Tue, 24 Oct 2017 16:34:59 +0200 Subject: [PATCH 1/2] Update DataManagementPlanDB.sql --- dmp-db-scema/DataManagementPlanDB.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dmp-db-scema/DataManagementPlanDB.sql b/dmp-db-scema/DataManagementPlanDB.sql index 8d8e41ffc..8ab9dcaf7 100644 --- a/dmp-db-scema/DataManagementPlanDB.sql +++ b/dmp-db-scema/DataManagementPlanDB.sql @@ -129,6 +129,9 @@ CREATE TABLE "DatasetProfile" ( "Definition" xml NOT NULL ); +-- SHould also force the 1-1 relation between the datasetprofile <-> ruleset and datasetprofile <-> viewstyle +ALTER TABLE "DatasetProfile" ADD CONSTRAINT datasetprofile_unique_ruleset UNIQUE ("Ruleset"); +ALTER TABLE "DatasetProfile" ADD CONSTRAINT datasetprofile_unique_viewstyle UNIQUE ("Viewstyle"); ALTER TABLE "DatasetProfile" OWNER TO dmptool; From 4b211e8664c969b763b9e42d3600112bfb885e82 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Tue, 24 Oct 2017 19:33:51 +0300 Subject: [PATCH 2/2] Changed the default spring serializer... It seems to have a bug regarding List, plus an incompatibility with a Json annotation --- .../org.eclipse.wst.common.component | 1 - dmp-backend/pom.xml | 19 ++- .../main/java/configs/WebConfiguration.java | 37 +++++ dmp-backend/src/main/java/entities/DMP.java | 8 +- .../main/java/entities/DMPOrganisation.java | 4 +- .../src/main/java/entities/DMPProfile.java | 21 ++- .../src/main/java/entities/DMPResearcher.java | 4 +- .../main/java/entities/DataRepository.java | 4 +- .../src/main/java/entities/Dataset.java | 12 +- .../java/entities/DatasetDataRepository.java | 4 +- .../main/java/entities/DatasetProfile.java | 4 +- .../java/entities/DatasetProfileRuleset.java | 6 +- .../entities/DatasetProfileViewstyle.java | 6 +- .../main/java/entities/DatasetRegistry.java | 4 +- .../main/java/entities/DatasetService.java | 4 +- .../src/main/java/entities/Organisation.java | 4 +- .../src/main/java/entities/Project.java | 2 - .../src/main/java/entities/Registry.java | 4 +- .../src/main/java/entities/Researcher.java | 4 +- .../src/main/java/entities/Service.java | 12 +- .../src/main/java/entities/UserInfo.java | 4 +- .../src/main/java/entities/UserProject.java | 4 +- .../main/java/entities/security/UserAuth.java | 4 +- .../main/java/helpers/SerializerProvider.java | 19 ++- .../src/main/java/rest/entities/DMPs.java | 15 ++ .../java/rest/entities/DatasetProfiles.java | 129 +++++++----------- .../src/main/java/rest/entities/Datasets.java | 34 +---- .../src/main/java/rest/entities/Projects.java | 20 ++- .../src/main/java/rest/entities/Services.java | 22 ++- .../webapp/WEB-INF/applicationContext.xml | 1 + dmp-backend/src/test/java/TestRest.java | 77 ++++++++--- 31 files changed, 257 insertions(+), 236 deletions(-) create mode 100644 dmp-backend/src/main/java/configs/WebConfiguration.java diff --git a/dmp-backend/.settings/org.eclipse.wst.common.component b/dmp-backend/.settings/org.eclipse.wst.common.component index 676f4f5bc..9c7a1cfe1 100644 --- a/dmp-backend/.settings/org.eclipse.wst.common.component +++ b/dmp-backend/.settings/org.eclipse.wst.common.component @@ -4,7 +4,6 @@ - diff --git a/dmp-backend/pom.xml b/dmp-backend/pom.xml index e4adb35eb..b48f387d6 100644 --- a/dmp-backend/pom.xml +++ b/dmp-backend/pom.xml @@ -143,10 +143,10 @@ - com.fasterxml.jackson.datatype - jackson-datatype-hibernate5 - 2.8.4 - + com.fasterxml.jackson.datatype + jackson-datatype-hibernate5 + 2.8.4 + @@ -166,13 +166,22 @@ ${org.apache.tomcat.tomcat-jdbc.version} provided - + + junit junit ${org.junit.version} test + + + com.google.code.gson + gson + 2.8.2 + test + + diff --git a/dmp-backend/src/main/java/configs/WebConfiguration.java b/dmp-backend/src/main/java/configs/WebConfiguration.java new file mode 100644 index 000000000..3f5245123 --- /dev/null +++ b/dmp-backend/src/main/java/configs/WebConfiguration.java @@ -0,0 +1,37 @@ +package configs; + +import java.util.List; + +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; +import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module.Feature; + +@Configuration +@EnableWebMvc +public class WebConfiguration extends WebMvcConfigurerAdapter { + + @Override + public void configureMessageConverters(List> converters) { + + Hibernate5Module module = new Hibernate5Module(); + module.enable(Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS); + ObjectMapper objectMapper = new ObjectMapper() +// .setSerializationInclusion(Include.NON_NULL) +// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .registerModule(new Hibernate5Module()) + ; + + converters.add(new MappingJackson2HttpMessageConverter(objectMapper)); + + System.out.println("Using custom json serializer loaded with module Hibernate5Module"); + + } +} \ No newline at end of file diff --git a/dmp-backend/src/main/java/entities/DMP.java b/dmp-backend/src/main/java/entities/DMP.java index 951b95cf0..3f3bfab4f 100644 --- a/dmp-backend/src/main/java/entities/DMP.java +++ b/dmp-backend/src/main/java/entities/DMP.java @@ -35,9 +35,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @Entity @Table(name="\"DMP\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DMP implements Serializable { @@ -64,7 +62,7 @@ public class DMP implements Serializable { private Set dataset; - @ManyToOne() + @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "\"Project\"") private Project project; @@ -73,7 +71,7 @@ public class DMP implements Serializable { @Column(name = "\"ProfileData\"", columnDefinition = "xml", nullable = true) private String profileData; - @OneToOne(fetch = FetchType.LAZY) + @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "\"Profile\"") private DMPProfile profile; diff --git a/dmp-backend/src/main/java/entities/DMPOrganisation.java b/dmp-backend/src/main/java/entities/DMPOrganisation.java index 5b3d7d69d..7f4c9a899 100644 --- a/dmp-backend/src/main/java/entities/DMPOrganisation.java +++ b/dmp-backend/src/main/java/entities/DMPOrganisation.java @@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DMPOrganisation\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DMPOrganisation implements Serializable { diff --git a/dmp-backend/src/main/java/entities/DMPProfile.java b/dmp-backend/src/main/java/entities/DMPProfile.java index fdf8354fc..012197425 100644 --- a/dmp-backend/src/main/java/entities/DMPProfile.java +++ b/dmp-backend/src/main/java/entities/DMPProfile.java @@ -2,14 +2,15 @@ package entities; import java.io.Serializable; +import java.util.Set; import java.util.UUID; -import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; +import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; @@ -25,9 +26,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DMPProfile\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DMPProfile implements Serializable { private static final long serialVersionUID = 3213099144442689808L; @@ -42,8 +41,8 @@ public class DMPProfile implements Serializable { private UUID id; - @OneToOne(fetch = FetchType.LAZY, mappedBy = "profile") - private DMP dmp; + @OneToMany(fetch = FetchType.LAZY, mappedBy = "profile") + private Set dmps; @Column(name = "\"Label\"") @@ -77,15 +76,13 @@ public class DMPProfile implements Serializable { this.definition = definition; } - public DMP getDmp() { - return dmp; + public Set getDmps() { + return dmps; } - public void setDmp(DMP dmp) { - this.dmp = dmp; + public void setDmps(Set dmps) { + this.dmps = dmps; } - - } diff --git a/dmp-backend/src/main/java/entities/DMPResearcher.java b/dmp-backend/src/main/java/entities/DMPResearcher.java index 5d17ee075..55b1fdd3c 100644 --- a/dmp-backend/src/main/java/entities/DMPResearcher.java +++ b/dmp-backend/src/main/java/entities/DMPResearcher.java @@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DMPResearcher\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DMPResearcher implements Serializable { private static final long serialVersionUID = 135449857355252959L; diff --git a/dmp-backend/src/main/java/entities/DataRepository.java b/dmp-backend/src/main/java/entities/DataRepository.java index f46fb4fa4..4515498ea 100644 --- a/dmp-backend/src/main/java/entities/DataRepository.java +++ b/dmp-backend/src/main/java/entities/DataRepository.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DataRepository\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DataRepository implements Serializable { diff --git a/dmp-backend/src/main/java/entities/Dataset.java b/dmp-backend/src/main/java/entities/Dataset.java index a1a519faa..3df2ec01f 100644 --- a/dmp-backend/src/main/java/entities/Dataset.java +++ b/dmp-backend/src/main/java/entities/Dataset.java @@ -30,14 +30,12 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity(name = "Dataset") @Table(name="\"Dataset\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class Dataset implements Serializable { private static final long serialVersionUID = 3575723814399553259L; - public Dataset () {} + //public Dataset () {} @Id @@ -50,12 +48,12 @@ public class Dataset implements Serializable { private String label; - @ManyToOne(fetch = FetchType.LAZY) + @ManyToOne(fetch = FetchType.EAGER) // @Cascade(value=org.hibernate.annotations.CascadeType.ALL) @JoinColumn(name = "\"DMP\"", nullable = true) private DMP dmp; - + @Column(name = "\"Uri\"") private String uri; @@ -64,7 +62,7 @@ public class Dataset implements Serializable { private String properties; - @ManyToOne(fetch = FetchType.LAZY) + @ManyToOne(fetch = FetchType.EAGER) //@Cascade(value=org.hibernate.annotations.CascadeType.ALL) @JoinColumn(name = "\"Profile\"", nullable = true) private DatasetProfile profile; diff --git a/dmp-backend/src/main/java/entities/DatasetDataRepository.java b/dmp-backend/src/main/java/entities/DatasetDataRepository.java index d625471d4..a98ee5645 100644 --- a/dmp-backend/src/main/java/entities/DatasetDataRepository.java +++ b/dmp-backend/src/main/java/entities/DatasetDataRepository.java @@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DatasetDataRepository\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DatasetDataRepository implements Serializable { diff --git a/dmp-backend/src/main/java/entities/DatasetProfile.java b/dmp-backend/src/main/java/entities/DatasetProfile.java index 346612149..535dd10b8 100644 --- a/dmp-backend/src/main/java/entities/DatasetProfile.java +++ b/dmp-backend/src/main/java/entities/DatasetProfile.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators; @Entity @Table(name="\"DatasetProfile\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DatasetProfile implements Serializable { diff --git a/dmp-backend/src/main/java/entities/DatasetProfileRuleset.java b/dmp-backend/src/main/java/entities/DatasetProfileRuleset.java index 40be7b1ba..ce239854c 100644 --- a/dmp-backend/src/main/java/entities/DatasetProfileRuleset.java +++ b/dmp-backend/src/main/java/entities/DatasetProfileRuleset.java @@ -27,9 +27,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DatasetProfileRuleset\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DatasetProfileRuleset implements Serializable { private static final long serialVersionUID = 4249565129050898613L; @@ -44,7 +42,7 @@ public class DatasetProfileRuleset implements Serializable { private UUID id; - @OneToOne(fetch = FetchType.EAGER, mappedBy = "ruleset") + @OneToOne(fetch = FetchType.LAZY, mappedBy = "ruleset") private DatasetProfile datasetProfile; diff --git a/dmp-backend/src/main/java/entities/DatasetProfileViewstyle.java b/dmp-backend/src/main/java/entities/DatasetProfileViewstyle.java index 64011c2fc..feaf65d42 100644 --- a/dmp-backend/src/main/java/entities/DatasetProfileViewstyle.java +++ b/dmp-backend/src/main/java/entities/DatasetProfileViewstyle.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DatasetProfileViewstyle\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DatasetProfileViewstyle implements Serializable { private static final long serialVersionUID = -3251295258160291468L; @@ -43,7 +41,7 @@ public class DatasetProfileViewstyle implements Serializable { private UUID id; - @OneToOne(fetch = FetchType.EAGER, mappedBy = "viewstyle") + @OneToOne(fetch = FetchType.LAZY, mappedBy = "viewstyle") private DatasetProfile datasetProfile; @Column(name = "\"Label\"") diff --git a/dmp-backend/src/main/java/entities/DatasetRegistry.java b/dmp-backend/src/main/java/entities/DatasetRegistry.java index 58ba36446..3574ae8f5 100644 --- a/dmp-backend/src/main/java/entities/DatasetRegistry.java +++ b/dmp-backend/src/main/java/entities/DatasetRegistry.java @@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DatasetRegistry\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DatasetRegistry implements Serializable { private static final long serialVersionUID = -5594183793725819187L; diff --git a/dmp-backend/src/main/java/entities/DatasetService.java b/dmp-backend/src/main/java/entities/DatasetService.java index f3ffd3fb1..e8267048c 100644 --- a/dmp-backend/src/main/java/entities/DatasetService.java +++ b/dmp-backend/src/main/java/entities/DatasetService.java @@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"DatasetService\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class DatasetService implements Serializable { private static final long serialVersionUID = 1469161193939096037L; diff --git a/dmp-backend/src/main/java/entities/Organisation.java b/dmp-backend/src/main/java/entities/Organisation.java index a720e32f2..1f1afae6f 100644 --- a/dmp-backend/src/main/java/entities/Organisation.java +++ b/dmp-backend/src/main/java/entities/Organisation.java @@ -28,9 +28,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"Organisation\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class Organisation implements Serializable { diff --git a/dmp-backend/src/main/java/entities/Project.java b/dmp-backend/src/main/java/entities/Project.java index 4d2c5a7ae..03d6fbe3a 100644 --- a/dmp-backend/src/main/java/entities/Project.java +++ b/dmp-backend/src/main/java/entities/Project.java @@ -32,8 +32,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; @Entity @Table(name="\"Project\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class Project implements Serializable { diff --git a/dmp-backend/src/main/java/entities/Registry.java b/dmp-backend/src/main/java/entities/Registry.java index 3fff1a0df..28532f610 100644 --- a/dmp-backend/src/main/java/entities/Registry.java +++ b/dmp-backend/src/main/java/entities/Registry.java @@ -28,9 +28,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"Registry\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class Registry implements Serializable { private static final long serialVersionUID = -277572262583178090L; diff --git a/dmp-backend/src/main/java/entities/Researcher.java b/dmp-backend/src/main/java/entities/Researcher.java index 1ef03aaa6..0cedb72a6 100644 --- a/dmp-backend/src/main/java/entities/Researcher.java +++ b/dmp-backend/src/main/java/entities/Researcher.java @@ -28,9 +28,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"Researcher\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class Researcher implements Serializable { diff --git a/dmp-backend/src/main/java/entities/Service.java b/dmp-backend/src/main/java/entities/Service.java index b69de373b..1474aa890 100644 --- a/dmp-backend/src/main/java/entities/Service.java +++ b/dmp-backend/src/main/java/entities/Service.java @@ -30,16 +30,12 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"Service\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class Service implements Serializable { - private static final long serialVersionUID = 7243446610500174060L; + private static final long serialVersionUID = 163279108676904730L; + - public Service () {} - - @Id @GeneratedValue @GenericGenerator(name = "uuid2", strategy = "uuid2") @@ -65,7 +61,7 @@ public class Service implements Serializable { private String definition; - @OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL) + @OneToMany(fetch = FetchType.LAZY) @JoinTable(name="\"DatasetService\"", joinColumns={@JoinColumn(name="\"Service\"", referencedColumnName="\"ID\"")}, inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")} diff --git a/dmp-backend/src/main/java/entities/UserInfo.java b/dmp-backend/src/main/java/entities/UserInfo.java index 945ef9392..99bc289a7 100644 --- a/dmp-backend/src/main/java/entities/UserInfo.java +++ b/dmp-backend/src/main/java/entities/UserInfo.java @@ -32,9 +32,7 @@ import entities.security.UserAuth; @Entity @Table(name="\"UserInfo\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class UserInfo implements Serializable{ private static final long serialVersionUID = 1225151430484658395L; diff --git a/dmp-backend/src/main/java/entities/UserProject.java b/dmp-backend/src/main/java/entities/UserProject.java index bbb0708a6..7c01c692b 100644 --- a/dmp-backend/src/main/java/entities/UserProject.java +++ b/dmp-backend/src/main/java/entities/UserProject.java @@ -20,9 +20,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"UserProject\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class UserProject implements Serializable{ private static final long serialVersionUID = -4467370784003784660L; diff --git a/dmp-backend/src/main/java/entities/security/UserAuth.java b/dmp-backend/src/main/java/entities/security/UserAuth.java index f8f7b2766..6051d9995 100644 --- a/dmp-backend/src/main/java/entities/security/UserAuth.java +++ b/dmp-backend/src/main/java/entities/security/UserAuth.java @@ -18,9 +18,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="\"UserAuth\"") -//@Proxy(lazy = false) -//@JsonInclude(Include.NON_NULL) -@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") public class UserAuth { @Id diff --git a/dmp-backend/src/main/java/helpers/SerializerProvider.java b/dmp-backend/src/main/java/helpers/SerializerProvider.java index be9380a19..ce27c02b6 100644 --- a/dmp-backend/src/main/java/helpers/SerializerProvider.java +++ b/dmp-backend/src/main/java/helpers/SerializerProvider.java @@ -2,18 +2,27 @@ package helpers; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; +import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module.Feature; public class SerializerProvider { - private static ObjectMapper objectMapper = new ObjectMapper() -// .setSerializationInclusion(Include.NON_NULL) -// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) - .registerModule(new Hibernate5Module()) - ; + private static ObjectMapper objectMapper = null; + static { + + Hibernate5Module module = new Hibernate5Module(); + module.enable(Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS); + objectMapper = new ObjectMapper() +// .setSerializationInclusion(Include.NON_NULL) +// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .registerModule(new Hibernate5Module()) + ; + + } + public static ObjectMapper getJsonSerializer() { return objectMapper; } diff --git a/dmp-backend/src/main/java/rest/entities/DMPs.java b/dmp-backend/src/main/java/rest/entities/DMPs.java index 2f2fa668a..84da97f2b 100644 --- a/dmp-backend/src/main/java/rest/entities/DMPs.java +++ b/dmp-backend/src/main/java/rest/entities/DMPs.java @@ -134,6 +134,7 @@ public class DMPs { } catch(Exception ex) { + ex.printStackTrace(); return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); } } @@ -252,6 +253,20 @@ public class DMPs { */ + + @RequestMapping(method = RequestMethod.POST, value = { "/dmp/getdatasets" }, consumes = "application/json", produces="application/json") + public @ResponseBody ResponseEntity getDatasetsOfDMP(@RequestBody DMP dmp) { + Set datasets = dMPDao.read(dmp.getId()).getDataset(); + try { + return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(datasets)); + } catch (JsonProcessingException e) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not get datasets of DMP!\""); + } + + } + + + @RequestMapping(method = RequestMethod.POST, value = { "/dmp/delete" }, consumes = "application/json", produces="text/plain") public @ResponseBody ResponseEntity delete(@RequestBody DMP dmp) { diff --git a/dmp-backend/src/main/java/rest/entities/DatasetProfiles.java b/dmp-backend/src/main/java/rest/entities/DatasetProfiles.java index a246fc64c..023a66f43 100644 --- a/dmp-backend/src/main/java/rest/entities/DatasetProfiles.java +++ b/dmp-backend/src/main/java/rest/entities/DatasetProfiles.java @@ -72,9 +72,7 @@ public class DatasetProfiles { @Autowired private ResearcherDao researcherDao; @Autowired private ServiceDao serviceDao; - private ObjectMapper objectMapper = - new ObjectMapper(); - //SerializerProvider.getJsonSerializer(); + private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer(); //FETCH BY DATASET PROFILE @@ -102,6 +100,31 @@ public class DatasetProfiles { } } + @RequestMapping(method = RequestMethod.GET, value = { "/datasetprofile/getAll" }) + public @ResponseBody ResponseEntity getAllDatasetProfiles(){ + + try { + List allDatasetProfiles = datasetProfileDao.getAll(); + + //sorry for that, spring-jersey serialisation has issues when performed on tables, so -> custom + List datasetProfilesStrL = allDatasetProfiles.stream().map((datasetProfileObj) -> { + try { + return objectMapper.writeValueAsString(datasetProfileObj); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return ""; + } + }).collect(Collectors.toList()); + + return new ResponseEntity("["+String.join(",", datasetProfilesStrL)+"]", HttpStatus.OK); + } + catch(Exception ex) { + ex.printStackTrace(); + return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + @Transactional @@ -113,14 +136,14 @@ public class DatasetProfiles { if(datasetprofileruleset != null) { if(datasetprofileruleset.getId()==null) - datasetprofileruleset = datasetProfileRulesetDao.create(datasetprofileruleset); + datasetProfileRulesetDao.create(datasetprofileruleset); else datasetProfileRulesetDao.update(datasetprofileruleset); datasetProfile.setRuleset(datasetprofileruleset); } if(datasetprofileviewstyle != null) { if(datasetprofileviewstyle.getId()==null) - datasetprofileviewstyle = datasetProfileViewstyleDao.create(datasetprofileviewstyle); + datasetProfileViewstyleDao.create(datasetprofileviewstyle); else datasetProfileViewstyleDao.update(datasetprofileviewstyle); datasetProfile.setViewstyle(datasetprofileviewstyle); @@ -129,7 +152,7 @@ public class DatasetProfiles { try { if(datasetProfile.getId()==null) - datasetProfile = datasetProfileDao.create(datasetProfile); + datasetProfileDao.create(datasetProfile); else datasetProfileDao.update(datasetProfile); return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(datasetProfile)); @@ -177,80 +200,26 @@ public class DatasetProfiles { } -// //@Transactional -// @RequestMapping(method = RequestMethod.POST, value = { "/datasetprofile/set" }, consumes = "application/json", produces="application/json") -// public @ResponseBody ResponseEntity setDatasetProfile(@RequestBody DatasetProfile datasetProfile) { -// -// System.out.println("inside setDatasetProfile"); -// try { -// System.out.println(objectMapper.writeValueAsString(datasetProfile)); -// } catch (JsonProcessingException e) { -// e.printStackTrace(); -// } -// -// if(datasetProfile.getRuleset()!=null && datasetProfile.getRuleset().getId()!=null){ -// DatasetProfileRuleset dpr = datasetProfile.getRuleset(); -// datasetProfileRulesetDao.update(dpr); -// DatasetProfileRuleset n = new DatasetProfileRuleset(); -// n.setId(dpr.getId()); -// datasetProfile.setRuleset(n); -// } -// -// if(datasetProfile.getViewstyle()!=null && datasetProfile.getViewstyle().getId()!=null){ -// DatasetProfileViewstyle dpv = datasetProfile.getViewstyle(); -// datasetProfileViewstyleDao.update(dpv); -// DatasetProfileViewstyle n = new DatasetProfileViewstyle(); -// n.setId(dpv.getId()); -// datasetProfile.setViewstyle(n); -// } -// -// datasetProfile.setDataset(null); -// -// DatasetProfile createdDatasetProfile = datasetProfileDao.update(datasetProfile); -// try { -// return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDatasetProfile)); -// } catch (JsonProcessingException e) { -// e.printStackTrace(); -// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not set dataset profile!\"}"); -// } -// -// } - - - -// @RequestMapping(method = RequestMethod.POST, value = { "/createEmptyDatasetProfile" }) -// public @ResponseBody ResponseEntity createEmptyDatasetProfile(@RequestParam("datasetID") String datasetID) { -// -// DatasetProfileRuleset dpr = new DatasetProfileRuleset(); -// dpr.setLabel(""); -// dpr.setDefinition(""); -// dpr.setId(datasetProfileRulesetDao.create(dpr).getId()); -// -// DatasetProfileViewstyle dpv = new DatasetProfileViewstyle(); -// dpv.setLabel(""); -// dpv.setDefinition(""); -// dpv.setId(datasetProfileViewstyleDao.create(dpv).getId()); -// -// DatasetProfile datasetProfile = new DatasetProfile(); -// datasetProfile.setLabel(""); -// datasetProfile.setDefinition(""); -// datasetProfile.setRuleset(dpr); -// datasetProfile.setViewstyle(dpv); -// -// Dataset ds = new Dataset(); -// ds.setId(UUID.fromString(datasetID)); -// Set datasets = new HashSet(); -// datasets.add(ds); -// datasetProfile.setDataset(datasets); -// -// try { -// datasetProfile = datasetProfileDao.create(datasetProfile); -// return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(datasetProfile)); -// } -// catch(Exception e) { -// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("FAILED: reason: "+e.getMessage()); -// } -// } + @Transactional + @RequestMapping(method = RequestMethod.POST, value = { "/datasetprofile/delete" }, consumes = "application/json", produces="application/json") + public @ResponseBody ResponseEntity deleteDatasetProfile(@RequestBody DatasetProfile datasetProfile) { + + DatasetProfileRuleset datasetprofileruleset = datasetProfile.getRuleset(); + DatasetProfileViewstyle datasetprofileviewstyle = datasetProfile.getViewstyle(); + + try { + if(datasetprofileruleset != null) + datasetProfileRulesetDao.delete(datasetprofileruleset); + if(datasetprofileviewstyle != null) + datasetProfileViewstyleDao.delete(datasetprofileviewstyle); + datasetProfileDao.delete(datasetProfile); + return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(datasetProfile)); + } + catch(Exception ex) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not delete dataset profile!\"}"); + } + + } diff --git a/dmp-backend/src/main/java/rest/entities/Datasets.java b/dmp-backend/src/main/java/rest/entities/Datasets.java index 3dcb6d6cb..f4b8fd240 100644 --- a/dmp-backend/src/main/java/rest/entities/Datasets.java +++ b/dmp-backend/src/main/java/rest/entities/Datasets.java @@ -74,7 +74,6 @@ public class Datasets { private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer(); - // FETCH BY DATASET(S) @@ -111,11 +110,13 @@ public class Datasets { try { List allDatasets = datasetDao.getAll(); + //sorry for that, spring-jersey serialisation has issues when performed on tables, so -> custom - List datasetsStrL = allDatasets.parallelStream().map((datasetObj) -> { + List datasetsStrL = allDatasets.stream().map((datasetObj) -> { try { return objectMapper.writeValueAsString(datasetObj); } catch (JsonProcessingException e) { + e.printStackTrace(); return ""; } }).collect(Collectors.toList()); @@ -123,6 +124,7 @@ public class Datasets { return new ResponseEntity("["+String.join(",", datasetsStrL)+"]", HttpStatus.OK); } catch(Exception ex) { + ex.printStackTrace(); return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); } @@ -219,33 +221,5 @@ public class Datasets { - - /* - @RequestMapping(method = RequestMethod.GET, value = { "/createEmptyDataset" }) - public @ResponseBody ResponseEntity createEmptyDataset() { - Dataset dataset = new Dataset(); - dataset.setLabel(""); - - try { - dataset = datasetDao.create(dataset); - } - catch(Exception e) { - e.printStackTrace(); - try { - dataset = datasetDao.update(dataset); - } - catch(Exception ex) { - ex.printStackTrace(); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("FAILED: reason: "+e.getMessage()); - } - } - return ResponseEntity.status(HttpStatus.CREATED).body("Created Dataset with id: " + dataset.getId()); - } - */ - - - - - } diff --git a/dmp-backend/src/main/java/rest/entities/Projects.java b/dmp-backend/src/main/java/rest/entities/Projects.java index 076cd9f7b..b527b0f08 100644 --- a/dmp-backend/src/main/java/rest/entities/Projects.java +++ b/dmp-backend/src/main/java/rest/entities/Projects.java @@ -84,25 +84,25 @@ public class Projects { // MANAGE PROJECT(S) - @RequestMapping(method = RequestMethod.GET, value = { "/projects" }) + @RequestMapping(method = RequestMethod.GET, value = { "/projects" }, produces="application/json") public @ResponseBody ResponseEntity listProjects(){ try { List allIDs = projectDao.listAllIDs(); - return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs)); + return ResponseEntity.status(HttpStatus.OK).body(allIDs); } catch(Exception ex) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage()); } } - @RequestMapping(method = RequestMethod.GET, value = { "/projects/{id}" }) + @RequestMapping(method = RequestMethod.GET, value = { "/projects/{id}" }, produces="application/json") public @ResponseBody ResponseEntity getProject(@PathVariable("id") String id) { try { Project project = projectDao.read(UUID.fromString(id)); System.out.println(project.getId().toString()); - return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(project)); + return ResponseEntity.status(HttpStatus.OK).body(project); } catch(Exception ex) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage()); @@ -110,11 +110,11 @@ public class Projects { } - @RequestMapping(method = RequestMethod.GET, value = { "/project/listAllLabelIDs" }) + @RequestMapping(method = RequestMethod.GET, value = { "/project/listAllLabelIDs" }, produces="application/json") public @ResponseBody ResponseEntity listLabelIds(){ try { List allIDs = projectDao.listAllIDsLabels(); - return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs)); + return ResponseEntity.status(HttpStatus.OK).body(allIDs); } catch(Exception ex) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage()); @@ -150,15 +150,11 @@ public class Projects { @RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json") public @ResponseBody ResponseEntity setProject(@RequestBody Project project) { Project createdProject = projectDao.update(project); - try { - return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdProject)); - } catch (JsonProcessingException e) { - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not create Project!\"}"); - } + return ResponseEntity.status(HttpStatus.CREATED).body(createdProject); } - @RequestMapping(method = RequestMethod.POST, value = { "/project/delete" }, consumes = "application/json", produces="text/plain") + @RequestMapping(method = RequestMethod.POST, value = { "/project/delete" }, consumes = "application/json", produces="application/json") public @ResponseBody ResponseEntity delete(@RequestBody Project project) { Project p = new Project(); diff --git a/dmp-backend/src/main/java/rest/entities/Services.java b/dmp-backend/src/main/java/rest/entities/Services.java index b82145f9c..d73a29b4c 100644 --- a/dmp-backend/src/main/java/rest/entities/Services.java +++ b/dmp-backend/src/main/java/rest/entities/Services.java @@ -1,5 +1,6 @@ package rest.entities; +import java.io.IOException; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; @@ -70,7 +71,9 @@ public class Services { @Autowired private ServiceDao serviceDao; - private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer(); + private ObjectMapper objectMapper = + SerializerProvider.getJsonSerializer(); +// new ObjectMapper(); // MANAGE SERVICE(S) @@ -124,7 +127,16 @@ public class Services { @Transactional @RequestMapping(method = RequestMethod.POST, value = { "/service/create" }, consumes = "application/json", produces="application/json") - public @ResponseBody ResponseEntity setService(@RequestBody Service service) { + public @ResponseBody ResponseEntity setService(@RequestBody String serviceSTR) { + + System.out.println(serviceSTR); + Service service = null; + try { + service = objectMapper.readValue(serviceSTR, Service.class); + } catch (IOException e1) { + e1.printStackTrace(); + } + Service createdService = serviceDao.update(service); try { return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdService)); @@ -137,10 +149,10 @@ public class Services { @RequestMapping(method = RequestMethod.POST, value = { "/service/delete" }, consumes = "application/json", produces="text/plain") public @ResponseBody ResponseEntity delete(@RequestBody Service service) { - Service s = new Service(); - s.setId(service.getId()); + System.out.println(service); + try { - serviceDao.delete(s); + serviceDao.delete(service); return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted Service entity!\"}"); } catch (Exception e) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not Delete Service entity!\"}"); diff --git a/dmp-backend/src/main/webapp/WEB-INF/applicationContext.xml b/dmp-backend/src/main/webapp/WEB-INF/applicationContext.xml index 99297f5f8..39ea602d6 100644 --- a/dmp-backend/src/main/webapp/WEB-INF/applicationContext.xml +++ b/dmp-backend/src/main/webapp/WEB-INF/applicationContext.xml @@ -112,6 +112,7 @@ + diff --git a/dmp-backend/src/test/java/TestRest.java b/dmp-backend/src/test/java/TestRest.java index bac068d71..6bfad4b28 100644 --- a/dmp-backend/src/test/java/TestRest.java +++ b/dmp-backend/src/test/java/TestRest.java @@ -1,18 +1,24 @@ import static org.junit.Assert.*; +import java.io.IOException; import java.util.ArrayList; +import java.util.UUID; import org.junit.Before; import org.junit.Test; +import org.mortbay.jetty.HttpStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; import dao.entities.DMPDao; import dao.entities.DMPProfileDao; @@ -30,11 +36,13 @@ import dao.entities.UserInfoDao; import entities.DatasetProfile; import entities.DatasetProfileRuleset; import entities.DatasetProfileViewstyle; +import entities.Service; import helpers.SerializerProvider; import rest.entities.DMPs; import rest.entities.DatasetProfiles; import rest.entities.Datasets; -import rest.entities.Projects; +import rest.entities.Projects; +import rest.entities.Services; @ComponentScan(basePackages = "dao, entities, controller, login, proxy, rest") public class TestRest { @@ -53,7 +61,8 @@ public class TestRest { @Autowired private ServiceDao serviceDao; @Autowired private UserInfoDao userInfoDao; - private static ObjectMapper objectMapper = SerializerProvider.getJsonSerializer(); + + Gson gson = new Gson(); private static String userID = "0f51f686-a2ce-47c1-9433-00736787aa88"; @@ -63,6 +72,7 @@ public class TestRest { private Datasets datasetsService; private DatasetProfiles datasetProfilesService; private DMPs dmpsService; + private Services servicesService; @Before @@ -76,11 +86,11 @@ public class TestRest { datasetsService = context.getBean(Datasets.class); datasetProfilesService = context.getBean(DatasetProfiles.class); dmpsService = context.getBean(DMPs.class); - + servicesService = context.getBean(Services.class); } - @Test +// @Test public void testDatasetProfile() { // DatasetProfile datasetProfile = new DatasetProfile(); // datasetProfile.setLabel("Sample-Dataset-Profile"); @@ -95,25 +105,58 @@ public class TestRest { // dpv.setLabel("Sample-Dataset-Profile viewstyle"); // dpv.setDefinition("dpv definition"); // datasetProfile.setViewstyle(dpv); - - -// String profJSON = (String)datasetProfilesService.createDatasetProfile(datasetProfile).getBody(); -// DatasetProfile prof = null; - try { -// prof = objectMapper.readValue(profJSON, DatasetProfile.class); -// assertNotNull(prof.getId()); - } - catch(Exception ex) { - } -// assertNotNull(prof); - +// +// datasetProfilesService.createDatasetProfile(datasetProfile); +// +// assertNotNull(datasetProfile.getId()); } +// @Test + public void testDatasetProfile2() { + +// DatasetProfile datasetProfile = new DatasetProfile(); +// datasetProfile.setLabel("Sample-Dataset-Profile-222"); +// datasetProfile.setDefinition("Sample-Dataset-Profile-222 definition"); +// +// DatasetProfileRuleset dpr = new DatasetProfileRuleset(); +// dpr.setLabel("Sample-Dataset-Profile-222 ruleset"); +// dpr.setDefinition("dpr definition"); +// datasetProfile.setRuleset(dpr); +// +// DatasetProfileViewstyle dpv = new DatasetProfileViewstyle(); +// dpv.setLabel("Sample-Dataset-Profile-222 viewstyle"); +// dpv.setDefinition("dpv definition"); +// datasetProfile.setViewstyle(dpv); +// +// ResponseEntity createResp = datasetProfilesService.createDatasetProfile(datasetProfile); +// assertEquals(201, createResp.getStatusCodeValue()); +// +// datasetProfile.setLabel("SAMPLE-DATASET-PROFILE-222"); +// dpr.setLabel("SAMPLE-DATASET-PROFILE-222"); +// dpv.setLabel("SAMPLE-DATASET-PROFILE-222"); +// +// ResponseEntity updResp = datasetProfilesService.updateDatasetProfile(datasetProfile); +// assertEquals(201, updResp.getStatusCodeValue()); +// +// ResponseEntity delResp = datasetProfilesService.deleteDatasetProfile(datasetProfile); +// assertEquals(200, delResp.getStatusCodeValue()); + + } + + + +// @Test + public void testServiceService() { + Service service = new Service(); + service.setId(UUID.fromString("37acad15-39a1-46f3-a6f3-1bf0eaefaadc")); + ResponseEntity delResp = servicesService.delete(service); + assertEquals(201, delResp.getStatusCodeValue()); + } - @Test +// @Test public void testProject() { System.out.println(projectsService.listProjects().getBody());