mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
1 Commits
14.46
...
terraform-
Author | SHA1 | Date | |
---|---|---|---|
|
f0478515e6 |
18
.travis.yml
18
.travis.yml
@@ -60,7 +60,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext02TestSuite"
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext04TestSuite"
|
||||
@@ -83,7 +83,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext05TestSuite"
|
||||
@@ -102,7 +102,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContextExtraTestSuite"
|
||||
@@ -110,7 +110,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MiscContextTestSuite"
|
||||
@@ -118,7 +118,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - SearchTestSuite"
|
||||
@@ -241,7 +241,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext03TestSuite"
|
||||
@@ -249,7 +249,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext04TestSuite"
|
||||
@@ -257,7 +257,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.4
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContextExtraTestSuite"
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.5.4
|
||||
TRANSFORMERS_TAG=2.5.3
|
||||
SOLR6_TAG=2.0.2-RC1
|
||||
POSTGRES_TAG=13.3
|
||||
ACTIVEMQ_TAG=5.16.1
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -130,7 +130,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.2.7</version>
|
||||
<version>6.2.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- the cxf libs were updated, see dependencyManagement section -->
|
||||
|
@@ -192,8 +192,6 @@ public class MimetypeMap implements MimetypeService
|
||||
|
||||
public static final String MIMETYPE_IMAGE_DWT = "image/x-dwt";
|
||||
|
||||
public static final String MIMETYPE_IMAGE_ICNS = "image/icns";
|
||||
|
||||
public static final String MIMETYPE_APPLICATION_EPS = "application/eps";
|
||||
|
||||
public static final String MIMETYPE_APPLICATION_PS = "application/postscript";
|
||||
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Data model classes
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.service.cmr.repository;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.service.Experimental;
|
||||
|
||||
/**
|
||||
* Unable to access as content is in an Archived state.
|
||||
* Default status is <i>Precondition Failed<i> Client Error = 412
|
||||
*
|
||||
* @author David Edwards
|
||||
*/
|
||||
@Experimental
|
||||
@AlfrescoPublicApi
|
||||
public class ArchivedIOException extends ContentIOException
|
||||
{
|
||||
private static final long serialVersionUID = 3258135874596276087L;
|
||||
|
||||
public ArchivedIOException(String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public ArchivedIOException(String msg, Throwable cause)
|
||||
{
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
}
|
@@ -611,10 +611,6 @@
|
||||
<mimetype mimetype="application/vnd.apple.numbers" display="Apple iWork Numbers">
|
||||
<extension>numbers</extension>
|
||||
</mimetype>
|
||||
<!-- Apple ICNS files -->
|
||||
<mimetype mimetype="image/icns" display="Apple Icon">
|
||||
<extension>icns</extension>
|
||||
</mimetype>
|
||||
|
||||
<!-- Markdown -->
|
||||
<mimetype mimetype="text/x-markdown" display="Markdown">
|
||||
|
@@ -94,8 +94,7 @@ public class MimetypeMapTest extends TestCase
|
||||
// other text forms
|
||||
assertEquals("text/csv", mimetypesByExtension.get("csv"));
|
||||
assertEquals("text/html", mimetypesByExtension.get("html"));
|
||||
assertEquals("image/icns", mimetypesByExtension.get("icns"));
|
||||
|
||||
|
||||
// JPEG
|
||||
assertEquals("jpg", extensionsByMimetype.get("image/jpeg"));
|
||||
assertEquals("image/jpeg", mimetypesByExtension.get("jpg"));
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.5.4
|
||||
TRANSFORMERS_TAG=2.5.3
|
||||
SOLR6_TAG=2.0.2
|
||||
POSTGRES_TAG=13.3
|
||||
ACTIVEMQ_TAG=5.16.1
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -198,15 +198,4 @@ public class UnlockFileTests extends WebDavTest
|
||||
.then().unlock()
|
||||
.and().assertThat().hasStatus(HttpStatus.NO_CONTENT.value()).and().assertThat().isUnlocked();
|
||||
}
|
||||
|
||||
@TestRail(section={TestGroup.PROTOCOLS, TestGroup.WEBDAV}, executionType= ExecutionType.SANITY,
|
||||
description ="Checks no existent file is not locked (and status 404)")
|
||||
@Test(groups = {TestGroup.PROTOCOLS, TestGroup.WEBDAV, TestGroup.SANITY})
|
||||
public void checkLockStatusForNonExistentFile() throws Exception
|
||||
{
|
||||
testFile = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, content);
|
||||
webDavProtocol.authenticateUser(dataUser.getAdminUser()).
|
||||
usingResource(testFile).
|
||||
assertThat().isUnlocked().assertThat().hasStatus(HttpStatus.NOT_FOUND.value());
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#%L
|
||||
Alfresco Repository WAR Community
|
||||
%%
|
||||
Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
%%
|
||||
This file is part of the Alfresco software.
|
||||
If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -35,6 +35,15 @@
|
||||
<%@ page import="org.alfresco.service.cmr.module.ModuleInstallState" %>
|
||||
<%@ page import="java.util.Calendar" %>
|
||||
|
||||
<!-- Enterprise index-jsp placeholder -->
|
||||
<%
|
||||
// route WebDAV requests
|
||||
if (request.getMethod().equalsIgnoreCase("PROPFIND") || request.getMethod().equalsIgnoreCase("OPTIONS"))
|
||||
{
|
||||
response.sendRedirect(request.getContextPath() + "/webdav/");
|
||||
}
|
||||
%>
|
||||
|
||||
<%
|
||||
WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext());
|
||||
SysAdminParams sysAdminParams = (SysAdminParams)context.getBean("sysAdminParams");
|
||||
|
29
pom.xml
29
pom.xml
@@ -2,7 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<version>12</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<modules>
|
||||
<module>core</module>
|
||||
<module>data-model</module>
|
||||
@@ -51,18 +52,18 @@
|
||||
<dependency.alfresco-log-sanitizer.version>0.2</dependency.alfresco-log-sanitizer.version>
|
||||
<dependency.activiti-engine.version>5.23.0</dependency.activiti-engine.version>
|
||||
<dependency.activiti.version>5.23.0</dependency.activiti.version>
|
||||
<dependency.alfresco-transform-model.version>1.4.3</dependency.alfresco-transform-model.version>
|
||||
<dependency.alfresco-transform-model.version>1.4.0</dependency.alfresco-transform-model.version>
|
||||
<dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version>
|
||||
<dependency.acs-event-model.version>0.0.13</dependency.acs-event-model.version>
|
||||
|
||||
<dependency.spring.version>5.3.13</dependency.spring.version>
|
||||
<dependency.spring.version>5.3.10</dependency.spring.version>
|
||||
<dependency.antlr.version>3.5.2</dependency.antlr.version>
|
||||
<dependency.jackson.version>2.12.3</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.12.4</dependency.jackson-databind.version>
|
||||
<dependency.cxf.version>3.4.5</dependency.cxf.version>
|
||||
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
||||
<dependency.webscripts.version>8.26</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.70</dependency.bouncycastle.version>
|
||||
<dependency.webscripts.version>8.24</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.69</dependency.bouncycastle.version>
|
||||
<dependency.mockito-core.version>3.11.2</dependency.mockito-core.version>
|
||||
<dependency.org-json.version>20210307</dependency.org-json.version>
|
||||
<dependency.commons-dbcp.version>1.4-DBCP330</dependency.commons-dbcp.version>
|
||||
@@ -86,11 +87,11 @@
|
||||
<dependency.activemq.version>5.16.1</dependency.activemq.version>
|
||||
<dependency.apache-compress.version>1.21</dependency.apache-compress.version>
|
||||
<dependency.apache.taglibs.version>1.2.5</dependency.apache.taglibs.version>
|
||||
<dependency.awaitility.version>4.1.1</dependency.awaitility.version>
|
||||
<dependency.awaitility.version>4.1.0</dependency.awaitility.version>
|
||||
<dependency.swagger-ui.version>3.38.0</dependency.swagger-ui.version>
|
||||
<dependency.swagger-parser.version>1.0.56</dependency.swagger-parser.version>
|
||||
<dependency.swagger-parser.version>1.0.52</dependency.swagger-parser.version>
|
||||
<dependency.maven-filtering.version>3.1.1</dependency.maven-filtering.version>
|
||||
<dependency.maven-artifact.version>3.8.4</dependency.maven-artifact.version>
|
||||
<dependency.maven-artifact.version>3.8.3</dependency.maven-artifact.version>
|
||||
|
||||
<dependency.jakarta-jaxb-api.version>2.3.3</dependency.jakarta-jaxb-api.version>
|
||||
<dependency.jakarta-ws-api.version>2.3.3</dependency.jakarta-ws-api.version>
|
||||
@@ -109,13 +110,13 @@
|
||||
<alfresco.api-explorer.version>7.1.0.1</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
|
||||
<alfresco.maven-plugin.version>2.2.0</alfresco.maven-plugin.version>
|
||||
|
||||
<dependency.postgresql.version>42.3.1</dependency.postgresql.version>
|
||||
<dependency.postgresql.version>42.2.24</dependency.postgresql.version>
|
||||
<dependency.mysql.version>8.0.25</dependency.mysql.version>
|
||||
<dependency.mysql-image.version>8</dependency.mysql-image.version>
|
||||
<dependency.mariadb.version>2.7.4</dependency.mariadb.version>
|
||||
<dependency.tas-utility.version>3.0.47</dependency.tas-utility.version>
|
||||
<dependency.tas-utility.version>3.0.45</dependency.tas-utility.version>
|
||||
<dependency.rest-assured.version>3.3.0</dependency.rest-assured.version>
|
||||
<dependency.tas-restapi.version>1.65</dependency.tas-restapi.version>
|
||||
<dependency.tas-restapi.version>1.64</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.31</dependency.tas-cmis.version>
|
||||
<dependency.tas-email.version>1.8</dependency.tas-email.version>
|
||||
<dependency.tas-webdav.version>1.6</dependency.tas-webdav.version>
|
||||
@@ -143,7 +144,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||
<tag>14.46</tag>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -707,7 +708,7 @@
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.13</version>
|
||||
<version>2.10.12</version>
|
||||
</dependency>
|
||||
|
||||
<!-- provided dependencies -->
|
||||
@@ -861,7 +862,7 @@
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>0.38.0</version>
|
||||
<version>0.37.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -47,7 +47,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.santuario</groupId>
|
||||
<artifactId>xmlsec</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<version>2.2.3</version>
|
||||
</dependency>
|
||||
<!-- newer version, see REPO-3133 -->
|
||||
<dependency>
|
||||
|
@@ -44,7 +44,6 @@ import org.alfresco.repo.content.filestore.FileContentReader;
|
||||
import org.alfresco.sync.repo.events.EventPublisher;
|
||||
import org.alfresco.repo.web.util.HttpRangeProcessor;
|
||||
import org.alfresco.rest.framework.resource.content.CacheDirective;
|
||||
import org.alfresco.service.cmr.repository.ArchivedIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
@@ -450,11 +449,7 @@ public class ContentStreamer implements ResourceLoaderAware
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("Client aborted stream read:\n\tcontent: " + reader);
|
||||
}
|
||||
catch (ArchivedIOException e2)
|
||||
{
|
||||
throw e2;
|
||||
}
|
||||
catch (ContentIOException e3)
|
||||
catch (ContentIOException e2)
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("Client aborted stream read:\n\tcontent: " + reader);
|
||||
|
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api;
|
||||
|
||||
import org.alfresco.rest.api.model.ContentStorageInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.Experimental;
|
||||
|
||||
/**
|
||||
* Storage information for content API.
|
||||
* Note: Currently marked as experimental and subject to change.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Experimental
|
||||
public interface ContentStorageInformation
|
||||
{
|
||||
/**
|
||||
* Note: Currently marked as experimental and subject to change.
|
||||
* @param nodeId Identifier of the node
|
||||
* @param contentPropName Qualified name of content property (e.g. 'cm_content')
|
||||
* @param parameters {@link Parameters} object to get the parameters passed into the request
|
||||
* @return {@link ContentStorageInfo} object consisting of qualified name of content property and a map of storage properties
|
||||
*/
|
||||
@Experimental
|
||||
ContentStorageInfo getStorageInfo(String nodeId, String contentPropName, Parameters parameters);
|
||||
}
|
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import org.alfresco.rest.api.ContentStorageInformation;
|
||||
import org.alfresco.rest.api.model.ContentStorageInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
import java.util.Map;
|
||||
/**
|
||||
* Default implementation for {@link ContentStorageInformation}
|
||||
* Note: Currently marked as experimental and subject to change.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Experimental
|
||||
public class ContentStorageInformationImpl implements ContentStorageInformation
|
||||
{
|
||||
|
||||
public static final char PREFIX_SEPARATOR = '_';
|
||||
|
||||
private final ContentService contentService;
|
||||
private final NamespaceService namespaceService;
|
||||
|
||||
public ContentStorageInformationImpl(ContentService contentService, NamespaceService namespaceService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Experimental
|
||||
public ContentStorageInfo getStorageInfo(String nodeId, String contentPropName, Parameters parameters)
|
||||
{
|
||||
final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||
final QName propQName = getQName(contentPropName);
|
||||
final Map<String, String> storageProperties = contentService.getStorageProperties(nodeRef, propQName);
|
||||
final ContentStorageInfo storageInfo = new ContentStorageInfo();
|
||||
storageInfo.setId(propQName.toPrefixString(namespaceService));
|
||||
storageInfo.setStorageProperties(storageProperties);
|
||||
return storageInfo;
|
||||
}
|
||||
|
||||
private QName getQName(final String contentPropName)
|
||||
{
|
||||
final String properContentPropName = contentPropName.replace(PREFIX_SEPARATOR, QName.NAMESPACE_PREFIX);
|
||||
return QName.resolveToQName(namespaceService, properContentPropName);
|
||||
}
|
||||
|
||||
}
|
@@ -25,32 +25,22 @@
|
||||
*/
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.ObjectStorageProps;
|
||||
import org.alfresco.repo.download.DownloadModel;
|
||||
import org.alfresco.rest.api.Downloads;
|
||||
import org.alfresco.rest.api.Nodes;
|
||||
import org.alfresco.rest.api.model.Download;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.download.DownloadService;
|
||||
import org.alfresco.service.cmr.download.DownloadStatus;
|
||||
import org.alfresco.service.cmr.module.ModuleService;
|
||||
import org.alfresco.service.cmr.repository.ArchivedIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -59,39 +49,23 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public class DownloadsImpl implements Downloads
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(Downloads.class);
|
||||
|
||||
private DownloadService downloadService;
|
||||
private ModuleService moduleService;
|
||||
private NodeService nodeService;
|
||||
private ContentService contentService;
|
||||
private Nodes nodes;
|
||||
private PermissionService permissionService;
|
||||
private int archiveCheckLimit;
|
||||
public static final String DEFAULT_ARCHIVE_NAME = "archive.zip";
|
||||
public static final String DEFAULT_ARCHIVE_EXTENSION = ".zip";
|
||||
public static final String [] CLOUD_CONNECTOR_MODULES = {"org_alfresco_integrations_AzureConnector", "org_alfresco_integrations_S3Connector"};
|
||||
|
||||
public void setDownloadService(DownloadService downloadService)
|
||||
{
|
||||
this.downloadService = downloadService;
|
||||
}
|
||||
|
||||
public void setModuleService(ModuleService moduleService)
|
||||
{
|
||||
this.moduleService = moduleService;
|
||||
}
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
public void setContentService(ContentService contentService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
}
|
||||
|
||||
public void setNodes(Nodes nodes)
|
||||
{
|
||||
this.nodes = nodes;
|
||||
@@ -102,11 +76,6 @@ public class DownloadsImpl implements Downloads
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
public void setArchiveCheckLimit(int checkLimit)
|
||||
{
|
||||
this.archiveCheckLimit = checkLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Download createDownloadNode(Download download)
|
||||
{
|
||||
@@ -118,8 +87,6 @@ public class DownloadsImpl implements Downloads
|
||||
|
||||
checkNodeIdsReadPermission(zipContentNodeRefs);
|
||||
|
||||
checkArchiveStatus(zipContentNodeRefs, archiveCheckLimit);
|
||||
|
||||
NodeRef zipNodeRef = downloadService.createDownload(zipContentNodeRefs, true);
|
||||
|
||||
String archiveName = zipContentNodeRefs.length > 1 ?
|
||||
@@ -205,95 +172,4 @@ public class DownloadsImpl implements Downloads
|
||||
return downloadInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the supplied nodes for any content that is archived.
|
||||
* Any folders will be expanded and their children checked.
|
||||
* A limit can be applied to prevent large sized requests preventing the asynchronous call to start.
|
||||
*
|
||||
* @param nodeRefs
|
||||
* @param checkLimit The maximum number of nodes to check, set to -1 for no limit
|
||||
* @see #checkArchiveStatus(NodeRef[], int, Set)
|
||||
*/
|
||||
@Experimental
|
||||
protected void checkArchiveStatus(NodeRef[] nodeRefs, int checkLimit)
|
||||
{
|
||||
if (canCheckArchived())
|
||||
{
|
||||
checkArchiveStatus(nodeRefs, checkLimit, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the supplied nodes for any content that is archived.
|
||||
* Any folders will be expanded and their children checked.
|
||||
* A limit can be applied to prevent large sized requests preventing the asynchronous call to start.
|
||||
* The cache is used to prevent duplication of checks, as it is possible to provide a folder and its contents as
|
||||
* separate nodes in the download request.
|
||||
*
|
||||
* @param nodeRefs
|
||||
* @param checkLimit The maximum number of nodes to check, set to -1 for no limit
|
||||
* @param cache Tracks nodes that we have already checked, if null an empty cache will be created
|
||||
*/
|
||||
@Experimental
|
||||
private void checkArchiveStatus(NodeRef[] nodeRefs, int checkLimit, Set<NodeRef> cache)
|
||||
{
|
||||
// Create the cache for recursive calls.
|
||||
if (cache == null)
|
||||
{
|
||||
cache = new HashSet<NodeRef>();
|
||||
}
|
||||
|
||||
Set<NodeRef> folders = new HashSet<NodeRef>();
|
||||
for (NodeRef nodeRef : nodeRefs)
|
||||
{
|
||||
// We hit the number of nodes we want to check.
|
||||
if (cache.size() == checkLimit)
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info(
|
||||
String.format(
|
||||
"Maximum check of %d reached for archived content. No more checks will be performed and download will still be created.",
|
||||
checkLimit));
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Already checked this node, we can skip.
|
||||
if (cache.contains(nodeRef))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QName qName = nodeService.getType(nodeRef);
|
||||
if (qName.equals(ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
// We'll check the child nodes at the end in case there are other nodes in this loop that is archived.
|
||||
folders.add(nodeRef);
|
||||
}
|
||||
else if (qName.equals(ContentModel.TYPE_CONTENT))
|
||||
{
|
||||
Map<String, String> props = contentService.getStorageProperties(nodeRef, qName);
|
||||
if (!props.isEmpty() && Boolean.valueOf(props.get(ObjectStorageProps.X_ALF_ARCHIVED.getValue())))
|
||||
{
|
||||
throw new ArchivedIOException("One or more nodes' content is archived and not accessible.");
|
||||
}
|
||||
}
|
||||
cache.add(nodeRef); // No need to check this node again.
|
||||
}
|
||||
|
||||
// We re-run the folder contents at the end in case we hit content that is archived in the first loop and can stop early.
|
||||
for (NodeRef nodeRef : folders)
|
||||
{
|
||||
NodeRef[] childRefs = nodeService.getChildAssocs(nodeRef).stream()
|
||||
.map(childAssoc -> childAssoc.getChildRef())
|
||||
.toArray(NodeRef[]::new);
|
||||
checkArchiveStatus(childRefs, checkLimit, cache); // We'll keep going until we have no more folders in children.
|
||||
}
|
||||
}
|
||||
|
||||
@Experimental
|
||||
protected boolean canCheckArchived()
|
||||
{
|
||||
return Arrays.stream(CLOUD_CONNECTOR_MODULES).anyMatch(m-> moduleService.getModule(m) != null);
|
||||
}
|
||||
}
|
||||
|
@@ -3420,7 +3420,7 @@ public class NodesImpl implements Nodes
|
||||
@Override
|
||||
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor)
|
||||
{
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(nodeRef, ContentModel.PROP_CONTENT, attachment, validFor);
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(nodeRef, attachment, validFor);
|
||||
if (directAccessUrl == null)
|
||||
{
|
||||
throw new DisabledServiceException("Direct access url isn't available.");
|
||||
|
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Representation of storage information for content.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
public class ContentStorageInfo
|
||||
{
|
||||
|
||||
/**
|
||||
* Qualified name of content property
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* Key-value (String-String) collection representing storage properties of given content
|
||||
*/
|
||||
private Map<String, String> storageProperties;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Map<String, String> getStorageProperties()
|
||||
{
|
||||
if (storageProperties == null) {
|
||||
storageProperties = new HashMap<>();
|
||||
}
|
||||
return storageProperties;
|
||||
}
|
||||
|
||||
public void setStorageProperties(Map<String, String> storageProperties)
|
||||
{
|
||||
this.storageProperties = storageProperties;
|
||||
}
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
|
||||
import org.alfresco.rest.api.ContentStorageInformation;
|
||||
import org.alfresco.rest.api.model.ContentStorageInfo;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Node storage information.
|
||||
* Note: Currently marked as experimental and subject to change.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Experimental
|
||||
@RelationshipResource(name = "storage-info", entityResource = NodesEntityResource.class, title = "Node's content storage information")
|
||||
public class NodeStorageInfoRelation implements RelationshipResourceAction.ReadById<ContentStorageInfo>, InitializingBean
|
||||
{
|
||||
|
||||
private final ContentStorageInformation storageInformation;
|
||||
|
||||
public NodeStorageInfoRelation(ContentStorageInformation storageInformation)
|
||||
{
|
||||
this.storageInformation = storageInformation;
|
||||
}
|
||||
|
||||
@WebApiDescription(title = "Get storage properties",
|
||||
description = "Retrieves storage properties for given node's content",
|
||||
successStatus = HttpServletResponse.SC_OK)
|
||||
@Override
|
||||
public ContentStorageInfo readById(String entityResourceId, String id, Parameters parameters)
|
||||
throws RelationshipResourceNotFoundException
|
||||
{
|
||||
return storageInformation.getStorageInfo(entityResourceId, id, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
PropertyCheck.mandatory(this, "storageInformation", storageInformation);
|
||||
}
|
||||
}
|
@@ -64,18 +64,6 @@ public class ApiException extends PlatformRuntimeException
|
||||
super(msgId, cause);
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public ApiException(String msgId, String message)
|
||||
{
|
||||
super(message);
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public ApiException(String msgId, String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public ApiException(String msgId, Throwable cause, Map<String,Object> additionalState)
|
||||
{
|
||||
|
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.framework.core.exceptions;
|
||||
|
||||
import org.alfresco.service.Experimental;
|
||||
|
||||
/**
|
||||
* Thrown when the content is archived and not readily accessible.
|
||||
* Status is <i>Precondition Failed</i> client error = 412.
|
||||
*
|
||||
* @author David Edwards
|
||||
*/
|
||||
@Experimental
|
||||
public class ArchivedContentException extends ApiException
|
||||
{
|
||||
|
||||
public static String DEFAULT_MESSAGE_ID = "framework.exception.ArchivedContent";
|
||||
|
||||
public ArchivedContentException()
|
||||
{
|
||||
super(DEFAULT_MESSAGE_ID);
|
||||
}
|
||||
|
||||
public ArchivedContentException(String message)
|
||||
{
|
||||
this(DEFAULT_MESSAGE_ID, message);
|
||||
}
|
||||
|
||||
private ArchivedContentException(String msgId, String message)
|
||||
{
|
||||
super(msgId, message);
|
||||
}
|
||||
|
||||
public ArchivedContentException(Throwable cause)
|
||||
{
|
||||
this(DEFAULT_MESSAGE_ID, cause.getLocalizedMessage(), cause);
|
||||
}
|
||||
|
||||
public ArchivedContentException(String message, Throwable cause)
|
||||
{
|
||||
this(DEFAULT_MESSAGE_ID, message, cause);
|
||||
}
|
||||
|
||||
private ArchivedContentException(String msgId, String message, Throwable cause)
|
||||
{
|
||||
super(msgId, message, cause);
|
||||
}
|
||||
|
||||
}
|
@@ -42,7 +42,6 @@ import org.alfresco.rest.framework.core.ResourceLocator;
|
||||
import org.alfresco.rest.framework.core.ResourceOperation;
|
||||
import org.alfresco.rest.framework.core.ResourceWithMetadata;
|
||||
import org.alfresco.rest.framework.core.exceptions.ApiException;
|
||||
import org.alfresco.rest.framework.core.exceptions.ArchivedContentException;
|
||||
import org.alfresco.rest.framework.resource.actions.ActionExecutor;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.BinaryResourceAction;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceBinaryAction;
|
||||
@@ -53,8 +52,6 @@ import org.alfresco.rest.framework.resource.content.FileBinaryResource;
|
||||
import org.alfresco.rest.framework.resource.content.NodeBinaryResource;
|
||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||
import org.alfresco.rest.framework.tools.ResponseWriter;
|
||||
import org.alfresco.service.cmr.repository.ArchivedIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -87,8 +84,6 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
|
||||
private ContentStreamer streamer;
|
||||
protected ResourceWebScriptHelper helper;
|
||||
|
||||
private static final String HEADER_CONTENT_LENGTH = "Content-Length";
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void execute(final Api api, final WebScriptRequest req, final WebScriptResponse res) throws IOException
|
||||
@@ -178,10 +173,6 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
|
||||
}
|
||||
|
||||
}
|
||||
catch (ContentIOException cioe)
|
||||
{
|
||||
handleContentIOException(res, cioe);
|
||||
}
|
||||
catch (AlfrescoRuntimeException | ApiException | WebScriptException xception )
|
||||
{
|
||||
renderException(xception, res, assistant);
|
||||
@@ -224,20 +215,6 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private void handleContentIOException(final WebScriptResponse res, ContentIOException exception) throws IOException
|
||||
{
|
||||
// If the Content-Length is not set back to -1 any client will expect to receive binary and will hang until it times out
|
||||
res.setHeader(HEADER_CONTENT_LENGTH, String.valueOf(-1));
|
||||
if (exception instanceof ArchivedIOException)
|
||||
{
|
||||
renderException(new ArchivedContentException(exception.getMsgId(), exception), res, assistant);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderException(exception, res, assistant);
|
||||
}
|
||||
}
|
||||
|
||||
protected RetryingTransactionHelper getTransactionHelper(String api)
|
||||
{
|
||||
RetryingTransactionHelper transHelper = transactionService.getRetryingTransactionHelper();
|
||||
|
@@ -174,7 +174,6 @@
|
||||
<entry key="org.springframework.http.InvalidMediaTypeException" value="#{T(org.springframework.extensions.webscripts.Status).STATUS_UNSUPPORTED_MEDIA_TYPE}" />
|
||||
<entry key="org.alfresco.rest.framework.core.exceptions.ServiceUnavailableException" value="503" />
|
||||
<entry key="org.alfresco.service.cmr.dictionary.InvalidTypeException" value="409" />
|
||||
<entry key="org.alfresco.rest.framework.core.exceptions.ArchivedContentException" value="#{T(org.springframework.extensions.webscripts.Status).STATUS_PRECONDITION_FAILED}" />
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
@@ -565,11 +564,8 @@
|
||||
<bean id="downloads" class="org.alfresco.rest.api.impl.DownloadsImpl">
|
||||
<property name="downloadService" ref="DownloadService"/>
|
||||
<property name="nodeService" ref="NodeService"/>
|
||||
<property name="contentService" ref="ContentService"/>
|
||||
<property name="moduleService" ref="ModuleService"/>
|
||||
<property name="nodes" ref="Nodes" />
|
||||
<property name="permissionService" ref="permissionService"/>
|
||||
<property name="archiveCheckLimit" value="${download.archiveCheckLimit}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="actions" class="org.alfresco.rest.api.impl.ActionsImpl">
|
||||
@@ -609,26 +605,6 @@
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="contentStorageInformation" class="org.alfresco.rest.api.impl.ContentStorageInformationImpl">
|
||||
<constructor-arg name="contentService" ref="ContentService"/>
|
||||
<constructor-arg name="namespaceService" ref="NamespaceService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ContentStorageInformation" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces">
|
||||
<value>org.alfresco.rest.api.ContentStorageInformation</value>
|
||||
</property>
|
||||
<property name="target">
|
||||
<ref bean="contentStorageInformation" />
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<idref bean="legacyExceptionInterceptor" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="deletedNodes" class="org.alfresco.rest.api.impl.DeletedNodesImpl">
|
||||
<property name="nodes" ref="Nodes" />
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
@@ -1000,11 +976,7 @@
|
||||
<property name="behaviourFilter" ref="policyBehaviourFilter"/>
|
||||
<property name="directAccessUrlHelper" ref="directAccessUrlHelper" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeStorageInfoRelation">
|
||||
<constructor-arg name="storageInformation" ref="ContentStorageInformation" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeSecondaryChildrenRelation" parent="baseNodeRelation"/>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeParentsRelation" parent="baseNodeRelation"/>
|
||||
|
@@ -76,7 +76,6 @@ import org.junit.runners.Suite;
|
||||
org.alfresco.repo.web.scripts.site.SurfConfigTest.class,
|
||||
org.alfresco.repo.web.scripts.node.NodeWebScripTest.class,
|
||||
org.alfresco.rest.api.impl.CommentsImplUnitTest.class,
|
||||
org.alfresco.rest.api.impl.DownloadsImplCheckArchiveStatusUnitTest.class,
|
||||
org.alfresco.rest.api.impl.RestApiDirectUrlConfigUnitTest.class
|
||||
})
|
||||
public class AppContext04TestSuite
|
||||
|
@@ -37,6 +37,7 @@ import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.util.BaseSpringTest;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
import org.alfresco.util.testing.category.FrequentlyFailingTests;
|
||||
import org.alfresco.util.testing.category.IntermittentlyFailingTests;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
|
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import org.alfresco.rest.api.model.ContentStorageInfo;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ContentStorageInformationImplTest
|
||||
{
|
||||
@Mock
|
||||
private ContentService contentService;
|
||||
@Mock
|
||||
private NamespaceService namespaceService;
|
||||
|
||||
@InjectMocks
|
||||
private ContentStorageInformationImpl objectUnderTest;
|
||||
|
||||
@Test
|
||||
public void shouldReturnStorageInfoResponseWithNonEmptyStorageProps()
|
||||
{
|
||||
|
||||
final String nodeId = "dummy-node-id";
|
||||
final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||
final String contentPropName = "cm:content";
|
||||
|
||||
final Map<String, String> storageProps = Map.of("x-amz-storage-class", "INTELLIGENT_TIERING", "x-alf-archived", "false");
|
||||
Mockito.when(contentService.getStorageProperties(Mockito.eq(nodeRef), Mockito.any())).thenReturn(storageProps);
|
||||
Mockito.when(namespaceService.getNamespaceURI(NamespaceService.CONTENT_MODEL_PREFIX))
|
||||
.thenReturn(NamespaceService.CONTENT_MODEL_1_0_URI);
|
||||
Mockito.when(namespaceService.getPrefixes(NamespaceService.CONTENT_MODEL_1_0_URI))
|
||||
.thenReturn(List.of(NamespaceService.CONTENT_MODEL_PREFIX));
|
||||
|
||||
final ContentStorageInfo storageInfo = objectUnderTest.getStorageInfo(nodeId, contentPropName, null);
|
||||
|
||||
Assert.assertEquals(storageProps, storageInfo.getStorageProperties());
|
||||
Assert.assertEquals(storageInfo.getId(), contentPropName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnStorageInfoResponseWithEmptyStorageProps()
|
||||
{
|
||||
final String nodeId = "dummy-node-id";
|
||||
final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||
final String contentPropName = "cm:content";
|
||||
|
||||
Mockito.when(contentService.getStorageProperties(Mockito.eq(nodeRef), Mockito.any())).thenCallRealMethod();
|
||||
Mockito.when(namespaceService.getNamespaceURI(NamespaceService.CONTENT_MODEL_PREFIX))
|
||||
.thenReturn(NamespaceService.CONTENT_MODEL_1_0_URI);
|
||||
Mockito.when(namespaceService.getPrefixes(NamespaceService.CONTENT_MODEL_1_0_URI))
|
||||
.thenReturn(List.of(NamespaceService.CONTENT_MODEL_PREFIX));
|
||||
|
||||
final ContentStorageInfo storageInfo = objectUnderTest.getStorageInfo(nodeId, contentPropName, null);
|
||||
|
||||
Assert.assertEquals(Collections.emptyMap(), storageInfo.getStorageProperties());
|
||||
Assert.assertEquals(storageInfo.getId(), contentPropName);
|
||||
}
|
||||
}
|
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.api.impl;
|
||||
|
||||
import static org.alfresco.model.ContentModel.TYPE_CONTENT;
|
||||
import static org.alfresco.model.ContentModel.TYPE_FOLDER;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.content.ObjectStorageProps;
|
||||
import org.alfresco.repo.module.ModuleDetailsImpl;
|
||||
import org.alfresco.rest.api.Nodes;
|
||||
import org.alfresco.service.cmr.download.DownloadService;
|
||||
import org.alfresco.service.cmr.module.ModuleDetails;
|
||||
import org.alfresco.service.cmr.module.ModuleService;
|
||||
import org.alfresco.service.cmr.repository.ArchivedIOException;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class DownloadsImplCheckArchiveStatusUnitTest
|
||||
{
|
||||
@InjectMocks
|
||||
private final DownloadsImpl downloads = new DownloadsImpl();
|
||||
|
||||
@Mock
|
||||
private DownloadService downloadService;
|
||||
@Mock
|
||||
private ModuleService moduleService;
|
||||
@Mock
|
||||
private NodeService nodeService;
|
||||
@Mock
|
||||
private ContentService contentService;
|
||||
@Mock
|
||||
private Nodes nodes;
|
||||
@Mock
|
||||
private PermissionService permissionService;
|
||||
|
||||
private final NodeRef contentNode1 = new NodeRef("://Content:/Node1");
|
||||
private final NodeRef contentNode2 = new NodeRef("://Content:/Node2");
|
||||
private final NodeRef contentNode3 = new NodeRef("://Content:/Node3");
|
||||
private final NodeRef contentNode4 = new NodeRef("://Content:/Node4");
|
||||
private final NodeRef contentNode5 = new NodeRef("://Content:/Node5");
|
||||
private final NodeRef contentNode6 = new NodeRef("://Content:/Node6");
|
||||
private final NodeRef folderParent1 = new NodeRef("://Folder:/Parent1");
|
||||
private final NodeRef folderParent2 = new NodeRef("://Folder:/Parent2");
|
||||
private final NodeRef folder1 = new NodeRef("://Folder:/1");
|
||||
private final NodeRef folder2 = new NodeRef("://Folder:/2");
|
||||
|
||||
// folderParent1
|
||||
private final List<ChildAssociationRef> folderParent1ChildAssocs = List.of(
|
||||
new ChildAssociationRef(TYPE_FOLDER, folderParent1, TYPE_CONTENT, contentNode3),
|
||||
new ChildAssociationRef(TYPE_FOLDER, folderParent1, TYPE_CONTENT, contentNode4),
|
||||
new ChildAssociationRef(TYPE_FOLDER, folderParent1, TYPE_CONTENT, contentNode5),
|
||||
new ChildAssociationRef(TYPE_FOLDER, folderParent1, TYPE_FOLDER, folder2),
|
||||
new ChildAssociationRef(TYPE_FOLDER, folderParent1, TYPE_FOLDER, folderParent2)
|
||||
);
|
||||
|
||||
// folderParent2
|
||||
private final List<ChildAssociationRef> folderParent2ChildAssocs = List.of(
|
||||
new ChildAssociationRef(TYPE_FOLDER, folderParent2, TYPE_FOLDER, folder1)
|
||||
);
|
||||
|
||||
// folder1
|
||||
private final List<ChildAssociationRef> folder1ChildAssocs = List.of(
|
||||
new ChildAssociationRef(TYPE_FOLDER, folder1, TYPE_CONTENT, contentNode1),
|
||||
new ChildAssociationRef(TYPE_FOLDER, folder1, TYPE_CONTENT, contentNode5),
|
||||
new ChildAssociationRef(TYPE_FOLDER, folder1, TYPE_CONTENT, contentNode6)
|
||||
);
|
||||
|
||||
// folder2 empty
|
||||
private final List<ChildAssociationRef> folder2ChildAssocs = List.of();
|
||||
|
||||
|
||||
private final Map<String, String> archivedProps = Map.of(ObjectStorageProps.X_ALF_ARCHIVED.getValue(), "true");
|
||||
private final Map<String, String> nonArchivedProps = Map.of(ObjectStorageProps.X_ALF_ARCHIVED.getValue(), "false");
|
||||
|
||||
private final ModuleDetails mockDetails = new ModuleDetailsImpl("id", null, "title", "description"); // doesn't need to do anything, just exist
|
||||
|
||||
private final NodeRef[] nodeRefsToTest = { contentNode1, contentNode2, folderParent1, folder1 };
|
||||
|
||||
@Before
|
||||
public void setup()
|
||||
{
|
||||
when(nodeService.getType(any())).thenReturn(TYPE_CONTENT);
|
||||
when(nodeService.getType(folderParent1)).thenReturn(TYPE_FOLDER);
|
||||
when(nodeService.getType(folderParent2)).thenReturn(TYPE_FOLDER);
|
||||
when(nodeService.getType(folder1)).thenReturn(TYPE_FOLDER);
|
||||
when(nodeService.getType(folder2)).thenReturn(TYPE_FOLDER);
|
||||
|
||||
when(nodeService.getChildAssocs(folderParent1)).thenReturn(folderParent1ChildAssocs);
|
||||
when(nodeService.getChildAssocs(folderParent2)).thenReturn(folderParent2ChildAssocs);
|
||||
when(nodeService.getChildAssocs(folder1)).thenReturn(folder1ChildAssocs);
|
||||
when(nodeService.getChildAssocs(folder2)).thenReturn(folder2ChildAssocs);
|
||||
|
||||
when(moduleService.getModule("org_alfresco_integrations_S3Connector")).thenReturn(mockDetails);
|
||||
|
||||
final NodeRef[] childNodeRefsExpectedFolderParent1 = { contentNode3, contentNode4, contentNode5, folder2, folderParent2 };
|
||||
final NodeRef[] childNodeRefsExpectedFolderParent2 = { folder1 };
|
||||
final NodeRef[] childNodeRefsExpectedFolder1 = { contentNode1, contentNode5, contentNode6 };
|
||||
final NodeRef[] childNodeRefsExpectedFolder2 = {};
|
||||
|
||||
assertChildNodeRefMocks(folderParent1, childNodeRefsExpectedFolderParent1);
|
||||
assertChildNodeRefMocks(folderParent2, childNodeRefsExpectedFolderParent2);
|
||||
assertChildNodeRefMocks(folder1, childNodeRefsExpectedFolder1);
|
||||
assertChildNodeRefMocks(folder2, childNodeRefsExpectedFolder2);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAllPass()
|
||||
{
|
||||
when(contentService.getStorageProperties(any(NodeRef.class), any(QName.class))).thenReturn(nonArchivedProps);
|
||||
|
||||
// No archived nodes, each content node should only be checked once
|
||||
downloads.checkArchiveStatus(nodeRefsToTest, -1);
|
||||
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode1, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode2, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode3, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode4, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode5, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode6, TYPE_CONTENT);
|
||||
verifyNoMoreInteractions(contentService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFirstItemArchived()
|
||||
{
|
||||
when(contentService.getStorageProperties(contentNode1, TYPE_CONTENT)).thenReturn(archivedProps);
|
||||
|
||||
assertThrows(ArchivedIOException.class, () -> downloads.checkArchiveStatus(nodeRefsToTest, -1));
|
||||
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode1, TYPE_CONTENT);
|
||||
verifyNoMoreInteractions(contentService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContentNode3Archived()
|
||||
{
|
||||
// fail node3 (within another folder)
|
||||
when(contentService.getStorageProperties(any(NodeRef.class), any(QName.class))).thenReturn(nonArchivedProps);
|
||||
when(contentService.getStorageProperties(contentNode3, TYPE_CONTENT)).thenReturn(archivedProps);
|
||||
|
||||
assertThrows(ArchivedIOException.class, () -> downloads.checkArchiveStatus(nodeRefsToTest, -1));
|
||||
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode1, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode2, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode3, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode5, TYPE_CONTENT);
|
||||
verify(contentService, times(1)).getStorageProperties(contentNode6, TYPE_CONTENT);
|
||||
verifyNoMoreInteractions(contentService);
|
||||
}
|
||||
|
||||
private void assertChildNodeRefMocks(final NodeRef nodeRef, final NodeRef[] expecteds)
|
||||
{
|
||||
final NodeRef[] actuals = nodeService.getChildAssocs(nodeRef).stream()
|
||||
.map(childAssoc -> childAssoc.getChildRef())
|
||||
.toArray(NodeRef[]::new);
|
||||
assertArrayEquals(expecteds, actuals);
|
||||
}
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.rest.api.tests;
|
||||
|
||||
import org.alfresco.repo.action.ActionServiceImpl;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.quickshare.QuickShareLinkExpiryActionImpl;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
@@ -64,6 +65,7 @@ import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.alfresco.util.testing.category.FrequentlyFailingTests;
|
||||
import org.alfresco.util.testing.category.LuceneTests;
|
||||
import org.alfresco.util.testing.category.RedundantTests;
|
||||
import org.joda.time.DateTime;
|
||||
|
@@ -82,7 +82,8 @@ Sometimes it is desirable to create a version automatically. Whether this happe
|
||||
When _cm:autoVersion_ is true, a new version is created when the _cm:content_ of a content node changes.
|
||||
When _cm:autoVersionOnUpdateProps_ is true, a new version is created when any of the properties of a content node change.
|
||||
|
||||
The defaults for these properties are set in the contentModel.xml file in the usual way. But to simplify the admin experience, the values of these properties can also be set using global properties:
|
||||
The defaults for these properties are set in the contentModel.xml file in the usual way. But to simplify the admin experience, the values of these properties can also set using global properties:
|
||||
|
||||
* version.store.enableAutoVersioning
|
||||
* version.store.enableAutoVersionOnUpdateProps
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.46</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -383,7 +383,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.2.7</version>
|
||||
<version>6.2.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- GData -->
|
||||
|
@@ -47,7 +47,6 @@ import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.content.filestore.FileContentWriter;
|
||||
import org.alfresco.repo.content.transform.TransformerDebug;
|
||||
import org.alfresco.service.cmr.repository.ArchivedIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentAccessor;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
@@ -430,7 +429,6 @@ public abstract class AbstractContentReader extends AbstractContentAccessor impl
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
if (e instanceof ArchivedIOException) throw e;
|
||||
throw new ContentIOException("Failed to open stream onto channel: \n" +
|
||||
" accessor: " + this,
|
||||
e);
|
||||
@@ -543,10 +541,6 @@ public abstract class AbstractContentReader extends AbstractContentAccessor impl
|
||||
// done
|
||||
return content;
|
||||
}
|
||||
catch (ArchivedIOException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ContentIOException("Failed to copy content to string: \n" +
|
||||
|
@@ -591,14 +591,14 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isContentDirectUrlEnabled(NodeRef nodeRef, QName propertyQName)
|
||||
public boolean isContentDirectUrlEnabled(NodeRef nodeRef)
|
||||
{
|
||||
boolean contentDirectUrlEnabled = false;
|
||||
|
||||
// TODO: update this
|
||||
if (systemWideDirectUrlConfig.isEnabled())
|
||||
{
|
||||
ContentData contentData = getContentData(nodeRef, propertyQName);
|
||||
ContentData contentData = getContentData(nodeRef, ContentModel.PROP_CONTENT);
|
||||
|
||||
// check that the URL is available
|
||||
if (contentData == null || contentData.getContentUrl() == null)
|
||||
@@ -615,15 +615,14 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, QName propertyQName, boolean attachment, Long validFor)
|
||||
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor)
|
||||
{
|
||||
if (!systemWideDirectUrlConfig.isEnabled())
|
||||
{
|
||||
throw new DirectAccessUrlDisabledException("Direct access url isn't available.");
|
||||
}
|
||||
|
||||
ContentData contentData = getContentData(nodeRef, propertyQName);
|
||||
ContentData contentData = getContentData(nodeRef, ContentModel.PROP_CONTENT);
|
||||
// check that the content & URL is available
|
||||
if (contentData == null || contentData.getContentUrl() == null)
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2019 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -34,7 +34,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.transform.client.model.config.SupportedSourceAndTarget;
|
||||
import org.alfresco.transform.client.model.config.TransformOption;
|
||||
import org.alfresco.transform.client.model.config.Transformer;
|
||||
import org.alfresco.transform.client.registry.AbstractTransformRegistry;
|
||||
import org.alfresco.transform.client.registry.CombinedConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -53,8 +52,7 @@ import java.util.Set;
|
||||
* any mimetype starting "text/", or "application/x-javascript", or "application/dita+xml". There must be no transform
|
||||
* options, but in case of the text transform the source and target encodings may be change.
|
||||
*
|
||||
* Supported transforms are added by {@link CombinedConfig#addPassThroughTransformer(
|
||||
* org.alfresco.service.cmr.repository.MimetypeService, AbstractTransformRegistry)}.
|
||||
* Supported transforms are added by {@link CombinedConfig#addPassThroughTransformer(org.alfresco.service.cmr.repository.MimetypeService)}.
|
||||
*
|
||||
* @author adavis
|
||||
*/
|
||||
@@ -78,18 +76,10 @@ public class LocalPassThroughTransform extends AbstractLocalTransform
|
||||
Set<SupportedSourceAndTarget> supportedSourceAndTargetList = new HashSet();
|
||||
for (String mimetype: mimetypes)
|
||||
{
|
||||
supportedSourceAndTargetList.add(SupportedSourceAndTarget.builder()
|
||||
.withSourceMediaType(mimetype)
|
||||
.withTargetMediaType(mimetype)
|
||||
.withPriority(20)
|
||||
.build());
|
||||
supportedSourceAndTargetList.add(new SupportedSourceAndTarget(mimetype, mimetype, -1, 20));
|
||||
if (isToText(mimetype, mimetype))
|
||||
{
|
||||
supportedSourceAndTargetList.add(SupportedSourceAndTarget.builder()
|
||||
.withSourceMediaType(mimetype)
|
||||
.withTargetMediaType(MimetypeMap.MIMETYPE_TEXT_PLAIN)
|
||||
.withPriority(20)
|
||||
.build());
|
||||
supportedSourceAndTargetList.add(new SupportedSourceAndTarget(mimetype, MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, 20));
|
||||
}
|
||||
}
|
||||
return Transformer.builder().withTransformerName(LocalPassThroughTransform.NAME).
|
||||
|
@@ -26,6 +26,7 @@
|
||||
package org.alfresco.repo.content.transform;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -33,7 +34,6 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.transform.client.model.config.TransformOptionGroup;
|
||||
@@ -133,15 +133,15 @@ public class LocalTransformServiceRegistry extends TransformServiceRegistryImpl
|
||||
@Override
|
||||
public boolean readConfig() throws IOException
|
||||
{
|
||||
CombinedConfig combinedConfig = new CombinedConfig(getLog(), this);
|
||||
List<String> urls = getTEngineUrlsSortedByName();
|
||||
CombinedConfig combinedConfig = new CombinedConfig(getLog());
|
||||
List<String> urls = getTEngineUrls();
|
||||
boolean successReadingConfig = combinedConfig.addRemoteConfig(urls, "T-Engine");
|
||||
successReadingConfig &= combinedConfig.addLocalConfig("alfresco/transforms");
|
||||
if (pipelineConfigDir != null && !pipelineConfigDir.isBlank())
|
||||
{
|
||||
successReadingConfig &= combinedConfig.addLocalConfig(pipelineConfigDir);
|
||||
}
|
||||
combinedConfig.addPassThroughTransformer(mimetypeService, this);
|
||||
combinedConfig.addPassThroughTransformer(mimetypeService);
|
||||
combinedConfig.register(this);
|
||||
return successReadingConfig;
|
||||
}
|
||||
@@ -159,8 +159,8 @@ public class LocalTransformServiceRegistry extends TransformServiceRegistryImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void register(Transformer transformer, Map<String, Set<TransformOption>> transformOptions,
|
||||
String baseUrl, String readFrom)
|
||||
public void register(Transformer transformer, Map<String, Set<TransformOption>> transformOptions,
|
||||
String baseUrl, String readFrom)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -321,23 +321,30 @@ public class LocalTransformServiceRegistry extends TransformServiceRegistryImpl
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return urls from System or Alfresco global properties that match of localTransform.<name>.url=<url> sorted
|
||||
* in <name> order.
|
||||
*/
|
||||
List<String> getTEngineUrlsSortedByName()
|
||||
private List<String> getTEngineUrls()
|
||||
{
|
||||
// T-Engines are sorted by name so they are in the same order as in the all-in-one transformer and the
|
||||
// T-Router. See AIOCustomConfig#getTEnginesSortedByName and TransformersConfigRegistry#retrieveRemoteConfig.
|
||||
return getKeySet().stream()
|
||||
.filter(key -> key instanceof String)
|
||||
.filter(key -> key.startsWith(LOCAL_TRANSFORMER) && key.endsWith(URL))
|
||||
.sorted()
|
||||
.map(key -> getProperty(key, null))
|
||||
.filter(url -> url instanceof String)
|
||||
.map(url -> url.trim())
|
||||
.filter(url -> !url.isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (Object o : getKeySet())
|
||||
{
|
||||
if (o instanceof String)
|
||||
{
|
||||
String key = (String)o;
|
||||
if (key.startsWith(LOCAL_TRANSFORMER) && key.endsWith(URL))
|
||||
{
|
||||
Object url = getProperty(key, null);
|
||||
if (url instanceof String)
|
||||
{
|
||||
String urlStr = ((String)url).trim();
|
||||
if (!urlStr.isEmpty())
|
||||
{
|
||||
urls.add((String) url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return urls;
|
||||
}
|
||||
|
||||
private int getStartupRetryPeriodSeconds(String name)
|
||||
|
@@ -415,13 +415,12 @@ implements TenantDeployer, DictionaryListener, /*TenantDictionaryListener, */Mes
|
||||
|
||||
for (NodeRef messageResource : nodeRefs)
|
||||
{
|
||||
String messageResourcePath = nodeService.getPath(messageResource).toPrefixString(namespaceService);
|
||||
String bundleBasePrefixedName = messageResourcePath.substring(messageResourcePath.lastIndexOf("/"));
|
||||
String bundleBaseName = messageService.getBaseBundleName(bundleBasePrefixedName);
|
||||
String resourceName = (String) nodeService.getProperty(messageResource, ContentModel.PROP_NAME);
|
||||
|
||||
String bundleBaseName = messageService.getBaseBundleName(resourceName);
|
||||
|
||||
if (!resourceBundleBaseNames.contains(bundleBaseName))
|
||||
{
|
||||
messageService.registerResourceBundle(storeRef.toString() + repositoryLocation.getPath() + bundleBaseName);
|
||||
resourceBundleBaseNames.add(bundleBaseName);
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -683,7 +683,6 @@ public class RenditionServiceImpl implements
|
||||
log.debug("OnContentUpdate calling RenditionService2.render(\""+sourceNodeRef+"\", \""+renditionName+"\" so we switch to the new service.");
|
||||
}
|
||||
useRenditionService2 = true;
|
||||
renditionService2.clearRenditionContentData(sourceNodeRef, renditionName);
|
||||
renditionService2.render(sourceNodeRef, renditionName);
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -538,8 +538,9 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set ThumbnailLastModified for " + renditionName);
|
||||
logger.debug("Set rendition hashcode " + transformContentHashCode + " and ThumbnailLastModified for " + renditionName);
|
||||
}
|
||||
nodeService.setProperty(renditionNode, RenditionModel.PROP_RENDITION_CONTENT_HASH_CODE, transformContentHashCode);
|
||||
setThumbnailLastModified(sourceNodeRef, renditionName);
|
||||
|
||||
if (transformInputStream != null)
|
||||
@@ -553,11 +554,6 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea
|
||||
contentWriter.setEncoding(DEFAULT_ENCODING);
|
||||
ContentWriter renditionWriter = contentWriter;
|
||||
renditionWriter.putContent(transformInputStream);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set rendition hashcode for " + renditionName);
|
||||
}
|
||||
nodeService.setProperty(renditionNode, RenditionModel.PROP_RENDITION_CONTENT_HASH_CODE, transformContentHashCode);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -567,7 +563,16 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea
|
||||
}
|
||||
else
|
||||
{
|
||||
clearRenditionContentData(renditionNode);
|
||||
Serializable content = nodeService.getProperty(renditionNode, PROP_CONTENT);
|
||||
if (content != null)
|
||||
{
|
||||
nodeService.removeProperty(renditionNode, PROP_CONTENT);
|
||||
nodeService.removeProperty(renditionNode, PROP_RENDITION_CONTENT_HASH_CODE);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Cleared rendition content and hashcode");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!sourceHasAspectRenditioned)
|
||||
@@ -731,43 +736,6 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears source nodeRef rendition content and content hash code using supplied rendition name
|
||||
*
|
||||
* @param sourceNodeRef
|
||||
* @param renditionName
|
||||
*/
|
||||
public void clearRenditionContentData(NodeRef sourceNodeRef, String renditionName)
|
||||
{
|
||||
clearRenditionContentData(getRenditionNode(sourceNodeRef, renditionName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears supplied rendition node content (if exists) and content hash code
|
||||
*
|
||||
* @param renditionNode
|
||||
*/
|
||||
private void clearRenditionContentData(NodeRef renditionNode)
|
||||
{
|
||||
if (renditionNode != null)
|
||||
{
|
||||
Serializable content = nodeService.getProperty(renditionNode, PROP_CONTENT);
|
||||
if (content != null)
|
||||
{
|
||||
nodeService.removeProperty(renditionNode, PROP_CONTENT);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Cleared rendition content");
|
||||
}
|
||||
}
|
||||
nodeService.removeProperty(renditionNode, PROP_RENDITION_CONTENT_HASH_CODE);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Cleared rendition hashcode");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method checks whether the specified source node is of a content class which has been registered for
|
||||
* rendition prevention.
|
||||
@@ -918,7 +886,6 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea
|
||||
RenditionDefinition2 renditionDefinition = renditionDefinitionRegistry2.getRenditionDefinition(renditionName);
|
||||
if (renditionDefinition != null)
|
||||
{
|
||||
clearRenditionContentData(sourceNodeRef, renditionName);
|
||||
render(sourceNodeRef, renditionName);
|
||||
}
|
||||
else
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -640,7 +640,7 @@ public class ThumbnailServiceImpl implements ThumbnailService,
|
||||
boolean valid = true;
|
||||
ContentData content = (ContentData) this.nodeService.getProperty(thumbnailNode, ContentModel.PROP_CONTENT);
|
||||
// (MNT-17162) A thumbnail with an empty content is cached for post-transaction removal, to prevent the delete in read-only transactions.
|
||||
if (content == null || content.getSize() == 0)
|
||||
if (content.getSize() == 0)
|
||||
{
|
||||
TransactionalResourceHelper.getSet(THUMBNAIL_TO_DELETE_NODES).add(thumbnailNode);
|
||||
TransactionSupportUtil.bindListener(this.thumbnailsToDeleteTransactionListener, 0);
|
||||
|
@@ -27,7 +27,6 @@ package org.alfresco.service.cmr.repository;
|
||||
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.Auditable;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
|
||||
@@ -171,20 +170,7 @@ public interface ContentService
|
||||
*
|
||||
* @return {@code true} if direct access URLs retrieving is supported for the node, {@code false} otherwise
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean isContentDirectUrlEnabled(NodeRef nodeRef)
|
||||
{
|
||||
return isContentDirectUrlEnabled(nodeRef, ContentModel.PROP_CONTENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the system and store supports the retrieving of a direct access {@code URL} for the given node.
|
||||
*
|
||||
* @param nodeRef a reference to a node having a content property
|
||||
* @param propertyQName the name of the property, which must be of type <b>content</b>
|
||||
* @return {@code true} if direct access URLs retrieving is supported for the node, {@code false} otherwise
|
||||
*/
|
||||
boolean isContentDirectUrlEnabled(NodeRef nodeRef, QName propertyQName);
|
||||
boolean isContentDirectUrlEnabled(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Gets a presigned URL to directly access the content. It is up to the actual store
|
||||
@@ -195,27 +181,11 @@ public interface ContentService
|
||||
* @return A direct access {@code URL} object for the content.
|
||||
* @throws UnsupportedOperationException if the store is unable to provide the information.
|
||||
*/
|
||||
@Deprecated
|
||||
default DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment)
|
||||
{
|
||||
return requestContentDirectUrl(nodeRef, attachment, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a presigned URL to directly access the content. It is up to the actual store
|
||||
* implementation if it can fulfil this request with an expiry time or not.
|
||||
*
|
||||
* @param nodeRef Node ref for which to obtain the direct access {@code URL}.
|
||||
* @param propertyQName the name of the property, which must be of type <b>content</b>
|
||||
* @param attachment {@code true} if an attachment URL is requested, {@code false} for an embedded {@code URL}.
|
||||
* @return A direct access {@code URL} object for the content.
|
||||
* @throws UnsupportedOperationException if the store is unable to provide the information.
|
||||
*/
|
||||
default DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, QName propertyQName, boolean attachment)
|
||||
{
|
||||
return requestContentDirectUrl(nodeRef, propertyQName, attachment, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a presigned URL to directly access the content. It is up to the actual store
|
||||
* implementation if it can fulfil this request with an expiry time or not.
|
||||
@@ -227,25 +197,7 @@ public interface ContentService
|
||||
* @throws UnsupportedOperationException if the store is unable to provide the information.
|
||||
*/
|
||||
@Auditable(parameters = {"nodeRef", "validFor"})
|
||||
@Deprecated
|
||||
default public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor)
|
||||
{
|
||||
return requestContentDirectUrl(nodeRef, ContentModel.PROP_CONTENT, attachment, validFor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a presigned URL to directly access the content. It is up to the actual store
|
||||
* implementation if it can fulfil this request with an expiry time or not.
|
||||
*
|
||||
* @param nodeRef Node ref for which to obtain the direct access {@code URL}.
|
||||
* @param propertyQName the name of the property, which must be of type <b>content</b>
|
||||
* @param attachment {@code true} if an attachment URL is requested, {@code false} for an embedded {@code URL}.
|
||||
* @param validFor The time at which the direct access {@code URL} will expire.
|
||||
* @return A direct access {@code URL} object for the content.
|
||||
* @throws UnsupportedOperationException if the store is unable to provide the information.
|
||||
*/
|
||||
@Auditable(parameters = {"nodeRef", "propertyQName", "validFor"})
|
||||
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, QName propertyQName, boolean attachment, Long validFor);
|
||||
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor);
|
||||
|
||||
/**
|
||||
* Gets a key-value (String-String) collection of storage headers/properties with their respective values for a specific node reference.
|
||||
|
@@ -44,7 +44,6 @@ import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -52,8 +51,8 @@ import java.util.List;
|
||||
* in one file. Transform options are shared between all sources.<p>
|
||||
*
|
||||
* The caller should make calls to {@link #addRemoteConfig(List, String)}, {@link #addLocalConfig(String)} or
|
||||
* {@link CombinedTransformConfig#addTransformConfig(TransformConfig, String, String, AbstractTransformRegistry)}
|
||||
* followed by a call to {@link #register(TransformServiceRegistryImpl)}.
|
||||
* {@link #addTransformConfig(TransformConfig, String, String)} followed by a call to
|
||||
* {@link #register(TransformServiceRegistryImpl)}.
|
||||
*
|
||||
* @author adavis
|
||||
*/
|
||||
@@ -65,7 +64,7 @@ public class CombinedConfig extends CombinedTransformConfig
|
||||
private ConfigFileFinder configFileFinder;
|
||||
private int tEngineCount;
|
||||
|
||||
public CombinedConfig(Log log, AbstractTransformRegistry registry)
|
||||
public CombinedConfig(Log log)
|
||||
{
|
||||
this.log = log;
|
||||
|
||||
@@ -75,7 +74,7 @@ public class CombinedConfig extends CombinedTransformConfig
|
||||
protected void readJson(JsonNode jsonNode, String readFrom, String baseUrl)
|
||||
{
|
||||
TransformConfig transformConfig = jsonObjectMapper.convertValue(jsonNode, TransformConfig.class);
|
||||
addTransformConfig(transformConfig, readFrom, baseUrl, registry);
|
||||
addTransformConfig(transformConfig, readFrom, baseUrl);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -130,9 +129,9 @@ public class CombinedConfig extends CombinedTransformConfig
|
||||
String content = getContent(resEntity);
|
||||
try (StringReader reader = new StringReader(content))
|
||||
{
|
||||
int transformCount = transformerCount();
|
||||
int transformCount = combinedTransformers.size();
|
||||
configFileFinder.readFile(reader, remoteType+" on "+baseUrl, "json", baseUrl, log);
|
||||
if (transformCount == transformerCount())
|
||||
if (transformCount == combinedTransformers.size())
|
||||
{
|
||||
successReadingConfig = false;
|
||||
}
|
||||
@@ -226,14 +225,11 @@ public class CombinedConfig extends CombinedTransformConfig
|
||||
* from selected text based types.
|
||||
* @param mimetypeService to find all the mimetypes
|
||||
*/
|
||||
public void addPassThroughTransformer(MimetypeService mimetypeService, AbstractTransformRegistry registry)
|
||||
public void addPassThroughTransformer(MimetypeService mimetypeService)
|
||||
{
|
||||
List<String> mimetypes = mimetypeService.getMimetypes();
|
||||
Transformer transformer = LocalPassThroughTransform.getConfig(mimetypes);
|
||||
TransformConfig transformConfig = TransformConfig.builder()
|
||||
.withTransformers(Collections.singletonList(transformer))
|
||||
.build();
|
||||
addTransformConfig(transformConfig, "based on mimetype list", null, registry);
|
||||
combinedTransformers.add(new TransformAndItsOrigin(transformer, null, "based on mimetype list"));
|
||||
}
|
||||
|
||||
public void register(TransformServiceRegistryImpl registry)
|
||||
|
@@ -7,19 +7,19 @@
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
DROP INDEX idx_alf_node_ver ON alf_node; --(optional)
|
||||
DROP INDEX idx_alf_node_ver; --(optional)
|
||||
CREATE INDEX idx_alf_node_ver ON alf_node (version);
|
||||
|
||||
DROP INDEX idx_alf_node_txn ON alf_node; --(optional)
|
||||
DROP INDEX idx_alf_node_txn; --(optional)
|
||||
CREATE INDEX idx_alf_node_txn ON alf_node (transaction_id);
|
||||
|
||||
DROP INDEX idx_alf_txn_ctms ON alf_transaction; --(optional)
|
||||
DROP INDEX idx_alf_txn_ctms; --(optional)
|
||||
CREATE INDEX idx_alf_txn_ctms ON alf_transaction (commit_time_ms, id);
|
||||
|
||||
DROP INDEX idx_alf_txn_ctms_sc ON alf_transaction; --(optional)
|
||||
DROP INDEX idx_alf_txn_ctms_sc; --(optional)
|
||||
CREATE INDEX idx_alf_txn_ctms_sc ON alf_transaction (commit_time_ms);
|
||||
|
||||
DROP INDEX idx_alf_txn_id_ctms ON alf_transaction; --(optional)
|
||||
DROP INDEX idx_alf_txn_id_ctms; --(optional)
|
||||
CREATE INDEX idx_alf_txn_id_ctms ON alf_transaction (id, commit_time_ms);
|
||||
|
||||
--
|
||||
@@ -32,4 +32,4 @@ INSERT INTO alf_applied_patch
|
||||
(
|
||||
'patch.db-V6.3-add-indexes-node-transaction', 'Create aditional indexes on alf_node and alf_transaction',
|
||||
0, 14001, -1, 14002, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||
);
|
||||
);
|
@@ -10,12 +10,12 @@
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
DROP TABLE alf_server;
|
||||
|
||||
ALTER TABLE alf_transaction
|
||||
DROP FOREIGN KEY fk_alf_txn_svr,
|
||||
DROP COLUMN server_id;
|
||||
|
||||
DROP TABLE IF EXISTS alf_server;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
|
||||
--
|
||||
|
@@ -852,12 +852,6 @@ fileFolderService.checkHidden.enabled=true
|
||||
|
||||
ticket.cleanup.cronExpression=0 0 * * * ?
|
||||
|
||||
#
|
||||
# Maximum number of items to check for archive status when creating downloads node set to -1 for unlimited checks
|
||||
# only used if azure-connector or s3-connector is installed
|
||||
#
|
||||
download.archiveCheckLimit=500
|
||||
|
||||
#
|
||||
# Download Service Cleanup
|
||||
#
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -59,7 +59,7 @@ import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.util.testing.category.FrequentlyFailingTests;
|
||||
import org.alfresco.util.testing.category.IntermittentlyFailingTests;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@@ -338,7 +338,7 @@ public class EncryptionTests extends TestCase
|
||||
testChangeKeysImpl(true);
|
||||
}
|
||||
|
||||
@Category(FrequentlyFailingTests.class) // ACS-2242
|
||||
@Category(IntermittentlyFailingTests.class) // ACS-959
|
||||
public void testFailedEncryptionWithCachedCiphers() throws Throwable
|
||||
{
|
||||
Pair<byte[], AlgorithmParameters> pair = null;
|
||||
|
@@ -31,18 +31,17 @@ import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||
import org.alfresco.repo.dictionary.NamespaceDAO;
|
||||
import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.node.db.DbNodeServiceImpl;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
@@ -51,7 +50,6 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransacti
|
||||
import org.alfresco.service.cmr.admin.RepoAdminService;
|
||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -69,8 +67,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @see RepoAdminServiceImpl
|
||||
*
|
||||
@@ -92,7 +88,6 @@ public class RepoAdminServiceImplTest extends TestCase
|
||||
private NamespaceService namespaceService;
|
||||
private BehaviourFilter behaviourFilter;
|
||||
private DictionaryDAO dictionaryDAO;
|
||||
private MessageService messageService;
|
||||
|
||||
final String modelPrefix = "model-";
|
||||
final static String MKR = "{MKR}";
|
||||
@@ -145,7 +140,6 @@ public class RepoAdminServiceImplTest extends TestCase
|
||||
namespaceService = (NamespaceService) ctx.getBean("NamespaceService");
|
||||
behaviourFilter = (BehaviourFilter)ctx.getBean("policyBehaviourFilter");
|
||||
dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO");
|
||||
messageService = (MessageService) ctx.getBean("MessageService");
|
||||
|
||||
DbNodeServiceImpl dbNodeService = (DbNodeServiceImpl)ctx.getBean("dbNodeService");
|
||||
dbNodeService.setEnableTimestampPropagation(false);
|
||||
@@ -871,182 +865,8 @@ public class RepoAdminServiceImplTest extends TestCase
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test deploy bundle from classpath
|
||||
public void testDeployMessageBundleFromClasspath() throws Exception
|
||||
{
|
||||
String bundleBaseName = "mycustommessages";
|
||||
String resourceClasspath = "alfresco/extension/messages/" + bundleBaseName;
|
||||
|
||||
final String message_key = "mycustommessages.key1";
|
||||
final String message_value_default = "This is a custom message";
|
||||
final String message_value_fr = "Ceci est un message personnalis\\u00e9";
|
||||
final String message_value_de = "Dies ist eine benutzerdefinierte Nachricht";
|
||||
|
||||
// Undeploy the bundle
|
||||
if (repoAdminService.getMessageBundles().contains(bundleBaseName))
|
||||
{
|
||||
repoAdminService.undeployMessageBundle(bundleBaseName);
|
||||
}
|
||||
|
||||
// Verify the custom bundle is registered
|
||||
assertFalse("The custom bundle should not be deployed", repoAdminService.getMessageBundles().contains(bundleBaseName));
|
||||
|
||||
// Depoly the message bundle
|
||||
repoAdminService.deployMessageBundle(resourceClasspath);
|
||||
|
||||
// Reload the messages
|
||||
repoAdminService.reloadMessageBundle(bundleBaseName);
|
||||
|
||||
// Verify the custom bundle is registered
|
||||
assertTrue("The custom bundle should be deployed", repoAdminService.getMessageBundles().contains(bundleBaseName));
|
||||
|
||||
// Verify we have the messages for each locale
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
assertMessageValue("Cannot retrieve default message value", message_value_default, message_key, Locale.getDefault());
|
||||
assertMessageValue("Cannot retrieve french message value", message_value_fr, message_key, Locale.FRANCE);
|
||||
assertMessageValue("Cannot retrieve german message value", message_value_de, message_key, Locale.GERMANY);
|
||||
|
||||
// Test deploy a non existent bundle
|
||||
try
|
||||
{
|
||||
repoAdminService.deployMessageBundle("alfresco/extension/messages/inexistentbundle");
|
||||
fail("Bundle was not supposed to be deployed");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Expected to fail
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Test deploy bundle from repo and reload bundles
|
||||
public void testDeployMessageBundleFromRepo() throws Exception
|
||||
{
|
||||
final String bundleBaseName = "repoBundle";
|
||||
final String message_key = "repoBundle.key1";
|
||||
final String message_value = "Value 1";
|
||||
final String message_value_fr = "Value FR";
|
||||
final String message_value_de = "Value DE";
|
||||
final String message_value_new = "New Value 1";
|
||||
|
||||
// Set location
|
||||
NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(rootNodeRef, "/app:company_home/app:dictionary/app:messages", null,
|
||||
namespaceService, false);
|
||||
assertEquals(1, nodeRefs.size());
|
||||
NodeRef messagesNodeRef = nodeRefs.get(0);
|
||||
|
||||
// Clear messages of this bundle if they exist and are registered
|
||||
clearRepoBundles(messagesNodeRef);
|
||||
|
||||
assertEquals(0, repoAdminService.getMessageBundles().size());
|
||||
|
||||
// Create and upload the message files
|
||||
NodeRef messageNode_default = createMessagesNodeWithSingleKey(messagesNodeRef, bundleBaseName, message_key, null,
|
||||
message_value);
|
||||
createMessagesNodeWithSingleKey(messagesNodeRef, bundleBaseName, message_key, Locale.FRANCE.toString(), message_value_fr);
|
||||
createMessagesNodeWithSingleKey(messagesNodeRef, bundleBaseName, message_key, Locale.GERMANY.toString(),
|
||||
message_value_de);
|
||||
|
||||
// Reload the messages
|
||||
repoAdminService.reloadMessageBundle(bundleBaseName);
|
||||
|
||||
// Verify we have the messages for each locale
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
assertMessageValue("Cannot retrieve default message value", message_value, message_key, Locale.getDefault());
|
||||
assertMessageValue("Cannot retrieve french message value", message_value_fr, message_key, Locale.FRANCE);
|
||||
assertMessageValue("Cannot retrieve german message value", message_value_de, message_key, Locale.GERMANY);
|
||||
|
||||
// Change the values
|
||||
putContentInMessageNode(messageNode_default, message_key, message_value_new);
|
||||
|
||||
// Verify we still have the old value
|
||||
assertMessageValue("Unexpected change of message value", message_value, message_key, Locale.getDefault());
|
||||
|
||||
// Reload the messages
|
||||
repoAdminService.reloadMessageBundle(bundleBaseName);
|
||||
|
||||
// Verify new values
|
||||
assertMessageValue("Change of message value not reflected", message_value_new, message_key, Locale.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create messages node
|
||||
*/
|
||||
private NodeRef createMessagesNodeWithSingleKey(NodeRef parentNode, String bundleName, String key, String locale,
|
||||
String localeValue)
|
||||
{
|
||||
String msg_extension = ".properties";
|
||||
String filename = bundleName + msg_extension;
|
||||
String messageValue = localeValue;
|
||||
|
||||
if (locale != null)
|
||||
{
|
||||
filename = bundleName + "_" + locale + msg_extension;
|
||||
}
|
||||
// Create a model node
|
||||
NodeRef messageNode = this.nodeService.createNode(
|
||||
parentNode,
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, filename),
|
||||
ContentModel.TYPE_CONTENT,
|
||||
Collections.<QName, Serializable> singletonMap(ContentModel.PROP_NAME, filename)
|
||||
).getChildRef();
|
||||
|
||||
putContentInMessageNode(messageNode, key, messageValue);
|
||||
|
||||
return messageNode;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Write content of message node
|
||||
*/
|
||||
private void putContentInMessageNode(NodeRef nodeRef, String key, String value)
|
||||
{
|
||||
ContentWriter contentWriter = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
String messagesString = key + "=" + value;
|
||||
contentWriter.putContent(messagesString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear Repo Bundle
|
||||
*/
|
||||
private void clearRepoBundles(NodeRef parentNode)
|
||||
{
|
||||
List<String> repoBundles = repoAdminService.getMessageBundles();
|
||||
for (String repoBundle : repoBundles)
|
||||
{
|
||||
repoAdminService.undeployMessageBundle(repoBundle);
|
||||
}
|
||||
|
||||
List<ChildAssociationRef> messageNodes = nodeService.getChildAssocs(parentNode);
|
||||
for (ChildAssociationRef messageChildRef : messageNodes)
|
||||
{
|
||||
NodeRef messageNode = messageChildRef.getChildRef();
|
||||
nodeService.deleteNode(messageNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear Repo Bundle
|
||||
*/
|
||||
private void assertMessageValue(String errorMessage, String expectedValue, String key, Locale locale)
|
||||
{
|
||||
transactionService.getRetryingTransactionHelper()
|
||||
.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
assertEquals(errorMessage, expectedValue, messageService.getMessage(key, locale));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// TODO - Test custom message management
|
||||
//
|
||||
}
|
||||
|
@@ -48,7 +48,6 @@ import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
@@ -79,8 +78,6 @@ public class ContentServiceImplUnitTest
|
||||
private static final String X_AMZ_HEADER_2 = "x-amz-header-2";
|
||||
private static final String VALUE_2 = "value2";
|
||||
|
||||
private static final QName PROP_CONTENT_QNAME = ContentModel.PROP_CONTENT;
|
||||
|
||||
@InjectMocks
|
||||
private ContentServiceImpl contentService;
|
||||
|
||||
@@ -134,10 +131,15 @@ public class ContentServiceImplUnitTest
|
||||
public void testRequestContentDirectUrl_SystemWideIsDisabled()
|
||||
{
|
||||
setupSystemWideDirectAccessConfig(DISABLED);
|
||||
assertThrows(DirectAccessUrlDisabledException.class, () -> {
|
||||
contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L);
|
||||
});
|
||||
verify(mockContentStore, never()).isContentDirectUrlEnabled();
|
||||
try
|
||||
{
|
||||
contentService.requestContentDirectUrl(NODE_REF, true, 20L);
|
||||
fail("Expected DirectAccessUrlDisabledException");
|
||||
}
|
||||
catch (DirectAccessUrlDisabledException ex)
|
||||
{
|
||||
verify(mockContentStore, never()).isContentDirectUrlEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -146,7 +148,7 @@ public class ContentServiceImplUnitTest
|
||||
setupSystemWideDirectAccessConfig(ENABLED);
|
||||
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(DISABLED);
|
||||
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME,true, 20L);
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, true, 20L);
|
||||
assertNull(directAccessUrl);
|
||||
verify(mockContentStore, never()).requestContentDirectUrl(anyString(), eq(true), anyString(), anyString(), anyLong());
|
||||
}
|
||||
@@ -157,7 +159,7 @@ public class ContentServiceImplUnitTest
|
||||
setupSystemWideDirectAccessConfig(ENABLED);
|
||||
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
|
||||
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L);
|
||||
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, true, 20L);
|
||||
assertNull(directAccessUrl);
|
||||
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), anyString(), anyString(), anyLong());
|
||||
}
|
||||
|
@@ -72,14 +72,6 @@ public class MimetypeMapContentTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public void testGuessAppleIconsMimetype() throws Exception
|
||||
{
|
||||
assertEquals(
|
||||
"image/icns",
|
||||
mimetypeService.guessMimetype("something.icns", openQuickTestFile("quick.icns"))
|
||||
);
|
||||
}
|
||||
|
||||
public void testGuessMimetypeForFile() throws Exception
|
||||
{
|
||||
// Correct ones
|
||||
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.content.transform;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnit;
|
||||
import org.mockito.junit.MockitoRule;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import static org.alfresco.repo.content.transform.LocalTransformServiceRegistry.LOCAL_TRANSFORMER;
|
||||
import static org.alfresco.repo.content.transform.LocalTransformServiceRegistry.URL;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class LocalTransformServiceRegistryTest
|
||||
{
|
||||
@Spy
|
||||
private Properties properties = new Properties();
|
||||
|
||||
@InjectMocks
|
||||
LocalTransformServiceRegistry registry = new LocalTransformServiceRegistry();
|
||||
|
||||
@Rule
|
||||
public MockitoRule initRule = MockitoJUnit.rule();
|
||||
|
||||
@Test
|
||||
public void testGetTEngineUrlsSortedByName() throws IOException
|
||||
{
|
||||
properties.put(LOCAL_TRANSFORMER+"aa"+URL, "aa");
|
||||
properties.put(LOCAL_TRANSFORMER+"engine1"+URL, "http_xxxx1");
|
||||
properties.put(LOCAL_TRANSFORMER+"engine3"+URL, "http3");
|
||||
properties.put(LOCAL_TRANSFORMER+"engine2"+URL, "http_xx2");
|
||||
properties.put(LOCAL_TRANSFORMER+"bb"+URL, "bb");
|
||||
properties.put(LOCAL_TRANSFORMER+"b"+URL, "b");
|
||||
|
||||
StringJoiner orderEngineConfigRead = new StringJoiner(",");
|
||||
registry.getTEngineUrlsSortedByName().forEach(name -> orderEngineConfigRead.add(name));
|
||||
assertEquals("aa,b,bb,http_xxxx1,http_xx2,http3", orderEngineConfigRead.toString());
|
||||
}
|
||||
}
|
@@ -44,15 +44,16 @@ import org.junit.runners.Suite.SuiteClasses;
|
||||
TransformerLogTest.class,
|
||||
TransformerDebugLogTest.class,
|
||||
|
||||
LocalTransformServiceRegistryTest.class,
|
||||
|
||||
TransformerConfigMBeanImplTest.class})
|
||||
|
||||
/**
|
||||
* Test classes in the Transformers subsystem
|
||||
*
|
||||
* @author Alan Davis
|
||||
*
|
||||
* @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries.
|
||||
*/
|
||||
@Deprecated
|
||||
public class TransformerConfigTestSuite
|
||||
{
|
||||
}
|
||||
|
@@ -25,14 +25,9 @@
|
||||
*/
|
||||
package org.alfresco.repo.dictionary;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
@@ -58,6 +53,8 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import javax.transaction.UserTransaction;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Category(BaseSpringTestsCategory.class)
|
||||
@@ -97,14 +94,6 @@ public class DictionaryRepositoryBootstrapTest extends BaseSpringTest
|
||||
|
||||
"</model>";
|
||||
|
||||
public static final String MESSAGES_KEY = "my_bootstrap_test";
|
||||
public static final String MESSAGES_VALUE = "My Message";
|
||||
public static final String MESSAGES_VALUE_FR = "Mon message";
|
||||
public static final String FOLDERNAME_MODELS = "models";
|
||||
public static final String FOLDERNAME_MESSAGES = "messages";
|
||||
public static final String BUNDLENAME_MESSAGES = "testBootstap";
|
||||
public static final String FILENAME_MESSAGES_EXT = ".properties";
|
||||
|
||||
/** Behaviour filter */
|
||||
private BehaviourFilter behaviourFilter;
|
||||
|
||||
@@ -134,8 +123,7 @@ public class DictionaryRepositoryBootstrapTest extends BaseSpringTest
|
||||
|
||||
private UserTransaction txn;
|
||||
private StoreRef storeRef;
|
||||
private NodeRef rootModelsNodeRef;
|
||||
private NodeRef rootMessagesNodeRef;
|
||||
private NodeRef rootNodeRef;
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
@@ -163,17 +151,7 @@ public class DictionaryRepositoryBootstrapTest extends BaseSpringTest
|
||||
|
||||
// Create the store and get the root node
|
||||
this.storeRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
||||
|
||||
NodeRef rootNodeRef = this.nodeService.getRootNode(this.storeRef);
|
||||
this.rootModelsNodeRef = this.nodeService
|
||||
.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, FOLDERNAME_MODELS), ContentModel.TYPE_FOLDER)
|
||||
.getChildRef();
|
||||
|
||||
this.rootMessagesNodeRef = this.nodeService
|
||||
.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, FOLDERNAME_MESSAGES), ContentModel.TYPE_FOLDER)
|
||||
.getChildRef();
|
||||
this.rootNodeRef = this.nodeService.getRootNode(this.storeRef);
|
||||
|
||||
txn.commit();
|
||||
|
||||
@@ -189,20 +167,18 @@ public class DictionaryRepositoryBootstrapTest extends BaseSpringTest
|
||||
this.bootstrap.setNamespaceService(this.namespaceService);
|
||||
this.bootstrap.setMessageService(this.messageService);
|
||||
this.bootstrap.setPolicyComponent(this.policyComponent);
|
||||
|
||||
RepositoryLocation modelsLocation = new RepositoryLocation(this.storeRef,
|
||||
this.nodeService.getPath(rootModelsNodeRef).toPrefixString(namespaceService), RepositoryLocation.LANGUAGE_PATH);
|
||||
RepositoryLocation messagesLocation = new RepositoryLocation(this.storeRef,
|
||||
this.nodeService.getPath(rootMessagesNodeRef).toPrefixString(namespaceService), RepositoryLocation.LANGUAGE_PATH);
|
||||
|
||||
List<RepositoryLocation> modelsLocations = new ArrayList<RepositoryLocation>();
|
||||
modelsLocations.add(modelsLocation);
|
||||
List<RepositoryLocation> messagesLocations = new ArrayList<RepositoryLocation>();
|
||||
messagesLocations.add(messagesLocation);
|
||||
|
||||
this.bootstrap.setRepositoryModelsLocations(modelsLocations);
|
||||
this.bootstrap.setRepositoryMessagesLocations(messagesLocations);
|
||||
|
||||
|
||||
RepositoryLocation location = new RepositoryLocation();
|
||||
location.setStoreProtocol(this.storeRef.getProtocol());
|
||||
location.setStoreId(this.storeRef.getIdentifier());
|
||||
location.setQueryLanguage(RepositoryLocation.LANGUAGE_PATH);
|
||||
// NOTE: we are not setting the path for now .. in doing so we are searching the root node only
|
||||
|
||||
List<RepositoryLocation> locations = new ArrayList<RepositoryLocation>();
|
||||
locations.add(location);
|
||||
|
||||
this.bootstrap.setRepositoryModelsLocations(locations);
|
||||
|
||||
// register with dictionary service
|
||||
this.bootstrap.register();
|
||||
txn.commit();
|
||||
@@ -248,15 +224,7 @@ public class DictionaryRepositoryBootstrapTest extends BaseSpringTest
|
||||
"Test model one",
|
||||
"base1",
|
||||
"prop1");
|
||||
|
||||
// Create a message file for the default locale
|
||||
NodeRef messageNodeDefaultLoc = createMessagesNode(null, null);
|
||||
// Create a message file for the french locale
|
||||
createMessagesNode(Locale.FRANCE.toString(), MESSAGES_VALUE_FR);
|
||||
// Construct baseBundleName for validation
|
||||
String baseBundleName = storeRef.toString()
|
||||
+ messageService.getBaseBundleName(nodeService.getPath(messageNodeDefaultLoc).toPrefixString(namespaceService));
|
||||
|
||||
|
||||
// Check that the model is not in the dictionary yet
|
||||
try
|
||||
{
|
||||
@@ -283,12 +251,6 @@ public class DictionaryRepositoryBootstrapTest extends BaseSpringTest
|
||||
QName.createQName("http://www.alfresco.org/model/test3DictionaryBootstrapFromRepo/1.0", "testModel3"));
|
||||
assertNotNull(modelDefinition3);
|
||||
|
||||
// Check if the messages were registered correctly
|
||||
assertTrue("The message bundle should be registered", messageService.getRegisteredBundles().contains(baseBundleName));
|
||||
assertEquals("The default message value is not as expected", MESSAGES_VALUE, messageService.getMessage(MESSAGES_KEY));
|
||||
assertEquals("The message value in french is not as expected", MESSAGES_VALUE_FR,
|
||||
messageService.getMessage(MESSAGES_KEY, Locale.FRANCE));
|
||||
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
@@ -315,7 +277,7 @@ public class DictionaryRepositoryBootstrapTest extends BaseSpringTest
|
||||
{
|
||||
// Create a model node
|
||||
NodeRef model = this.nodeService.createNode(
|
||||
this.rootModelsNodeRef,
|
||||
this.rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}models"),
|
||||
ContentModel.TYPE_DICTIONARY_MODEL).getChildRef();
|
||||
@@ -338,39 +300,6 @@ public class DictionaryRepositoryBootstrapTest extends BaseSpringTest
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create messages node
|
||||
*
|
||||
* @return NodeRef
|
||||
*/
|
||||
private NodeRef createMessagesNode(String locale, String localeValue)
|
||||
{
|
||||
String filename = BUNDLENAME_MESSAGES + FILENAME_MESSAGES_EXT;
|
||||
String messageValue = MESSAGES_VALUE;
|
||||
|
||||
if (locale != null)
|
||||
{
|
||||
filename = BUNDLENAME_MESSAGES + "_" + locale + FILENAME_MESSAGES_EXT;
|
||||
messageValue = localeValue;
|
||||
}
|
||||
// Create a model node
|
||||
NodeRef messageNode = this.nodeService.createNode(
|
||||
this.rootMessagesNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, filename),
|
||||
ContentModel.TYPE_CONTENT,
|
||||
Collections.<QName, Serializable> singletonMap(ContentModel.PROP_NAME, filename)
|
||||
).getChildRef();
|
||||
|
||||
ContentWriter contentWriter = this.contentService.getWriter(messageNode, ContentModel.PROP_CONTENT, true);
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
String messagesString = MESSAGES_KEY + "=" + messageValue;
|
||||
contentWriter.putContent(messagesString);
|
||||
|
||||
return messageNode;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the model string
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -61,9 +61,7 @@ import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.util.testing.category.FrequentlyFailingTests;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.dao.ConcurrencyFailureException;
|
||||
|
||||
@@ -953,7 +951,6 @@ public class FixedAclUpdaterTest extends TestCase
|
||||
/*
|
||||
* Lock node that has the aspect applied before job runs
|
||||
*/
|
||||
@Category(FrequentlyFailingTests.class) // ACS-2245
|
||||
@Test
|
||||
public void testAsyncWithNodeLock()
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -37,7 +37,6 @@ import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.testing.category.DBTests;
|
||||
import org.alfresco.util.testing.category.FrequentlyFailingTests;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.log4j.Level;
|
||||
@@ -508,7 +507,6 @@ public class JobLockServiceTest extends TestCase
|
||||
public void testGetLockWithCallbackNullCallback() { runGetLockWithCallback(1); }
|
||||
public void testGetLockWithCallbackShortTTL() { runGetLockWithCallback(2); }
|
||||
public void testGetLockWithCallbackLocked() { runGetLockWithCallback(3); }
|
||||
@Category(FrequentlyFailingTests.class) // ACS-2243
|
||||
public void testGetLockWithCallbackNormal() { runGetLockWithCallback(4); }
|
||||
|
||||
public void runGetLockWithCallback(int t)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -25,16 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.rendition2;
|
||||
|
||||
import static java.lang.Thread.sleep;
|
||||
import static org.alfresco.model.ContentModel.PROP_CONTENT;
|
||||
import static org.alfresco.model.RenditionModel.PROP_RENDITION_CONTENT_HASH_CODE;
|
||||
import static org.alfresco.repo.content.MimetypeMap.EXTENSION_BINARY;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.content.metadata.AsynchronousExtractor;
|
||||
@@ -69,7 +60,15 @@ import org.quartz.CronExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.lang.Thread.sleep;
|
||||
import static org.alfresco.model.ContentModel.PROP_CONTENT;
|
||||
import static org.alfresco.repo.content.MimetypeMap.EXTENSION_BINARY;
|
||||
|
||||
/**
|
||||
* Class unites common utility methods for {@link org.alfresco.repo.rendition2} package tests.
|
||||
@@ -532,41 +531,4 @@ public abstract class AbstractRenditionIntegrationTest extends BaseSpringTest
|
||||
RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
|
||||
txnHelper.doInTransaction(createUserCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to check if the supplied content hash code is valid or not
|
||||
*
|
||||
* @param contentHashCode
|
||||
* the hash code to verify
|
||||
*
|
||||
* @return true in case it is an actual hash code, false otherwise
|
||||
*/
|
||||
protected boolean isValidRenditionContentHashCode(int contentHashCode)
|
||||
{
|
||||
return contentHashCode != RenditionService2Impl.RENDITION2_DOES_NOT_EXIST
|
||||
&& contentHashCode != RenditionService2Impl.SOURCE_HAS_NO_CONTENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method which gets the content hash code from the supplied rendition node without specific validations (the
|
||||
* equivalent method from {@link RenditionService2Impl} is not exposed)
|
||||
*
|
||||
* @param renditionNodeRef
|
||||
* the rendition node
|
||||
*
|
||||
* @return -1 in case of there is no content, -2 in case rendition doesn't exist, the actual content hash code
|
||||
* otherwise
|
||||
*/
|
||||
protected int getRenditionContentHashCode(NodeRef renditionNodeRef)
|
||||
{
|
||||
int renditionContentHashCode = RenditionService2Impl.RENDITION2_DOES_NOT_EXIST;
|
||||
|
||||
if (renditionNodeRef != null)
|
||||
{
|
||||
Serializable hashCode = nodeService.getProperty(renditionNodeRef, PROP_RENDITION_CONTENT_HASH_CODE);
|
||||
renditionContentHashCode = hashCode == null ? RenditionService2Impl.SOURCE_HAS_NO_CONTENT : (int) hashCode;
|
||||
}
|
||||
|
||||
return renditionContentHashCode;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -25,11 +25,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.rendition2;
|
||||
|
||||
import static org.alfresco.model.ContentModel.PROP_CONTENT;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.RenditionModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
@@ -41,9 +36,16 @@ import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.alfresco.model.ContentModel.PROP_CONTENT;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link RenditionService2}
|
||||
*/
|
||||
@@ -306,99 +308,6 @@ public class RenditionService2IntegrationTest extends AbstractRenditionIntegrati
|
||||
assertTrue("The rendition should be generated by new Rendition Service", hasRenditionedAspect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests new {@link RenditionService2Impl#clearRenditionContentData(NodeRef, String)} method.
|
||||
* <p>
|
||||
* This method cleans a rendition content and content hash code.
|
||||
* </p>
|
||||
*/
|
||||
@Test
|
||||
public void testClearRenditionContentData()
|
||||
{
|
||||
// Create a node
|
||||
NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg");
|
||||
|
||||
// Trigger the rendition
|
||||
render(ADMIN, sourceNodeRef, DOC_LIB);
|
||||
NodeRef renditionNodeRef = waitForRendition(ADMIN, sourceNodeRef, DOC_LIB, true);
|
||||
assertNotNull("Rendition was not generated", renditionNodeRef);
|
||||
assertNotNull("Rendition was not generated", nodeService.getProperty(renditionNodeRef, ContentModel.PROP_CONTENT));
|
||||
|
||||
// Check the rendition content hash code is valid
|
||||
int contentHashCode = getRenditionContentHashCode(renditionNodeRef);
|
||||
assertTrue("Rendition content hash code was not generated", isValidRenditionContentHashCode(contentHashCode));
|
||||
|
||||
// Disable renditionService2
|
||||
renditionService2.setEnabled(false);
|
||||
|
||||
// Call 'clearRenditionContentData' method directly to prove rendition content will be cleaned
|
||||
AuthenticationUtil.runAs((AuthenticationUtil.RunAsWork<Void>) () ->
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(() ->
|
||||
{
|
||||
renditionService2.clearRenditionContentData(sourceNodeRef, DOC_LIB);
|
||||
return null;
|
||||
}), ADMIN);
|
||||
|
||||
// The rendition should not have content by now
|
||||
assertNull("Rendition has content", nodeService.getProperty(renditionNodeRef, ContentModel.PROP_CONTENT));
|
||||
|
||||
// The rendition should not have a content hash code by now
|
||||
contentHashCode = getRenditionContentHashCode(renditionNodeRef);
|
||||
assertFalse("Rendition has content hash code", isValidRenditionContentHashCode(contentHashCode));
|
||||
|
||||
// Enable renditionService2
|
||||
renditionService2.setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if a rendition without content (but with contentHashCode) can be generated again.
|
||||
* <p>
|
||||
* If the rendition consumption receives a null InputStream, the contentHashCode should be cleaned from the
|
||||
* rendition node, allowing new requests to generate the rendition.
|
||||
* </p>
|
||||
*/
|
||||
@Test
|
||||
public void testRenditionWithoutContentButWithContentHashCode()
|
||||
{
|
||||
// Create a node with an actual rendition
|
||||
NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg");
|
||||
render(ADMIN, sourceNodeRef, DOC_LIB);
|
||||
NodeRef renditionNodeRef = waitForRendition(ADMIN, sourceNodeRef, DOC_LIB, true);
|
||||
assertNotNull("Rendition was not generated", renditionNodeRef);
|
||||
assertNotNull("Rendition was not generated", nodeService.getProperty(renditionNodeRef, ContentModel.PROP_CONTENT));
|
||||
|
||||
// Clear rendition content (at this point we're forcing a rendition without content but with hash code)
|
||||
clearContent(ADMIN, renditionNodeRef);
|
||||
assertNull("Rendition has content", nodeService.getProperty(renditionNodeRef, ContentModel.PROP_CONTENT));
|
||||
|
||||
// Check that rendition still has the content hash code
|
||||
final int contentHashCode = getRenditionContentHashCode(renditionNodeRef);
|
||||
assertTrue("Rendition content hash code was not generated", isValidRenditionContentHashCode(contentHashCode));
|
||||
|
||||
// Call the 'consume' method directly supplying a null InputStream
|
||||
// This is explicitly called to prove that rendition hash code will be cleaned (as opposite to previous behavior)
|
||||
RenditionDefinition2 renditionDefinition = renditionDefinitionRegistry2.getRenditionDefinition(DOC_LIB);
|
||||
AuthenticationUtil.runAs(() -> {
|
||||
renditionService2.consume(sourceNodeRef, null, renditionDefinition, contentHashCode);
|
||||
return null;
|
||||
}, ADMIN);
|
||||
waitForRendition(ADMIN, sourceNodeRef, DOC_LIB, false);
|
||||
|
||||
// The content hash code should have been cleaned from the rendition node
|
||||
int contentHashCode2 = getRenditionContentHashCode(renditionNodeRef);
|
||||
assertFalse("Rendition content hash code was not cleaned", isValidRenditionContentHashCode(contentHashCode2));
|
||||
|
||||
// Attempts to render the rendition again
|
||||
render(ADMIN, sourceNodeRef, DOC_LIB);
|
||||
NodeRef renditionNodeRef2 = waitForRendition(ADMIN, sourceNodeRef, DOC_LIB, true);
|
||||
assertEquals("New rendition nodeRef is different", renditionNodeRef.toString(), renditionNodeRef2.toString());
|
||||
assertNotNull("New rendition content was not generated", nodeService.getProperty(renditionNodeRef2, ContentModel.PROP_CONTENT));
|
||||
|
||||
// Check the new rendition content hash code
|
||||
int contentHashCode3 = getRenditionContentHashCode(renditionNodeRef2);
|
||||
assertTrue("New rendition content hash code was not generated", isValidRenditionContentHashCode(contentHashCode3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated can be removed when we remove the original RenditionService
|
||||
*/
|
||||
|
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.version;
|
||||
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
@@ -64,7 +63,6 @@ public class ContentServiceImplTest extends BaseVersionStoreTest
|
||||
* Test content data
|
||||
*/
|
||||
private final static String UPDATED_CONTENT = "This content has been updated with a new value.";
|
||||
private static final QName QNAME = ContentModel.PROP_CONTENT;
|
||||
|
||||
/**
|
||||
* The version content store
|
||||
@@ -159,30 +157,34 @@ public class ContentServiceImplTest extends BaseVersionStoreTest
|
||||
// Set the presigned URL to expire after one minute.
|
||||
Long validFor = 60L;
|
||||
|
||||
assertThrows("nodeRef has no content", IllegalArgumentException.class, () -> {
|
||||
try
|
||||
{
|
||||
// Create a node without content
|
||||
NodeRef nodeRef = this.dbNodeService
|
||||
.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}MyNoContentNode"), TEST_TYPE_QNAME, this.nodeProperties).getChildRef();
|
||||
|
||||
assertNull(contentService.requestContentDirectUrl(nodeRef, QNAME, true, validFor));
|
||||
});
|
||||
assertNull(contentService.requestContentDirectUrl(nodeRef, true, validFor));
|
||||
fail("nodeRef has no content");
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected exception
|
||||
}
|
||||
|
||||
assertThrows("nodeRef is null", IllegalArgumentException.class, () -> {
|
||||
assertNull(contentService.requestContentDirectUrl(null, null, true, null));
|
||||
});
|
||||
|
||||
assertThrows("propertyQName has no content", NullPointerException.class, () -> {
|
||||
// Create a node without content
|
||||
NodeRef nodeRef = this.dbNodeService
|
||||
.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}MyNoContentNode"), TEST_TYPE_QNAME, this.nodeProperties).getChildRef();
|
||||
|
||||
contentService.requestContentDirectUrl(nodeRef, null, true, validFor);
|
||||
});
|
||||
try
|
||||
{
|
||||
assertNull(contentService.requestContentDirectUrl(null, true, null));
|
||||
fail("nodeRef is null");
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected exception
|
||||
}
|
||||
|
||||
// Create a node with content
|
||||
NodeRef nodeRef = createNewVersionableNode();
|
||||
|
||||
assertNull(contentService.requestContentDirectUrl(nodeRef, QNAME, true, null));
|
||||
assertNull(contentService.requestContentDirectUrl(nodeRef, QNAME, true, validFor));
|
||||
assertNull(contentService.requestContentDirectUrl(nodeRef, true, null));
|
||||
assertNull(contentService.requestContentDirectUrl(nodeRef, true, validFor));
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,6 @@ import org.alfresco.repo.content.transform.LocalTransformImpl;
|
||||
import org.alfresco.repo.content.transform.LocalTransformServiceRegistry;
|
||||
import org.alfresco.repo.content.transform.TransformerDebug;
|
||||
import org.alfresco.transform.client.model.config.SupportedSourceAndTarget;
|
||||
import org.alfresco.transform.client.model.config.TransformConfig;
|
||||
import org.alfresco.transform.client.model.config.TransformOption;
|
||||
import org.alfresco.transform.client.model.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.client.model.config.TransformOptionValue;
|
||||
@@ -192,7 +191,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
private static final String URL = ".url";
|
||||
|
||||
private Map<String, Set<TransformOption>> mapOfTransformOptions;
|
||||
private List<Transformer> transformerList;
|
||||
private List<CombinedConfig.TransformAndItsOrigin> transformerList;
|
||||
|
||||
protected TestLocalTransformServiceRegistry registry;
|
||||
|
||||
@@ -263,13 +262,11 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
*/
|
||||
private void retrieveLocalTransformList(String path)
|
||||
{
|
||||
CombinedConfig combinedConfig = new CombinedConfig(log, registry);
|
||||
CombinedConfig combinedConfig = new CombinedConfig(log);
|
||||
combinedConfig.addLocalConfig(path);
|
||||
combinedConfig.register(registry);
|
||||
|
||||
TransformConfig transformConfig = combinedConfig.buildTransformConfig();
|
||||
mapOfTransformOptions = transformConfig.getTransformOptions();
|
||||
transformerList = transformConfig.getTransformers();
|
||||
mapOfTransformOptions = combinedConfig.combinedTransformOptions;
|
||||
transformerList = combinedConfig.combinedTransformers;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -373,6 +370,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
return LOCAL_TRANSFORM+transformer.getTransformerName()+".url";
|
||||
}
|
||||
|
||||
|
||||
private int countTopLevelOptions(Set<String> transformOptionNames)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -386,7 +384,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
|
||||
private void register(String path) throws IOException
|
||||
{
|
||||
CombinedConfig combinedConfig = new CombinedConfig(log, registry);
|
||||
CombinedConfig combinedConfig = new CombinedConfig(log);
|
||||
combinedConfig.addLocalConfig(path);
|
||||
combinedConfig.register((TransformServiceRegistryImpl)registry);
|
||||
}
|
||||
@@ -563,22 +561,22 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
listOfExpectedTransformersName.add("libreoffice");
|
||||
listOfExpectedTransformersName.add("officeToImageViaPdf");
|
||||
|
||||
for (Transformer transformer : transformerList)
|
||||
for (CombinedConfig.TransformAndItsOrigin t : transformerList)
|
||||
{
|
||||
assertTrue(transformer.getTransformerName() + " should be an expected local transformer.", listOfExpectedTransformersName.contains(transformer.getTransformerName()));
|
||||
listOfExpectedTransformersName.remove(transformer.getTransformerName());
|
||||
assertTrue(t.transformer.getTransformerName() + " should be an expected local transformer.", listOfExpectedTransformersName.contains(t.transformer.getTransformerName()));
|
||||
listOfExpectedTransformersName.remove(t.transformer.getTransformerName());
|
||||
|
||||
switch (transformer.getTransformerName())
|
||||
switch (t.transformer.getTransformerName())
|
||||
{
|
||||
case "imagemagick":
|
||||
assertEquals(transformer.getTransformerName() + " incorrect number of supported transform", 18, transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform option names", 1, transformer.getTransformOptions().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform options", 6, countTopLevelOptions(transformer.getTransformOptions()));
|
||||
assertEquals(transformer.getTransformerName() + " expected to not be a transformer pipeline", transformer.getTransformerPipeline().size(), 0);
|
||||
assertEquals(transformer.getTransformerName() + " expected to not be a failover pipeline", transformer.getTransformerFailover().size(), 0);
|
||||
assertEquals(t.transformer.getTransformerName() + " incorrect number of supported transform", 18, t.transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform option names", 1, t.transformer.getTransformOptions().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform options", 6, countTopLevelOptions(t.transformer.getTransformOptions()));
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to not be a transformer pipeline", t.transformer.getTransformerPipeline().size(), 0);
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to not be a failover pipeline", t.transformer.getTransformerFailover().size(), 0);
|
||||
|
||||
//Test supportedSourceAndTargetList
|
||||
for ( SupportedSourceAndTarget ssat: transformer.getSupportedSourceAndTargetList())
|
||||
for ( SupportedSourceAndTarget ssat: t.transformer.getSupportedSourceAndTargetList())
|
||||
{
|
||||
assertTrue(ssat.getSourceMediaType() + " not expected to be a supported transform source.", imagemagickSupportedTransformation.containsKey(ssat.getSourceMediaType()));
|
||||
assertTrue(ssat.getTargetMediaType() + " not expected to be a supported transform target for " + ssat.getSourceMediaType(), imagemagickSupportedTransformation.get(ssat.getSourceMediaType()).contains(ssat.getTargetMediaType()));
|
||||
@@ -586,14 +584,14 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
break;
|
||||
|
||||
case "tika":
|
||||
assertEquals(transformer.getTransformerName() + " incorrect number of supported transform", 11, transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform option names", 1, transformer.getTransformOptions().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform options", 5, countTopLevelOptions(transformer.getTransformOptions()));
|
||||
assertEquals(transformer.getTransformerName() + " expected to not be a transformer pipeline", transformer.getTransformerPipeline().size(), 0);
|
||||
assertEquals(transformer.getTransformerName() + " expected to not be a failover pipeline", transformer.getTransformerFailover().size(), 0);
|
||||
assertEquals(t.transformer.getTransformerName() + " incorrect number of supported transform", 11, t.transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform option names", 1, t.transformer.getTransformOptions().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform options", 5, countTopLevelOptions(t.transformer.getTransformOptions()));
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to not be a transformer pipeline", t.transformer.getTransformerPipeline().size(), 0);
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to not be a failover pipeline", t.transformer.getTransformerFailover().size(), 0);
|
||||
|
||||
//Test supportedSourceAndTargetList
|
||||
for ( SupportedSourceAndTarget ssat: transformer.getSupportedSourceAndTargetList())
|
||||
for ( SupportedSourceAndTarget ssat: t.transformer.getSupportedSourceAndTargetList())
|
||||
{
|
||||
assertTrue(ssat.getSourceMediaType() + " not expected to be a supported transform source.", tikaSupportedTransformation.containsKey(ssat.getSourceMediaType()));
|
||||
assertTrue(ssat.getTargetMediaType() + " not expected to be a supported transform target for " + ssat.getSourceMediaType(), tikaSupportedTransformation.get(ssat.getSourceMediaType()).contains(ssat.getTargetMediaType()));
|
||||
@@ -601,14 +599,14 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
break;
|
||||
|
||||
case "pdfrenderer":
|
||||
assertEquals(transformer.getTransformerName() + " incorrect number of supported transform", 4, transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform option names", 1, transformer.getTransformOptions().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform options", 5, countTopLevelOptions(transformer.getTransformOptions()));
|
||||
assertEquals(transformer.getTransformerName() + " expected to not be a transformer pipeline", transformer.getTransformerPipeline().size(), 0);
|
||||
assertEquals(transformer.getTransformerName() + " expected to not be a failover pipeline", transformer.getTransformerFailover().size(), 0);
|
||||
assertEquals(t.transformer.getTransformerName() + " incorrect number of supported transform", 4, t.transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform option names", 1, t.transformer.getTransformOptions().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform options", 5, countTopLevelOptions(t.transformer.getTransformOptions()));
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to not be a transformer pipeline", t.transformer.getTransformerPipeline().size(), 0);
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to not be a failover pipeline", t.transformer.getTransformerFailover().size(), 0);
|
||||
|
||||
//Test supportedSourceAndTargetList
|
||||
for ( SupportedSourceAndTarget ssat: transformer.getSupportedSourceAndTargetList())
|
||||
for ( SupportedSourceAndTarget ssat: t.transformer.getSupportedSourceAndTargetList())
|
||||
{
|
||||
assertTrue(ssat.getSourceMediaType() + " not expected to be a supported transform source.", pdfRendererSupportedTransformation.containsKey(ssat.getSourceMediaType()));
|
||||
assertTrue(ssat.getTargetMediaType() + " not expected to be a supported transform target for " + ssat.getSourceMediaType(), pdfRendererSupportedTransformation.get(ssat.getSourceMediaType()).contains(ssat.getTargetMediaType()));
|
||||
@@ -616,14 +614,14 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
break;
|
||||
|
||||
case "libreoffice":
|
||||
assertEquals(transformer.getTransformerName() + " incorrect number of supported transform", 9, transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform option names", 0, transformer.getTransformOptions().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform options", 0, countTopLevelOptions(transformer.getTransformOptions()));
|
||||
assertEquals(transformer.getTransformerName() + " expected to not be a transformer pipeline", transformer.getTransformerPipeline().size(), 0);
|
||||
assertEquals(transformer.getTransformerName() + " expected to not be a failover pipeline", transformer.getTransformerFailover().size(), 0);
|
||||
assertEquals(t.transformer.getTransformerName() + " incorrect number of supported transform", 9, t.transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform option names", 0, t.transformer.getTransformOptions().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform options", 0, countTopLevelOptions(t.transformer.getTransformOptions()));
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to not be a transformer pipeline", t.transformer.getTransformerPipeline().size(), 0);
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to not be a failover pipeline", t.transformer.getTransformerFailover().size(), 0);
|
||||
|
||||
//Test supportedSourceAndTargetList
|
||||
for ( SupportedSourceAndTarget ssat: transformer.getSupportedSourceAndTargetList())
|
||||
for ( SupportedSourceAndTarget ssat: t.transformer.getSupportedSourceAndTargetList())
|
||||
{
|
||||
assertTrue(ssat.getSourceMediaType() + " not expected to be a supported transform source.", libreofficeSupportedTransformation.containsKey(ssat.getSourceMediaType()));
|
||||
assertTrue(ssat.getTargetMediaType() + " not expected to be a supported transform target for " + ssat.getSourceMediaType(), libreofficeSupportedTransformation.get(ssat.getSourceMediaType()).contains(ssat.getTargetMediaType()));
|
||||
@@ -632,13 +630,13 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
|
||||
case "officeToImageViaPdf":
|
||||
// Note we will get 35 entries in getSupportedSourceAndTargetList() if the metadata transforms are not excluded
|
||||
assertEquals(transformer.getTransformerName() + " incorrect number of supported transform", 28, transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform option names", 2, transformer.getTransformOptions().size());
|
||||
assertEquals( transformer.getTransformerName() + "incorrect number of transform options", 11, countTopLevelOptions(transformer.getTransformOptions()));
|
||||
assertEquals(transformer.getTransformerName() + " expected to be a transformer pipeline", transformer.getTransformerPipeline().size(), 3);
|
||||
assertEquals(t.transformer.getTransformerName() + " incorrect number of supported transform", 28, t.transformer.getSupportedSourceAndTargetList().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform option names", 2, t.transformer.getTransformOptions().size());
|
||||
assertEquals( t.transformer.getTransformerName() + "incorrect number of transform options", 11, countTopLevelOptions(t.transformer.getTransformOptions()));
|
||||
assertEquals(t.transformer.getTransformerName() + " expected to be a transformer pipeline", t.transformer.getTransformerPipeline().size(), 3);
|
||||
|
||||
//Test supportedSourceAndTargetList
|
||||
for ( SupportedSourceAndTarget ssat: transformer.getSupportedSourceAndTargetList())
|
||||
for ( SupportedSourceAndTarget ssat: t.transformer.getSupportedSourceAndTargetList())
|
||||
{
|
||||
assertTrue(ssat.getSourceMediaType() + " not expected to be a supported transform source.", officeToImageViaPdfSupportedTransformation.containsKey(ssat.getSourceMediaType()));
|
||||
assertTrue(ssat.getTargetMediaType() + " not expected to be a supported transform target for " + ssat.getSourceMediaType(), officeToImageViaPdfSupportedTransformation.get(ssat.getSourceMediaType()).contains(ssat.getTargetMediaType()));
|
||||
@@ -655,11 +653,11 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
retrieveLocalTransformList(LOCAL_TRANSFORM_SERVICE_CONFIG);
|
||||
|
||||
assertNotNull("Transformer list is null.", transformerList);
|
||||
for (Transformer transformer : transformerList)
|
||||
for (CombinedConfig.TransformAndItsOrigin t : transformerList)
|
||||
{
|
||||
if (transformer.getTransformerPipeline() == null)
|
||||
if(t.transformer.getTransformerPipeline() == null)
|
||||
{
|
||||
assertNotNull(transformer.getTransformerName()+ " JVM property not set.", System.getProperty(LOCAL_TRANSFORM + transformer.getTransformerName() + URL));
|
||||
assertNotNull(t.transformer.getTransformerName()+ " JVM property not set.", System.getProperty(LOCAL_TRANSFORM + t.transformer.getTransformerName() + URL));
|
||||
}
|
||||
}
|
||||
assertEquals("Unexpected pdfrenderer JVM property value", "http://localhost:8090/", System.getProperty(LOCAL_TRANSFORM + "pdfrenderer" + URL));
|
||||
@@ -667,11 +665,11 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
|
||||
assertEquals("Unexpected libreoffice JVM property value", "http://localhost:8092/", System.getProperty(LOCAL_TRANSFORM + "libreoffice" + URL));
|
||||
assertEquals("Unexpected tika JVM property value", "http://localhost:8093/", System.getProperty(LOCAL_TRANSFORM + "tika" + URL));
|
||||
|
||||
for (Transformer transformer : transformerList)
|
||||
for (CombinedConfig.TransformAndItsOrigin t : transformerList)
|
||||
{
|
||||
if(transformer.getTransformerPipeline() == null)
|
||||
if(t.transformer.getTransformerPipeline() == null)
|
||||
{
|
||||
assertNotNull(transformer.getTransformerName()+ " alfresco-global property not set.", properties.getProperty(LOCAL_TRANSFORM + transformer.getTransformerName() + URL));
|
||||
assertNotNull(t.transformer.getTransformerName()+ " alfresco-global property not set.", properties.getProperty(LOCAL_TRANSFORM + t.transformer.getTransformerName() + URL));
|
||||
}
|
||||
}
|
||||
assertEquals("Unexpected pdfrenderer alfresco-global property value", "http://localhost:8090/", properties.getProperty(LOCAL_TRANSFORM + "pdfrenderer" + URL));
|
||||
|
@@ -1 +0,0 @@
|
||||
mycustommessages.key1=This is a custom message
|
@@ -1 +0,0 @@
|
||||
mycustommessages.key1=Dies ist eine benutzerdefinierte Nachricht
|
@@ -1 +0,0 @@
|
||||
mycustommessages.key1=Ceci est un message personnalis\u00e9
|
Binary file not shown.
Reference in New Issue
Block a user