You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by cs...@apache.org on 2013/01/24 15:20:01 UTC

svn commit: r1438009 - in /syncope/trunk: client/src/main/java/org/apache/syncope/client/services/proxy/ common/src/main/java/org/apache/syncope/common/services/ console/src/main/java/org/apache/syncope/console/rest/ core/src/main/java/org/apache/synco...

Author: cschneider
Date: Thu Jan 24 14:20:00 2013
New Revision: 1438009

URL: http://svn.apache.org/viewvc?rev=1438009&view=rev
Log:
SYNCOPE-231 Adding ReportService for CXF

Added:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java   (with props)
Modified:
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java
    syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
    syncope/trunk/core/src/main/resources/restContext.xml
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java?rev=1438009&r1=1438008&r2=1438009&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java Thu Jan 24 14:20:00 2013
@@ -19,8 +19,12 @@
 package org.apache.syncope.client.services.proxy;
 
 import java.io.InputStream;
+import java.net.URI;
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.services.ReportService;
 import org.apache.syncope.common.to.ReportExecTO;
@@ -35,13 +39,15 @@ public class ReportServiceProxy extends 
     }
 
     @Override
-    public ReportTO create(final ReportTO reportTO) {
-        return getRestTemplate().postForObject(baseUrl + "report/create", reportTO, ReportTO.class);
+    public Response create(final ReportTO reportTO) {
+        ReportTO createdReportTO = getRestTemplate().postForObject(baseUrl + "report/create", reportTO, ReportTO.class);
+        URI location = URI.create(baseUrl + "report/read/" + createdReportTO.getId() + ".json");
+        return Response.created(location).entity(createdReportTO.getId()).build();
     }
 
     @Override
-    public ReportTO update(final Long reportId, final ReportTO reportTO) {
-        return getRestTemplate().postForObject(baseUrl + "report/update", reportTO, ReportTO.class);
+    public void update(final Long reportId, final ReportTO reportTO) {
+        getRestTemplate().postForObject(baseUrl + "report/update", reportTO, ReportTO.class);
     }
 
     @Override
@@ -66,9 +72,10 @@ public class ReportServiceProxy extends 
     }
 
     @Override
-    public List<String> getReportletConfClasses() {
-        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "report/reportletConfClasses.json",
+    public Set<String> getReportletConfClasses() {
+        List<String> confClasses = Arrays.asList(getRestTemplate().getForObject(baseUrl + "report/reportletConfClasses.json",
                 String[].class));
+        return new HashSet<String>(confClasses);
     }
 
     @Override
@@ -99,13 +106,13 @@ public class ReportServiceProxy extends 
     }
 
     @Override
-    public ReportTO delete(final Long reportId) {
-        return getRestTemplate().getForObject(baseUrl + "report/delete/{reportId}", ReportTO.class, reportId);
+    public void delete(final Long reportId) {
+        getRestTemplate().getForObject(baseUrl + "report/delete/{reportId}", ReportTO.class, reportId);
     }
 
     @Override
-    public ReportExecTO deleteExecution(final Long executionId) {
-        return getRestTemplate().getForObject(baseUrl + "report/execution/delete/{executionId}", ReportExecTO.class,
+    public void deleteExecution(final Long executionId) {
+        getRestTemplate().getForObject(baseUrl + "report/execution/delete/{executionId}", ReportExecTO.class,
                 executionId);
     }
 }

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java?rev=1438009&r1=1438008&r2=1438009&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java Thu Jan 24 14:20:00 2013
@@ -19,6 +19,7 @@
 package org.apache.syncope.common.services;
 
 import java.util.List;
+import java.util.Set;
 
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
@@ -40,11 +41,11 @@ import org.apache.syncope.common.types.R
 public interface ReportService {
 
     @POST
-    ReportTO create(ReportTO reportTO);
+    Response create(ReportTO reportTO);
 
     @PUT
     @Path("{reportId}")
-    ReportTO update(@PathParam("reportId") Long reportId, ReportTO reportTO);
+    void update(@PathParam("reportId") Long reportId, ReportTO reportTO);
 
     @GET
     @Path("count")
@@ -63,7 +64,7 @@ public interface ReportService {
 
     @GET
     @Path("reportletConfClasses")
-    List<String> getReportletConfClasses();
+    Set<String> getReportletConfClasses();
 
     @GET
     @Path("{reportId}")
@@ -85,9 +86,9 @@ public interface ReportService {
 
     @DELETE
     @Path("{reportId}")
-    ReportTO delete(@PathParam("reportId") Long reportId);
+    void delete(@PathParam("reportId") Long reportId);
 
     @DELETE
     @Path("executions/{executionId}")
-    ReportExecTO deleteExecution(@PathParam("executionId") Long executionId);
+    void deleteExecution(@PathParam("executionId") Long executionId);
 }

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java?rev=1438009&r1=1438008&r2=1438009&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java Thu Jan 24 14:20:00 2013
@@ -18,7 +18,12 @@
  */
 package org.apache.syncope.console.rest;
 
+import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.core.Response;
 
 import org.apache.syncope.common.services.ReportService;
 import org.apache.syncope.common.to.ReportExecTO;
@@ -35,7 +40,8 @@ public class ReportRestClient extends Ba
         List<String> reportletClasses = null;
 
         try {
-            reportletClasses = getService(ReportService.class).getReportletConfClasses();
+            Set<String> reportletClassesSet = getService(ReportService.class).getReportletConfClasses();
+            reportletClasses = new LinkedList<String>(reportletClassesSet);
         } catch (SyncopeClientCompositeErrorException e) {
             LOG.error("While getting available reportlet classes", e);
         }
@@ -59,11 +65,13 @@ public class ReportRestClient extends Ba
     }
 
     public ReportTO create(final ReportTO reportTO) {
-        return getService(ReportService.class).create(reportTO);
+        Response response = getService(ReportService.class).create(reportTO);
+        Long reportId = (Long) response.getEntity();
+        return getService(ReportService.class).read(reportId);
     }
 
-    public ReportTO update(final ReportTO reportTO) {
-        return getService(ReportService.class).update(reportTO.getId(), reportTO);
+    public void update(final ReportTO reportTO) {
+        getService(ReportService.class).update(reportTO.getId(), reportTO);
     }
 
     /**
@@ -71,8 +79,8 @@ public class ReportRestClient extends Ba
      *
      * @param reportId report to delete
      */
-    public ReportTO delete(final Long reportId) {
-        return getService(ReportService.class).delete(reportId);
+    public void delete(final Long reportId) {
+        getService(ReportService.class).delete(reportId);
     }
 
     /**

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java?rev=1438009&r1=1438008&r2=1438009&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java Thu Jan 24 14:20:00 2013
@@ -20,6 +20,7 @@ package org.apache.syncope.core.rest.con
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -29,6 +30,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.zip.ZipInputStream;
 
+import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cocoon.optional.pipeline.components.sax.fop.FopSerializer;
@@ -100,6 +102,12 @@ public class ReportController extends Ab
     @PreAuthorize("hasRole('REPORT_CREATE')")
     @RequestMapping(method = RequestMethod.POST, value = "/create")
     public ReportTO create(final HttpServletResponse response, @RequestBody final ReportTO reportTO) {
+        ReportTO createdReportTO = createInternal(reportTO);
+        response.setStatus(HttpServletResponse.SC_CREATED);
+        return createdReportTO;
+    }
+    
+    public ReportTO createInternal(final ReportTO reportTO) {
         LOG.debug("Creating report " + reportTO);
 
         Report report = new Report();
@@ -122,7 +130,6 @@ public class ReportController extends Ab
         auditManager.audit(Category.report, ReportSubCategory.create, Result.success,
                 "Successfully created report: " + report.getId());
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
         return binder.getReportTO(report);
     }
 
@@ -212,6 +219,12 @@ public class ReportController extends Ab
     @PreAuthorize("hasRole('REPORT_LIST')")
     @RequestMapping(method = RequestMethod.GET, value = "/reportletConfClasses")
     public ModelAndView getReportletConfClasses() {
+        Set<String> reportletConfClasses = getReportletConfClassesInternal();
+        return new ModelAndView().addObject(reportletConfClasses);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Set<String> getReportletConfClassesInternal() {
         Set<String> reportletConfClasses = new HashSet<String>();
 
         for (Class<Reportlet> reportletClass : binder.getAllReportletClasses()) {
@@ -223,8 +236,7 @@ public class ReportController extends Ab
 
         auditManager.audit(Category.report, ReportSubCategory.getReportletConfClasses, Result.success,
                 "Successfully listed all ReportletConf classes: " + reportletConfClasses.size());
-
-        return new ModelAndView().addObject(reportletConfClasses);
+        return reportletConfClasses;
     }
 
     @PreAuthorize("hasRole('REPORT_READ')")
@@ -265,31 +277,26 @@ public class ReportController extends Ab
             @PathVariable("executionId") final Long executionId,
             @RequestParam(value = "fmt", required = false) final ReportExecExportFormat fmt) throws NotFoundException {
 
-        ReportExec reportExec = reportExecDAO.find(executionId);
-        if (reportExec == null) {
-            throw new NotFoundException("Report execution " + executionId);
-        }
-        if (!ReportExecStatus.SUCCESS.name().equals(reportExec.getStatus()) || reportExec.getExecResult() == null) {
-            SyncopeClientCompositeErrorException sccee = new SyncopeClientCompositeErrorException(
-                    HttpStatus.BAD_REQUEST);
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidReportExec);
-            sce.addElement(reportExec.getExecResult() == null
-                    ? "No report data produced"
-                    : "Report did not run successfully");
-            sccee.addException(sce);
-            throw sccee;
+        ServletOutputStream os;
+        try {
+            os = response.getOutputStream();
+        } catch (IOException e1) {
+            throw new RuntimeException("Could not retrieve stream", e1);
         }
+        ReportExec reportExec = getAndCheckReportExecInternal(executionId);
 
-        ReportExecExportFormat format = fmt == null
-                ? ReportExecExportFormat.XML
-                : fmt;
-
-        LOG.debug("Exporting result of {} as {}", reportExec, format);
+        ReportExecExportFormat format = (fmt == null) ? ReportExecExportFormat.XML : fmt;
 
         response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
         response.addHeader("Content-Disposition", "attachment; filename=" + reportExec.getReport().getName() + "."
                 + format.name().toLowerCase());
 
+        exportExecutionResultInternal(os, reportExec, format);
+    }
+
+    public void exportExecutionResultInternal(OutputStream os, ReportExec reportExec, ReportExecExportFormat format) {
+        LOG.debug("Exporting result of {} as {}", reportExec, format);
+
         // streaming SAX handler from a compressed byte array stream
         ByteArrayInputStream bais = new ByteArrayInputStream(reportExec.getExecResult());
         ZipInputStream zis = new ZipInputStream(bais);
@@ -333,7 +340,7 @@ public class ReportController extends Ab
                     pipeline.addComponent(XMLSerializer.createXMLSerializer());
             }
 
-            pipeline.setup(response.getOutputStream());
+            pipeline.setup(os);
             pipeline.execute();
 
             LOG.debug("Result of {} successfully exported as {}", reportExec, format);
@@ -352,6 +359,25 @@ public class ReportController extends Ab
                 "Successfully exported report execution: " + reportExec.getId());
     }
 
+    public ReportExec getAndCheckReportExecInternal(final Long executionId)
+            throws NotFoundException {
+        ReportExec reportExec = reportExecDAO.find(executionId);
+        if (reportExec == null) {
+            throw new NotFoundException("Report execution " + executionId);
+        }
+        if (!ReportExecStatus.SUCCESS.name().equals(reportExec.getStatus()) || reportExec.getExecResult() == null) {
+            SyncopeClientCompositeErrorException sccee = new SyncopeClientCompositeErrorException(
+                    HttpStatus.BAD_REQUEST);
+            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidReportExec);
+            sce.addElement(reportExec.getExecResult() == null
+                    ? "No report data produced"
+                    : "Report did not run successfully");
+            sccee.addException(sce);
+            throw sccee;
+        }
+        return reportExec;
+    }
+
     @PreAuthorize("hasRole('REPORT_EXECUTE')")
     @RequestMapping(method = RequestMethod.POST, value = "/execute/{reportId}")
     public ReportExecTO execute(@PathVariable("reportId") final Long reportId) throws NotFoundException {

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java?rev=1438009&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java Thu Jan 24 14:20:00 2013
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.services;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.syncope.common.services.ReportService;
+import org.apache.syncope.common.to.ReportExecTO;
+import org.apache.syncope.common.to.ReportTO;
+import org.apache.syncope.common.types.ReportExecExportFormat;
+import org.apache.syncope.core.persistence.beans.ReportExec;
+import org.apache.syncope.core.persistence.dao.ReportDAO;
+import org.apache.syncope.core.rest.controller.ReportController;
+import org.apache.syncope.core.util.NotFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ReportServiceImpl implements ReportService, ContextAware {
+    @Autowired
+    ReportController reportController;
+    
+    @Autowired
+    private ReportDAO reportDAO;
+    
+    private UriInfo uriInfo;
+
+    @Override
+    public Response create(ReportTO reportTO) {
+        ReportTO createdReportTO = reportController.createInternal(reportTO);
+        URI location = uriInfo.getAbsolutePathBuilder().path("" + createdReportTO.getId()).build();
+        return Response.created(location).build();
+    }
+
+    @Override
+    public void update(@PathParam("reportId") Long reportId, ReportTO reportTO) {
+        try {
+            reportController.update(reportTO);
+        } catch (NotFoundException e) {
+            throw new javax.ws.rs.NotFoundException(e);
+        }
+    }
+
+    @Override
+    public int count() {
+        return reportDAO.count();
+    }
+
+    @Override
+    public List<ReportTO> list() {
+        return reportController.list();
+    }
+
+    @Override
+    public List<ReportTO> list(@QueryParam("page") int page,
+            @QueryParam("size") @DefaultValue("25") int size) {
+        return reportController.list(page, size);
+    }
+
+    @Override
+    public List<ReportExecTO> listExecutions() {
+        return reportController.listExecutions();
+    }
+
+    @Override
+    public Set<String> getReportletConfClasses() {
+        return reportController.getReportletConfClassesInternal();
+    }
+
+    @Override
+    public ReportTO read(@PathParam("reportId") Long reportId) {
+        try {
+            return reportController.read(reportId);
+        } catch (NotFoundException e) {
+            throw new javax.ws.rs.NotFoundException();
+        }
+    }
+
+    @Override
+    public ReportExecTO readExecution(@PathParam("executionId") Long executionId) {
+        try {
+            return reportController.readExecution(executionId);
+        } catch (NotFoundException e) {
+            throw new javax.ws.rs.NotFoundException(e);
+        }
+    }
+
+    @Override
+    public Response exportExecutionResult(final @PathParam("executionId") Long executionId,
+            final @QueryParam("format") ReportExecExportFormat fmt) {
+        final ReportExecExportFormat format = (fmt == null) ? ReportExecExportFormat.XML : fmt;
+        try {
+            final ReportExec reportExec = reportController.getAndCheckReportExecInternal(executionId);
+            return Response.ok(new StreamingOutput() {
+                public void write(final OutputStream os) throws IOException {
+                    reportController.exportExecutionResultInternal(os, reportExec, format);
+                }
+            }).build();
+        } catch (NotFoundException e) {
+            throw new javax.ws.rs.NotFoundException(e);
+        }
+    }
+
+    @Override
+    public ReportExecTO execute(@PathParam("reportId") Long reportId) {
+        try {
+            return reportController.execute(reportId);
+        } catch (NotFoundException e) {
+            throw new javax.ws.rs.NotFoundException(e);
+        }
+    }
+
+    @Override
+    public void delete(@PathParam("reportId") Long reportId) {
+        try {
+            reportController.delete(reportId);
+        } catch (NotFoundException e) {
+            throw new javax.ws.rs.NotFoundException(e);
+        }
+    }
+
+    @Override
+    public void deleteExecution(@PathParam("executionId") Long executionId) {
+        try {
+            reportController.deleteExecution(executionId);
+        } catch (NotFoundException e) {
+            throw new javax.ws.rs.NotFoundException(e);
+        }
+    }
+
+    @Override
+    public void setUriInfo(UriInfo uriInfo) {
+        this.uriInfo = uriInfo;
+    }
+
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/trunk/core/src/main/resources/restContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/restContext.xml?rev=1438009&r1=1438008&r2=1438009&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/restContext.xml (original)
+++ syncope/trunk/core/src/main/resources/restContext.xml Thu Jan 24 14:20:00 2013
@@ -72,6 +72,7 @@ under the License.
       <ref bean="entitlementServiceImpl"/>
       <ref bean="policyServiceImpl"/>
       <ref bean="schemaServiceImpl"/>
+      <ref bean="reportServiceImpl"/>
     </jaxrs:serviceBeans>
     <jaxrs:resourceComparator>
       <bean id="myServiceComparator" class="org.apache.syncope.core.rest.utils.QueryResourceInfoComperator"/>

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java?rev=1438009&r1=1438008&r2=1438009&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java Thu Jan 24 14:20:00 2013
@@ -29,6 +29,9 @@ import java.io.StringWriter;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.core.Response;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.IOUtils;
@@ -43,6 +46,12 @@ import org.springframework.web.client.Ht
 
 @FixMethodOrder(MethodSorters.JVM)
 public class ReportTestITCase extends AbstractTest {
+    
+    ReportTO createReport(ReportTO report) {
+        Response response = reportService.create(report);
+        Long reportId = (Long) response.getEntity();
+        return reportService.read(reportId);
+    }
 
     // Enable running test more than once with parameters
     public ReportTestITCase(String contentType) {
@@ -51,7 +60,7 @@ public class ReportTestITCase extends Ab
 
     @Test
     public void getReportletClasses() {
-        List<String> reportletClasses = reportService.getReportletConfClasses();
+        Set<String> reportletClasses = reportService.getReportletConfClasses();
         assertNotNull(reportletClasses);
         assertFalse(reportletClasses.isEmpty());
     }
@@ -105,7 +114,7 @@ public class ReportTestITCase extends Ab
         report.addReportletConf(new UserReportletConf("first"));
         report.addReportletConf(new UserReportletConf("second"));
 
-        report = reportService.create(report);
+        report = createReport(report);
         assertNotNull(report);
 
         ReportTO actual = reportService.read(report.getId());
@@ -121,13 +130,14 @@ public class ReportTestITCase extends Ab
         report.addReportletConf(new UserReportletConf("first"));
         report.addReportletConf(new UserReportletConf("second"));
 
-        report = reportService.create(report);
+        report = createReport(report);
         assertNotNull(report);
         assertEquals(2, report.getReportletConfs().size());
 
         report.addReportletConf(new UserReportletConf("last"));
 
-        ReportTO updated = reportService.update(report.getId(), report);
+        reportService.update(report.getId(), report);
+        ReportTO updated = reportService.read(report.getId());
         assertNotNull(updated);
         assertEquals(3, updated.getReportletConfs().size());
     }
@@ -139,11 +149,10 @@ public class ReportTestITCase extends Ab
         report.addReportletConf(new UserReportletConf("first"));
         report.addReportletConf(new UserReportletConf("second"));
 
-        report = reportService.create(report);
+        report = createReport(report);
         assertNotNull(report);
 
-        ReportTO deletedReport = reportService.delete(report.getId());
-        assertNotNull(deletedReport);
+        reportService.delete(report.getId());
 
         try {
             reportService.read(report.getId());
@@ -186,7 +195,7 @@ public class ReportTestITCase extends Ab
         ReportTO reportTO = reportService.read(1L);
         reportTO.setId(0);
         reportTO.setName("executeAndExport" + getUUIDString());
-        reportTO = reportService.create(reportTO);
+        reportTO = createReport(reportTO);
         assertNotNull(reportTO);
 
         ReportExecTO execution = reportService.execute(reportTO.getId());
@@ -258,7 +267,7 @@ public class ReportTestITCase extends Ab
     public void issueSYNCOPE43() {
         ReportTO reportTO = new ReportTO();
         reportTO.setName("issueSYNCOPE43" + getUUIDString());
-        reportTO = reportService.create(reportTO);
+        reportTO = createReport(reportTO);
         assertNotNull(reportTO);
 
         ReportExecTO execution = reportService.execute(reportTO.getId());
@@ -285,7 +294,7 @@ public class ReportTestITCase extends Ab
         ReportTO reportTO = reportService.read(1L);
         reportTO.setId(0);
         reportTO.setName("issueSYNCOPE102" + getUUIDString());
-        reportTO = reportService.create(reportTO);
+        reportTO = createReport(reportTO);
         assertNotNull(reportTO);
 
         // Execute (multiple requests)