This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 26c99ad4d6509a9c8b29df5500bcd9961d4187cd
Author: Francesco Chicchiriccò <ilgro...@apache.org>
AuthorDate: Tue Aug 16 16:34:48 2022 +0200

    Getting rid of Cocoon 3
---
 core/idrepo/logic/pom.xml                          |  65 +++++--
 .../org/apache/syncope/core/logic/ReportLogic.java | 112 +++++++-----
 .../syncope/core/logic/cocoon/FopSerializer.java   |  83 ---------
 .../syncope/core/logic/cocoon/XSLTTransformer.java | 195 ---------------------
 .../apache/syncope/core/logic/AbstractTest.java    |  48 +++++
 .../syncope/core/logic/DummyConfParamOps.java}     |  31 ++--
 .../apache/syncope/core/logic/DummyDomainOps.java  |  64 +++++++
 .../core/logic/DummyImplementationLookup.java      |  96 ++++++++++
 .../syncope/core/logic/DummyServiceOps.java}       |  34 ++--
 .../syncope/core/logic/IdRepoLogicTestContext.java |  75 ++++++++
 .../apache/syncope/core/logic/ReportLogicTest.java | 121 +++++++++++++
 .../apache/syncope/core/logic/TestInitializer.java |  68 +++++++
 .../core/rest/cxf/service/ReportServiceImpl.java   |   2 +-
 .../java/job/report/DefaultReportJobDelegate.java  |   3 +-
 docker/core/src/main/resources/log4j2.xml          |   3 -
 fit/core-reference/src/main/resources/log4j2.xml   |   3 -
 .../syncope/fit/core/ReportTemplateITCase.java     |   4 +-
 pom.xml                                            |  35 +---
 18 files changed, 647 insertions(+), 395 deletions(-)

diff --git a/core/idrepo/logic/pom.xml b/core/idrepo/logic/pom.xml
index dd1fe37c17..7703503fa3 100644
--- a/core/idrepo/logic/pom.xml
+++ b/core/idrepo/logic/pom.xml
@@ -52,15 +52,6 @@ under the License.
       <artifactId>aspectjweaver</artifactId>
     </dependency>
 
-    <dependency>
-      <groupId>org.apache.cocoon.sax</groupId>
-      <artifactId>cocoon-sax</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cocoon.optional</groupId>
-      <artifactId>cocoon-optional</artifactId>
-    </dependency>
-
     <dependency>
       <groupId>org.apache.xmlgraphics</groupId>
       <artifactId>fop</artifactId>
@@ -81,6 +72,39 @@ under the License.
       <artifactId>syncope-core-provisioning-java</artifactId>
       <version>${project.version}</version>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.syncope.core</groupId>
+      <artifactId>syncope-core-workflow-java</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.syncope.core</groupId>
+      <artifactId>syncope-core-persistence-jpa</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -90,7 +114,28 @@ under the License.
         <filtering>true</filtering>
       </resource>
     </resources>
-        
+    <testResources>
+      <testResource>
+        <directory>${basedir}/src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+      <testResource>
+        
<directory>${basedir}/../../persistence-jpa/src/main/resources</directory>
+        <includes>
+          <include>persistence.properties</include>
+        </includes>
+        <filtering>true</filtering>
+      </testResource>
+      <testResource>
+        
<directory>${basedir}/../../persistence-jpa/src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+      <testResource>
+        
<directory>${basedir}/../../provisioning-java/src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
+
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
 
b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
index 45264244d1..95803a43a3 100644
--- 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
+++ 
b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.logic;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.OutputStream;
 import java.lang.reflect.Method;
 import java.nio.charset.StandardCharsets;
@@ -28,19 +29,26 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.zip.ZipInputStream;
 import javax.ws.rs.core.Response;
+import javax.xml.XMLConstants;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import org.apache.cocoon.pipeline.NonCachingPipeline;
-import org.apache.cocoon.pipeline.Pipeline;
-import org.apache.cocoon.sax.SAXPipelineComponent;
-import org.apache.cocoon.sax.component.XMLGenerator;
-import org.apache.cocoon.sax.component.XMLSerializer;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.commons.lang3.tuple.Triple;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.apps.FopFactoryBuilder;
 import org.apache.syncope.common.keymaster.client.api.ConfParamOps;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.ExecTO;
@@ -54,9 +62,6 @@ import 
org.apache.syncope.common.lib.types.ReportExecExportFormat;
 import org.apache.syncope.common.lib.types.ReportExecStatus;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.batch.BatchResponseItem;
-import org.apache.syncope.core.logic.cocoon.FopSerializer;
-import org.apache.syncope.core.logic.cocoon.TextSerializer;
-import org.apache.syncope.core.logic.cocoon.XSLTTransformer;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
 import org.apache.syncope.core.persistence.api.dao.ReportDAO;
 import org.apache.syncope.core.persistence.api.dao.ReportExecDAO;
@@ -78,6 +83,22 @@ import 
org.springframework.transaction.annotation.Transactional;
 
 public class ReportLogic extends AbstractExecutableLogic<ReportTO> {
 
+    protected static final Pattern XSLT_PARAMETER_NAME_PATTERN = 
Pattern.compile("[a-zA-Z_][\\w\\-\\.]*");
+
+    protected static final SAXTransformerFactory TRAX_FACTORY;
+
+    protected static final FopFactory FOP_FACTORY = new FopFactoryBuilder(new 
File(".").toURI()).build();
+
+    static {
+        TRAX_FACTORY = (SAXTransformerFactory) 
SAXTransformerFactory.newInstance();
+        TRAX_FACTORY.setURIResolver((href, base) -> null);
+        try {
+            TRAX_FACTORY.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, 
true);
+        } catch (TransformerConfigurationException e) {
+            LOG.error("Could not enable secure XML processing", e);
+        }
+    }
+
     protected final ReportDAO reportDAO;
 
     protected final ReportExecDAO reportExecDAO;
@@ -227,8 +248,27 @@ public class ReportLogic extends 
AbstractExecutableLogic<ReportTO> {
         return reportExec;
     }
 
+    protected Transformer buildXSLTTransformer(final String template, final 
Map<String, Object> parameters)
+            throws TransformerConfigurationException {
+
+        Templates templates = TRAX_FACTORY.newTemplates(
+                new StreamSource(IOUtils.toInputStream(template, 
StandardCharsets.UTF_8)));
+        TransformerHandler transformerHandler = 
TRAX_FACTORY.newTransformerHandler(templates);
+
+        Transformer transformer = transformerHandler.getTransformer();
+        parameters.forEach((name, values) -> {
+            if (XSLT_PARAMETER_NAME_PATTERN.matcher(name).matches()) {
+                transformer.setParameter(name, values);
+            }
+        });
+
+        return transformer;
+    }
+
     @PreAuthorize("hasRole('" + IdRepoEntitlement.REPORT_READ + "')")
-    public static void exportExecutionResult(final OutputStream os, final 
ReportExec reportExec,
+    public void exportExecutionResult(
+            final OutputStream os,
+            final ReportExec reportExec,
             final ReportExecExportFormat format) {
 
         // streaming SAX handler from a compressed byte array stream
@@ -238,9 +278,6 @@ public class ReportLogic extends 
AbstractExecutableLogic<ReportTO> {
             // a single ZipEntry in the ZipInputStream (see ReportJob)
             zis.getNextEntry();
 
-            Pipeline<SAXPipelineComponent> pipeline = new 
NonCachingPipeline<>();
-            pipeline.addComponent(new XMLGenerator(zis));
-
             Map<String, Object> parameters = new HashMap<>();
             parameters.put("status", reportExec.getStatus());
             parameters.put("message", reportExec.getMessage());
@@ -249,49 +286,44 @@ public class ReportLogic extends 
AbstractExecutableLogic<ReportTO> {
 
             switch (format) {
                 case HTML:
-                    XSLTTransformer xsl2html = new XSLTTransformer(new 
StreamSource(
-                            
IOUtils.toInputStream(reportExec.getReport().getTemplate().getHTMLTemplate(),
-                                    StandardCharsets.UTF_8)));
-                    xsl2html.setParameters(parameters);
-                    pipeline.addComponent(xsl2html);
-                    
pipeline.addComponent(XMLSerializer.createXHTMLSerializer());
+                    Transformer html = buildXSLTTransformer(
+                            
reportExec.getReport().getTemplate().getHTMLTemplate(), parameters);
+                    html.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, 
"yes");
+                    html.transform(
+                            new StreamSource(zis),
+                            new StreamResult(os));
                     break;
 
                 case PDF:
-                    XSLTTransformer xsl2pdf = new XSLTTransformer(new 
StreamSource(
-                            
IOUtils.toInputStream(reportExec.getReport().getTemplate().getFOTemplate(),
-                                    StandardCharsets.UTF_8)));
-                    xsl2pdf.setParameters(parameters);
-                    pipeline.addComponent(xsl2pdf);
-                    pipeline.addComponent(new 
FopSerializer(MimeConstants.MIME_PDF));
+                    Transformer pdf = buildXSLTTransformer(
+                            
reportExec.getReport().getTemplate().getFOTemplate(), parameters);
+                    pdf.transform(
+                            new StreamSource(zis),
+                            new 
SAXResult(FOP_FACTORY.newFop(MimeConstants.MIME_PDF, os).getDefaultHandler()));
                     break;
 
                 case RTF:
-                    XSLTTransformer xsl2rtf = new XSLTTransformer(new 
StreamSource(
-                            
IOUtils.toInputStream(reportExec.getReport().getTemplate().getFOTemplate(),
-                                    StandardCharsets.UTF_8)));
-                    xsl2rtf.setParameters(parameters);
-                    pipeline.addComponent(xsl2rtf);
-                    pipeline.addComponent(new 
FopSerializer(MimeConstants.MIME_RTF));
+                    Transformer rtf = buildXSLTTransformer(
+                            
reportExec.getReport().getTemplate().getFOTemplate(), parameters);
+                    rtf.transform(
+                            new StreamSource(zis),
+                            new 
SAXResult(FOP_FACTORY.newFop(MimeConstants.MIME_RTF, os).getDefaultHandler()));
                     break;
 
                 case CSV:
-                    XSLTTransformer xsl2csv = new XSLTTransformer(new 
StreamSource(
-                            
IOUtils.toInputStream(reportExec.getReport().getTemplate().getCSVTemplate(),
-                                    StandardCharsets.UTF_8)));
-                    xsl2csv.setParameters(parameters);
-                    pipeline.addComponent(xsl2csv);
-                    pipeline.addComponent(new TextSerializer());
+                    Transformer csv = buildXSLTTransformer(
+                            
reportExec.getReport().getTemplate().getCSVTemplate(), parameters);
+                    csv.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, 
"yes");
+                    csv.transform(
+                            new StreamSource(zis),
+                            new StreamResult(os));
                     break;
 
                 case XML:
                 default:
-                    pipeline.addComponent(XMLSerializer.createXMLSerializer());
+                    zis.transferTo(os);
             }
 
-            pipeline.setup(os);
-            pipeline.execute();
-
             LOG.debug("Result of {} successfully exported as {}", reportExec, 
format);
         } catch (Exception e) {
             LOG.error("While exporting content", e);
diff --git 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/FopSerializer.java
 
b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/FopSerializer.java
deleted file mode 100644
index 14124cd18a..0000000000
--- 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/FopSerializer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.logic.cocoon;
-
-import java.io.File;
-import java.io.OutputStream;
-import org.apache.cocoon.pipeline.ProcessingException;
-import org.apache.cocoon.pipeline.caching.CacheKey;
-import org.apache.cocoon.pipeline.caching.SimpleCacheKey;
-import org.apache.cocoon.pipeline.component.CachingPipelineComponent;
-import org.apache.cocoon.pipeline.util.StringRepresentation;
-import org.apache.cocoon.sax.AbstractSAXSerializer;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.apps.Fop;
-import org.apache.fop.apps.FopFactory;
-import org.apache.fop.apps.FopFactoryBuilder;
-import org.apache.xmlgraphics.util.MimeConstants;
-import org.xml.sax.ContentHandler;
-
-public class FopSerializer extends AbstractSAXSerializer implements 
CachingPipelineComponent {
-
-    private static final FopFactory FOP_FACTORY = new FopFactoryBuilder(new 
File(".").toURI()).build();
-
-    private String outputFormat;
-
-    /**
-     * Create a new FOP serializer that produces a PDF in output
-     */
-    public FopSerializer() {
-        this(MimeConstants.MIME_PDF);
-    }
-
-    /**
-     * Create a new FOP serializer that produces the specified mime
-     *
-     * @param outputFormat the output's mime type
-     */
-    public FopSerializer(final String outputFormat) {
-        if (outputFormat == null) {
-            throw new IllegalArgumentException("The parameter 'outputFormat' 
mustn't be null.");
-        }
-
-        this.outputFormat = outputFormat;
-    }
-
-    @Override
-    public CacheKey constructCacheKey() {
-        return new SimpleCacheKey();
-    }
-
-    @Override
-    public void setOutputStream(final OutputStream outputStream) {
-        try {
-            Fop fop = FOP_FACTORY.newFop(this.outputFormat, outputStream);
-            ContentHandler fopContentHandler = fop.getDefaultHandler();
-
-            this.setContentHandler(fopContentHandler);
-        } catch (FOPException e) {
-            throw new ProcessingException("Impossible to initialize 
FOPSerializer", e);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return StringRepresentation.buildString(this, "outputFormat=" + 
this.outputFormat);
-    }
-}
diff --git 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/XSLTTransformer.java
 
b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/XSLTTransformer.java
deleted file mode 100644
index eb5dab6366..0000000000
--- 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/XSLTTransformer.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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.logic.cocoon;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import org.apache.cocoon.pipeline.SetupException;
-import org.apache.cocoon.pipeline.caching.CacheKey;
-import org.apache.cocoon.pipeline.component.CachingPipelineComponent;
-import org.apache.cocoon.pipeline.util.StringRepresentation;
-import org.apache.cocoon.sax.AbstractSAXTransformer;
-import org.apache.cocoon.sax.SAXConsumer;
-import org.apache.cocoon.sax.util.SAXConsumerAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class XSLTTransformer extends AbstractSAXTransformer implements 
CachingPipelineComponent {
-
-    private static final Logger LOG = 
LoggerFactory.getLogger(XSLTTransformer.class);
-
-    /**
-     * A generic transformer factory to parse XSLTs.
-     */
-    private static final SAXTransformerFactory TRAX_FACTORY = 
createNewSAXTransformerFactory();
-
-    /**
-     * The XSLT parameters name pattern.
-     */
-    private static final Pattern XSLT_PARAMETER_NAME_PATTERN = 
Pattern.compile("[a-zA-Z_][\\w\\-\\.]*");
-
-    /**
-     * The XSLT parameters reference.
-     */
-    private Map<String, Object> parameters;
-
-    /**
-     * The XSLT Template reference.
-     */
-    private Templates templates;
-
-    private Source source;
-
-    public XSLTTransformer(final Source source) {
-        super();
-        this.load(source, null);
-    }
-
-    /**
-     * Creates a new transformer reading the XSLT from the Source source and 
setting the TransformerFactory attributes.
-     *
-     * This constructor is useful when users want to perform XSLT 
transformation using <a
-     * href="http://xml.apache.org/xalan-j/xsltc_usage.html";>xsltc</a>.
-     *
-     * @param source the XSLT source
-     * @param attributes the Transformer Factory attributes
-     */
-    public XSLTTransformer(final Source source, final Map<String, Object> 
attributes) {
-        super();
-        this.load(source, attributes);
-    }
-
-    /**
-     * Method useful to create a new transformer reading the XSLT from the URL 
source and setting the Transformer
-     * Factory attributes.
-     *
-     * This method is useful when users want to perform XSLT transformation 
using <a
-     * href="http://xml.apache.org/xalan-j/xsltc_usage.html";>xsltc</a>.
-     *
-     * @param source the XSLT source
-     * @param attributes the Transformer Factory attributes
-     */
-    private void load(final Source source, final Map<String, Object> 
attributes) {
-        if (source == null) {
-            throw new IllegalArgumentException("The parameter 'source' mustn't 
be null.");
-        }
-
-        this.source = source;
-
-        this.load(this.source, this.source.toString(), attributes);
-    }
-
-    private void load(final Source source, final String localCacheKey, final 
Map<String, Object> attributes) {
-        LOG.debug("{} local cache miss: {}", getClass().getSimpleName(), 
localCacheKey);
-
-        // XSLT has to be parsed
-        final SAXTransformerFactory transformerFactory;
-        if (attributes == null || attributes.isEmpty()) {
-            transformerFactory = TRAX_FACTORY;
-        } else {
-            transformerFactory = createNewSAXTransformerFactory();
-            attributes.forEach(transformerFactory::setAttribute);
-        }
-
-        try {
-            this.templates = transformerFactory.newTemplates(source);
-        } catch (TransformerConfigurationException e) {
-            throw new SetupException("Impossible to read XSLT from '" + source 
+ "', see nested exception", e);
-        }
-    }
-
-    /**
-     * Sets the XSLT parameters to be applied to XSLT stylesheet.
-     *
-     * @param parameters the XSLT parameters to be applied to XSLT stylesheet
-     */
-    public void setParameters(final Map<String, ? extends Object> parameters) {
-        if (parameters == null) {
-            this.parameters = null;
-        } else {
-            this.parameters = new HashMap<>(parameters);
-        }
-    }
-
-    @Override
-    protected void setSAXConsumer(final SAXConsumer consumer) {
-        TransformerHandler transformerHandler;
-        try {
-            transformerHandler = 
TRAX_FACTORY.newTransformerHandler(this.templates);
-        } catch (Exception e) {
-            throw new SetupException("Could not initialize transformer 
handler.", e);
-        }
-
-        if (this.parameters != null) {
-            final Transformer transformer = 
transformerHandler.getTransformer();
-
-            this.parameters.forEach((name, values) -> {
-                // is valid XSLT parameter name
-                if (XSLT_PARAMETER_NAME_PATTERN.matcher(name).matches()) {
-                    transformer.setParameter(name, values);
-                }
-            });
-        }
-
-        final SAXResult result = new SAXResult();
-        result.setHandler(consumer);
-        // According to TrAX specs, all TransformerHandlers are LexicalHandlers
-        result.setLexicalHandler(consumer);
-        transformerHandler.setResult(result);
-
-        final SAXConsumerAdapter saxConsumerAdapter = new SAXConsumerAdapter();
-        saxConsumerAdapter.setContentHandler(transformerHandler);
-        super.setSAXConsumer(saxConsumerAdapter);
-    }
-
-    @Override
-    public CacheKey constructCacheKey() {
-        return null;
-    }
-
-    /**
-     * Utility method to create a new transformer factory.
-     *
-     * @return a new transformer factory
-     */
-    private static SAXTransformerFactory createNewSAXTransformerFactory() {
-        SAXTransformerFactory transformerFactory = (SAXTransformerFactory) 
SAXTransformerFactory.newInstance();
-        transformerFactory.setURIResolver((href, base) -> null);
-        try {
-            
transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-        } catch (TransformerConfigurationException e) {
-            LOG.error("Could not enable secure XML processing", e);
-        }
-        return transformerFactory;
-    }
-
-    @Override
-    public String toString() {
-        return StringRepresentation.buildString(this, "src=<" + this.source + 
'>');
-    }
-}
diff --git 
a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/AbstractTest.java
 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/AbstractTest.java
new file mode 100644
index 0000000000..80a069689e
--- /dev/null
+++ 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/AbstractTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.logic;
+
+import javax.persistence.EntityManager;
+import org.apache.syncope.common.lib.types.EntitlementsHolder;
+import org.apache.syncope.common.lib.types.IdRepoEntitlement;
+import org.apache.syncope.core.spring.ApplicationContextProvider;
+import org.apache.syncope.core.spring.security.AuthContextUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.springframework.orm.jpa.EntityManagerFactoryUtils;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
+
+@SpringJUnitConfig(classes = { IdRepoLogicTestContext.class })
+public abstract class AbstractTest {
+
+    protected EntityManager entityManager() {
+        EntityManager entityManager = 
EntityManagerFactoryUtils.getTransactionalEntityManager(
+                EntityManagerFactoryUtils.findEntityManagerFactory(
+                        ApplicationContextProvider.getBeanFactory(), 
AuthContextUtils.getDomain()));
+        if (entityManager == null) {
+            throw new IllegalStateException("Could not find EntityManager for 
domain " + AuthContextUtils.getDomain());
+        }
+
+        return entityManager;
+    }
+
+    @BeforeAll
+    public static void init() {
+        EntitlementsHolder.getInstance().addAll(IdRepoEntitlement.values());
+    }
+}
diff --git 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/TextSerializer.java
 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyConfParamOps.java
similarity index 50%
copy from 
core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/TextSerializer.java
copy to 
core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyConfParamOps.java
index 8a866492f4..7ebb0b1740 100644
--- 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/TextSerializer.java
+++ 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyConfParamOps.java
@@ -16,27 +16,28 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.core.logic.cocoon;
+package org.apache.syncope.core.logic;
 
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.charset.StandardCharsets;
-import org.apache.cocoon.pipeline.caching.CacheKey;
-import org.apache.cocoon.pipeline.caching.SimpleCacheKey;
-import org.apache.cocoon.pipeline.component.CachingPipelineComponent;
-import org.apache.cocoon.sax.AbstractSAXSerializer;
-import org.apache.tika.sax.ToTextContentHandler;
+import java.util.Map;
+import org.apache.syncope.common.keymaster.client.api.ConfParamOps;
 
-public class TextSerializer extends AbstractSAXSerializer implements 
CachingPipelineComponent {
+public class DummyConfParamOps implements ConfParamOps {
 
     @Override
-    public void setOutputStream(final OutputStream outputStream) {
-        super.setOutputStream(outputStream);
-        setContentHandler(new ToTextContentHandler(new 
OutputStreamWriter(outputStream, StandardCharsets.UTF_8)));
+    public Map<String, Object> list(final String domain) {
+        return Map.of();
     }
 
     @Override
-    public CacheKey constructCacheKey() {
-        return new SimpleCacheKey();
+    public <T> T get(final String domain, final String key, final T 
defaultValue, final Class<T> reference) {
+        return defaultValue;
+    }
+
+    @Override
+    public <T> void set(final String domain, final String key, final T value) {
+    }
+
+    @Override
+    public void remove(final String domain, final String key) {
     }
 }
diff --git 
a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyDomainOps.java
 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyDomainOps.java
new file mode 100644
index 0000000000..840c11edb8
--- /dev/null
+++ 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyDomainOps.java
@@ -0,0 +1,64 @@
+/*
+ * 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.logic;
+
+import java.util.List;
+import org.apache.syncope.common.keymaster.client.api.DomainOps;
+import org.apache.syncope.common.keymaster.client.api.model.Domain;
+import org.apache.syncope.common.lib.types.CipherAlgorithm;
+import org.apache.syncope.core.persistence.api.DomainRegistry;
+
+public class DummyDomainOps implements DomainOps {
+
+    private final DomainRegistry domainRegistry;
+
+    public DummyDomainOps(final DomainRegistry domainRegistry) {
+        this.domainRegistry = domainRegistry;
+    }
+
+    @Override
+    public List<Domain> list() {
+        return List.of();
+    }
+
+    @Override
+    public Domain read(final String key) {
+        return new Domain.Builder(key).build();
+    }
+
+    @Override
+    public void create(final Domain domain) {
+        domainRegistry.register(domain);
+    }
+
+    @Override
+    public void changeAdminPassword(final String key, final String password, 
final CipherAlgorithm cipherAlgorithm) {
+        // nothing to do
+    }
+
+    @Override
+    public void adjustPoolSize(final String key, final int maxPoolSize, final 
int minIdle) {
+        // nothing to do
+    }
+
+    @Override
+    public void delete(final String key) {
+        // nothing to do
+    }
+}
diff --git 
a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyImplementationLookup.java
 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyImplementationLookup.java
new file mode 100644
index 0000000000..28c68461c1
--- /dev/null
+++ 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyImplementationLookup.java
@@ -0,0 +1,96 @@
+/*
+ * 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.logic;
+
+import java.util.Set;
+import org.apache.syncope.common.lib.policy.AccountRuleConf;
+import org.apache.syncope.common.lib.policy.PasswordRuleConf;
+import org.apache.syncope.common.lib.policy.PullCorrelationRuleConf;
+import org.apache.syncope.common.lib.policy.PushCorrelationRuleConf;
+import org.apache.syncope.common.lib.report.ReportletConf;
+import org.apache.syncope.common.lib.report.UserReportletConf;
+import org.apache.syncope.core.persistence.api.ImplementationLookup;
+import org.apache.syncope.core.persistence.api.dao.AccountRule;
+import org.apache.syncope.core.persistence.api.dao.PasswordRule;
+import org.apache.syncope.core.persistence.api.dao.PullCorrelationRule;
+import org.apache.syncope.core.persistence.api.dao.PushCorrelationRule;
+import org.apache.syncope.core.persistence.api.dao.Reportlet;
+import org.apache.syncope.core.provisioning.java.job.report.UserReportlet;
+
+public class DummyImplementationLookup implements ImplementationLookup {
+
+    @Override
+    public int getOrder() {
+        return -1;
+    }
+
+    @Override
+    public Set<String> getClassNames(final String type) {
+        return Set.of();
+    }
+
+    @Override
+    public Set<Class<?>> getJWTSSOProviderClasses() {
+        return Set.of();
+    }
+
+    @Override
+    public Class<? extends Reportlet> getReportletClass(
+            final Class<? extends ReportletConf> reportletConfClass) {
+
+        if (UserReportletConf.class.equals(reportletConfClass)) {
+            return UserReportlet.class;
+        }
+
+        return null;
+    }
+
+    @Override
+    public Class<? extends AccountRule> getAccountRuleClass(
+            final Class<? extends AccountRuleConf> accountRuleConfClass) {
+
+        return null;
+    }
+
+    @Override
+    public Class<? extends PasswordRule> getPasswordRuleClass(
+            final Class<? extends PasswordRuleConf> passwordRuleConfClass) {
+
+        return null;
+    }
+
+    @Override
+    public Class<? extends PullCorrelationRule> getPullCorrelationRuleClass(
+            final Class<? extends PullCorrelationRuleConf> 
pullCorrelationRuleConfClass) {
+
+        return null;
+    }
+
+    @Override
+    public Class<? extends PushCorrelationRule> getPushCorrelationRuleClass(
+            final Class<? extends PushCorrelationRuleConf> 
pushCorrelationRuleConfClass) {
+
+        return null;
+    }
+
+    @Override
+    public Set<Class<?>> getAuditAppenderClasses() {
+        return Set.of();
+    }
+}
diff --git 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/TextSerializer.java
 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyServiceOps.java
similarity index 50%
rename from 
core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/TextSerializer.java
rename to 
core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyServiceOps.java
index 8a866492f4..efdedf03b9 100644
--- 
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/cocoon/TextSerializer.java
+++ 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/DummyServiceOps.java
@@ -16,27 +16,31 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.core.logic.cocoon;
+package org.apache.syncope.core.logic;
 
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.charset.StandardCharsets;
-import org.apache.cocoon.pipeline.caching.CacheKey;
-import org.apache.cocoon.pipeline.caching.SimpleCacheKey;
-import org.apache.cocoon.pipeline.component.CachingPipelineComponent;
-import org.apache.cocoon.sax.AbstractSAXSerializer;
-import org.apache.tika.sax.ToTextContentHandler;
+import java.util.List;
+import org.apache.syncope.common.keymaster.client.api.ServiceOps;
+import org.apache.syncope.common.keymaster.client.api.model.NetworkService;
 
-public class TextSerializer extends AbstractSAXSerializer implements 
CachingPipelineComponent {
+public class DummyServiceOps implements ServiceOps {
 
     @Override
-    public void setOutputStream(final OutputStream outputStream) {
-        super.setOutputStream(outputStream);
-        setContentHandler(new ToTextContentHandler(new 
OutputStreamWriter(outputStream, StandardCharsets.UTF_8)));
+    public void register(final NetworkService service) {
+        // do nothing
     }
 
     @Override
-    public CacheKey constructCacheKey() {
-        return new SimpleCacheKey();
+    public void unregister(final NetworkService service) {
+        // do nothing
+    }
+
+    @Override
+    public List<NetworkService> list(final NetworkService.Type serviceType) {
+        return List.of();
+    }
+
+    @Override
+    public NetworkService get(final NetworkService.Type serviceType) {
+        return null;
     }
 }
diff --git 
a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/IdRepoLogicTestContext.java
 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/IdRepoLogicTestContext.java
new file mode 100644
index 0000000000..d647b7ca82
--- /dev/null
+++ 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/IdRepoLogicTestContext.java
@@ -0,0 +1,75 @@
+/*
+ * 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.logic;
+
+import org.apache.syncope.common.keymaster.client.api.ConfParamOps;
+import org.apache.syncope.common.keymaster.client.api.DomainOps;
+import org.apache.syncope.common.keymaster.client.api.ServiceOps;
+import org.apache.syncope.core.persistence.api.DomainHolder;
+import org.apache.syncope.core.persistence.api.DomainRegistry;
+import org.apache.syncope.core.persistence.api.ImplementationLookup;
+import org.apache.syncope.core.persistence.api.content.ContentLoader;
+import org.apache.syncope.core.persistence.jpa.MasterDomain;
+import org.apache.syncope.core.persistence.jpa.PersistenceContext;
+import org.apache.syncope.core.persistence.jpa.StartupDomainLoader;
+import org.apache.syncope.core.provisioning.java.ProvisioningContext;
+import org.apache.syncope.core.spring.security.SecurityContext;
+import org.apache.syncope.core.workflow.java.WorkflowContext;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.PropertySource;
+
+@PropertySource("classpath:core-test.properties")
+@Import({ IdRepoLogicContext.class, IdRepoLogicContext.class, 
SecurityContext.class,
+    PersistenceContext.class, MasterDomain.class, ProvisioningContext.class, 
WorkflowContext.class })
+@Configuration(proxyBeanMethods = false)
+public class IdRepoLogicTestContext {
+
+    @Bean
+    public TestInitializer testInitializer(
+            final StartupDomainLoader domainLoader,
+            final DomainHolder domainHolder,
+            final ContentLoader contentLoader,
+            final ConfigurableApplicationContext ctx) {
+
+        return new TestInitializer(domainLoader, domainHolder, contentLoader, 
ctx);
+    }
+
+    @Bean
+    public ImplementationLookup implementationLookup() {
+        return new DummyImplementationLookup();
+    }
+
+    @Bean
+    public ConfParamOps confParamOps() {
+        return new DummyConfParamOps();
+    }
+
+    @Bean
+    public DomainOps domainOps(final DomainRegistry domainRegistry) {
+        return new DummyDomainOps(domainRegistry);
+    }
+
+    @Bean
+    public ServiceOps serviceOps() {
+        return new DummyServiceOps();
+    }
+}
diff --git 
a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java
 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java
new file mode 100644
index 0000000000..366a1f3b67
--- /dev/null
+++ 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.logic;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.ReportTO;
+import org.apache.syncope.common.lib.types.IdMEntitlement;
+import org.apache.syncope.common.lib.types.ReportExecExportFormat;
+import org.apache.syncope.core.persistence.api.dao.ReportDAO;
+import org.apache.syncope.core.persistence.api.dao.ReportExecDAO;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.ReportExec;
+import org.apache.syncope.core.provisioning.api.job.report.ReportJobDelegate;
+import 
org.apache.syncope.core.provisioning.java.job.report.DefaultReportJobDelegate;
+import org.apache.syncope.core.spring.security.SyncopeAuthenticationDetails;
+import org.apache.syncope.core.spring.security.SyncopeGrantedAuthority;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import 
org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional("Master")
+public class ReportLogicTest extends AbstractTest {
+
+    @BeforeAll
+    public static void setAuthContext() {
+        List<GrantedAuthority> authorities = IdMEntitlement.values().stream().
+                map(entitlement -> new SyncopeGrantedAuthority(entitlement, 
SyncopeConstants.ROOT_REALM)).
+                collect(Collectors.toList());
+
+        UsernamePasswordAuthenticationToken auth = new 
UsernamePasswordAuthenticationToken(
+                new org.springframework.security.core.userdetails.User(
+                        "admin", "FAKE_PASSWORD", authorities), 
"FAKE_PASSWORD", authorities);
+        auth.setDetails(new 
SyncopeAuthenticationDetails(SyncopeConstants.MASTER_DOMAIN, null));
+        SecurityContextHolder.getContext().setAuthentication(auth);
+    }
+
+    @AfterAll
+    public static void unsetAuthContext() {
+        SecurityContextHolder.getContext().setAuthentication(null);
+    }
+
+    @Autowired
+    private ReportLogic logic;
+
+    @Autowired
+    private ReportDAO reportDAO;
+
+    @Autowired
+    private ReportExecDAO reportExecDAO;
+
+    @Autowired
+    private EntityFactory entityFactory;
+
+    private void checkExport(final String execKey, final 
ReportExecExportFormat fmt) throws IOException {
+        ReportExecExportFormat format = 
Optional.ofNullable(fmt).orElse(ReportExecExportFormat.XML);
+        ReportExec reportExec = logic.getReportExec(execKey);
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+        logic.exportExecutionResult(os, reportExec, format);
+
+        os.close();
+        byte[] entity = os.toByteArray();
+        assertTrue(entity.length > 0);
+    }
+
+    @Test
+    public void executeAndExport() throws Exception {
+        ReportTO report = logic.read("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
+        assertNotNull(report);
+        assertTrue(report.isActive());
+
+        report.getExecutions().forEach(exec -> 
logic.deleteExecution(exec.getKey()));
+
+        report = logic.read(report.getKey());
+        assertTrue(report.getExecutions().isEmpty());
+
+        ReportJobDelegate delegate = new DefaultReportJobDelegate(reportDAO, 
reportExecDAO, entityFactory);
+        delegate.execute(report.getKey(), "test");
+
+        report = logic.read(report.getKey());
+        assertFalse(report.getExecutions().isEmpty());
+
+        String execKey = report.getExecutions().get(0).getKey();
+
+        checkExport(execKey, ReportExecExportFormat.XML);
+        checkExport(execKey, ReportExecExportFormat.HTML);
+        checkExport(execKey, ReportExecExportFormat.PDF);
+        checkExport(execKey, ReportExecExportFormat.RTF);
+        checkExport(execKey, ReportExecExportFormat.CSV);
+    }
+}
diff --git 
a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/TestInitializer.java
 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/TestInitializer.java
new file mode 100644
index 0000000000..05ad8941d2
--- /dev/null
+++ 
b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/TestInitializer.java
@@ -0,0 +1,68 @@
+/*
+ * 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.logic;
+
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.core.persistence.api.DomainHolder;
+import org.apache.syncope.core.persistence.api.content.ContentLoader;
+import org.apache.syncope.core.persistence.jpa.StartupDomainLoader;
+import org.apache.syncope.core.spring.ApplicationContextProvider;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+import 
org.springframework.transaction.support.TransactionSynchronizationManager;
+
+public class TestInitializer implements InitializingBean {
+
+    private final StartupDomainLoader domainLoader;
+
+    private final DomainHolder domainHolder;
+
+    private final ContentLoader contentLoader;
+
+    private final ConfigurableApplicationContext ctx;
+
+    public TestInitializer(
+            final StartupDomainLoader domainLoader,
+            final DomainHolder domainHolder,
+            final ContentLoader contentLoader,
+            final ConfigurableApplicationContext ctx) {
+
+        this.domainLoader = domainLoader;
+        this.domainHolder = domainHolder;
+        this.contentLoader = contentLoader;
+        this.ctx = ctx;
+    }
+
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        ApplicationContextProvider.setApplicationContext(ctx);
+        ApplicationContextProvider.setBeanFactory((DefaultListableBeanFactory) 
ctx.getBeanFactory());
+
+        if (!TransactionSynchronizationManager.isSynchronizationActive()) {
+            TransactionSynchronizationManager.initSynchronization();
+        }
+
+        domainLoader.load();
+
+        contentLoader.load(
+                SyncopeConstants.MASTER_DOMAIN,
+                domainHolder.getDomains().get(SyncopeConstants.MASTER_DOMAIN));
+    }
+}
diff --git 
a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ReportServiceImpl.java
 
b/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ReportServiceImpl.java
index 998cb8c122..a2834c8402 100644
--- 
a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ReportServiceImpl.java
+++ 
b/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ReportServiceImpl.java
@@ -75,7 +75,7 @@ public class ReportServiceImpl extends 
AbstractExecutableService implements Repo
     public Response exportExecutionResult(final String executionKey, final 
ReportExecExportFormat fmt) {
         ReportExecExportFormat format = 
Optional.ofNullable(fmt).orElse(ReportExecExportFormat.XML);
         ReportExec reportExec = logic.getReportExec(executionKey);
-        StreamingOutput sout = (os) -> ReportLogic.exportExecutionResult(os, 
reportExec, format);
+        StreamingOutput sout = os -> logic.exportExecutionResult(os, 
reportExec, format);
 
         return Response.ok(sout).
                 header(HttpHeaders.CONTENT_DISPOSITION,
diff --git 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/DefaultReportJobDelegate.java
 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/DefaultReportJobDelegate.java
index 8daf068afd..7385c405d5 100644
--- 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/DefaultReportJobDelegate.java
+++ 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/DefaultReportJobDelegate.java
@@ -174,7 +174,8 @@ public class DefaultReportJobDelegate implements 
ReportJobDelegate {
                         status.set("Invoking reportlet " + 
report.getReportlets().get(i).getKey());
                         reportlet.get().extract(handler, status);
                     } catch (Throwable t) {
-                        LOG.error("While executing reportlet {} for report 
{}", reportlet, reportKey, t);
+                        LOG.error("While executing reportlet {} for report {}",
+                                report.getReportlets().get(i).getKey(), 
reportKey, t);
 
                         execution.setStatus(ReportExecStatus.FAILURE);
 
diff --git a/docker/core/src/main/resources/log4j2.xml 
b/docker/core/src/main/resources/log4j2.xml
index d9796f2192..496772d5f6 100644
--- a/docker/core/src/main/resources/log4j2.xml
+++ b/docker/core/src/main/resources/log4j2.xml
@@ -86,9 +86,6 @@ under the License.
     <asyncLogger name="liquibase" additivity="false" level="ERROR">
       <appender-ref ref="console"/>
     </asyncLogger>
-    <asyncLogger name="org.apache.cocoon" additivity="false" level="ERROR">
-      <appender-ref ref="console"/>
-    </asyncLogger>
     <asyncLogger name="org.apache.fop" additivity="false" level="ERROR">
       <appender-ref ref="console"/>
     </asyncLogger>
diff --git a/fit/core-reference/src/main/resources/log4j2.xml 
b/fit/core-reference/src/main/resources/log4j2.xml
index a224040868..77f1ab7948 100644
--- a/fit/core-reference/src/main/resources/log4j2.xml
+++ b/fit/core-reference/src/main/resources/log4j2.xml
@@ -132,9 +132,6 @@ under the License.
     <asyncLogger name="liquibase" additivity="false" level="ERROR">
       <appender-ref ref="main"/>
     </asyncLogger>
-    <asyncLogger name="org.apache.cocoon" additivity="false" level="ERROR">
-      <appender-ref ref="main"/>
-    </asyncLogger>
     <asyncLogger name="org.apache.fop" additivity="false" level="ERROR">
       <appender-ref ref="main"/>
     </asyncLogger>
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java
 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java
index c47bb7a968..51736c4dcd 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java
@@ -161,9 +161,7 @@ public class ReportTemplateITCase extends AbstractITCase {
         response = REPORT_SERVICE.exportExecutionResult(execKey, 
ReportExecExportFormat.HTML);
         String result = IOUtils.toString((InputStream) response.getEntity(), 
StandardCharsets.UTF_8);
         assertNotNull(result);
-        assertTrue(result.startsWith("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>"
-                + "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
-                + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>"));
+        assertTrue(result.startsWith("<html"));
 
         String malicious = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
                 + "<!DOCTYPE xsl:stylesheet "
diff --git a/pom.xml b/pom.xml
index 94fae08d7a..a40b0f0067 100644
--- a/pom.xml
+++ b/pom.xml
@@ -115,7 +115,7 @@ under the License.
       <email>ilgro...@apache.org</email>
       <name>Francesco Chicchiriccò</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>ASF member</role>
         <role>PMC chair</role>
@@ -126,7 +126,7 @@ under the License.
       <id>fmartelli</id>
       <name>Fabio Martelli</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>PMC member</role>
       </roles>
@@ -136,7 +136,7 @@ under the License.
       <id>mdisabatino</id>
       <name>Marco Di Sabatino Di Diodoro</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>PMC member</role>
       </roles>
@@ -146,7 +146,7 @@ under the License.
       <id>massi</id>
       <name>Massimiliano Perrone</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>PMC member</role>
       </roles>
@@ -271,7 +271,7 @@ under the License.
       <id>andreapatricelli</id>
       <name>Andrea Patricelli</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>PMC member</role>
       </roles>
@@ -292,8 +292,6 @@ under the License.
     <developer>
       <id>matteodc</id>
       <name>Matteo Di Carlo</name>
-      <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
       <roles>
         <role>committer</role>
       </roles>
@@ -304,7 +302,7 @@ under the License.
       <id>skylark17</id>
       <name>Matteo Alessandroni</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>PMC member</role>
       </roles>
@@ -315,7 +313,7 @@ under the License.
       <id>loredicola</id>
       <name>Lorenzo Di Cola</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>committer</role>
       </roles>
@@ -325,8 +323,6 @@ under the License.
     <developer>
       <id>dimaayash</id>
       <name>Dima Ayash</name>
-      <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
       <roles>
         <role>committer</role>
       </roles>
@@ -336,7 +332,7 @@ under the License.
       <id>mmoayyed</id>
       <name>Misagh Moayyed</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>committer</role>
       </roles>
@@ -346,7 +342,7 @@ under the License.
       <id>sgarofalo</id>
       <name>Samuel Garofalo</name>
       <organization>Tirasa</organization>
-      <organizationUrl>http://www.tirasa.net/</organizationUrl>
+      <organizationUrl>https://www.tirasa.net/</organizationUrl>
       <roles>
         <role>committer</role>
       </roles>
@@ -430,8 +426,6 @@ under the License.
 
     <jasypt.version>1.9.3</jasypt.version>
 
-    <cocoon.version>3.0.0-alpha-3</cocoon.version>
-
     <groovy.version>4.0.4</groovy.version>
 
     <flowable.version>6.7.2</flowable.version>
@@ -1174,17 +1168,6 @@ under the License.
         <version>${jasypt.version}</version>
       </dependency>
 
-      <dependency>
-        <groupId>org.apache.cocoon.sax</groupId>
-        <artifactId>cocoon-sax</artifactId>
-        <version>${cocoon.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.cocoon.optional</groupId>
-        <artifactId>cocoon-optional</artifactId>
-        <version>${cocoon.version}</version>
-      </dependency>
-
       <dependency>
         <groupId>org.apache.xmlgraphics</groupId>
         <artifactId>fop</artifactId>

Reply via email to